@@ -114,6 +114,7 @@ public class MainApplication extends Application { | |||
//初始化DB数据 | |||
InitDBdata(); | |||
DataBus.getInstance().GetLc();//获取料仓数据 | |||
ConfigData.getInstance().LoadingCloud();//加载云端数据 | |||
} | |||
//========================================================================// | |||
@@ -149,16 +150,13 @@ public class MainApplication extends Application { | |||
} | |||
//工序模型表 | |||
InitProcessData(); | |||
ConfigData.getInstance().InitProcessData(); | |||
} | |||
if(QueryDB.GetPlcaddressALL().size()<=0) | |||
{ | |||
ConfigData.getInstance().RevertPLC(); | |||
} | |||
} | |||
/** | |||
* 删除表-重新生成新表 | |||
@@ -169,154 +167,9 @@ public class MainApplication extends Application { | |||
DBHelper.getInstance(this).DeleteCreateTables(BPA_PLCADDRESS.class,null); | |||
} | |||
public void RevertProcess() | |||
{ | |||
ArrayList<BPA_PROCESS> arrayList= QueryDB.GetProcessALL(); | |||
for (BPA_PROCESS item:arrayList) | |||
{ | |||
ArrayList<BPA_PROCESSModel> arrayList1= QueryDB.GetProcessModelALL(); | |||
for (BPA_PROCESSModel item1:arrayList1) | |||
{ | |||
QueryDB.DeleteProcessModel(item1); | |||
} | |||
QueryDB.DeleteProcess(item); | |||
} | |||
InitProcessData(); | |||
} | |||
/** | |||
* 初始化工序模型表 | |||
*/ | |||
public void InitProcessData() | |||
{ | |||
List<String> mxname=Arrays.asList("搅拌","位置","加热","主料","液体料","延迟","出菜"); | |||
Map<String,List<String>> mx=new IdentityHashMap<>(); | |||
mx.put("搅拌",Arrays.asList("搅拌速度","延迟(秒)")); | |||
mx.put("位置",Arrays.asList("转动速度","位置动作","延迟(秒)")); | |||
mx.put("加热",Arrays.asList("加热功率","延迟(秒)")); | |||
mx.put("主料",Arrays.asList("主料名称","主料重量","延迟(秒)","投料动作")); | |||
mx.put("液体料",new ArrayList<>()); | |||
mx.put("延迟",Arrays.asList("延迟(秒)")); | |||
mx.put("出菜",Arrays.asList("延迟(秒)")); | |||
int index=1; | |||
for (String key:mxname) | |||
{ | |||
List<String> values= mx.get(key); | |||
BPA_PROCESS process=new BPA_PROCESS(); | |||
process.sort=index; | |||
process.name=key; | |||
QueryDB.AddProcess(process);//增加模型 | |||
int chidindex=1; | |||
for (String item:values)//模型 | |||
{ | |||
BPA_PROCESSModel processModel=new BPA_PROCESSModel(); | |||
processModel.processid=process.id; | |||
processModel.name=item; | |||
processModel.sort=chidindex; | |||
if (item.equals("搅拌动作")) | |||
{ | |||
processModel.datatype=2; | |||
processModel.data="正转反转、一直正转、一直反转"; | |||
} | |||
else if (item.equals("位置动作")) | |||
{ | |||
processModel.datatype=2; | |||
processModel.data="原点位、投料位、出餐启动、倒菜位、抽料位、清洗位、炒菜位1、炒菜位2、炒菜位3"; | |||
} | |||
else if (item.equals("投料动作")) | |||
{ | |||
processModel.datatype=2; | |||
processModel.data="投出抖动三次、投出等待三秒、直接投出、手动投料"; | |||
} | |||
else if (item.equals("正转速度") || item.equals("反转速度") || item.equals("转动速度")|| item.equals("搅拌速度")) | |||
{ | |||
processModel.datatype=2; | |||
processModel.data="停止、最低、低速、中速、高速、最高、极高"; | |||
}else if (item.equals("加热功率") || item.equals("热锅功率")) | |||
{ | |||
processModel.datatype=2; | |||
processModel.data="停止、一档、二档、三档、四档、五档"; | |||
}else if (item.equals("主料名称")) | |||
{ | |||
processModel.datatype=1; | |||
}else | |||
{ | |||
processModel.datatype=0; | |||
} | |||
QueryDB.AddProcessModel(processModel); | |||
chidindex++; | |||
} | |||
index++; | |||
} | |||
} | |||
/** | |||
* 初始化工序模型表 | |||
*/ | |||
public void InitProcessData1() | |||
{ | |||
List<String> mxname=Arrays.asList("搅拌","热油","主料","加热","液体料","延迟","勾芡","出菜","热锅"); | |||
Map<String,List<String>> mx=new IdentityHashMap<>(); | |||
mx.put("搅拌",Arrays.asList("搅拌动作","正转速度","反转速度","正转(秒)","反转(秒)","停止(秒)","延迟(秒)")); | |||
mx.put("热油",Arrays.asList("加热功率","热油(克)")); | |||
mx.put("主料",Arrays.asList("主料名称","主料重量","烹饪(秒)","投料动作")); | |||
mx.put("加热",Arrays.asList("加热功率","延迟(秒)")); | |||
mx.put("液体料",new ArrayList<>()); | |||
mx.put("延迟",Arrays.asList("延迟(秒)")); | |||
mx.put("勾芡",Arrays.asList("勾芡(克)")); | |||
mx.put("出菜",Arrays.asList("时间(秒)")); | |||
mx.put("热锅",Arrays.asList("热锅功率")); | |||
int index=1; | |||
for (String key:mxname) | |||
{ | |||
List<String> values= mx.get(key); | |||
BPA_PROCESS process=new BPA_PROCESS(); | |||
process.sort=index; | |||
process.name=key; | |||
QueryDB.AddProcess(process);//增加模型 | |||
int chidindex=1; | |||
for (String item:values)//模型 | |||
{ | |||
BPA_PROCESSModel processModel=new BPA_PROCESSModel(); | |||
processModel.processid=process.id; | |||
processModel.name=item; | |||
processModel.sort=chidindex; | |||
if (item.equals("搅拌动作")) | |||
{ | |||
processModel.datatype=2; | |||
processModel.data="正转反转、一直正转、一直反转"; | |||
} | |||
else if (item.equals("投料动作")) | |||
{ | |||
processModel.datatype=2; | |||
processModel.data="投出抖动三次、投出等待三秒、直接投出、手动投料"; | |||
} | |||
else if (item.equals("正转速度") || item.equals("反转速度")) | |||
{ | |||
processModel.datatype=2; | |||
processModel.data="停止、最低、低速、中速、高速、最高、极高"; | |||
}else if (item.equals("加热功率") || item.equals("热锅功率")) | |||
{ | |||
processModel.datatype=2; | |||
processModel.data="停止、一档、二档、三档、四档、五档"; | |||
}else if (item.equals("主料名称")) | |||
{ | |||
processModel.datatype=1; | |||
}else | |||
{ | |||
processModel.datatype=0; | |||
} | |||
QueryDB.AddProcessModel(processModel); | |||
chidindex++; | |||
} | |||
index++; | |||
} | |||
} | |||
/** | |||
* 初始化消息日志接收打印 | |||
*/ | |||
@@ -3,41 +3,62 @@ package com.bonait.bnframework.business; | |||
import android.content.Context; | |||
import android.graphics.Bitmap; | |||
import android.graphics.BitmapFactory; | |||
import android.os.Handler; | |||
import android.os.Message; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
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_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_SYSTEMSET; | |||
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS; | |||
import com.bonait.bnframework.common.helper.ConfigUtil; | |||
import com.bonait.bnframework.common.helper.Json; | |||
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
import com.bonait.bnframework.common.image.utils.LocalCacheUtils; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.modbus.ModbusTcpHelper; | |||
import com.bonait.bnframework.common.modbus.ModbusTcpServer; | |||
import com.bonait.bnframework.common.model.ResAPI; | |||
import com.bonait.bnframework.common.model.ResListAPI; | |||
import com.bonait.bnframework.common.model.mode.ActionJsonMode; | |||
import com.bonait.bnframework.common.model.mode.BomTechnologyActionInfo; | |||
import com.bonait.bnframework.common.model.mode.ResGoodProcess; | |||
import com.bonait.bnframework.common.model.mode.TechnologyValueMode; | |||
import com.bonait.bnframework.common.model.mode.BatchingInfo; | |||
import com.bonait.bnframework.common.model.mode.CloudGood; | |||
import com.bonait.bnframework.common.model.mode.DeviceInformation; | |||
import com.bonait.bnframework.common.model.mode.DicModel; | |||
import com.bonait.bnframework.common.model.mode.InPage; | |||
import com.bonait.bnframework.common.model.mode.InputDev; | |||
import com.bonait.bnframework.common.model.mode.FoodMenuInfo; | |||
import com.bonait.bnframework.common.model.mode.GoodsParentTypeInfo; | |||
import com.bonait.bnframework.common.model.mode.GoodsTechnology; | |||
import com.bonait.bnframework.common.model.mode.GoodsTypeInfo; | |||
import com.bonait.bnframework.common.model.mode.GoodsUintInfo; | |||
import com.bonait.bnframework.common.model.mode.OrganizeMode; | |||
import com.bonait.bnframework.common.model.mode.ResALLData; | |||
import com.bonait.bnframework.common.model.mode.TechnologyAction; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.google.gson.Gson; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.model.HttpHeaders; | |||
import com.lzy.okgo.model.Response; | |||
import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.Collections; | |||
import java.util.Comparator; | |||
import java.util.Date; | |||
import java.util.IdentityHashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import okhttp3.MediaType; | |||
import okhttp3.RequestBody; | |||
/** | |||
* 主函数进程 | |||
@@ -194,6 +215,43 @@ public class ConfigData { | |||
ConfigUtil.write(ConfigName.getInstance().dishesCon, "Version", ConfigName.getInstance().Version); | |||
} | |||
/** | |||
* 加载云端数据 | |||
*/ | |||
public void LoadingCloud() { | |||
ArrayList<BPA_CLOUDDATA> data = QueryDB.GetClouddataALL(); | |||
if (data.size() > 0) { | |||
ConfigName.getInstance().cloudData = new ResALLData(); | |||
for (BPA_CLOUDDATA item : data) { | |||
if (item.name.equals("物料集合")) { | |||
ConfigName.getInstance().cloudData.batchingInfo = | |||
new Json<BatchingInfo>().jsonToListobject(BatchingInfo.class, item.text); | |||
} else if (item.name.equals("工艺模型")) { | |||
ConfigName.getInstance().cloudData.goodsTechnology = | |||
new Json<GoodsTechnology>().jsonToListobject(GoodsTechnology.class, item.text); | |||
} else if (item.name.equals("工艺模型详细信息")) { | |||
ConfigName.getInstance().cloudData.technologyAction = | |||
new Json<TechnologyAction>().jsonToListobject(TechnologyAction.class, item.text); | |||
} else if (item.name.equals("菜谱信息")) { | |||
ConfigName.getInstance().cloudData.foodMenuInfo = | |||
new Json<FoodMenuInfo>().jsonToListobject(FoodMenuInfo.class, item.text); | |||
} else if (item.name.equals("商品小类")) { | |||
ConfigName.getInstance().cloudData.goodsTypeInfo = | |||
new Json<GoodsTypeInfo>().jsonToListobject(GoodsTypeInfo.class, item.text); | |||
} else if (item.name.equals("商品大类")) { | |||
ConfigName.getInstance().cloudData.goodsParentTypeInfo = | |||
new Json<GoodsParentTypeInfo>().jsonToListobject(GoodsParentTypeInfo.class, item.text); | |||
} else if (item.name.equals("商品单位")) { | |||
ConfigName.getInstance().cloudData.goodsUintInfo = | |||
new Json<GoodsUintInfo>().jsonToListobject(GoodsUintInfo.class, item.text); | |||
} | |||
} | |||
} | |||
} | |||
/** | |||
* 获取组织信息 | |||
* | |||
@@ -223,9 +281,8 @@ public class ConfigData { | |||
ResAPI<DeviceInformation> deviceInformation = response.body(); | |||
if (deviceInformation.succeeded) { | |||
ConfigName.getInstance().deviceInformation = deviceInformation.data; | |||
if (ConfigName.getInstance().deviceInformation!=null) | |||
{ | |||
ConfigName.getInstance().DeviceId=ConfigName.getInstance().deviceInformation.id; | |||
if (ConfigName.getInstance().deviceInformation != null) { | |||
ConfigName.getInstance().DeviceId = ConfigName.getInstance().deviceInformation.id; | |||
} | |||
} | |||
} | |||
@@ -241,115 +298,282 @@ public class ConfigData { | |||
/** | |||
* 同步云端数据 | |||
*/ | |||
public void SyncDataInTheCloud(Context context) | |||
{ | |||
//region 拉取物料数据 | |||
OkGo.<ResAPI<ResALLData>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetBaseDataModel, | |||
ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceAutoKey)) | |||
.tag(context) | |||
.headers(new HttpHeaders("TenantId",ConfigName.getInstance().organizeMode.companyId)) | |||
.execute(new JsonDialogCallback<ResAPI<ResALLData>>(context) { | |||
@Override | |||
public void onSuccess(Response<ResAPI<ResALLData>> response) { | |||
ResAPI<ResALLData> allDataResAPI = response.body(); | |||
if (allDataResAPI.succeeded && allDataResAPI.data!=null) { | |||
BPA_CLOUDDATA data=new BPA_CLOUDDATA(); | |||
ArrayList<BPA_CLOUDDATA> arrayList= QueryDB.GetClouddataALL(); | |||
for (BPA_CLOUDDATA item:arrayList) | |||
{ | |||
QueryDB.DeleteClouddata(item); | |||
} | |||
if(allDataResAPI.data.batchingInfo!=null) | |||
{ | |||
data=new BPA_CLOUDDATA(); | |||
data.id=java.util.UUID.randomUUID().toString(); | |||
data.name="物料集合"; | |||
data.text=new Gson().toJson(allDataResAPI.data.batchingInfo); | |||
QueryDB.AddClouddata(data); | |||
} | |||
if(allDataResAPI.data.goodsTechnology!=null) | |||
{ | |||
data=new BPA_CLOUDDATA(); | |||
data.id=java.util.UUID.randomUUID().toString(); | |||
data.name="工艺模型"; | |||
data.text=new Gson().toJson(allDataResAPI.data.goodsTechnology); | |||
QueryDB.AddClouddata(data); | |||
} | |||
if(allDataResAPI.data.technologyAction!=null) | |||
{ | |||
data=new BPA_CLOUDDATA(); | |||
data.id=java.util.UUID.randomUUID().toString(); | |||
data.name="工艺模型详细信息"; | |||
data.text=new Gson().toJson(allDataResAPI.data.technologyAction); | |||
QueryDB.AddClouddata(data); | |||
} | |||
if(allDataResAPI.data.foodMenuInfo!=null) | |||
{ | |||
data=new BPA_CLOUDDATA(); | |||
data.id=java.util.UUID.randomUUID().toString(); | |||
data.name="菜谱信息"; | |||
data.text=new Gson().toJson(allDataResAPI.data.foodMenuInfo); | |||
QueryDB.AddClouddata(data); | |||
} | |||
if(allDataResAPI.data.goodsTypeInfo!=null) | |||
{ | |||
data=new BPA_CLOUDDATA(); | |||
data.id=java.util.UUID.randomUUID().toString(); | |||
data.name="商品小类"; | |||
data.text=new Gson().toJson(allDataResAPI.data.goodsTypeInfo); | |||
QueryDB.AddClouddata(data); | |||
} | |||
if(allDataResAPI.data.goodsParentTypeInfo!=null) | |||
{ | |||
data=new BPA_CLOUDDATA(); | |||
data.id=java.util.UUID.randomUUID().toString(); | |||
data.name="商品大类"; | |||
data.text=new Gson().toJson(allDataResAPI.data.goodsParentTypeInfo); | |||
QueryDB.AddClouddata(data); | |||
public void SyncDataInTheCloud(Context context, Handler mHandler) { | |||
if (NetworkUtils.isNetworkConnected(context)) { | |||
//region 拉取物料数据 | |||
OkGo.<ResAPI<ResALLData>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetBaseDataModel, | |||
ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceAutoKey)) | |||
.tag(context) | |||
.headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)) | |||
.execute(new JsonDialogCallback<ResAPI<ResALLData>>(context) { | |||
@Override | |||
public void onSuccess(Response<ResAPI<ResALLData>> response) { | |||
ResAPI<ResALLData> allDataResAPI = response.body(); | |||
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); | |||
} | |||
//region 物料管理 | |||
List<BatchingInfo> bayc = allDataResAPI.data.batchingInfo; | |||
if (allDataResAPI.data.batchingInfo != null) { | |||
data = new BPA_CLOUDDATA(); | |||
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); | |||
} | |||
Integer I = 0; | |||
for (BatchingInfo item : bayc) { | |||
BPA_MATERIAL bpa_material = new BPA_MATERIAL(); | |||
bpa_material.id = item.id; | |||
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); | |||
I++; | |||
} | |||
} | |||
//endregion | |||
//region 工艺模型 | |||
if (allDataResAPI.data.goodsTechnology != null) { | |||
data = new BPA_CLOUDDATA(); | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "工艺模型"; | |||
data.text = new Gson().toJson(allDataResAPI.data.goodsTechnology); | |||
QueryDB.AddClouddata(data); | |||
ArrayList<BPA_PROCESS> processes = QueryDB.GetProcessALL(); | |||
for (BPA_PROCESS pro : processes) { | |||
QueryDB.DeleteProcess(pro); | |||
} | |||
Integer I = 0; | |||
for (GoodsTechnology item : allDataResAPI.data.goodsTechnology) { | |||
BPA_PROCESS bpa_process = new BPA_PROCESS(); | |||
bpa_process.id = item.id; | |||
bpa_process.name = item.name; | |||
bpa_process.createTime = item.createAt; | |||
bpa_process.sort = I; | |||
QueryDB.AddProcess(bpa_process); | |||
I++; | |||
} | |||
} | |||
//endregion | |||
//region 工艺模型详细信息 | |||
if (allDataResAPI.data.technologyAction != null) { | |||
data = new BPA_CLOUDDATA(); | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "工艺模型详细信息"; | |||
data.text = new Gson().toJson(allDataResAPI.data.technologyAction); | |||
QueryDB.AddClouddata(data); | |||
ArrayList<BPA_PROCESSModel> processes = QueryDB.GetProcessModelALL(); | |||
for (BPA_PROCESSModel pro : processes) { | |||
QueryDB.DeleteProcessModel(pro); | |||
} | |||
for (TechnologyAction item : allDataResAPI.data.technologyAction) { | |||
BPA_PROCESSModel bpa_process = new BPA_PROCESSModel(); | |||
bpa_process.id = item.id; | |||
bpa_process.processid = item.goodstechnologyId; | |||
bpa_process.name = item.actionName; | |||
bpa_process.createTime = item.createAt; | |||
bpa_process.sort = item.sort; | |||
bpa_process.datatype = (item.actionType.equals("digit") ? 0 : ((item.actionType.equals("text") || item.actionType.equals("textarea") || item.actionType.equals("switch")) ? 1 : 2)); | |||
bpa_process.data = ""; | |||
if (item.actionType.equals("select") && !item.actionValue.isEmpty()) { | |||
List<TechnologyValueMode> val = new Json<TechnologyValueMode>().jsonToListobject(TechnologyValueMode.class, item.actionValue); | |||
for (int i = 0; i < val.size(); i++) { | |||
if (i < val.size() - 1) { | |||
bpa_process.data += val.get(i).actionValueName + "、"; | |||
} else { | |||
bpa_process.data += val.get(i).actionValueName; | |||
} | |||
} | |||
} | |||
QueryDB.AddProcessModel(bpa_process); | |||
} | |||
} | |||
//endegion | |||
if (allDataResAPI.data.foodMenuInfo != null) { | |||
data = new BPA_CLOUDDATA(); | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "菜谱信息"; | |||
data.text = new Gson().toJson(allDataResAPI.data.foodMenuInfo); | |||
QueryDB.AddClouddata(data); | |||
} | |||
if (allDataResAPI.data.goodsTypeInfo != null) { | |||
data = new BPA_CLOUDDATA(); | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "商品小类"; | |||
data.text = new Gson().toJson(allDataResAPI.data.goodsTypeInfo); | |||
QueryDB.AddClouddata(data); | |||
} | |||
if (allDataResAPI.data.goodsParentTypeInfo != null) { | |||
data = new BPA_CLOUDDATA(); | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "商品大类"; | |||
data.text = new Gson().toJson(allDataResAPI.data.goodsParentTypeInfo); | |||
QueryDB.AddClouddata(data); | |||
} | |||
if (allDataResAPI.data.goodsUintInfo != null) { | |||
data = new BPA_CLOUDDATA(); | |||
data.id = java.util.UUID.randomUUID().toString(); | |||
data.name = "商品单位"; | |||
data.text = new Gson().toJson(allDataResAPI.data.goodsUintInfo); | |||
QueryDB.AddClouddata(data); | |||
} | |||
Message msg = new Message(); | |||
msg.obj = "MSG_REFRESH"; | |||
mHandler.sendMessage(msg); | |||
} | |||
} | |||
}); | |||
//endregion | |||
} else { | |||
ToastUtils.warning("无网络,请先连接网络!!!"); | |||
} | |||
} | |||
if(allDataResAPI.data.goodsUintInfo!=null) | |||
{ | |||
data=new BPA_CLOUDDATA(); | |||
data.id=java.util.UUID.randomUUID().toString(); | |||
data.name="商品单位"; | |||
data.text=new Gson().toJson(allDataResAPI.data.goodsUintInfo); | |||
QueryDB.AddClouddata(data); | |||
/** | |||
* 获取设备所有商品信息 | |||
* | |||
* @param context | |||
*/ | |||
public void GetGevGood(Context context, Handler mHandler) { | |||
if (NetworkUtils.isNetworkConnected(context)) { | |||
OkGo.<ResAPI<List<CloudGood>>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetGoods, | |||
ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceId)) | |||
.tag(context) | |||
.headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)) | |||
.execute(new JsonDialogCallback<ResAPI<List<CloudGood>>>(context) { | |||
@Override | |||
public void onSuccess(Response<ResAPI<List<CloudGood>>> response) { | |||
ResAPI<List<CloudGood>> allDataResAPI = response.body(); | |||
if (allDataResAPI.succeeded && allDataResAPI.data != null && allDataResAPI.data.size() > 0) { | |||
ConfigName.getInstance().cloudGoods = allDataResAPI.data; | |||
Message msg = new Message(); | |||
msg.obj = "MSG_REFRESH"; | |||
mHandler.sendMessage(msg); | |||
} | |||
} | |||
} | |||
}); | |||
//endregion | |||
}); | |||
} else { | |||
ToastUtils.warning("无网络,请先连接网络!!!"); | |||
} | |||
} | |||
/** | |||
* 获取所有商品信息 | |||
* 获取商品配方信息 | |||
* | |||
* @param context | |||
*/ | |||
public void GetGevGood(Context context) | |||
{ | |||
OkGo.<ResAPI<List<CloudGood>>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetGoods, | |||
ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceId)) | |||
.tag(context) | |||
.headers(new HttpHeaders("TenantId",ConfigName.getInstance().organizeMode.companyId)) | |||
.execute(new JsonDialogCallback<ResAPI<List<CloudGood>>>(context) { | |||
@Override | |||
public void onSuccess(Response<ResAPI<List<CloudGood>>> response) { | |||
ResAPI<List<CloudGood>> allDataResAPI = response.body(); | |||
if (allDataResAPI.succeeded && allDataResAPI.data!=null) { | |||
public void GetGoodProcess(Context context, String goodid) { | |||
Boolean IsXZ= QueryDB.GetGoodsIDIs(goodid); | |||
if(IsXZ) | |||
{ | |||
ToastUtils.warning("请勿重复下载,本地商品已存在!!!"); | |||
return; | |||
} | |||
if (NetworkUtils.isNetworkConnected(context)) { | |||
OkGo.<ResAPI<ResGoodProcess>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetGoodsBom, | |||
goodid)) | |||
.tag(context) | |||
.headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)) | |||
.execute(new JsonDialogCallback<ResAPI<ResGoodProcess>>(context) { | |||
@Override | |||
public void onSuccess(Response<ResAPI<ResGoodProcess>> response) { | |||
ResAPI<ResGoodProcess> allDataResAPI = response.body(); | |||
if (allDataResAPI.succeeded && allDataResAPI.data != null) { | |||
CloudGood cloudGood = null; | |||
for (CloudGood item : ConfigName.getInstance().cloudGoods) { | |||
if (item.id.equals(goodid)) { | |||
cloudGood = item; | |||
break; | |||
} | |||
} | |||
if (cloudGood != null) { | |||
//1.增加商品 | |||
BPA_GOODS good = new BPA_GOODS(); | |||
good.id = cloudGood.id; | |||
good.name = cloudGood.goods_Name; | |||
good.status = 1; | |||
good.sort = QueryDB.GetGoodsALL().size() + 1; | |||
good.maketime = 180; | |||
good.issc = 0; | |||
good.url = cloudGood.goods_ImgUrl; | |||
good.exp="云端商品"; | |||
QueryDB.AddGoods(good); | |||
//2.增加配方 | |||
if (allDataResAPI.data.bomTechnologyActionInfo != null && allDataResAPI.data.bomTechnologyActionInfo.size() > 0) { | |||
List<BomTechnologyActionInfo> bayc = allDataResAPI.data.bomTechnologyActionInfo; | |||
Collections.sort(bayc, new Comparator<BomTechnologyActionInfo>() { | |||
@Override | |||
public int compare(BomTechnologyActionInfo o1, BomTechnologyActionInfo o2) { | |||
return Double.valueOf(o1.sort).compareTo(Double.valueOf(o2.sort)); | |||
} | |||
}); | |||
for (BomTechnologyActionInfo k : allDataResAPI.data.bomTechnologyActionInfo) { | |||
BPA_GOODSRECIPE item = new BPA_GOODSRECIPE(); | |||
item.goodsID = good.id; | |||
item.sort = k.sort; | |||
item.processname = k.stepName; | |||
if (!k.actionJson.isEmpty()) { | |||
String data = ""; | |||
String desc = ""; | |||
boolean iswl=false; | |||
List<ActionJsonMode> gyActions = new Json<List<ActionJsonMode>>().jsonToListobject(ActionJsonMode.class, ((String) k.actionJson)); | |||
for (ActionJsonMode m : gyActions) { | |||
data += m.ActionName + "," + m.ActionValue + "|"; | |||
desc += m.ActionValue + ","; | |||
if(!m.BatchingId.isEmpty()) | |||
{ | |||
iswl=true; | |||
} | |||
} | |||
if (data.contains("|")) { | |||
item.processvalue = data.substring(0, data.length() - 1); | |||
} | |||
if (desc.contains(",")) { | |||
item.processms = k.stepName + "(" + desc.substring(0, desc.length() - 1) + ")"; | |||
} | |||
item.materialType=iswl?0:1; | |||
} | |||
QueryDB.AddGoodsSrecipe(item); | |||
} | |||
} | |||
ToastUtils.info("下载菜品成功!!!"); | |||
MessageManager.getInstance().sendMessage(MessageName.ScGood,"Good"); | |||
} | |||
} | |||
} | |||
} | |||
}); | |||
}); | |||
} else { | |||
ToastUtils.warning("无网络,请先连接网络!!!"); | |||
} | |||
} | |||
/** | |||
@@ -372,30 +596,152 @@ public class ConfigData { | |||
/** | |||
* 还原PLC | |||
*/ | |||
public void RevertPLC() | |||
{ | |||
try | |||
{ | |||
ArrayList<BPA_PLCADDRESS> arrayList= QueryDB.GetPlcaddressALL(); | |||
for (BPA_PLCADDRESS item:arrayList) | |||
{ | |||
public void RevertPLC() { | |||
try { | |||
ArrayList<BPA_PLCADDRESS> arrayList = QueryDB.GetPlcaddressALL(); | |||
for (BPA_PLCADDRESS item : arrayList) { | |||
QueryDB.DeletePlcaddress(item); | |||
} | |||
int k=1; | |||
for (Res_PLCADDRESS item:ConfigName.getInstance().PlcAddress_大炒) | |||
{ | |||
BPA_PLCADDRESS plc=new BPA_PLCADDRESS(); | |||
plc.name=item.name; | |||
plc.address=item.address; | |||
plc.isread=item.isread; | |||
plc.iswrite=item.iswrite; | |||
plc.sort=k; | |||
int k = 1; | |||
for (Res_PLCADDRESS item : ConfigName.getInstance().PlcAddress_大炒) { | |||
BPA_PLCADDRESS plc = new BPA_PLCADDRESS(); | |||
plc.name = item.name; | |||
plc.address = item.address; | |||
plc.isread = item.isread; | |||
plc.iswrite = item.iswrite; | |||
plc.sort = k; | |||
k++; | |||
QueryDB.AddPlcaddress(plc); | |||
} | |||
}catch (Exception ex) | |||
{ | |||
} catch (Exception ex) { | |||
} | |||
} | |||
/** | |||
* 还原工序模型 | |||
*/ | |||
public void RevertProcess() { | |||
ArrayList<BPA_PROCESS> arrayList = QueryDB.GetProcessALL(); | |||
for (BPA_PROCESS item : arrayList) { | |||
ArrayList<BPA_PROCESSModel> arrayList1 = QueryDB.GetProcessModelALL(); | |||
for (BPA_PROCESSModel item1 : arrayList1) { | |||
QueryDB.DeleteProcessModel(item1); | |||
} | |||
QueryDB.DeleteProcess(item); | |||
} | |||
InitProcessData(); | |||
} | |||
/** | |||
* 初始化工序模型表 | |||
*/ | |||
public void InitProcessData() { | |||
List<String> mxname = Arrays.asList("搅拌", "位置", "加热", "主料", "液体料", "延迟", "出菜"); | |||
Map<String, List<String>> mx = new IdentityHashMap<>(); | |||
mx.put("搅拌", Arrays.asList("搅拌速度", "延迟(秒)")); | |||
mx.put("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)")); | |||
mx.put("加热", Arrays.asList("加热功率", "延迟(秒)")); | |||
mx.put("主料", Arrays.asList("主料名称", "主料重量", "延迟(秒)", "投料动作")); | |||
mx.put("液体料", new ArrayList<>()); | |||
mx.put("延迟", Arrays.asList("延迟(秒)")); | |||
mx.put("出菜", Arrays.asList("延迟(秒)")); | |||
int index = 1; | |||
for (String key : mxname) { | |||
List<String> values = mx.get(key); | |||
BPA_PROCESS process = new BPA_PROCESS(); | |||
process.sort = index; | |||
process.name = key; | |||
QueryDB.AddProcess(process);//增加模型 | |||
int chidindex = 1; | |||
for (String item : values)//模型 | |||
{ | |||
BPA_PROCESSModel processModel = new BPA_PROCESSModel(); | |||
processModel.processid = process.id; | |||
processModel.name = item; | |||
processModel.sort = chidindex; | |||
if (item.equals("搅拌动作")) { | |||
processModel.datatype = 2; | |||
processModel.data = "正转反转、一直正转、一直反转"; | |||
} else if (item.equals("位置动作")) { | |||
processModel.datatype = 2; | |||
processModel.data = "原点位、投料位、出餐启动、倒菜位、抽料位、清洗位、炒菜位1、炒菜位2、炒菜位3"; | |||
} else if (item.equals("投料动作")) { | |||
processModel.datatype = 2; | |||
processModel.data = "投出抖动三次、投出等待三秒、直接投出、手动投料"; | |||
} else if (item.equals("正转速度") || item.equals("反转速度") || item.equals("转动速度") || item.equals("搅拌速度")) { | |||
processModel.datatype = 2; | |||
processModel.data = "停止、最低、低速、中速、高速、最高、极高"; | |||
} else if (item.equals("加热功率") || item.equals("热锅功率")) { | |||
processModel.datatype = 2; | |||
processModel.data = "停止、一档、二档、三档、四档、五档"; | |||
} else if (item.equals("主料名称")) { | |||
processModel.datatype = 1; | |||
} else { | |||
processModel.datatype = 0; | |||
} | |||
QueryDB.AddProcessModel(processModel); | |||
chidindex++; | |||
} | |||
index++; | |||
} | |||
} | |||
/** | |||
* 初始化工序模型表-老v版本 | |||
*/ | |||
public void InitProcessData1() { | |||
List<String> mxname = Arrays.asList("搅拌", "热油", "主料", "加热", "液体料", "延迟", "勾芡", "出菜", "热锅"); | |||
Map<String, List<String>> mx = new IdentityHashMap<>(); | |||
mx.put("搅拌", Arrays.asList("搅拌动作", "正转速度", "反转速度", "正转(秒)", "反转(秒)", "停止(秒)", "延迟(秒)")); | |||
mx.put("热油", Arrays.asList("加热功率", "热油(克)")); | |||
mx.put("主料", Arrays.asList("主料名称", "主料重量", "烹饪(秒)", "投料动作")); | |||
mx.put("加热", Arrays.asList("加热功率", "延迟(秒)")); | |||
mx.put("液体料", new ArrayList<>()); | |||
mx.put("延迟", Arrays.asList("延迟(秒)")); | |||
mx.put("勾芡", Arrays.asList("勾芡(克)")); | |||
mx.put("出菜", Arrays.asList("时间(秒)")); | |||
mx.put("热锅", Arrays.asList("热锅功率")); | |||
int index = 1; | |||
for (String key : mxname) { | |||
List<String> values = mx.get(key); | |||
BPA_PROCESS process = new BPA_PROCESS(); | |||
process.sort = index; | |||
process.name = key; | |||
QueryDB.AddProcess(process);//增加模型 | |||
int chidindex = 1; | |||
for (String item : values)//模型 | |||
{ | |||
BPA_PROCESSModel processModel = new BPA_PROCESSModel(); | |||
processModel.processid = process.id; | |||
processModel.name = item; | |||
processModel.sort = chidindex; | |||
if (item.equals("搅拌动作")) { | |||
processModel.datatype = 2; | |||
processModel.data = "正转反转、一直正转、一直反转"; | |||
} else if (item.equals("投料动作")) { | |||
processModel.datatype = 2; | |||
processModel.data = "投出抖动三次、投出等待三秒、直接投出、手动投料"; | |||
} else if (item.equals("正转速度") || item.equals("反转速度")) { | |||
processModel.datatype = 2; | |||
processModel.data = "停止、最低、低速、中速、高速、最高、极高"; | |||
} else if (item.equals("加热功率") || item.equals("热锅功率")) { | |||
processModel.datatype = 2; | |||
processModel.data = "停止、一档、二档、三档、四档、五档"; | |||
} else if (item.equals("主料名称")) { | |||
processModel.datatype = 1; | |||
} else { | |||
processModel.datatype = 0; | |||
} | |||
QueryDB.AddProcessModel(processModel); | |||
chidindex++; | |||
} | |||
index++; | |||
} | |||
} | |||
//endregion | |||
@@ -405,15 +751,12 @@ public class ConfigData { | |||
/** | |||
* 连接PLC | |||
*/ | |||
public void ConnectPLC() | |||
{ | |||
public void ConnectPLC() { | |||
ConfigName.getInstance().PLC_Address.clear(); | |||
ArrayList<BPA_PLCADDRESS> address=QueryDB.GetPlcaddressALL(); | |||
for (BPA_PLCADDRESS item:address) | |||
{ | |||
if(!item.address.isEmpty() && !item.address.equals("-------------")) | |||
{ | |||
ConfigName.getInstance().PLC_Address.put(item.name,item); | |||
ArrayList<BPA_PLCADDRESS> address = QueryDB.GetPlcaddressALL(); | |||
for (BPA_PLCADDRESS item : address) { | |||
if (!item.address.isEmpty() && !item.address.equals("-------------")) { | |||
ConfigName.getInstance().PLC_Address.put(item.name, item); | |||
} | |||
} | |||
ExecuteTheRecipe.Listening();//启动数据监听 | |||
@@ -432,16 +775,14 @@ public class ConfigData { | |||
/** | |||
* 关闭PLC | |||
*/ | |||
public void ColsePLC() | |||
{ | |||
public void ColsePLC() { | |||
ModbusTcpHelper.get().release();//释放modbus | |||
} | |||
/** | |||
* PLC初始化完成时,需要注册的服务 | |||
*/ | |||
public void PLC_Init() | |||
{ | |||
public void PLC_Init() { | |||
} | |||
@@ -8,8 +8,10 @@ import com.bonait.bnframework.common.db.mode.BPA_USER; | |||
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS; | |||
import com.bonait.bnframework.common.db.res.StatusMode; | |||
import com.bonait.bnframework.common.model.AddrType; | |||
import com.bonait.bnframework.common.model.mode.CloudGood; | |||
import com.bonait.bnframework.common.model.mode.DeviceInformation; | |||
import com.bonait.bnframework.common.model.mode.OrganizeMode; | |||
import com.bonait.bnframework.common.model.mode.ResALLData; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
@@ -387,7 +389,6 @@ public class ConfigName { | |||
add(new StatusMode("搅拌电机变频器通讯异常",false,R.mipmap.bpq,R.mipmap.bpq,6)); | |||
add(new StatusMode("翻转电机变频器通讯异常",false,R.mipmap.bpq,R.mipmap.bpq,7)); | |||
}}; | |||
/** | |||
* 状态上报信息 | |||
*/ | |||
@@ -424,6 +425,17 @@ public class ConfigName { | |||
}}; | |||
//endregion | |||
//region 云端数据 | |||
/** | |||
* 云端数据 | |||
*/ | |||
public ResALLData cloudData=null; | |||
/** | |||
* 云端商品 | |||
*/ | |||
public List<CloudGood> cloudGoods=new ArrayList<>(); | |||
//endregion | |||
} | |||
@@ -695,7 +695,7 @@ public class QueryDB { | |||
* @return | |||
*/ | |||
public static ArrayList<BPA_GOODS> GetGoodsALL() { | |||
String orderby = Desc_Sort_Up + ',' + Desc_Time_Up;//先按排序 创建时间倒序 | |||
String orderby = Desc_Time_Up;//先按排序 创建时间倒序 | |||
String where = "isDelete=?"; | |||
String[] args = new String[]{"0"}; | |||
ArrayList<BPA_GOODS> data = new ArrayList<>(); | |||
@@ -0,0 +1,8 @@ | |||
package com.bonait.bnframework.common.model.mode; | |||
public class ActionJsonMode { | |||
public String TechnologyactionId ;//工艺id | |||
public String ActionName ;//名称 | |||
public String ActionValue ;//变量 | |||
public String BatchingId ;//物料id | |||
} |
@@ -0,0 +1,17 @@ | |||
package com.bonait.bnframework.common.model.mode; | |||
public class BomInfo { | |||
public String id; | |||
public String isDeleted; | |||
public String deleteAt; | |||
public String updateAt; | |||
public String createAt; | |||
public int status; | |||
public String groupId; | |||
public String name; | |||
public String code; | |||
public boolean isMain; | |||
public int autoKey; | |||
public String bomInfo; | |||
public int sort; | |||
} |
@@ -0,0 +1,14 @@ | |||
package com.bonait.bnframework.common.model.mode; | |||
public class BomTechnologyActionInfo { | |||
public String id; | |||
public String stepName; | |||
public String actionJson; | |||
public String bomId; | |||
public boolean isBatch; | |||
public String chnologyId; | |||
public String createAt; | |||
public String groupId; | |||
public int isDeleted; | |||
public int sort; | |||
} |
@@ -11,11 +11,11 @@ public class ResALLData { | |||
*/ | |||
public List<BatchingInfo> batchingInfo; | |||
/** | |||
* 工艺模型 | |||
* 工艺模型 --一直 | |||
*/ | |||
public List<GoodsTechnology> goodsTechnology; | |||
/** | |||
* 工艺模型详细信息 | |||
* 工艺模型详细信息 --一致 | |||
*/ | |||
public List<TechnologyAction> technologyAction; | |||
/** | |||
@@ -0,0 +1,14 @@ | |||
package com.bonait.bnframework.common.model.mode; | |||
import java.util.List; | |||
public class ResGoodProcess { | |||
/** | |||
* 商品Bom清单 | |||
*/ | |||
public List<BomInfo> bomInfo; | |||
/** | |||
* 商品配方 | |||
*/ | |||
public List<BomTechnologyActionInfo> bomTechnologyActionInfo; | |||
} |
@@ -6,7 +6,7 @@ package com.bonait.bnframework.common.model.mode; | |||
public class TechnologyAction { | |||
public String goodstechnologyId;//模型id | |||
public String actionName;//搅拌动作 | |||
public String actionType;//动作类型 | |||
public String actionType;//动作类型 text textarea switch 1 select 选择 digit 0 | |||
public String actionValue;//"[{\"actionValueName\":\"正转反转\"},{\"actionValueName\":\"一直正转\"},{\"actionValueName\":\"一直反转\"}] | |||
public int sort; | |||
public int isDeleted; | |||
@@ -0,0 +1,5 @@ | |||
package com.bonait.bnframework.common.model.mode; | |||
public class TechnologyValueMode { | |||
public String actionValueName; | |||
} |
@@ -4,19 +4,27 @@ import static com.bonait.bnframework.MainApplication.getContext; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import android.annotation.SuppressLint; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import androidx.recyclerview.widget.GridLayoutManager; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import android.os.Handler; | |||
import android.os.Message; | |||
import android.view.View; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ConfigData; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.message.MessageLooper; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.model.mode.CloudGood; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.modules.home.fragment.mode.QDListSectionAdapter; | |||
import com.bonait.bnframework.modules.home.fragment.mode.SectionHeader; | |||
@@ -27,6 +35,7 @@ import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter; | |||
import com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
@@ -53,7 +62,7 @@ public class CpActivity extends BaseActivity { | |||
NBClick(); | |||
} | |||
// QDListSectionAdapter | |||
// QDListSectionAdapter | |||
private void initAdapter() { | |||
mLayoutManager = createLayoutManager(); | |||
mSectionLayout.setLayoutManager(mLayoutManager); | |||
@@ -82,16 +91,26 @@ public class CpActivity extends BaseActivity { | |||
int FirstPos = mAdapter.getSectionIndex(position); | |||
int SecondPos = mAdapter.getItemIndex(position); | |||
//ItemPopupWindow.show(getContext(), holder.itemView, holder.getItemViewType(), FirstPos, SecondPos); | |||
ToastUtils.info("一级条目" +FirstPos+ "二级"+ SecondPos); | |||
ToastUtils.info("一级条目" + FirstPos + "二级" + SecondPos); | |||
return true; | |||
} | |||
}); | |||
mSectionLayout.setAdapter(mAdapter, true); | |||
ConfigData.getInstance().GetGevGood(this, mHandler); | |||
mAdapter.setData(getList()); | |||
} | |||
public void NBClick() | |||
{ | |||
@SuppressLint("HandlerLeak") | |||
private Handler mHandler = new Handler() { | |||
@Override | |||
public void handleMessage(Message msg) { | |||
if (msg.obj.toString() == "MSG_REFRESH") { | |||
mAdapter.setData(getList()); | |||
} | |||
} | |||
}; | |||
public void NBClick() { | |||
/** | |||
* 删除菜品 | |||
*/ | |||
@@ -99,7 +118,7 @@ public class CpActivity extends BaseActivity { | |||
@Override | |||
public void onMessage(Object msg) { | |||
if (msg != null) { | |||
SectionItem item=(SectionItem)msg; | |||
SectionItem item = (SectionItem) msg; | |||
QueryDB.DeleteGoodsid(item.getAccount()); | |||
mAdapter.setData(getList()); | |||
} | |||
@@ -126,11 +145,11 @@ public class CpActivity extends BaseActivity { | |||
@Override | |||
public void onMessage(Object msg) { | |||
if (msg != null) { | |||
SectionItem item=(SectionItem)msg; | |||
String goodid=item.getAccount();//商品id | |||
SectionItem item = (SectionItem) msg; | |||
String goodid = item.getAccount();//商品id | |||
Intent intent = new Intent(getContext(), DiyUpdateActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | |||
intent.putExtra("id",goodid); | |||
intent.putExtra("id", goodid); | |||
startActivity(intent); | |||
} | |||
} | |||
@@ -161,32 +180,40 @@ public class CpActivity extends BaseActivity { | |||
/** | |||
* 获取数据 | |||
* | |||
* @return | |||
*/ | |||
private static ArrayList<QMUISection<SectionHeader, SectionItem>> getList() { | |||
ArrayList<QMUISection<SectionHeader, SectionItem>> list = new ArrayList<>(); | |||
ArrayList<BPA_GOODS> good= QueryDB.GetGoodsALL(); | |||
ArrayList<BPA_GOODS> good = QueryDB.GetGoodsALL(); | |||
List<String> Bendi_id = new ArrayList<>(); | |||
List<String> Colud_id = new ArrayList<>(); | |||
SectionHeader header_bdcp = new SectionHeader("本地菜谱","",""); | |||
SectionHeader header_bdcp = new SectionHeader("本地菜谱", "", ""); | |||
ArrayList<SectionItem> contents_bdcp = new ArrayList<>(); | |||
SectionHeader header_sccp = new SectionHeader("收藏菜谱","",""); | |||
SectionHeader header_sccp = new SectionHeader("收藏菜谱", "", ""); | |||
ArrayList<SectionItem> contents_sccp = new ArrayList<>(); | |||
SectionHeader header_ydcp = new SectionHeader("云端菜谱","",""); | |||
SectionHeader header_ydcp = new SectionHeader("云端菜谱", "", ""); | |||
ArrayList<SectionItem> contents_ydcp = new ArrayList<>(); | |||
for (BPA_GOODS item:good) | |||
{ | |||
if(item.url==null) | |||
{ | |||
item.url="未知"; | |||
for (CloudGood item : ConfigName.getInstance().cloudGoods) { | |||
Colud_id.add(item.id); | |||
} | |||
for (BPA_GOODS item : good) { | |||
if (item.url == null) { | |||
item.url = "未知"; | |||
} | |||
contents_bdcp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id,item.url,item.issc==1)); | |||
if(item.issc==1) | |||
{ | |||
contents_sccp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id,item.url,item.issc==1)); | |||
item.exp = item.exp == null ? "" : item.exp; | |||
contents_bdcp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id, item.url, item.issc == 1, false, true, item.exp)); | |||
if (item.issc == 1) { | |||
contents_sccp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id, item.url, item.issc == 1, false, true, item.exp)); | |||
} | |||
Bendi_id.add(item.id); | |||
} | |||
for (CloudGood item : ConfigName.getInstance().cloudGoods) { | |||
contents_ydcp.add(new SectionItem(item.goods_Name, "180", item.id, item.goods_ImgUrl, false, true, Bendi_id.contains(item.id) ? true : false, "云端商品")); | |||
} | |||
list.add(new QMUISection<>(header_bdcp, contents_bdcp, false)); | |||
list.add(new QMUISection<>(header_sccp, contents_sccp, true)); | |||
@@ -75,31 +75,32 @@ public class DiyActivity extends BaseActivity { | |||
EditText zzsc;//制作时长 | |||
@BindView(R.id.check) | |||
CheckBox check;//默认收藏 | |||
// @BindView(R.id.Banner_Main) | |||
// @BindView(R.id.Banner_Main) | |||
// Banner Banner_Main;//轮播图 | |||
// //用于存放获取的图片 | |||
List<Drawable> Banner_list = new ArrayList<>(); | |||
@BindView(R.id.hrgx) | |||
Spinner hrgx;//工序 | |||
Map<String,String> hrgx_map = new LinkedHashMap<>(); | |||
Map<String,Integer> hrgx_map_index = new LinkedHashMap<>(); | |||
Map<String, String> hrgx_map = new LinkedHashMap<>(); | |||
Map<String, Integer> hrgx_map_index = new LinkedHashMap<>(); | |||
@BindView(R.id.gxchid) | |||
LinearLayout gxchid;//工序子集 | |||
@BindView(R.id.datatab_gxbz) | |||
ListView datatab_gxbz;//工序步骤 | |||
public gongxubuzhou_adapter gxbz_adapter=null; | |||
public String imageUrl=""; | |||
public gongxubuzhou_adapter gxbz_adapter = null; | |||
public String imageUrl = ""; | |||
/** | |||
* 工序步骤 | |||
*/ | |||
public ArrayList<BPA_GOODSRECIPE> bpa_goodsrecipes=new ArrayList<>(); | |||
public ArrayList<BPA_GOODSRECIPE> bpa_goodsrecipes = new ArrayList<>(); | |||
/** | |||
* 是否人工单击 | |||
*/ | |||
public boolean isUserClicked =false; | |||
public boolean isUserClicked = false; | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
@@ -108,20 +109,19 @@ public class DiyActivity extends BaseActivity { | |||
initTopBar(); | |||
initData(); | |||
} | |||
private void initData() | |||
{ | |||
private void initData() { | |||
//1.初始化轮播图 | |||
//Drawable_Get(Banner_list); | |||
//2.初始化工序 | |||
ArrayList<BPA_PROCESS> data=QueryDB.GetProcessALL(); | |||
int i=0;String id=""; | |||
for (BPA_PROCESS item:data) | |||
{ | |||
hrgx_map.put(item.name,item.id); | |||
hrgx_map_index.put(item.name,i); | |||
if(i==0) | |||
{ | |||
id= item.id; | |||
ArrayList<BPA_PROCESS> data = QueryDB.GetProcessALL(); | |||
int i = 0; | |||
String id = ""; | |||
for (BPA_PROCESS item : data) { | |||
hrgx_map.put(item.name, item.id); | |||
hrgx_map_index.put(item.name, i); | |||
if (i == 0) { | |||
id = item.id; | |||
} | |||
i++; | |||
} | |||
@@ -140,20 +140,21 @@ public class DiyActivity extends BaseActivity { | |||
hrgx.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
if(isUserClicked)//不是用户点击返回 | |||
if (isUserClicked)//不是用户点击返回 | |||
{ | |||
String id= hrgx_map.get(hrgx.getSelectedItem().toString()); | |||
String id = hrgx_map.get(hrgx.getSelectedItem().toString()); | |||
SelectItemFrom(id); | |||
isUserClicked=false; | |||
isUserClicked = false; | |||
} | |||
} | |||
@Override | |||
public void onNothingSelected(AdapterView<?> adapterView) { | |||
} | |||
}); | |||
SelectItemFrom(id); | |||
//3.工序步骤 | |||
gxbz_adapter = new gongxubuzhou_adapter(getContext(), R.layout.gx_item, (List<BPA_GOODSRECIPE>) bpa_goodsrecipes,null); | |||
gxbz_adapter = new gongxubuzhou_adapter(getContext(), R.layout.gx_item, (List<BPA_GOODSRECIPE>) bpa_goodsrecipes, null); | |||
datatab_gxbz.setAdapter(gxbz_adapter); | |||
datatab_gxbz.setOnItemClickListener(new AdapterView.OnItemClickListener() { | |||
@@ -172,8 +173,8 @@ public class DiyActivity extends BaseActivity { | |||
@Override | |||
public void onMessage(Object msg) { | |||
if (msg != null) { | |||
imageUrl=(String) msg; | |||
new MyBitmapUtils().disPlay(cpfm,imageUrl); | |||
imageUrl = (String) msg; | |||
new MyBitmapUtils().disPlay(cpfm, imageUrl); | |||
} | |||
} | |||
}); | |||
@@ -181,43 +182,36 @@ public class DiyActivity extends BaseActivity { | |||
/** | |||
* 根据选中步骤显示变量 | |||
* | |||
* @param goodsrecipe | |||
*/ | |||
public void SetSelectGX(BPA_GOODSRECIPE goodsrecipe) | |||
{ | |||
try | |||
{ | |||
public void SetSelectGX(BPA_GOODSRECIPE goodsrecipe) { | |||
try { | |||
//1.根据工序名称显示工序集合 | |||
hrgx.setSelection(hrgx_map_index.get(goodsrecipe.processname)); | |||
String id= hrgx_map.get(hrgx.getSelectedItem().toString()); | |||
String id = hrgx_map.get(hrgx.getSelectedItem().toString()); | |||
SelectItemFrom(id); | |||
//2.根据工序变量集合-获取变量名称和值 | |||
final HashMap<String,String> formulation=new HashMap<>(); | |||
final HashMap<String, String> formulation = new HashMap<>(); | |||
//region 获取变量名称和值 | |||
String text=goodsrecipe.processvalue; | |||
List<String> data=new ArrayList<>(); | |||
if(text.contains("|")) | |||
{ | |||
String[] res= text.split("[|]"); | |||
for (int i=0;i<res.length;i++) | |||
{ | |||
String text = goodsrecipe.processvalue; | |||
List<String> data = new ArrayList<>(); | |||
if (text.contains("|")) { | |||
String[] res = text.split("[|]"); | |||
for (int i = 0; i < res.length; i++) { | |||
data.add(res[i]); | |||
} | |||
}else | |||
{ | |||
} else { | |||
data.add(text); | |||
} | |||
for(String item:data) | |||
{ | |||
if(!item.isEmpty() && item.contains(",")) | |||
{ | |||
String[] wl= item.split("[,]"); | |||
if (wl != null && wl.length == 2) | |||
{ | |||
String name=wl[0]; | |||
String val=wl[1]; | |||
formulation.put(name,val); | |||
for (String item : data) { | |||
if (!item.isEmpty() && item.contains(",")) { | |||
String[] wl = item.split("[,]"); | |||
if (wl != null && wl.length == 2) { | |||
String name = wl[0]; | |||
String val = wl[1]; | |||
formulation.put(name, val); | |||
} | |||
} | |||
} | |||
@@ -227,139 +221,126 @@ public class DiyActivity extends BaseActivity { | |||
for (Map.Entry<String, String> entry : formulation.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
String STR= formulation.get(key); | |||
String STR = formulation.get(key); | |||
} | |||
for (int i = 0; i < gxchid.getChildCount(); i++) { | |||
fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i); | |||
String res= formulation.get(gongxu.model.name); | |||
if(res!=null) | |||
{ | |||
String res = formulation.get(gongxu.model.name); | |||
if (res != null) { | |||
gongxu.SetValues(res); | |||
} | |||
} | |||
}catch (Exception ex) | |||
{ | |||
} catch (Exception ex) { | |||
} | |||
} | |||
/** | |||
* 根据选中工序id显示集合 | |||
* | |||
* @param id | |||
*/ | |||
public void SelectItemFrom(String id) | |||
{ | |||
try | |||
{ | |||
public void SelectItemFrom(String id) { | |||
try { | |||
gxchid.removeAllViews(); | |||
ArrayList<BPA_PROCESSModel> mode= QueryDB.GetProcessModelProcessID(id); | |||
if(mode.size()>0)//工序 | |||
ArrayList<BPA_PROCESSModel> mode = QueryDB.GetProcessModelProcessID(id); | |||
if (mode.size() > 0)//工序 | |||
{ | |||
for (BPA_PROCESSModel item : mode) | |||
{ | |||
item_gx gx=new item_gx(); | |||
gx.datatype=item.datatype; | |||
gx.name=item.name; | |||
gx.data=item.data; | |||
gx.IsWL=false; | |||
fragment_gx gongxu=new fragment_gx(this,null,gx); | |||
for (BPA_PROCESSModel item : mode) { | |||
item_gx gx = new item_gx(); | |||
gx.datatype = item.datatype; | |||
gx.name = item.name; | |||
gx.data = item.data; | |||
gx.IsWL = false; | |||
fragment_gx gongxu = new fragment_gx(this, null, gx); | |||
gxchid.addView(gongxu); | |||
} | |||
}else //物料 | |||
} else //物料 | |||
{ | |||
ArrayList<BPA_MATERIAL> materials= QueryDB.GetMaterialALL(); | |||
for (BPA_MATERIAL item2 : materials) | |||
{ | |||
item_gx gx=new item_gx(); | |||
gx.datatype=0;//液体料都是数字 | |||
gx.name=item2.name; | |||
gx.IsWL=true; | |||
fragment_gx gongxu=new fragment_gx(this,null,gx); | |||
ArrayList<BPA_MATERIAL> materials = QueryDB.GetMaterialALL(); | |||
for (BPA_MATERIAL item2 : materials) { | |||
item_gx gx = new item_gx(); | |||
gx.datatype = 0;//液体料都是数字 | |||
gx.name = item2.name; | |||
gx.IsWL = true; | |||
fragment_gx gongxu = new fragment_gx(this, null, gx); | |||
gxchid.addView(gongxu); | |||
} | |||
} | |||
}catch (Exception ex) | |||
{ | |||
} catch (Exception ex) { | |||
} | |||
} | |||
/** | |||
* 获取选中行的变量 | |||
* | |||
* @return | |||
*/ | |||
public BPA_GOODSRECIPE GetSelectItemFromValue() | |||
{ | |||
BPA_GOODSRECIPE pf=new BPA_GOODSRECIPE(); | |||
try | |||
{ | |||
String name= hrgx.getSelectedItem().toString(); | |||
boolean IsVerify=true; | |||
String description=""; | |||
public BPA_GOODSRECIPE GetSelectItemFromValue() { | |||
BPA_GOODSRECIPE pf = new BPA_GOODSRECIPE(); | |||
try { | |||
String name = hrgx.getSelectedItem().toString(); | |||
boolean IsVerify = true; | |||
String description = ""; | |||
// 延迟,100|延迟,100|延迟,100|延迟,100| | |||
String data=""; | |||
String desc=""; | |||
if(name.equals("液体料")) | |||
{ | |||
pf.materialType=0; | |||
String data = ""; | |||
String desc = ""; | |||
if (name.equals("液体料")) { | |||
pf.materialType = 0; | |||
for (int i = 0; i < gxchid.getChildCount(); i++) { | |||
fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i); | |||
String values= gongxu.GetValues(); | |||
if(!values.isEmpty()) | |||
{ | |||
data+=gongxu.model.name+","+values+"|"; | |||
desc+=values+","; | |||
String values = gongxu.GetValues(); | |||
if (!values.isEmpty()) { | |||
data += gongxu.model.name + "," + values + "|"; | |||
desc += values + ","; | |||
} | |||
} | |||
if(data.isEmpty()) | |||
{ | |||
IsVerify=false; | |||
description+="物料-不能为空,请勾选一个物料\n"; | |||
if (data.isEmpty()) { | |||
IsVerify = false; | |||
description += "物料-不能为空,请勾选一个物料\n"; | |||
} | |||
}else | |||
{ | |||
pf.materialType=1; | |||
} else { | |||
pf.materialType = 1; | |||
for (int i = 0; i < gxchid.getChildCount(); i++) { | |||
fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i); | |||
String values= gongxu.GetValues(); | |||
if(values.isEmpty()) | |||
{ | |||
IsVerify=false; | |||
description+=gongxu.model.name +"-不能为空\n"; | |||
}else | |||
{ | |||
data+=gongxu.model.name+","+values+"|"; | |||
desc+=values+","; | |||
String values = gongxu.GetValues(); | |||
if (values.isEmpty()) { | |||
IsVerify = false; | |||
description += gongxu.model.name + "-不能为空\n"; | |||
} else { | |||
data += gongxu.model.name + "," + values + "|"; | |||
desc += values + ","; | |||
} | |||
} | |||
} | |||
if(IsVerify) | |||
{ | |||
pf.processname=name; | |||
pf.processms= name+"("+desc.substring(0,desc.length()-1) +")"; | |||
pf.processvalue=data.substring(0,data.length()-1); | |||
if (IsVerify) { | |||
pf.processname = name; | |||
pf.processms = name + "(" + desc.substring(0, desc.length() - 1) + ")"; | |||
pf.processvalue = data.substring(0, data.length() - 1); | |||
return pf; | |||
}else | |||
{ | |||
ToastUtils.info("数据验证失败,原因:"+description); | |||
} else { | |||
ToastUtils.info("数据验证失败,原因:" + description); | |||
return null; | |||
} | |||
}catch (Exception ex) | |||
{ | |||
} catch (Exception ex) { | |||
return null; | |||
} | |||
} | |||
private void initTopBar() { | |||
mTopBar.setTitle("DIY模式"); | |||
mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { | |||
mTopBar.addLeftImageButton(R.mipmap.fanhui, R.id.topbar).setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
finish(); | |||
} | |||
}); | |||
} | |||
/** | |||
* 获取图片存放到list中 | |||
* | |||
* @param arrayList | |||
*/ | |||
private void Drawable_Get(List arrayList) { | |||
@@ -371,8 +352,10 @@ public class DiyActivity extends BaseActivity { | |||
//调用轮播图设置方法 | |||
Banner_Set(Banner_list); | |||
} | |||
/** | |||
* 将图片存放到轮播图中 | |||
* | |||
* @param arrayList | |||
*/ | |||
private void Banner_Set(List arrayList) { | |||
@@ -380,11 +363,13 @@ public class DiyActivity extends BaseActivity { | |||
//setImageLoader(一个实体类)用于加载图片到手机页面上显示 | |||
//Banner_Main.setImages(Banner_list).setImageLoader(new MyImage()).start(); | |||
} | |||
/** | |||
* 点击事件 | |||
* | |||
* @param view | |||
*/ | |||
@OnClick({R.id.add_hrgx,R.id.update_gx,R.id.delete_gx,R.id.shangyi,R.id.xiayi,R.id.caozuomoshi,R.id.shengchengcaipu,R.id.cpfm}) | |||
@OnClick({R.id.add_hrgx, R.id.update_gx, R.id.delete_gx, R.id.shangyi, R.id.xiayi, R.id.caozuomoshi, R.id.shengchengcaipu, R.id.cpfm}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
case R.id.cpfm://菜谱封面 | |||
@@ -394,80 +379,70 @@ public class DiyActivity extends BaseActivity { | |||
startActivity(intent); | |||
break; | |||
case R.id.add_hrgx://添加工序 | |||
BPA_GOODSRECIPE goodsrecipe= GetSelectItemFromValue(); | |||
if(goodsrecipe!=null) | |||
{ | |||
BPA_GOODSRECIPE goodsrecipe = GetSelectItemFromValue(); | |||
if (goodsrecipe != null) { | |||
bpa_goodsrecipes.add(GetSelectItemFromValue()); | |||
gxbz_adapter.notifyDataSetChanged(); | |||
} | |||
break; | |||
case R.id.update_gx://修改工序 | |||
int index_update= gxbz_adapter.getSelectedPosition(); | |||
if(index_update>=0 && index_update<bpa_goodsrecipes.size()) | |||
{ | |||
BPA_GOODSRECIPE obj_update= (BPA_GOODSRECIPE)bpa_goodsrecipes.get(index_update); | |||
String selectname= hrgx.getSelectedItem().toString(); | |||
if(!obj_update.processname.equals(selectname)) | |||
{ | |||
int index_update = gxbz_adapter.getSelectedPosition(); | |||
if (index_update >= 0 && index_update < bpa_goodsrecipes.size()) { | |||
BPA_GOODSRECIPE obj_update = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_update); | |||
String selectname = hrgx.getSelectedItem().toString(); | |||
if (!obj_update.processname.equals(selectname)) { | |||
ToastUtils.info("请先选择工序!"); | |||
return; | |||
} | |||
bpa_goodsrecipes.set(index_update,GetSelectItemFromValue()); | |||
bpa_goodsrecipes.set(index_update, GetSelectItemFromValue()); | |||
gxbz_adapter.notifyDataSetChanged(); | |||
ToastUtils.info("修改步骤"+(index_update+1)+":"+obj_update.processname+"成功!"); | |||
}else | |||
{ | |||
ToastUtils.info("修改步骤" + (index_update + 1) + ":" + obj_update.processname + "成功!"); | |||
} else { | |||
ToastUtils.info("请先选择工序!"); | |||
} | |||
break; | |||
case R.id.delete_gx://删除工序 | |||
int index_delete= gxbz_adapter.getSelectedPosition(); | |||
if(index_delete>=0 && index_delete<bpa_goodsrecipes.size()) | |||
{ | |||
BPA_GOODSRECIPE obj_delete= (BPA_GOODSRECIPE)bpa_goodsrecipes.get(index_delete); | |||
int index_delete = gxbz_adapter.getSelectedPosition(); | |||
if (index_delete >= 0 && index_delete < bpa_goodsrecipes.size()) { | |||
BPA_GOODSRECIPE obj_delete = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_delete); | |||
bpa_goodsrecipes.remove(obj_delete); | |||
gxbz_adapter.notifyDataSetChanged(); | |||
//移动光标 | |||
if(index_delete-1>=0) | |||
{ | |||
SetSelectPos(index_delete-1); | |||
if (index_delete - 1 >= 0) { | |||
SetSelectPos(index_delete - 1); | |||
} | |||
ToastUtils.info("删除工序"+obj_delete.processname+"成功!"); | |||
}else | |||
{ | |||
ToastUtils.info("删除工序" + obj_delete.processname + "成功!"); | |||
} else { | |||
ToastUtils.info("请先选择工序!"); | |||
} | |||
break; | |||
case R.id.shangyi://上移 | |||
int index_up= gxbz_adapter.getSelectedPosition();; | |||
if(index_up>0) | |||
{ | |||
BPA_GOODSRECIPE obj_up= (BPA_GOODSRECIPE)bpa_goodsrecipes.get(index_up); | |||
int index_up = gxbz_adapter.getSelectedPosition(); | |||
; | |||
if (index_up > 0) { | |||
BPA_GOODSRECIPE obj_up = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_up); | |||
bpa_goodsrecipes.remove(obj_up); | |||
bpa_goodsrecipes.add(index_up-1,obj_up); | |||
bpa_goodsrecipes.add(index_up - 1, obj_up); | |||
gxbz_adapter.notifyDataSetChanged(); | |||
//移动光标 | |||
SetSelectPos(index_up-1); | |||
}else | |||
{ | |||
SetSelectPos(index_up - 1); | |||
} else { | |||
ToastUtils.info("已经最顶部!"); | |||
} | |||
break; | |||
case R.id.xiayi://下移 | |||
int index_down= gxbz_adapter.getSelectedPosition(); | |||
if(index_down<bpa_goodsrecipes.size()-1 && index_down>=0) | |||
{ | |||
BPA_GOODSRECIPE obj_down= (BPA_GOODSRECIPE)bpa_goodsrecipes.get(index_down); | |||
int index_down = gxbz_adapter.getSelectedPosition(); | |||
if (index_down < bpa_goodsrecipes.size() - 1 && index_down >= 0) { | |||
BPA_GOODSRECIPE obj_down = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_down); | |||
bpa_goodsrecipes.remove(obj_down); | |||
bpa_goodsrecipes.add(index_down+1,obj_down); | |||
bpa_goodsrecipes.add(index_down + 1, obj_down); | |||
gxbz_adapter.notifyDataSetChanged(); | |||
//移动光标 | |||
SetSelectPos(index_down+1); | |||
}else | |||
{ | |||
SetSelectPos(index_down + 1); | |||
} else { | |||
ToastUtils.info("已经最底部!"); | |||
} | |||
break; | |||
@@ -475,47 +450,42 @@ public class DiyActivity extends BaseActivity { | |||
ToastUtils.info("操作模式"); | |||
break; | |||
case R.id.shengchengcaipu://生成菜谱 | |||
String name=edittext.getText().toString(); | |||
String name = edittext.getText().toString(); | |||
if(name.isEmpty()) | |||
{ | |||
if (name.isEmpty()) { | |||
ToastUtils.info("菜谱名称不能为空!"); | |||
return; | |||
}else | |||
{ | |||
boolean isSucess= QueryDB.GetGoodsIs(name); | |||
if(isSucess) | |||
{ | |||
} else { | |||
boolean isSucess = QueryDB.GetGoodsIs(name); | |||
if (isSucess) { | |||
ToastUtils.info("菜谱名称已存在!"); | |||
return; | |||
} | |||
//按钮点击 | |||
String title = "生成菜谱操作提示!"; | |||
String message = "请问客官确定要生成["+name+"]菜谱吗?"; | |||
String message = "请问客官确定要生成[" + name + "]菜谱吗?"; | |||
AlertDialogUtils.showDialog(view.getContext(), title, message, new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
int sc=60*3; | |||
if(!zzsc.getText().toString().isEmpty() && !zzsc.getText().toString().equals("0")) | |||
{ | |||
sc=Integer.parseInt(zzsc.getText().toString()); | |||
int sc = 60 * 3; | |||
if (!zzsc.getText().toString().isEmpty() && !zzsc.getText().toString().equals("0")) { | |||
sc = Integer.parseInt(zzsc.getText().toString()); | |||
} | |||
ArrayList<BPA_GOODS> goods=QueryDB.GetGoodsALL(); | |||
BPA_GOODS good=new BPA_GOODS(); | |||
good.name=name; | |||
good.status=1; | |||
good.sort=goods.size()+1; | |||
good.maketime=sc; | |||
good.issc=check.isChecked()?1:0; | |||
good.url=imageUrl; | |||
ArrayList<BPA_GOODS> goods = QueryDB.GetGoodsALL(); | |||
BPA_GOODS good = new BPA_GOODS(); | |||
good.name = name; | |||
good.status = 1; | |||
good.sort = goods.size() + 1; | |||
good.maketime = sc; | |||
good.issc = check.isChecked() ? 1 : 0; | |||
good.url = imageUrl; | |||
QueryDB.AddGoods(good); | |||
for (int k=0;k<bpa_goodsrecipes.size();k++) | |||
{ | |||
BPA_GOODSRECIPE item=bpa_goodsrecipes.get(k); | |||
item.goodsID=good.id; | |||
item.sort=k+1; | |||
for (int k = 0; k < bpa_goodsrecipes.size(); k++) { | |||
BPA_GOODSRECIPE item = bpa_goodsrecipes.get(k); | |||
item.goodsID = good.id; | |||
item.sort = k + 1; | |||
QueryDB.AddGoodsSrecipe(item); | |||
} | |||
ToastUtils.info("菜谱生成成功!"); | |||
@@ -527,16 +497,18 @@ public class DiyActivity extends BaseActivity { | |||
break; | |||
} | |||
} | |||
public void SetSelectPos(int index) | |||
{ | |||
public void SetSelectPos(int index) { | |||
//移动光标 | |||
gxbz_adapter.setSelectedPosition(index); | |||
gxbz_adapter.notifyDataSetInvalidated(); | |||
} | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
} | |||
@Override | |||
protected boolean canDragBack() { | |||
return false; | |||
@@ -1,11 +1,15 @@ | |||
package com.bonait.bnframework.modules.home.fragment.from.fragment; | |||
import android.annotation.SuppressLint; | |||
import android.content.Context; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import android.content.DialogInterface; | |||
import android.os.Bundle; | |||
import android.os.Handler; | |||
import android.os.Message; | |||
import android.text.InputType; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
@@ -53,21 +57,22 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
Button add_wl; | |||
@BindView(R.id.datatab_wl) | |||
ListView datatab_wl; | |||
Map<String,Integer> wllx_map = new LinkedHashMap<>(); | |||
Map<String, Integer> wllx_map = new LinkedHashMap<>(); | |||
/** | |||
* 物料数据 | |||
*/ | |||
ArrayList<BPA_MATERIAL> bpa_materials=new ArrayList<>(); | |||
ArrayList<BPA_MATERIAL> bpa_materials = new ArrayList<>(); | |||
@BindView(R.id.datatab_lc) | |||
ListView datatab_lc;//料仓 | |||
ArrayList<lcMode> lcModes=new ArrayList<>(); | |||
ArrayList<lcMode> lcModes = new ArrayList<>(); | |||
@BindView(R.id.datatab_gxmx) | |||
ListView datatab_gxmx;//工序 | |||
ArrayList<BPA_PROCESS> processes=new ArrayList<>(); | |||
ArrayList<BPA_PROCESS> processes = new ArrayList<>(); | |||
private Context context; | |||
@Override | |||
protected View onCreateView() { | |||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_system_seasoningset, null); | |||
@@ -87,8 +92,8 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
* 初始化界面 | |||
*/ | |||
public void InitView() { | |||
wllx_map.put("液料",0); | |||
wllx_map.put("酱料",1); | |||
wllx_map.put("液料", 0); | |||
wllx_map.put("酱料", 1); | |||
ArrayAdapter<String> adapter2 = new ArrayAdapter<>(context, R.layout.spinner_text_item, new ArrayList<>(wllx_map.keySet())); | |||
adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item); | |||
wllx.setAdapter(adapter2); | |||
@@ -97,38 +102,48 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
Initdata_gx(); | |||
} | |||
@OnClick({R.id.add_wl,R.id.synchronous}) | |||
@SuppressLint("HandlerLeak") | |||
private Handler mHandler = new Handler() { | |||
@Override | |||
public void handleMessage(Message msg) { | |||
if (msg.obj.toString()== "MSG_REFRESH") { | |||
Initdata_wl(); | |||
Initdata_lc(); | |||
Initdata_gx(); | |||
} | |||
} | |||
}; | |||
@OnClick({R.id.add_wl, R.id.synchronous, R.id.huifuchuchang}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
case R.id.add_wl://增加物料 | |||
String name= edittext.getText().toString(); | |||
String lx=wllx.getSelectedItem().toString(); | |||
if(name.isEmpty()){ | |||
String name = edittext.getText().toString(); | |||
String lx = wllx.getSelectedItem().toString(); | |||
if (name.isEmpty()) { | |||
ToastUtils.info("物料名称不能为空"); | |||
return; | |||
} | |||
if(lx.isEmpty()){ | |||
if (lx.isEmpty()) { | |||
ToastUtils.info("物料类型不能为空"); | |||
return; | |||
} | |||
if(QueryDB.GetMaterialIs(name)){ | |||
if (QueryDB.GetMaterialIs(name)) { | |||
ToastUtils.info("物料名称重复,请重新输入后重试!"); | |||
return; | |||
} | |||
BPA_MATERIAL bpa_material=new BPA_MATERIAL(); | |||
bpa_material.name=name; | |||
bpa_material.imgUrl=""; | |||
bpa_material.type=wllx_map.get(lx); | |||
bpa_material.deviceID= ConfigName.getInstance().DeviceId; | |||
bpa_material.userID=ConfigName.getInstance().user.userID; | |||
BPA_MATERIAL bpa_material = new BPA_MATERIAL(); | |||
bpa_material.name = name; | |||
bpa_material.imgUrl = ""; | |||
bpa_material.type = wllx_map.get(lx); | |||
bpa_material.deviceID = ConfigName.getInstance().DeviceId; | |||
bpa_material.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddMaterial(bpa_material); | |||
ToastUtils.info("新增成功"); | |||
Initdata_wl(); | |||
break; | |||
case R.id.synchronous://同步云端 | |||
if(NetworkUtils.isNetworkConnected(context)) | |||
{ | |||
if (NetworkUtils.isNetworkConnected(context)) { | |||
final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); | |||
builder.setTitle("密码确认") | |||
.setPlaceholder("在此输入权限密码") | |||
@@ -144,12 +159,10 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
public void onClick(QMUIDialog dialog, int index) { | |||
CharSequence text = builder.getEditText().getText(); | |||
if (text != null && text.length() > 0) { | |||
if(text.toString().equals(ConfigName.getInstance().user.pass)) | |||
{ | |||
ConfigData.getInstance().SyncDataInTheCloud(context); | |||
if (text.toString().equals(ConfigName.getInstance().user.pass)) { | |||
ConfigData.getInstance().SyncDataInTheCloud(context,mHandler); | |||
dialog.dismiss(); | |||
}else | |||
{ | |||
} else { | |||
ToastUtils.info("权限密码不正确!"); | |||
} | |||
} else { | |||
@@ -158,26 +171,29 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
} | |||
}) | |||
.show(); | |||
}else | |||
{ | |||
} else { | |||
ToastUtils.warning("无网络,请先连接网络!!!"); | |||
} | |||
break; | |||
case R.id.huifuchuchang://恢复出 | |||
ConfigData.getInstance().RevertProcess(); | |||
Initdata_gx(); | |||
break; | |||
} | |||
} | |||
//region 数据加载 | |||
/** | |||
* 初始化数据加载 | |||
*/ | |||
public void Initdata_wl() | |||
{ | |||
try{ | |||
bpa_materials= QueryDB.GetMaterialALL(); | |||
wl_adapter adapter = new wl_adapter(context, R.layout.wl_item, bpa_materials,this); | |||
public void Initdata_wl() { | |||
try { | |||
bpa_materials = QueryDB.GetMaterialALL(); | |||
wl_adapter adapter = new wl_adapter(context, R.layout.wl_item, bpa_materials, this); | |||
datatab_wl.setAdapter(adapter); | |||
}catch(Exception e){ | |||
} catch (Exception e) { | |||
} | |||
} | |||
@@ -185,13 +201,12 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
/** | |||
* 初始化数据加载 | |||
*/ | |||
public void Initdata_lc() | |||
{ | |||
try{ | |||
lcModes=DataBus.getInstance().ResGetLc(); | |||
lcsz_adapter adapter1 = new lcsz_adapter(context, R.layout.lcsz_item,lcModes,this); | |||
public void Initdata_lc() { | |||
try { | |||
lcModes = DataBus.getInstance().ResGetLc(); | |||
lcsz_adapter adapter1 = new lcsz_adapter(context, R.layout.lcsz_item, lcModes, this); | |||
datatab_lc.setAdapter(adapter1); | |||
}catch(Exception e){ | |||
} catch (Exception e) { | |||
} | |||
} | |||
@@ -199,13 +214,12 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
/** | |||
* 初始化数据加载 | |||
*/ | |||
public void Initdata_gx() | |||
{ | |||
try{ | |||
processes= QueryDB.GetProcessALL(); | |||
process_adapter adapter1 = new process_adapter(context, R.layout.process_item,processes,this); | |||
public void Initdata_gx() { | |||
try { | |||
processes = QueryDB.GetProcessALL(); | |||
process_adapter adapter1 = new process_adapter(context, R.layout.process_item, processes, this); | |||
datatab_gxmx.setAdapter(adapter1); | |||
}catch(Exception e){ | |||
} catch (Exception e) { | |||
} | |||
} | |||
@@ -214,9 +228,8 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
if( DataBus.getInstance().mListener!=null) | |||
{ | |||
DataBus.getInstance().mListener.clickListenerNew(this.getView(),0,""); | |||
if (DataBus.getInstance().mListener != null) { | |||
DataBus.getInstance().mListener.clickListenerNew(this.getView(), 0, ""); | |||
} | |||
Logger.d("我的fragment销毁"); | |||
} | |||
@@ -225,9 +238,9 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
* 当在activity设置viewPager + BottomNavigation + fragment时, | |||
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题, | |||
* 必须加上此方法,禁止fragment左滑返回上一界面。 | |||
* | |||
* <p> | |||
* 切记!切记!切记!否则会闪退! | |||
* | |||
* <p> | |||
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。 | |||
*/ | |||
@Override | |||
@@ -237,18 +250,18 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
/** | |||
* 点击事件 | |||
* | |||
* @param v | |||
* @param data | |||
*/ | |||
@Override | |||
public void clickListener(View v, Object data) { | |||
switch (v.getId()) | |||
{ | |||
switch (v.getId()) { | |||
case R.id.name://修改物料名称按钮 | |||
final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); | |||
builder.setTitle("物料名称") | |||
.setPlaceholder("在此输入物料名称") | |||
.setDefaultText(((BPA_MATERIAL)data).name) | |||
.setDefaultText(((BPA_MATERIAL) data).name) | |||
.setInputType(InputType.TYPE_CLASS_TEXT) | |||
.addAction("取消", new QMUIDialogAction.ActionListener() { | |||
@Override | |||
@@ -261,11 +274,11 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
public void onClick(QMUIDialog dialog, int index) { | |||
CharSequence text = builder.getEditText().getText(); | |||
if (text != null && text.length() > 0) { | |||
if(QueryDB.GetMaterialIs(text.toString())){ | |||
if (QueryDB.GetMaterialIs(text.toString())) { | |||
ToastUtils.info("物料名称重复,请重新输入后重试!"); | |||
return; | |||
} | |||
QueryDB.UpdateMaterialName(((BPA_MATERIAL)data).id,text.toString()); | |||
QueryDB.UpdateMaterialName(((BPA_MATERIAL) data).id, text.toString()); | |||
Initdata_wl(); | |||
dialog.dismiss(); | |||
} else { | |||
@@ -277,13 +290,13 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
.show(); | |||
break; | |||
case R.id.lx://选择类型 | |||
final String [] items=new String[]{"液料","酱料"}; | |||
final int checkIndex=((BPA_MATERIAL)data).type; | |||
final String[] items = new String[]{"液料", "酱料"}; | |||
final int checkIndex = ((BPA_MATERIAL) data).type; | |||
new QMUIDialog.CheckableDialogBuilder(context) | |||
.addItems(items, new DialogInterface.OnClickListener() { | |||
@Override | |||
public void onClick(DialogInterface dialog, int which) { | |||
QueryDB.UpdateMaterialType(((BPA_MATERIAL)data).id,which); | |||
QueryDB.UpdateMaterialType(((BPA_MATERIAL) data).id, which); | |||
Initdata_wl(); | |||
dialog.dismiss(); | |||
} | |||
@@ -292,7 +305,7 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
.show(); | |||
break; | |||
case R.id.button_item://删除按钮 | |||
QueryDB.DeleteMaterial((BPA_MATERIAL)data); | |||
QueryDB.DeleteMaterial((BPA_MATERIAL) data); | |||
Initdata_wl(); | |||
break; | |||
} | |||
@@ -301,33 +314,29 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
lcMode lc= (lcMode)data; | |||
switch (v.getId()) | |||
{ | |||
lcMode lc = (lcMode) data; | |||
switch (v.getId()) { | |||
case R.id.name://修改物料 | |||
List<String> names=new ArrayList<>(); | |||
int index=0; | |||
int count=0; | |||
ArrayList<BPA_MATERIAL> materials=new ArrayList<>(); | |||
for (BPA_MATERIAL item: bpa_materials) | |||
{ | |||
List<String> names = new ArrayList<>(); | |||
int index = 0; | |||
int count = 0; | |||
ArrayList<BPA_MATERIAL> materials = new ArrayList<>(); | |||
for (BPA_MATERIAL item : bpa_materials) { | |||
materials.add(item); | |||
} | |||
BPA_MATERIAL wsz = new BPA_MATERIAL(); | |||
wsz.name = "未设置"; | |||
wsz.id = ""; | |||
materials.add(wsz); | |||
for (BPA_MATERIAL item: materials) | |||
{ | |||
for (BPA_MATERIAL item : materials) { | |||
names.add(item.name); | |||
if(item.name.equals(lc.materialName)) | |||
{ | |||
index=count; | |||
if (item.name.equals(lc.materialName)) { | |||
index = count; | |||
} | |||
count++; | |||
} | |||
String[] items = names.toArray(new String[names.size()]); | |||
final int checkIndex=index; | |||
String[] items = names.toArray(new String[names.size()]); | |||
final int checkIndex = index; | |||
new QMUIDialog.CheckableDialogBuilder(context) | |||
.addItems(items, new DialogInterface.OnClickListener() { | |||
@Override | |||
@@ -349,9 +358,9 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
break; | |||
case R.id.bjz://修改料仓报警值 | |||
final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); | |||
builder.setTitle(lc.materialName+" 报警值(g)") | |||
builder.setTitle(lc.materialName + " 报警值(g)") | |||
.setPlaceholder("在此输入报警值") | |||
.setDefaultText(lc.warningValue+"") | |||
.setDefaultText(lc.warningValue + "") | |||
.setInputType(InputType.TYPE_CLASS_NUMBER) | |||
.addAction("取消", new QMUIDialogAction.ActionListener() { | |||
@Override | |||
@@ -364,7 +373,7 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
public void onClick(QMUIDialog dialog, int index) { | |||
CharSequence text = builder.getEditText().getText(); | |||
if (text != null && text.length() > 0) { | |||
QueryDB.UpdateSilosBJZ(lc.id,Integer.parseInt(text.toString())); | |||
QueryDB.UpdateSilosBJZ(lc.id, Integer.parseInt(text.toString())); | |||
Initdata_lc(); | |||
dialog.dismiss(); | |||
} else { | |||
@@ -377,9 +386,9 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
break; | |||
case R.id.zlz://修改料仓总量值 | |||
final QMUIDialog.EditTextDialogBuilder builder1 = new QMUIDialog.EditTextDialogBuilder(context); | |||
builder1.setTitle(lc.materialName+" 总量值(g)") | |||
builder1.setTitle(lc.materialName + " 总量值(g)") | |||
.setPlaceholder("在此输入总量值") | |||
.setDefaultText(lc.siloszl+"") | |||
.setDefaultText(lc.siloszl + "") | |||
.setInputType(InputType.TYPE_CLASS_NUMBER) | |||
.addAction("取消", new QMUIDialogAction.ActionListener() { | |||
@Override | |||
@@ -392,7 +401,7 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
public void onClick(QMUIDialog dialog, int index) { | |||
CharSequence text = builder1.getEditText().getText(); | |||
if (text != null && text.length() > 0) { | |||
QueryDB.UpdateSilosZL(lc.id,Integer.parseInt(text.toString())); | |||
QueryDB.UpdateSilosZL(lc.id, Integer.parseInt(text.toString())); | |||
Initdata_lc(); | |||
dialog.dismiss(); | |||
} else { | |||
@@ -11,6 +11,8 @@ import android.widget.RelativeLayout; | |||
import android.widget.TextView; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ConfigData; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
@@ -77,6 +79,24 @@ public class QDListSectionAdapter extends QMUIDefaultStickySectionAdapter { | |||
IsSC=((SectionItem)section.getItemAt(itemIndex)).getIsSC(); | |||
String id= ((SectionItem)section.getItemAt(itemIndex)).getAccount(); | |||
String url=((SectionItem)section.getItemAt(itemIndex)).getAddress(); | |||
Boolean isCloud=((SectionItem)section.getItemAt(itemIndex)).getIsCloud();//是否云端商品 | |||
if(isCloud) | |||
{ | |||
Sc_text.setText("下载"); | |||
delete_text.setVisibility(View.GONE); | |||
sc_image.setVisibility(View.GONE); | |||
if(((SectionItem)section.getItemAt(itemIndex)).getIsdownload()) | |||
{ | |||
Sc_text.setVisibility(View.GONE); | |||
} | |||
}else | |||
{ | |||
Sc_text.setText("上传"); | |||
if(((SectionItem)section.getItemAt(itemIndex)).getExp().equals("云端商品")) | |||
{ | |||
Sc_text.setVisibility(View.GONE); | |||
} | |||
} | |||
tvTag.setText(name); | |||
tvNote.setText("时间:"+ ((SectionItem)section.getItemAt(itemIndex)).getNote()+"秒"); | |||
//设置图片 | |||
@@ -89,7 +109,13 @@ public class QDListSectionAdapter extends QMUIDefaultStickySectionAdapter { | |||
Sc_text.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
ToastUtils.info("点击上传按钮,菜品:"+name); | |||
if(isCloud) | |||
{ | |||
ConfigData.getInstance().GetGoodProcess(holder.itemView.getContext(),id); | |||
}else | |||
{ | |||
ToastUtils.info("点击上传按钮,菜品:"+name); | |||
} | |||
} | |||
}); | |||
//删除按钮点击 | |||
@@ -137,7 +163,13 @@ public class QDListSectionAdapter extends QMUIDefaultStickySectionAdapter { | |||
ImageUrl.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
MessageManager.getInstance().sendMessage(MessageName.ClickGood, ((SectionItem)section.getItemAt(itemIndex))); | |||
if(isCloud) | |||
{ | |||
ToastUtils.warning("请先下载该商品!"); | |||
}else | |||
{ | |||
MessageManager.getInstance().sendMessage(MessageName.ClickGood, ((SectionItem)section.getItemAt(itemIndex))); | |||
} | |||
} | |||
}); | |||
} | |||
@@ -44,12 +44,24 @@ public class SectionItem implements QMUISection.Model<SectionItem> { | |||
*/ | |||
private String address; | |||
public SectionItem(String name1, String name2, String name3,String address,boolean isSC) { | |||
/** | |||
* 数据来源 | |||
*/ | |||
private Boolean IsCloud; | |||
private Boolean Isdownload; | |||
private String Exp; | |||
public SectionItem(String name1, String name2, String name3, String address, boolean isSC, boolean isCloud, boolean isdownload,String exp) { | |||
this.tvTag = name1; | |||
this.tvNote = name2; | |||
this.tvAccount = name3; | |||
this.IsSC=isSC; | |||
this.address=address; | |||
this.IsSC = isSC; | |||
this.address = address; | |||
this.IsCloud = isCloud; | |||
this.Isdownload=isdownload; | |||
this.Exp=exp; | |||
} | |||
public String getTag() { | |||
@@ -63,33 +75,49 @@ public class SectionItem implements QMUISection.Model<SectionItem> { | |||
public String getAccount() { | |||
return tvAccount; | |||
} | |||
public Boolean getIsSC() { | |||
return IsSC; | |||
} | |||
public String getAddress() { | |||
return address; | |||
} | |||
public void SetIsSC(boolean isSC) | |||
{ | |||
this.IsSC=isSC; | |||
public Boolean getIsCloud() { | |||
return IsCloud; | |||
} | |||
public Boolean getIsdownload() { | |||
return Isdownload; | |||
} | |||
public void SetIsSC(boolean isSC) { | |||
this.IsSC = isSC; | |||
} | |||
public String getExp() { | |||
return Exp; | |||
} | |||
@Override | |||
public SectionItem cloneForDiff() { | |||
return new SectionItem(getTag(), getNote(), getAccount(),getAddress(),getIsSC()); | |||
return new SectionItem(getTag(), getNote(), getAccount(), getAddress(), getIsSC(), getIsCloud(),getIsdownload(), getExp()); | |||
} | |||
@Override | |||
public boolean isSameItem(SectionItem other) { | |||
return tvTag == other.tvTag || (tvTag != null && tvTag.equals(other.tvTag)) | |||
&& tvNote == other.tvNote || (tvNote != null && tvNote.equals(other.tvNote)) | |||
&& IsSC == other.IsSC || (IsSC != null && IsSC.equals(other.IsSC)) | |||
&& tvNote == other.tvNote || (tvNote != null && tvNote.equals(other.tvNote)) | |||
&& IsSC == other.IsSC || (IsSC != null && IsSC.equals(other.IsSC)) | |||
&& IsCloud == other.IsCloud || (IsCloud != null && IsCloud.equals(other.IsCloud)) | |||
&& Isdownload == other.Isdownload || (Isdownload != null && Isdownload.equals(other.Isdownload)) | |||
&& Exp == other.Exp || (Exp != null && Exp.equals(other.Exp)) | |||
&& address == other.address || (address != null && address.equals(other.address)) | |||
&& tvAccount == other.tvAccount || (tvAccount != null && tvAccount.equals(other.tvAccount)); | |||
&& tvAccount == other.tvAccount || (tvAccount != null && tvAccount.equals(other.tvAccount)); | |||
} | |||
@Override | |||
@Override | |||
public boolean isSameContent(SectionItem other) { | |||
return true; | |||
} |
@@ -366,6 +366,17 @@ | |||
android:visibility="gone" | |||
android:text="增加" | |||
android:textSize="14dp" /> | |||
<Button | |||
android:id="@+id/huifuchuchang" | |||
android:layout_width="100dp" | |||
android:layout_height="26dp" | |||
android:layout_alignParentRight="true" | |||
android:layout_centerInParent="true" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:background="@drawable/button1" | |||
android:text="恢复出厂设置" | |||
android:textSize="14dp" /> | |||
</RelativeLayout> | |||
</RelativeLayout> | |||
@@ -2,7 +2,7 @@ | |||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="150dp" | |||
android:layout_height="200dp" | |||
android:layout_height="180dp" | |||
android:background="@color/white" | |||
android:layout_marginTop="5dp" | |||
android:layout_marginLeft="5dp" | |||
@@ -15,9 +15,9 @@ | |||
android:orientation="vertical"> | |||
<ImageView | |||
android:id="@+id/ImageUrl" | |||
android:layout_margin="3dp" | |||
android:layout_margin="5dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="130dp" | |||
android:layout_height="110dp" | |||
android:src="@mipmap/loading3" | |||
android:scaleType="fitXY" | |||
/> | |||