浏览代码

添加上传测试代码

master
liup 3 天前
父节点
当前提交
f1d9cdd689
共有 7 个文件被更改,包括 128 次插入11 次删除
  1. +1
    -0
      .gitignore
  2. +13
    -0
      .idea/easycode.ignore
  3. +6
    -0
      .idea/git_toolbox_blame.xml
  4. +1
    -0
      app/src/main/java/com/bonait/bnframework/business/ConfigData.java
  5. +52
    -0
      app/src/main/java/com/bonait/bnframework/common/db/util/DBListDataUtil.java
  6. +53
    -10
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java
  7. +2
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java

+ 1
- 0
.gitignore 查看文件

@@ -11,3 +11,4 @@
/build
/captures
.externalNativeBuild
*.apk

+ 13
- 0
.idea/easycode.ignore 查看文件

@@ -0,0 +1,13 @@
node_modules/
dist/
vendor/
cache/
.*/
*.min.*
*.test.*
*.spec.*
*.bundle.*
*.bundle-min.*
*.*.js
*.*.ts
*.log

+ 6
- 0
.idea/git_toolbox_blame.xml 查看文件

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxBlameSettings">
<option name="version" value="2" />
</component>
</project>

+ 1
- 0
app/src/main/java/com/bonait/bnframework/business/ConfigData.java 查看文件

@@ -1100,6 +1100,7 @@ public class ConfigData {
try {
String str = ConfigName.getInstance().SaasAddress + ConfigName.getInstance().UpdateGoods;
// String str="http://192.168.1.7:5000/api/CommInteface/SendGoodsInfo";

OkGo.<ResAPI<Boolean>>post(str).tag(context).upRequestBody(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(update))).headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)).execute(new JsonDialogCallback<ResAPI<Boolean>>(context) {
@Override
public void onSuccess(Response<ResAPI<Boolean>> response) {


+ 52
- 0
app/src/main/java/com/bonait/bnframework/common/db/util/DBListDataUtil.java 查看文件

@@ -328,4 +328,56 @@ public class DBListDataUtil {
}
return false;
}
public static boolean addGoodsList( List<BPA_GOODS> list) {
if(list==null || list.isEmpty()){
return true;
}
QueryDB.lock.lock();
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase();
try {
long insert=-1;
db.beginTransaction();
for(int i = 0; i < list.size(); i++){
ContentValues cv = new ContentValues();

Map<String, Object> map = Tools.getObjValue(list.get(i));
if (map.get("id").toString().isEmpty())
return false;
for (String key : map.keySet()) {
Object value = map.get(key);
if (value instanceof String) {
cv.put(key, (String) value);
} else if (value instanceof Integer) {
cv.put(key, ((Integer) value).intValue());
} else if (value instanceof Double) {
cv.put(key, ((Double) value).doubleValue());
} else if (value instanceof Float) {
cv.put(key, ((Float) value).floatValue());
} else if (value instanceof Long) {
cv.put(key, ((Long) value).longValue());
} else if (value instanceof Boolean) {
cv.put(key, ((Boolean) value).booleanValue());
}
}
insert = db.insertOrThrow(BPA_GOODS.class.getSimpleName(), null, cv);
if (insert == -1) {
throw new Exception("Failed to insert data at index " + i);
}
}
LogUtils.d("removeList 批量添加工序");

db.setTransactionSuccessful();
return insert > 0;
} catch (Exception e) {
LogUtils.d("addList 批量新增异常");
} finally {
db.endTransaction();
db.close();
QueryDB.lock.unlock();
}
return false;
}



}

+ 53
- 10
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java 查看文件

@@ -4,13 +4,17 @@ import android.os.Bundle;

import androidx.annotation.NonNull;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.UpDataModel;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.file.DBHelper;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.util.DBListDataUtil;
import com.bonait.bnframework.common.helper.BatchSync;
import com.bonait.bnframework.common.helper.HttpServer;
import com.bonait.bnframework.common.helper.I.IRunT;
@@ -98,18 +102,57 @@ public class BottomNavigation2Activity extends BaseActivity {
// }catch (Exception e){}
// }).start();

// new Thread(new Runnable() {
// @Override
// public void run() {
// List<BPA_GOODS> goodsList = QueryDB.GetGoodsALL();
// List<BPA_GOODS> newgoodsList = QueryDB.GetGoodsALL();
// for(int i=0;i<newgoodsList.size();i++){
// newgoodsList.get(i).id = java.util.UUID.randomUUID().toString();
// }
// List<BPA_GOODSRECIPE> goodsrecipes = QueryDB.GetGoodsSrecipeALL();
//
// for (int i=0;i<goodsList.size();i++){
// for(int j=0;j<goodsrecipes.size();j++){
// if(goodsrecipes.get(j).goodsID!=null && goodsrecipes.get(j).goodsID.equals(goodsList.get(i).id)){
// goodsrecipes.get(j).goodsID = newgoodsList.get(i).id;
// }
// }
// LogUtils.d(" 更新数据 position="+i);
// }
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS.class,null);
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODSRECIPE.class,null);
// DBListDataUtil.addGoodsList(newgoodsList);
// DBListDataUtil.addGOODSRECIPEList(goodsrecipes);
// }
// }).start();



if(ConfigName.getInstance().versionSelectionEnum.contains("一拖")){
hs = new HttpServer();
new Thread(()->{
try {
Thread.sleep(3000);
ConfigData.getInstance().GetMainConsoleData();
}catch (Exception e){}
}).start();
}
// new Thread(new Runnable() {
// @Override
// public void run() {
//
// List<BPA_GOODS> goodsrecipes = QueryDB.GetGoodsALL();
//
// for (int i=0;i<goodsrecipes.size();i++){
// goodsrecipes.get(i).gyid = java.util.UUID.randomUUID().toString();
// LogUtils.d(" 更新数据 position="+i);
// }
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS.class,null);
// DBListDataUtil.addGoodsList(goodsrecipes);
// }
// }).start();
//
//
// if(ConfigName.getInstance().versionSelectionEnum.contains("一拖")){
// hs = new HttpServer();
// new Thread(()->{
// try {
// Thread.sleep(3000);
// ConfigData.getInstance().GetMainConsoleData();
// }catch (Exception e){}
// }).start();
// }
}

@Override


+ 2
- 1
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java 查看文件

@@ -13,6 +13,7 @@ import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.ExecuteTheRecipe;
@@ -27,6 +28,7 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_PROCESS;
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel;
import com.bonait.bnframework.common.db.util.DBListDataUtil;
import com.bonait.bnframework.common.helper.CountDownTimerExt;
import com.bonait.bnframework.common.helper.HttpServer;
import com.bonait.bnframework.common.helper.I.IRunT;
@@ -117,7 +119,6 @@ public class BottomNavigationNewActivity extends BaseActivity {




bottomNavigationView.mListener = new MyClickListener() {
@Override
public void clickListener(View v, Object data) {


正在加载...
取消
保存