Browse Source

BUG修改

callm 6 years ago
parent
commit
08522ea913

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

@@ -38,13 +38,13 @@ namespace UAS_LabelMachine
             dh = new DataHelper();
             dh1 = new DataHelper();
             //启动时压缩数据库
-            BaseUtil.CompactAccessDB("LabelPrint.accdb");
             adh1 = new SqliteDBHelper("LabelPrint.db3");
             adh2 = new SqliteDBHelper("LabelPrint.db3");
             SystemInf.dh = dh;
             SystemInf.dh1 = dh1;
             SystemInf.back_adh = adh1;
             SystemInf.adh = adh2;
+            adh1.ExecuteZip();
             //获取账套信息
             dt = (DataTable)dh.ExecuteSql("select ma_function,ms_pwd,ma_user from master ", "select");
             DataTable MasterDB = dt.Clone();

+ 6 - 2
UAS-出货标签管理(吉利通)/PublicMethod/BaseUtil.cs

@@ -64,7 +64,7 @@ namespace UAS_LabelMachine
             if (DateCode.Length == 4)
             {
                 oYear = int.Parse(DateCode.Substring(0, 2));
-                DateTime date=  new DateTime(DateTime.Now.Year, 1, 1).AddDays(7 * int.Parse(DateCode.Substring(2, 2)));
+                DateTime date = new DateTime(DateTime.Now.Year, 1, 1).AddDays(7 * int.Parse(DateCode.Substring(2, 2)));
                 oMonth = date.Month;
                 oDay = date.Day;
             }
@@ -279,7 +279,11 @@ namespace UAS_LabelMachine
                                     }
                                     else if (collection[i] is NumericUpDown)
                                     {
-                                        (collection[i] as NumericUpDown).Value = int.Parse(dt.Rows[0][j].ToString());
+                                        int num = 0;
+                                        if (int.TryParse(dt.Rows[0][j].ToString(), out num))
+                                        {
+                                            (collection[i] as NumericUpDown).Value = num;
+                                        }
                                     }
                                     else
                                     {

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

@@ -37,6 +37,12 @@ namespace UAS_LabelMachine
             }
         }
 
+        public  void ExecuteZip()
+        {
+            command = new SQLiteCommand("Vacuum", this._odcConnection);
+            command.ExecuteNonQuery();
+        }
+
         public void Close()
         {
             this._odcConnection.Close();

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

@@ -293,6 +293,8 @@ namespace UAS_LabelMachine
                 byte[] readBuffer = new byte[len];
                 port.Read(readBuffer, 0, len); //将数据读入缓存
                 string msg = Encoding.ASCII.GetString(readBuffer, 0, len).Replace("\n", "").Replace("\r", "").Replace("\t", ""); //获取出入库产品编号
+                if (LabelInf.Rows.Count == 0)
+                    return; 
                 int pib_pdno = int.Parse(LabelInf.Rows[CurrentRowIndex].Cells["pib_pdno"].Value.ToString());
                 if (DetailRange.Checked)
                 {