Browse Source

测试内容

callm 6 years ago
parent
commit
5f6c1e6faa

+ 1 - 29
UAS-出货标签管理(吉利通)/PublicMethod/SqliteDBHelper.cs

@@ -515,38 +515,11 @@ namespace UAS_LabelMachine
         /// <param name="SQL"></param>
         /// <param name="Type"></param>
         /// <returns></returns>
-        public object ExecuteSql(string SQL, string Type, params object[] names)
+        public object ExecuteSql(string SQL, string Type)
         {
             object result = null;
             command = new SQLiteCommand(SQL, this._odcConnection);
             Reconnect(command);
-            //用来拼接参数的
-            if (names.Length > 0)
-            {
-                string[] par = SQL.Split(':');
-                //用来存参数的数组
-                StringBuilder[] addpar = new StringBuilder[par.Length - 1];
-                for (int i = 0; i < par.Length - 1; i++)
-                {
-                    //新建一个char类型的数组用来存储每个字节的变量
-                    char[] c = par[i + 1].ToCharArray();
-                    addpar[i] = new StringBuilder();
-                    for (int j = 0; j < c.Length; j++)
-                    {
-                        if (c[j] != ' ' && c[j] != ',' && c[j] != ')')
-                        {
-                            addpar[i].Append(c[j]);
-                        }
-                        else
-                        {
-                            break;
-                        }
-                    }
-                }
-                for (int i = 0; i < addpar.Length; i++)
-                    command.Parameters.Add(new SQLiteParameter(addpar[i].ToString(), names[i]));
-            }
-
             switch (Type.ToUpper())
             {
                 case "SELECT":
@@ -603,7 +576,6 @@ namespace UAS_LabelMachine
                     }
                     break;
             }
-
             return result;
         }
 

File diff suppressed because it is too large
+ 254 - 206
UAS-出货标签管理(吉利通)/UAS_出货标签管理.Designer.cs


+ 23 - 7
UAS-出货标签管理(吉利通)/UAS_出货标签管理.cs

@@ -323,6 +323,7 @@ namespace UAS_LabelMachine
                     case "FrontendCheck":
                         //比对当前箱数量和容量
                         FrontCollect.Text = msg;
+                        Console.WriteLine(System.DateTime.Now.ToString("1" + "yyyy-MM-dd hh:mm:ss fff"));
                         if (!FrontCheckFunction(msg, out ErrorMsg))
                         {
                             LogicHandler.SendDataToPLC(PLC1, PLCInstruct.FrontDataDelete, adh);
@@ -331,6 +332,7 @@ namespace UAS_LabelMachine
                         }
                         else
                         {
+                            Console.WriteLine(System.DateTime.Now.ToString("2" + "yyyy-MM-dd hh:mm:ss fff"));
                             if (cu_print_checkdatecode.Checked)
                             {
                                 string datecode = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
@@ -585,6 +587,7 @@ namespace UAS_LabelMachine
         private bool FrontCheckFunction(string msg, out string ErrorMsg)
         {
             ErrorMsg = "";
+            Console.WriteLine(System.DateTime.Now.ToString("1" + "yyyy-MM-dd hh:mm:ss fff"));
             //调用正则验证
             RegexMatch("FrontCheck", msg, out ErrorMsg);
             if (ErrorMsg != "")
@@ -890,6 +893,7 @@ namespace UAS_LabelMachine
             if (SingleLabelCombox.Text != "")
             {
                 SingleDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + SingleLabelCombox.Text);
+                SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
                 SingleLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + SingleLabelCombox.SelectedValue.ToString().Split('#')[0], "select");
             }
             sql.Clear();
@@ -915,6 +919,7 @@ namespace UAS_LabelMachine
             if (MidLabelCombox.Text != "")
             {
                 MidDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + MidLabelCombox.Text);
+                MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
                 MidLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + MidLabelCombox.SelectedValue.ToString().Split('#')[0], "select");
             }
             //缓存中盒参数
@@ -941,6 +946,7 @@ namespace UAS_LabelMachine
             if (OutBoxCombox.Text != "")
             {
                 OutBoxDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + OutBoxCombox.Text);
+                OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
                 OutLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + OutBoxCombox.SelectedValue.ToString().Split('#')[0], "select");
             }
             //缓存外箱参数
@@ -1421,7 +1427,6 @@ namespace UAS_LabelMachine
                         MidDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
                 }
             }
-            MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
             MidDoc.PrintDocument();
         }
 
@@ -1511,7 +1516,6 @@ namespace UAS_LabelMachine
                             OutBoxDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
                     }
                 }
-                OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
                 OutBoxDoc.PrintDocument();
             }
         }
@@ -2031,7 +2035,7 @@ namespace UAS_LabelMachine
         private void PLCStart_Click(object sender, EventArgs e)
         {
             //查询前端检验的端口号
-            DataTable dt = (DataTable)adh.ExecuteSql("select * from cominfo", "select");
+            DataTable dt = (DataTable)adh.ExecuteSql("select comtype,BaudRate,com,datawait,outtime from cominfo", "select");
             DataRow[] dr = dt.Select("comtype='PLC1'");
             if (dr.Length > 0)
             {
@@ -2370,13 +2374,13 @@ namespace UAS_LabelMachine
                 }
             }
             catch (Exception) { }
-            int outboxcode1 = int.Parse(Process_midboxcode.Text == "" ? "1" : Process_midboxcode.Text);
-            int outboxcode2 = int.Parse(Process_outboxcode.Text == "" ? "1" : Process_outboxcode.Text);
+            int outboxcode1 = Outbox1;
+            int outboxcode2 = Outbox2;
             string pd_id = LabelInf.Rows[CurrentRowIndex].Cells["pd_id"].Value.ToString();
             //如果满容量获取过箱号就不再重复获取了
             bool GetBarcode = false;
             //获取当前的行号
-            int CurrentRowNum = int.Parse(LabelInf.Rows[CurrentRowIndex].Cells["rownum"].Value.ToString());
+            decimal CurrentRowNum = decimal.Parse(LabelInf.Rows[CurrentRowIndex].Cells["rownum"].Value.ToString());
             //超过中盒容量中盒号+1
             if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + outboxcode1) >= MidBoxCapacity.Value)
             {
@@ -2600,7 +2604,7 @@ namespace UAS_LabelMachine
                         SingleDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
                 }
             }
-            SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
+            Console.WriteLine("8" + System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
             SingleDoc.PrintDocument();
             LogicHandler.UpdateRowPrinted(pib_id);
         }
@@ -2646,5 +2650,17 @@ namespace UAS_LabelMachine
                 }
             }
         }
+
+        int Outbox1;
+        int Outbox2;
+        private void Process_midboxcode_TextChanged(object sender, EventArgs e)
+        {
+            int.TryParse(Process_midboxcode.Text, out Outbox1);
+        }
+
+        private void Process_outboxcode_TextChanged(object sender, EventArgs e)
+        {
+            int.TryParse(Process_outboxcode.Text, out Outbox2);
+        }
     }
 }

Some files were not shown because too many files changed in this diff