Browse Source

修改

授权码生成工具
liup 4 months ago
parent
commit
07a72e594e
3 changed files with 25 additions and 6 deletions
  1. +9
    -4
      app/src/main/java/com/bonait/bnframework/business/MainInit.java
  2. +15
    -1
      app/src/main/java/com/bonait/bnframework/common/db/file/DBHelper.java
  3. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/db/util/GoodsDBUtil.java

+ 9
- 4
app/src/main/java/com/bonait/bnframework/business/MainInit.java View File

@@ -23,6 +23,7 @@ import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS;
import com.bonait.bnframework.common.db.mode.BPA_PROCESS;
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel;
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE;
@@ -280,10 +281,14 @@ public class MainInit {
ConfigData.getInstance().RevertPLCProcess();
}

// if(PreferenceUtils.getInt("isNewVersion",0)!=1){
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_MATERIAL.class,null);
// PreferenceUtils.setInt("isNewVersion",1);
// }
if(PreferenceUtils.getInt("isNewVersion",0)!=2){
if(!DBHelper.getInstance(MainApplication.getContext()).doesTableExist(BPA_PROPERTY_CLASSIFY.class)){
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROPERTY_CLASSIFY.class,null);
}

DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS.class,null);
PreferenceUtils.setInt("isNewVersion",2);
}
}




+ 15
- 1
app/src/main/java/com/bonait/bnframework/common/db/file/DBHelper.java View File

@@ -1,9 +1,11 @@
package com.bonait.bnframework.common.db.file;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE;
@@ -218,7 +220,19 @@ public class DBHelper extends SQLiteOpenHelper {
db.setTransactionSuccessful();
db.endTransaction();
}

/**
* 判断表是否存在
* @param c
* @return
*/
public boolean doesTableExist(Class c) {
SQLiteDatabase db =this.getWritableDatabase();
Cursor cursor = db.rawQuery("SELECT name FROM sqlite_master WHERE type='table' AND name=?", new String[]{c.getSimpleName()});
boolean exists = cursor.moveToFirst();
cursor.close();
LogUtils.d(" doesTableExist 判断表是否存在 "+c.getSimpleName()+" exists="+exists);
return exists;
}
/**
* 删除在创建
* @param c


+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/db/util/GoodsDBUtil.java View File

@@ -214,7 +214,7 @@ public class GoodsDBUtil {
for (Object k : obj) {
data.add((BPA_GOODS) k);
}
LogUtils.d("getByGoodsId 根据商品Id获取商品列表 data=" + data.toString());
LogUtils.d("getByClassifyId 根据商品分类Id获取商品列表 data=" + data.toString());
return data;
}



Loading…
Cancel
Save