@@ -165,5 +165,8 @@ dependencies { | |||
// implementation files('libs\\org.eclipse.paho.android.service-1.1.1.jar') | |||
// implementation files('libs\\org.eclipse.paho.client.mqttv3-1.2.5.jar') | |||
api 'org.greenrobot:eventbus:3.1.1' | |||
//日志工具 可定位代码行数 | |||
api 'com.apkfuns.logutils:library:1.7.5' | |||
} |
@@ -22,8 +22,10 @@ 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_SILOS; | |||
import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET; | |||
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS; | |||
import com.bonait.bnframework.common.db.util.DBListDataUtil; | |||
import com.bonait.bnframework.common.helper.ConfigUtil; | |||
import com.bonait.bnframework.common.helper.I.IRun; | |||
import com.bonait.bnframework.common.helper.I.IRunT; | |||
@@ -62,12 +64,15 @@ import com.bonait.bnframework.common.oss.OssHelper; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.common.view.GoodEditDialog; | |||
import com.bonait.bnframework.event.DownGoodsEvent; | |||
import com.google.gson.Gson; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.callback.StringCallback; | |||
import com.lzy.okgo.model.HttpHeaders; | |||
import com.lzy.okgo.model.Response; | |||
import org.greenrobot.eventbus.EventBus; | |||
import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
@@ -397,46 +402,25 @@ public class ConfigData { | |||
public boolean GoodsSync(String goods){ | |||
try{ | |||
ReceiveData rd = new Gson().fromJson(goods, ReceiveData.class); | |||
if(rd.goods!=null){ | |||
for (BPA_GOODS item:rd.goods){ | |||
if(QueryDB.GetGoodsIDIs(item.id))QueryDB.UpdateGoods(item); | |||
else QueryDB.AddGoods(item); | |||
} | |||
} | |||
if(rd.material!=null){ | |||
for (BPA_MATERIAL item:rd.material){ | |||
if(QueryDB.GetMaterialIs(item.id))QueryDB.UpdateMaterial(item); | |||
else QueryDB.AddMaterial(item); | |||
} | |||
} | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS.class,null); | |||
DBListDataUtil.addGOODSList(rd.goods); | |||
if(rd.goodsrecipes!=null){ | |||
ArrayList<BPA_GOODSRECIPE> removeData = QueryDB.GetGoodsSrecipeALL(); | |||
if(removeData!=null){ | |||
for(BPA_GOODSRECIPE remove:removeData){ | |||
QueryDB.DeleteGoodsSrecipe(remove); | |||
} | |||
} | |||
for(BPA_GOODSRECIPE item:rd.goodsrecipes){ | |||
QueryDB.AddGoodsSrecipe(item); | |||
} | |||
} | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_MATERIAL.class,null); | |||
DBListDataUtil.addMATERIALList(rd.material); | |||
if(rd.processes!=null){ | |||
for(BPA_PROCESS item:rd.processes){ | |||
if(QueryDB.GetProcessID(item.id)!=null)QueryDB.UpdateProcess(item); | |||
else QueryDB.AddProcess(item); | |||
} | |||
} | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODSRECIPE.class,null); | |||
DBListDataUtil.addGOODSRECIPEList(rd.goodsrecipes); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESS.class,null); | |||
DBListDataUtil.addPROCESSList(rd.processes); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESSModel.class,null); | |||
DBListDataUtil.addPROCESSModelList(rd.processModels); | |||
if(rd.processModels!=null){ | |||
for(BPA_PROCESSModel item:rd.processModels){ | |||
if(QueryDB.GetProcessModelID(item.id)!=null)QueryDB.UpdateProcessModel(item); | |||
else QueryDB.AddProcessModel(item); | |||
} | |||
} | |||
ToastUtils.info("接收主控数据成功!"); | |||
EventBus.getDefault().post(new DownGoodsEvent()); | |||
return true; | |||
}catch (Exception ex){ | |||
MessageLog.ShowError("解析数据失败!,"+ex.getMessage()); | |||
@@ -501,10 +485,11 @@ public class ConfigData { | |||
if (allDataResAPI.succeeded && allDataResAPI.data != null) { | |||
BPA_CLOUDDATA data = new BPA_CLOUDDATA(); | |||
ConfigName.getInstance().cloudData = allDataResAPI.data; | |||
ArrayList<BPA_CLOUDDATA> arrayList = QueryDB.GetClouddataALL(); | |||
for (BPA_CLOUDDATA item : arrayList) { | |||
QueryDB.DeleteClouddata(item); | |||
} | |||
ArrayList<BPA_CLOUDDATA> cloudList = new ArrayList<>(); | |||
ArrayList<BPA_MATERIAL> materials = new ArrayList<>(); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_MATERIAL.class,null); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_CLOUDDATA.class,null); | |||
//region 物料管理 | |||
List<BatchingInfo> bayc = allDataResAPI.data.batchingInfo; | |||
@@ -513,13 +498,7 @@ public class ConfigData { | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "物料集合"; | |||
data.text = new Gson().toJson(bayc); | |||
QueryDB.AddClouddata(data); | |||
ArrayList<BPA_MATERIAL> materials = QueryDB.GetMaterialALL(); | |||
for (BPA_MATERIAL wl : materials) { | |||
QueryDB.DeleteMaterial(wl); | |||
} | |||
cloudList.add(data); | |||
Integer I = 0; | |||
for (BatchingInfo item : bayc) { | |||
BPA_MATERIAL bpa_material = new BPA_MATERIAL(); | |||
@@ -527,13 +506,13 @@ public class ConfigData { | |||
bpa_material.name = item.batching_Name; | |||
bpa_material.imgUrl = ""; | |||
bpa_material.createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(new Date().getTime() + I * 1000)); | |||
; | |||
bpa_material.deviceID = ConfigName.getInstance().DeviceId; | |||
bpa_material.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddMaterial(bpa_material); | |||
materials.add(bpa_material); | |||
I++; | |||
} | |||
} | |||
DBListDataUtil.addMATERIALList(materials); | |||
//endregion | |||
//region 工艺模型 | |||
@@ -542,12 +521,10 @@ public class ConfigData { | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "工艺模型"; | |||
data.text = new Gson().toJson(allDataResAPI.data.goodsTechnology); | |||
QueryDB.AddClouddata(data); | |||
cloudList.add(data); | |||
ArrayList<BPA_PROCESS> processes = QueryDB.GetProcessALL(); | |||
for (BPA_PROCESS pro : processes) { | |||
QueryDB.DeleteProcess(pro); | |||
} | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESS.class,null); | |||
List<BPA_PROCESS> processes = new ArrayList<>(); | |||
Integer I = 0; | |||
for (GoodsTechnology item : allDataResAPI.data.goodsTechnology) { | |||
BPA_PROCESS bpa_process = new BPA_PROCESS(); | |||
@@ -555,10 +532,12 @@ public class ConfigData { | |||
bpa_process.name = item.name; | |||
bpa_process.createTime = item.createAt; | |||
bpa_process.sort = I; | |||
QueryDB.AddProcess(bpa_process); | |||
processes.add(bpa_process); | |||
I++; | |||
} | |||
DBListDataUtil.addPROCESSList(processes); | |||
} | |||
//endregion | |||
//region 工艺模型详细信息 | |||
@@ -567,12 +546,11 @@ public class ConfigData { | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "工艺模型详细信息"; | |||
data.text = new Gson().toJson(allDataResAPI.data.technologyAction); | |||
QueryDB.AddClouddata(data); | |||
cloudList.add(data); | |||
ArrayList<BPA_PROCESSModel> processes = QueryDB.GetProcessModelALL(); | |||
for (BPA_PROCESSModel pro : processes) { | |||
QueryDB.DeleteProcessModel(pro); | |||
} | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESSModel.class,null); | |||
List<BPA_PROCESSModel> models = new ArrayList<>(); | |||
for (TechnologyAction item : allDataResAPI.data.technologyAction) { | |||
BPA_PROCESSModel bpa_process = new BPA_PROCESSModel(); | |||
bpa_process.id = item.id; | |||
@@ -594,8 +572,9 @@ public class ConfigData { | |||
} | |||
} | |||
} | |||
QueryDB.AddProcessModel(bpa_process); | |||
models.add(bpa_process); | |||
} | |||
DBListDataUtil.addPROCESSModelList(models); | |||
} | |||
//endegion | |||
@@ -605,7 +584,7 @@ public class ConfigData { | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "菜谱信息"; | |||
data.text = new Gson().toJson(allDataResAPI.data.foodMenuInfo); | |||
QueryDB.AddClouddata(data); | |||
cloudList.add(data); | |||
} | |||
if (allDataResAPI.data.goodsTypeInfo != null) { | |||
@@ -613,7 +592,7 @@ public class ConfigData { | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "商品小类"; | |||
data.text = new Gson().toJson(allDataResAPI.data.goodsTypeInfo); | |||
QueryDB.AddClouddata(data); | |||
cloudList.add(data); | |||
} | |||
if (allDataResAPI.data.goodsParentTypeInfo != null) { | |||
@@ -621,7 +600,7 @@ public class ConfigData { | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "商品大类"; | |||
data.text = new Gson().toJson(allDataResAPI.data.goodsParentTypeInfo); | |||
QueryDB.AddClouddata(data); | |||
cloudList.add(data); | |||
} | |||
if (allDataResAPI.data.goodsUintInfo != null) { | |||
@@ -629,7 +608,7 @@ public class ConfigData { | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "商品单位"; | |||
data.text = new Gson().toJson(allDataResAPI.data.goodsUintInfo); | |||
QueryDB.AddClouddata(data); | |||
cloudList.add(data); | |||
} | |||
if (allDataResAPI.data.bomTypeInfo != null) { | |||
@@ -637,7 +616,7 @@ public class ConfigData { | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "配方分类"; | |||
data.text = new Gson().toJson(allDataResAPI.data.bomTypeInfo); | |||
QueryDB.AddClouddata(data); | |||
cloudList.add(data); | |||
} | |||
if (allDataResAPI.data.goodsAttributeValue != null) { | |||
@@ -645,8 +624,9 @@ public class ConfigData { | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "商品属性"; | |||
data.text = new Gson().toJson(allDataResAPI.data.goodsAttributeValue); | |||
QueryDB.AddClouddata(data); | |||
cloudList.add(data); | |||
} | |||
DBListDataUtil.addCLOUDDATAList(cloudList); | |||
Message msg = new Message(); | |||
msg.obj = "MSG_REFRESH"; | |||
@@ -0,0 +1,331 @@ | |||
package com.bonait.bnframework.common.db.util; | |||
import android.content.ContentValues; | |||
import android.database.sqlite.SQLiteDatabase; | |||
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.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_CLOUDDATA; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
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.helper.Tools; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author: liup | |||
* @description: 批量增删 | |||
* @date: 2024/7/23 9:48. | |||
*/ | |||
public class DBListDataUtil { | |||
/** | |||
* 批量新增 | |||
* @param list | |||
* @return | |||
*/ | |||
public static boolean addPROCESSModelList( List<BPA_PROCESSModel> 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_PROCESSModel.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; | |||
} | |||
public static boolean addPROCESSList( List<BPA_PROCESS> 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_PROCESS.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; | |||
} | |||
public static boolean addGOODSRECIPEList( List<BPA_GOODSRECIPE> 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_GOODSRECIPE.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; | |||
} | |||
public static boolean addMATERIALList( List<BPA_MATERIAL> 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_MATERIAL.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; | |||
} | |||
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; | |||
} | |||
public static boolean addCLOUDDATAList( List<BPA_CLOUDDATA> 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_CLOUDDATA.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; | |||
} | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.bonait.bnframework.common.model.mode; | |||
public enum MouthFacingEnum { | |||
原点位, | |||
炒菜位, | |||
维护位, | |||
抽料位, | |||
@@ -0,0 +1,12 @@ | |||
package com.bonait.bnframework.event; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/7/23 9:43. | |||
*/ | |||
public class DownGoodsEvent { | |||
public DownGoodsEvent(){ | |||
} | |||
} |
@@ -68,7 +68,7 @@ public class BottomNavigation2Activity extends BaseActivity { | |||
new Thread(()->{ | |||
try { | |||
Thread.sleep(3000); | |||
ConfigData.getInstance(). GetMainConsoleData(); | |||
ConfigData.getInstance().GetMainConsoleData(); | |||
}catch (Exception e){} | |||
}).start(); | |||
} | |||
@@ -46,6 +46,7 @@ import com.bonait.bnframework.common.model.mode.CloudGood; | |||
import com.bonait.bnframework.common.model.mode.GoodsTypeInfo; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.event.DownGoodsEvent; | |||
import com.bonait.bnframework.modules.home.adapter.good_adapter; | |||
import com.bonait.bnframework.modules.home.fragment.from.CookingActivity; | |||
import com.bonait.bnframework.modules.home.fragment.from.CookingSimulatedActivity; | |||
@@ -61,6 +62,10 @@ import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||
import com.qmuiteam.qmui.widget.section.QMUISection; | |||
import org.greenrobot.eventbus.EventBus; | |||
import org.greenrobot.eventbus.Subscribe; | |||
import org.greenrobot.eventbus.ThreadMode; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
@@ -124,7 +129,7 @@ public class HomeFragmentPR extends BaseFragment { | |||
activity = getActivity(); | |||
initTopBar(); | |||
SelectTab(1); | |||
EventBus.getDefault().register(this); | |||
} | |||
@SuppressLint("HandlerLeak") | |||
@@ -485,10 +490,12 @@ public class HomeFragmentPR extends BaseFragment { | |||
} | |||
} | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
Logger.d("第一页销毁"); | |||
EventBus.getDefault().unregister(this); | |||
} | |||
/** | |||
@@ -505,4 +512,9 @@ public class HomeFragmentPR extends BaseFragment { | |||
return false; | |||
} | |||
//接收图片选择事件 | |||
@Subscribe(threadMode = ThreadMode.MAIN) | |||
public void onDownGoodsEvent(DownGoodsEvent event){ | |||
SelectTab(1); | |||
} | |||
} |
@@ -109,6 +109,9 @@ public class HomeFragmentSBKZ extends BaseFragment { | |||
@BindView(R.id.guokoucaoxiang_wh) | |||
imagebuttom3 guokoucaoxiang_wh; | |||
@BindView(R.id.guokoucaoxiang_yd) | |||
imagebuttom3 guokoucaoxiang_yd; | |||
@BindView(R.id.chushui) | |||
imagebuttom3 chushui; | |||
@BindView(R.id.xiguoshui) | |||
@@ -203,6 +206,7 @@ public class HomeFragmentSBKZ extends BaseFragment { | |||
guokoucaoxiang_dc.mListener = myClickListener; | |||
guokoucaoxiang_qx.mListener = myClickListener; | |||
guokoucaoxiang_wh.mListener = myClickListener; | |||
guokoucaoxiang_yd.mListener = myClickListener; | |||
touliao1.mListener = myClickListener; | |||
touliao2.mListener = myClickListener; | |||
@@ -474,6 +478,9 @@ public class HomeFragmentSBKZ extends BaseFragment { | |||
case R.id.guokoucaoxiang_wh: | |||
SetMouthFacing(MouthFacingEnum.维护位); | |||
break; | |||
case R.id.guokoucaoxiang_yd: | |||
SetMouthFacing(MouthFacingEnum.原点位); | |||
break; | |||
case R.id.touliao1: | |||
MainDish(1); | |||
break; | |||
@@ -637,6 +644,10 @@ public class HomeFragmentSBKZ extends BaseFragment { | |||
ExecuteTheRecipe.BottomClick("清洗位"); | |||
guokoucaoxiang.setTag("锅口朝向\n 清洗位-按钮"); | |||
break; | |||
case 原点位: | |||
ExecuteTheRecipe.BottomClick("原点位"); | |||
guokoucaoxiang.setTag("锅口朝向\n 原点位-按钮"); | |||
break; | |||
} | |||
guokoucaoxiang_1.setVisibility(View.GONE); | |||
guokoucaoxiang.Init(); | |||
@@ -98,7 +98,7 @@ | |||
android:layout_marginBottom="@dimen/dp_10" | |||
android:antialias="true" | |||
android:scaleType="fitXY" | |||
android:src="@mipmap/device1" /> | |||
android:src="@mipmap/device00" /> | |||
<!-- 温度 --> | |||
<!-- <LinearLayout--> | |||
@@ -143,7 +143,7 @@ | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3 | |||
android:id="@+id/fanchaoshudu" | |||
android:layout_width="240dp" | |||
android:layout_width="140dp" | |||
android:layout_height="60dp" | |||
android:contentDescription="true" | |||
android:tag="翻炒速度-按钮" | |||
@@ -155,47 +155,61 @@ | |||
android:id="@+id/fanchaoshudu_1" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
tools:visibility="visible" | |||
android:orientation="vertical" | |||
android:visibility="gone"> | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3 | |||
android:id="@+id/fanchaoshudu_k" | |||
android:layout_width="60dp" | |||
android:layout_height="50dp" | |||
android:contentDescription="true" | |||
android:tag="快" | |||
app:imagesrc_ks="@mipmap/sb1" | |||
app:imagesrc_qt="@mipmap/sb2" | |||
app:imagesrc_tz="@mipmap/sb3" /> | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3 | |||
android:id="@+id/fanchaoshudu_z" | |||
android:layout_width="60dp" | |||
android:layout_height="50dp" | |||
android:contentDescription="true" | |||
android:tag="中" | |||
app:imagesrc_ks="@mipmap/sb1" | |||
app:imagesrc_qt="@mipmap/sb2" | |||
app:imagesrc_tz="@mipmap/sb3" /> | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3 | |||
android:id="@+id/fanchaoshudu_m" | |||
android:layout_width="60dp" | |||
android:layout_height="50dp" | |||
android:contentDescription="true" | |||
android:tag="慢" | |||
app:imagesrc_ks="@mipmap/sb1" | |||
app:imagesrc_qt="@mipmap/sb2" | |||
app:imagesrc_tz="@mipmap/sb3" /> | |||
<LinearLayout | |||
android:layout_width="wrap_content" | |||
android:orientation="horizontal" | |||
android:layout_height="wrap_content"> | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3 | |||
android:id="@+id/fanchaoshudu_k" | |||
android:layout_width="60dp" | |||
android:layout_height="50dp" | |||
android:contentDescription="true" | |||
android:tag="快" | |||
app:imagesrc_ks="@mipmap/sb1" | |||
app:imagesrc_qt="@mipmap/sb2" | |||
app:imagesrc_tz="@mipmap/sb3" /> | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3 | |||
android:id="@+id/fanchaoshudu_z" | |||
android:layout_width="60dp" | |||
android:layout_height="50dp" | |||
android:contentDescription="true" | |||
android:tag="中" | |||
app:imagesrc_ks="@mipmap/sb1" | |||
app:imagesrc_qt="@mipmap/sb2" | |||
app:imagesrc_tz="@mipmap/sb3" /> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_width="wrap_content" | |||
android:orientation="horizontal" | |||
android:layout_height="wrap_content"> | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3 | |||
android:id="@+id/fanchaoshudu_m" | |||
android:layout_width="60dp" | |||
android:layout_height="50dp" | |||
android:contentDescription="true" | |||
android:tag="慢" | |||
app:imagesrc_ks="@mipmap/sb1" | |||
app:imagesrc_qt="@mipmap/sb2" | |||
app:imagesrc_tz="@mipmap/sb3" /> | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3 | |||
android:id="@+id/fanchaoshudu_t" | |||
android:layout_width="60dp" | |||
android:layout_height="50dp" | |||
android:contentDescription="true" | |||
android:tag="停" | |||
app:imagesrc_ks="@mipmap/sb1" | |||
app:imagesrc_qt="@mipmap/sb2" | |||
app:imagesrc_tz="@mipmap/sb3" /> | |||
</LinearLayout> | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3 | |||
android:id="@+id/fanchaoshudu_t" | |||
android:layout_width="60dp" | |||
android:layout_height="50dp" | |||
android:contentDescription="true" | |||
android:tag="停" | |||
app:imagesrc_ks="@mipmap/sb1" | |||
app:imagesrc_qt="@mipmap/sb2" | |||
app:imagesrc_tz="@mipmap/sb3" /> | |||
</LinearLayout> | |||
</LinearLayout> | |||
@@ -398,7 +412,7 @@ | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentRight="true" | |||
android:layout_marginTop="80dp" | |||
android:layout_marginTop="40dp" | |||
android:layout_marginRight="140dp" | |||
android:orientation="vertical"> | |||
@@ -417,14 +431,24 @@ | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:orientation="vertical" | |||
tools:visibility="visible" | |||
android:visibility="gone"> | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3 | |||
android:id="@+id/guokoucaoxiang_yd" | |||
android:layout_width="100dp" | |||
android:layout_height="60dp" | |||
android:contentDescription="true" | |||
android:tag="原点位-按钮" | |||
app:imagesrc_ks="@mipmap/sb1" | |||
app:imagesrc_qt="@mipmap/sb2" | |||
app:imagesrc_tz="@mipmap/sb3" /> | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3 | |||
android:id="@+id/guokoucaoxiang_wh" | |||
android:layout_width="100dp" | |||
android:layout_height="60dp" | |||
android:contentDescription="true" | |||
android:tag="炒菜位-按钮" | |||
android:tag="维护位-按钮" | |||
app:imagesrc_ks="@mipmap/sb1" | |||
app:imagesrc_qt="@mipmap/sb2" | |||
app:imagesrc_tz="@mipmap/sb3" /> | |||
@@ -51,7 +51,7 @@ ext { // 统一版本入口 | |||
// 炒锅 | |||
// 设置applicationId(这里很重要,两个相同applicationId的apk不同同时安装在同一台Android手机中) | |||
applicationId="com.bonait.bnframework" | |||
applicationId="com.bonait.bnframeworkhh" | |||
// 奶茶机 | |||
// 设置applicationId(这里很重要,两个相同applicationId的apk不同同时安装在同一台Android手机中) | |||