From 98e92dafdb2cb689a3bb3cbc9ab5a9525748c617 Mon Sep 17 00:00:00 2001 From: fyf Date: Thu, 20 Jul 2023 12:36:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=20=E5=95=86=E5=93=81=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonait/bnframework/MainApplication.java | 5 +- .../bnframework/business/ConfigData.java | 616 ++++++++++-------- .../common/constant/ConfigName.java | 489 +++++++------- .../common/model/mode/BomTypeInfo.java | 13 + .../common/model/mode/GoodsUintInfo.java | 2 +- .../common/model/mode/ProcessT.java | 13 + .../common/model/mode/ResALLData.java | 5 + .../model/mode/VersionSelectionEnum.java | 10 + .../{EditDialog.java => GoodEditDialog.java} | 118 +++- .../from/fragment/SystemCsPLCFragment.java | 2 +- .../fragment/SystemSeasoningsetFragment.java | 2 +- .../fragment/SystemSystemsetFragment.java | 45 +- .../fragment/mode/QDListSectionAdapter.java | 2 +- .../modules/mine/fragment/MyFragment.java | 23 + app/src/main/res/drawable-hdpi/hfccsz.png | Bin 0 -> 1530 bytes app/src/main/res/layout/fragment_my.xml | 8 + .../res/layout/fragment_system_systemset.xml | 12 + .../res/layout/item/layout/dialog_edit.xml | 125 +++- 18 files changed, 918 insertions(+), 572 deletions(-) create mode 100644 app/src/main/java/com/bonait/bnframework/common/model/mode/BomTypeInfo.java create mode 100644 app/src/main/java/com/bonait/bnframework/common/model/mode/ProcessT.java create mode 100644 app/src/main/java/com/bonait/bnframework/common/model/mode/VersionSelectionEnum.java rename app/src/main/java/com/bonait/bnframework/common/view/{EditDialog.java => GoodEditDialog.java} (54%) create mode 100644 app/src/main/res/drawable-hdpi/hfccsz.png diff --git a/app/src/main/java/com/bonait/bnframework/MainApplication.java b/app/src/main/java/com/bonait/bnframework/MainApplication.java index 1a07a508..448e9e7a 100644 --- a/app/src/main/java/com/bonait/bnframework/MainApplication.java +++ b/app/src/main/java/com/bonait/bnframework/MainApplication.java @@ -148,14 +148,11 @@ public class MainApplication extends Application { QueryDB.AddSilosAndMaterial(sm); } } - - //工序模型表 - ConfigData.getInstance().InitProcessData(); } if(QueryDB.GetPlcaddressALL().size()<=0) { - ConfigData.getInstance().RevertPLC(); + ConfigData.getInstance().RevertPLCProcess(); } } /** diff --git a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java index c09080d8..ed452532 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java +++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java @@ -19,7 +19,6 @@ 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.db.res.ResGoodsRecipe; import com.bonait.bnframework.common.helper.ConfigUtil; import com.bonait.bnframework.common.helper.Json; import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; @@ -30,6 +29,8 @@ import com.bonait.bnframework.common.modbus.ModbusTcpServer; import com.bonait.bnframework.common.model.ResAPI; import com.bonait.bnframework.common.model.mode.ActionJsonMode; import com.bonait.bnframework.common.model.mode.BomTechnologyActionInfo; +import com.bonait.bnframework.common.model.mode.BomTypeInfo; +import com.bonait.bnframework.common.model.mode.ProcessT; import com.bonait.bnframework.common.model.mode.ResGoodProcess; import com.bonait.bnframework.common.model.mode.TechnologyValueMode; import com.bonait.bnframework.common.model.mode.BatchingInfo; @@ -47,6 +48,7 @@ import com.bonait.bnframework.common.model.mode.UpdateBomInfo; import com.bonait.bnframework.common.model.mode.UpdateCloudGood; import com.bonait.bnframework.common.utils.NetworkUtils; import com.bonait.bnframework.common.utils.ToastUtils; +import com.bonait.bnframework.common.view.GoodEditDialog; import com.google.gson.Gson; import com.lzy.okgo.OkGo; import com.lzy.okgo.model.HttpHeaders; @@ -111,14 +113,11 @@ public class ConfigData { // { // QueryDB.DeleteSystemset(item.id); // } - for (int i = 0; i < 5; i++) { + for (int i = 1; i < 5; i++) { int ty = i; BPA_SYSTEMSET set = new BPA_SYSTEMSET(); set.type = ty; switch (ty) { - case 0: - set.value = ConfigName.getInstance().Environment; - break; case 1: set.value = ConfigName.getInstance().Address; break; @@ -145,10 +144,40 @@ public class ConfigData { QueryDB.AddSystemset(set); } } + + BPA_SYSTEMSET find_99 = null; + BPA_SYSTEMSET find_100 = null; + for (BPA_SYSTEMSET item : bpa_systemsets) { + if (item.type == -99) { + find_99 = item; + } else if (item.type == -100) { + find_100 = item; + } + } + if (find_99 == null) { + BPA_SYSTEMSET set = new BPA_SYSTEMSET(); + set.type = -99; + set.value = ConfigName.getInstance().Environment; + set.deviceID = ConfigName.getInstance().DeviceId; + set.userID = ConfigName.getInstance().user.userID; + QueryDB.AddSystemset(set); + } + if (find_100 == null) { + BPA_SYSTEMSET set = new BPA_SYSTEMSET(); + set.type = -100; + set.value = ConfigName.getInstance().versionSelectionEnum; + set.deviceID = ConfigName.getInstance().DeviceId; + set.userID = ConfigName.getInstance().user.userID; + QueryDB.AddSystemset(set); + } + bpa_systemsets = QueryDB.GetSystemsetALL(); for (BPA_SYSTEMSET item : bpa_systemsets) { switch (item.type) { - case 0: + case -100: + ConfigName.getInstance().versionSelectionEnum = item.value; + break; + case -99: ConfigName.getInstance().Environment = item.value; break; case 1: @@ -240,13 +269,12 @@ public class ConfigData { ConfigName.getInstance().cloudData.foodMenuInfo = new Json().jsonToListobject(FoodMenuInfo.class, item.text); } else if (item.name.equals("商品小类")) { ConfigName.getInstance().cloudData.goodsTypeInfo = new Json().jsonToListobject(GoodsTypeInfo.class, item.text); - } else if (item.name.equals("商品大类")) { ConfigName.getInstance().cloudData.goodsParentTypeInfo = new Json().jsonToListobject(GoodsParentTypeInfo.class, item.text); - } else if (item.name.equals("商品单位")) { ConfigName.getInstance().cloudData.goodsUintInfo = new Json().jsonToListobject(GoodsUintInfo.class, item.text); - + } else if (item.name.equals("配方分类")) { + ConfigName.getInstance().cloudData.bomTypeInfo = new Json().jsonToListobject(BomTypeInfo.class, item.text); } } } @@ -432,6 +460,15 @@ public class ConfigData { data.text = new Gson().toJson(allDataResAPI.data.goodsUintInfo); QueryDB.AddClouddata(data); } + + if (allDataResAPI.data.bomTypeInfo != null) { + data = new BPA_CLOUDDATA(); + data.id = java.util.UUID.randomUUID().toString(); + data.name = "配方分类"; + data.text = new Gson().toJson(allDataResAPI.data.bomTypeInfo); + QueryDB.AddClouddata(data); + } + Message msg = new Message(); msg.obj = "MSG_REFRESH"; mHandler.sendMessage(msg); @@ -573,166 +610,178 @@ public class ConfigData { public void UploadGoods(Context context, String goodid) { try { if (NetworkUtils.isNetworkConnected(context)) { - if (ConfigName.getInstance().organizeMode == null && ConfigName.getInstance().cloudData!=null) { + if (ConfigName.getInstance().organizeMode == null && ConfigName.getInstance().cloudData != null) { ToastUtils.warning("无组织信息不能上传,请设置当前店铺信息!!!"); return; } - - Boolean isSuceess = false; - BPA_GOODS good = QueryDB.GetGoodsId(goodid); - UpdateCloudGood update = new UpdateCloudGood(); - update.storeId=ConfigName.getInstance().organizeMode.id; - update.goodsInfo=new CloudGood(); - update.goodsInfo.id=good.id; - update.goodsInfo.createAt=good.createTime; - update.goodsInfo.isDeleted=0; - update.goodsInfo.status=0; - update.goodsInfo.groupId=ConfigName.getInstance().organizeMode.companyId; - update.goodsInfo.autoKey=0; - update.goodsInfo.isWeigh=false; - update.goodsInfo.vipPrice=0; - update.goodsInfo.price=0; - update.goodsInfo.code=good.id; - update.goodsInfo.goods_Sort=good.sort; - update.goodsInfo.goods_Descritption="设备上传商品"; - update.goodsInfo.goods_Name=good.name; - - //选择菜谱 大类id 小类id 单位id - update.foodMenuId=""; - update.goodsInfo.goods_ImgUrl="设备上传商品";//图片地址 - update.goodsInfo.parentTypeID="";//大类 - update.goodsInfo.goods_TypeID="";//小类 - update.goodsInfo.goodsUintId="";//单位 - - UpdateBomInfo bom=new UpdateBomInfo(); - bom.bomType=""; - bom.name=good.name; - bom.code=java.util.UUID.randomUUID().toString();; - bom.isMain=true; - bom.sort=0; - update.bomInfo=bom; - - ArrayList goodsrecipes=QueryDB.GetGoodsSrecipeID(good.id); - for (BPA_GOODSRECIPE item:goodsrecipes) - { - GoodsTechnology goodsTechnology=null; - for (GoodsTechnology _find:ConfigName.getInstance().cloudData.goodsTechnology) - { - if (_find.name.equals(item.processname)) - { - goodsTechnology=_find; - break; - } - } - - if(goodsTechnology!=null) - { - //2.根据工序变量集合-获取变量名称和值 - List names=new ArrayList<>(); - final HashMap formulation=new HashMap<>(); - //region 获取变量名称和值 - String text=item.processvalue; - List data=new ArrayList<>(); - if(text.contains("|")) - { - String[] res= text.split("[|]"); - for (int i=0;i actionJsonModes=new ArrayList<>(); - //region 获取工艺集合 - if (item.materialType==0)//物料 - { - for (String f:names) - { - BatchingInfo batchingInfo=null; - for (BatchingInfo _find:ConfigName.getInstance().cloudData.batchingInfo) - { - if (_find.batching_Name.equals(f)) - { - batchingInfo=_find; + final GoodEditDialog editDialog = new GoodEditDialog(context); + editDialog.setTitle("上传菜谱界面"); + editDialog.setYesOnclickListener("确定", new GoodEditDialog.onYesOnclickListener() { + @Override + public void onYesClick(String sp, String dl, String xl, String dw, String fl) { + + Boolean isSuceess = false; + UpdateCloudGood update = new UpdateCloudGood(); + try { + BPA_GOODS good = QueryDB.GetGoodsId(goodid); + update.storeId = ConfigName.getInstance().organizeMode.id; + update.goodsInfo = new CloudGood(); + update.bomTechnologyActionInfo = new ArrayList(); + update.goodsInfo.id = good.id; + update.goodsInfo.createAt = good.createTime; + update.goodsInfo.isDeleted = 0; + update.goodsInfo.status = 0; + update.goodsInfo.groupId = ConfigName.getInstance().organizeMode.companyId; + update.goodsInfo.autoKey = 0; + update.goodsInfo.isWeigh = false; + update.goodsInfo.vipPrice = 0; + update.goodsInfo.price = 0; + update.goodsInfo.code = good.id; + update.goodsInfo.goods_Sort = good.sort; + update.goodsInfo.goods_Descritption = "设备上传商品"; + update.goodsInfo.goods_Name = good.name; + + //选择菜谱 大类id 小类id 单位id + update.foodMenuId = sp; + update.goodsInfo.goods_ImgUrl = "设备上传商品";//图片地址 + update.goodsInfo.parentTypeID = dl;//大类 + update.goodsInfo.goods_TypeID = xl;//小类 + update.goodsInfo.goodsUintId = dw;//单位 + + UpdateBomInfo bom = new UpdateBomInfo(); + bom.bomType = fl; + bom.name = good.name; + bom.code = java.util.UUID.randomUUID().toString(); + ; + bom.isMain = true; + bom.sort = 0; + update.bomInfo = bom; + + ArrayList goodsrecipes = QueryDB.GetGoodsSrecipeID(good.id); + for (BPA_GOODSRECIPE item : goodsrecipes) { + GoodsTechnology goodsTechnology = null; + for (GoodsTechnology _find : ConfigName.getInstance().cloudData.goodsTechnology) { + if (_find.name.equals(item.processname)) { + goodsTechnology = _find; break; } } - ActionJsonMode m=new ActionJsonMode(); - m.TechnologyactionId="";//模型id - m.BatchingId=batchingInfo!=null?batchingInfo.id:"";//物料id - m.ActionName=f; - m.ActionValue=formulation.get(f); - actionJsonModes.add(m); - } - }else//模型 - { - for (String f:names) - { - TechnologyAction technologyAction=null; - for (TechnologyAction _find:ConfigName.getInstance().cloudData.technologyAction) - { - if (_find.actionName.equals(f) && _find.goodstechnologyId.equals(goodsTechnology.id)) + + if (goodsTechnology != null) { + //2.根据工序变量集合-获取变量名称和值 + List names = new ArrayList<>(); + final HashMap formulation = new HashMap<>(); + //region 获取变量名称和值 + String text = item.processvalue; + List data = new ArrayList<>(); + if (text.contains("|")) { + String[] res = text.split("[|]"); + for (int i = 0; i < res.length; i++) { + data.add(res[i]); + } + } else { + data.add(text); + } + for (String item1 : data) { + if (!item1.isEmpty() && item1.contains(",")) { + String[] wl = item1.split("[,]"); + if (wl != null && wl.length == 2) { + String name = wl[0]; + String val = wl[1]; + names.add(name); + formulation.put(name, val); + } + } + } + //endregion + + List actionJsonModes = new ArrayList<>(); + //region 获取工艺集合 + if (item.materialType == 0)//物料 { - technologyAction=_find; - break; + for (String f : names) { + BatchingInfo batchingInfo = null; + for (BatchingInfo _find : ConfigName.getInstance().cloudData.batchingInfo) { + if (_find.batching_Name.equals(f)) { + batchingInfo = _find; + break; + } + } + ActionJsonMode m = new ActionJsonMode(); + m.TechnologyactionId = "";//模型id + m.BatchingId = batchingInfo != null ? batchingInfo.id : "";//物料id + m.ActionName = f; + m.ActionValue = formulation.get(f); + actionJsonModes.add(m); + } + } else//模型 + { + for (String f : names) { + TechnologyAction technologyAction = null; + for (TechnologyAction _find : ConfigName.getInstance().cloudData.technologyAction) { + if (_find.actionName.equals(f) && _find.goodstechnologyId.equals(goodsTechnology.id)) { + technologyAction = _find; + break; + } + } + ActionJsonMode m = new ActionJsonMode(); + m.TechnologyactionId = technologyAction != null ? technologyAction.id : "";//模型id + m.BatchingId = "";//物料id + m.ActionName = f; + m.ActionValue = formulation.get(f); + actionJsonModes.add(m); + } } + //endregion + + BomTechnologyActionInfo info = new BomTechnologyActionInfo(); + info.stepName = item.processname; + info.actionJson = new Gson().toJson(actionJsonModes); + info.isBatch = (item.materialType == 0 ? true : false); + info.chnologyId = goodsTechnology.id;//工艺名称id + info.createAt = item.createTime; + info.groupId = ConfigName.getInstance().organizeMode.companyId; + info.id = item.id; + info.isDeleted = 0; + info.sort = item.sort; + update.bomTechnologyActionInfo.add(info); } - ActionJsonMode m=new ActionJsonMode(); - m.TechnologyactionId=technologyAction!=null?technologyAction.id:"";//模型id - m.BatchingId="";//物料id - m.ActionName=f; - m.ActionValue=formulation.get(f); - actionJsonModes.add(m); } + isSuceess = true; + } catch (Exception ex) { + isSuceess = true; + ToastUtils.info("上传菜品异常:" + ex.getMessage()); } - //endregion - BomTechnologyActionInfo info=new BomTechnologyActionInfo(); - info.stepName=item.processname; - info.actionJson=new Gson().toJson(actionJsonModes); - info.isBatch=(item.materialType==0?true:false); - info.chnologyId=goodsTechnology.id;//工艺名称id - info.createAt=item.createTime; - info.groupId=ConfigName.getInstance().organizeMode.companyId; - info.id=item.id; - info.isDeleted=0; - info.sort=item.sort; - update.bomTechnologyActionInfo.add(info); - } - } - if (isSuceess) { - OkGo.>post(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().UpdateGoods).tag(context).upRequestBody(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(update))).headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)).execute(new JsonDialogCallback>(context) { - @Override - public void onSuccess(Response> response) { - ResAPI allDataResAPI = response.body(); - if (allDataResAPI.data) { - ToastUtils.info("上传菜品成功!!!"); - MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good"); - } else { - ToastUtils.warning("上传菜品失败!!!"); + if (isSuceess) { + try { + OkGo.>post(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().UpdateGoods).tag(context).upRequestBody(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(update))).headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)).execute(new JsonDialogCallback>(context) { + @Override + public void onSuccess(Response> response) { + ResAPI allDataResAPI = response.body(); + if (allDataResAPI.succeeded) { + ToastUtils.info("上传菜品成功!!!"); + MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good"); + editDialog.dismiss(); + } else { + ToastUtils.warning("上传菜品失败!!!"); + } + } + }); + } catch (Exception ex) { + ToastUtils.info("上传菜品异常:" + ex.getMessage()); } } - }); - } + } + }); + editDialog.setNoOnclickListener("取消", new GoodEditDialog.onNoOnclickListener() { + @Override + public void onNoClick() { + editDialog.dismiss(); + } + }); + editDialog.show(); } else { ToastUtils.warning("无网络,请先连接网络!!!"); } @@ -758,16 +807,19 @@ public class ConfigData { } /** - * 还原PLC + * 恢复出厂设置 PLC与工序 */ - public void RevertPLC() { + public void RevertPLCProcess() { try { + List plcaddresses = ConfigName.getInstance().PlcAddress_大炒; + List processTS = ConfigName.getInstance().Process_大炒; + //region 恢复PLC ArrayList arrayList = QueryDB.GetPlcaddressALL(); for (BPA_PLCADDRESS item : arrayList) { QueryDB.DeletePlcaddress(item); } int k = 1; - for (Res_PLCADDRESS item : ConfigName.getInstance().PlcAddress_大炒) { + for (Res_PLCADDRESS item : plcaddresses) { BPA_PLCADDRESS plc = new BPA_PLCADDRESS(); plc.name = item.name; plc.address = item.address; @@ -777,137 +829,139 @@ public class ConfigData { k++; QueryDB.AddPlcaddress(plc); } - } catch (Exception ex) { - - } - } - - /** - * 还原工序模型 - */ - public void RevertProcess() { - ArrayList arrayList = QueryDB.GetProcessALL(); - for (BPA_PROCESS item : arrayList) { - ArrayList arrayList1 = QueryDB.GetProcessModelALL(); - for (BPA_PROCESSModel item1 : arrayList1) { - QueryDB.DeleteProcessModel(item1); - } - QueryDB.DeleteProcess(item); - } - InitProcessData(); - } + //endregion - /** - * 初始化工序模型表 - */ - public void InitProcessData() { - List mxname = Arrays.asList("搅拌", "位置", "加热", "主料", "液体料", "延迟", "出菜"); - Map> 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 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; + //region 恢复工序 + ArrayList a = QueryDB.GetProcessALL(); + for (BPA_PROCESS item : a) { + ArrayList arrayList1 = QueryDB.GetProcessModelALL(); + for (BPA_PROCESSModel item1 : arrayList1) { + QueryDB.DeleteProcessModel(item1); } - QueryDB.AddProcessModel(processModel); - chidindex++; + QueryDB.DeleteProcess(item); } - index++; - } - } - - /** - * 初始化工序模型表-老v版本 - */ - public void InitProcessData1() { - List mxname = Arrays.asList("搅拌", "热油", "主料", "加热", "液体料", "延迟", "勾芡", "出菜", "热锅"); - Map> 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 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; + int index = 1; + for (ProcessT key : processTS) { + List values = key.val; + BPA_PROCESS process = new BPA_PROCESS(); + process.sort = index; + process.name = key.name; + 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; + processModel.datatype = ((item.equals("主料名称") ? 1 : (item.equals("液体料") ? 0 : 2))); + processModel.data=ConfigName.getInstance().GetProcessTypeVal(item); + QueryDB.AddProcessModel(processModel); + chidindex++; } - QueryDB.AddProcessModel(processModel); - chidindex++; + index++; } - index++; + //endregion + + } catch (Exception ex) { + } } + +// /** +// * 还原PLC +// */ +// public void RevertPLC() { +// try { +// ArrayList 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; +// k++; +// QueryDB.AddPlcaddress(plc); +// } +// } catch (Exception ex) { +// +// } +// } +// +// /** +// * 还原工序模型 +// */ +// public void RevertProcess() { +// ArrayList arrayList = QueryDB.GetProcessALL(); +// for (BPA_PROCESS item : arrayList) { +// ArrayList arrayList1 = QueryDB.GetProcessModelALL(); +// for (BPA_PROCESSModel item1 : arrayList1) { +// QueryDB.DeleteProcessModel(item1); +// } +// QueryDB.DeleteProcess(item); +// } +// InitProcessData(); +// } +// +// /** +// * 初始化工序模型表 +// */ +// public void InitProcessData() { +// List mxname = Arrays.asList("搅拌", "位置", "加热", "主料", "液体料", "延迟", "出菜"); +// Map> 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 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++; +// } +// } //endregion //region PLC初始化 diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java index bd98768f..e9e3f122 100644 --- a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java +++ b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java @@ -11,9 +11,12 @@ 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.ProcessT; import com.bonait.bnframework.common.model.mode.ResALLData; +import com.bonait.bnframework.common.model.mode.VersionSelectionEnum; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; @@ -25,13 +28,13 @@ import java.util.concurrent.ConcurrentHashMap; */ public class ConfigName { //region 单例模式 - private static ConfigName mInstance; //实例变量设置私有,防止直接通过类名访问 + private static ConfigName mInstance; //实例变量设置私有,防止直接通过类名访问 private ConfigName() { //默认构造函数私有,防止类外直接new创建对象 } public static synchronized ConfigName getInstance() { //静态同步方法作为唯一的实例对象获取方式 - if (mInstance==null) { + if (mInstance == null) { mInstance = new ConfigName(); } return mInstance; @@ -62,154 +65,154 @@ public class ConfigName { /** * 店铺名称 */ - public String Shop_Name="黑菠萝奶茶机"; + public String Shop_Name = "黑菠萝奶茶机"; /** * 门店Id */ - public String ClientAutoKey="152"; + public String ClientAutoKey = "152"; /** * 店铺设备号 */ - public String DeviceAutoKey="146"; + public String DeviceAutoKey = "146"; /** * 设备id */ - public String DeviceId="未知"; + public String DeviceId = "未知"; //endregion //region MQTT配置中心 /** * 用户名 */ - public String mqtt_userName="emqx_u_block"; + public String mqtt_userName = "emqx_u_block"; /** * 密码 */ - public String mqtt_passWord="emqx_p_admin8765490789"; + public String mqtt_passWord = "emqx_p_admin8765490789"; /** * ip地址 */ - public String mqtt_ip="10.2.1.21"; + public String mqtt_ip = "10.2.1.21"; /** * post端口 */ - public int mqtt_post=1883; + public int mqtt_post = 1883; /** * 订阅主题 */ - public String mqtt_topic="DOWN/MORKT/BUSINESS/"; - public String mqtt_hearttopic="UP/MORKT/HEARTBEAT"; + public String mqtt_topic = "DOWN/MORKT/BUSINESS/"; + public String mqtt_hearttopic = "UP/MORKT/HEARTBEAT"; //endregion //region 环境配置 /** * 环境配置 */ - public String Environment="开发环境"; + public String Environment = "开发环境"; //endregion //region 登录信息 /** * 用户信息 */ - public BPA_USER user=new BPA_USER(); + public BPA_USER user = new BPA_USER(); //endregion //region 组织信息 /** * 组织信息 */ - public OrganizeMode organizeMode=null; + public OrganizeMode organizeMode = null; /** * 设备信息 */ - public DeviceInformation deviceInformation=null; + public DeviceInformation deviceInformation = null; //endregion //region 版本信息 /** * 版本更新,当前版本 */ - public String Version="1.0"; + public String Version = "1.0"; //endregion //region 是否手动下单 /** * 是否手动下单 */ - public Boolean IsUserDownOrder=false; + public Boolean IsUserDownOrder = false; //endregion //region 系统设置表 /** * 订单上报周期,默认一小时 *60 */ - public int OrderPushTime=3600; + public int OrderPushTime = 3600; /** * 料仓余量上报周期,默认10分钟 *60 */ - public int SilosValuePushTime=600; + public int SilosValuePushTime = 600; /** * 其他传感器上报周期,默认10分钟 *60 */ - public int OtherValuePushTime=600; + public int OtherValuePushTime = 600; /** * 管道排空周期,默认一小时 *60 */ - public int PipeDrainCycleTime=3600; + public int PipeDrainCycleTime = 3600; /** * 订单未制作超时规则,默认20分钟 *60 */ - public int OrderTimeout=1200; + public int OrderTimeout = 1200; /** * 料仓补料阈值,500g */ - public int SiloFeedThreshold=500; + public int SiloFeedThreshold = 500; /** * 料仓告警阈值,50g */ - public int SiloAlarmThreshold=50; + public int SiloAlarmThreshold = 50; /** * 自动清洗时间,默认一小时 *60 */ - public int AICleanTime=3600; + public int AICleanTime = 3600; //endregion //region PlC连接参数 /** * Plc是否连接 */ - public boolean PlcIsConnect=false; + public boolean PlcIsConnect = false; /** * Plc地址 */ - public String Address="192.168.1.100"; + public String Address = "192.168.1.100"; /** * Plc端口 */ - public int Post=502; + public int Post = 502; //endregion //region URL //Sass地址 - public String SaasAddress="http://order.test1.com"; + public String SaasAddress = "http://order.test1.com"; //public String SaasAddress="https://bpa.black-pa.com:21527"; //public String SaasAddress="https://witt.black-pa.com"; //获取店铺详细信息 Get - public String GetStore="kitchen/api/StoreHelper/GetStoreInfoById?storeId="; + public String GetStore = "kitchen/api/StoreHelper/GetStoreInfoById?storeId="; //获取设备信息分页 Get - public String GetDeviceInformation="kitchen/api/CommInteface/GetDeviceInfo?storeId=%s&autoKey=%s"; + public String GetDeviceInformation = "kitchen/api/CommInteface/GetDeviceInfo?storeId=%s&autoKey=%s"; //获取 获取基础信息(所有物料信息、设备工序模型、菜谱列表、商品小类、商品大类、单位数据 - public String GetBaseDataModel="kitchen/api/CommInteface/GetBaseDataModel?storeId=%s&autoKey=%s"; + public String GetBaseDataModel = "kitchen/api/CommInteface/GetBaseDataModel?storeId=%s&autoKey=%s"; //获取 商品 - public String GetGoods="kitchen/api/CommInteface/GetDeviceGood?storeId=%s&deviceId=%s"; + public String GetGoods = "kitchen/api/CommInteface/GetDeviceGood?storeId=%s&deviceId=%s"; //获取商品配方信息 - public String GetGoodsBom="kitchen/api/CommInteface/GetDeviceGoodBomTechnology?goodsId=%s"; + public String GetGoodsBom = "kitchen/api/CommInteface/GetDeviceGoodBomTechnology?goodsId=%s"; //上传商品 - public String UpdateGoods="kitchen/api/CommInteface/SendGoodsInfo"; + public String UpdateGoods = "kitchen/api/CommInteface/SendGoodsInfo"; //版本更新 - public String UpdateVersion="http://111.9.47.105:18097/api/Version/GetLatest"; + public String UpdateVersion = "http://111.9.47.105:18097/api/Version/GetLatest"; //endregion //region PLC地址配置 @@ -220,208 +223,238 @@ public class ConfigName { /** * 大炒基础PLC模型 */ - public List PlcAddress_大炒=new ArrayList(){{ + public List PlcAddress_大炒 = new ArrayList() {{ //硬件设备 初始化 - add(new Res_PLCADDRESS("硬件设备","-------------",0,0)); - add(new Res_PLCADDRESS("初始化","M10.0",1,1)); - add(new Res_PLCADDRESS("停止" ,"M10.1",1,1)); - add(new Res_PLCADDRESS("复位" ,"M10.2",0,1)); + add(new Res_PLCADDRESS("硬件设备", "-------------", 0, 0)); + add(new Res_PLCADDRESS("初始化", "M10.0", 1, 1)); + add(new Res_PLCADDRESS("停止", "M10.1", 1, 1)); + add(new Res_PLCADDRESS("复位", "M10.2", 0, 1)); //搅拌模型 - add(new Res_PLCADDRESS("模型控制","-------------",0,0)); - add(new Res_PLCADDRESS("搅拌","M10.3",0,1)); - add(new Res_PLCADDRESS("搅拌速度","VW102",1,1)); + add(new Res_PLCADDRESS("模型控制", "-------------", 0, 0)); + add(new Res_PLCADDRESS("搅拌", "M10.3", 0, 1)); + add(new Res_PLCADDRESS("搅拌速度", "VW102", 1, 1)); //翻转正转模型 - add(new Res_PLCADDRESS("翻转正转","M10.4",0,1)); - add(new Res_PLCADDRESS("转动速度","VW104",1,1)); + add(new Res_PLCADDRESS("翻转正转", "M10.4", 0, 1)); + add(new Res_PLCADDRESS("转动速度", "VW104", 1, 1)); //翻转反转模型 - add(new Res_PLCADDRESS("翻转反转","M10.5",0,1)); - add(new Res_PLCADDRESS("转动速度","VW104",1,1)); + add(new Res_PLCADDRESS("翻转反转", "M10.5", 0, 1)); + add(new Res_PLCADDRESS("转动速度", "VW104", 1, 1)); //加热模型 - add(new Res_PLCADDRESS("加热","M10.6",0,1)); - add(new Res_PLCADDRESS("加热功率","VW100",1,1)); + add(new Res_PLCADDRESS("加热", "M10.6", 0, 1)); + add(new Res_PLCADDRESS("加热功率", "VW100", 1, 1)); //抽水放水 - add(new Res_PLCADDRESS("炒锅抽水","M10.7",0,1)); - add(new Res_PLCADDRESS("炒锅放水","M11.0",0,1)); + add(new Res_PLCADDRESS("炒锅抽水", "M10.7", 0, 1)); + add(new Res_PLCADDRESS("炒锅放水", "M11.0", 0, 1)); //出菜模型 - add(new Res_PLCADDRESS("出菜","M11.5",0,1)); + add(new Res_PLCADDRESS("出菜", "M11.5", 0, 1)); //位置动作 - add(new Res_PLCADDRESS("原点位","M11.4",0,1)); - add(new Res_PLCADDRESS("投料位","M11.4",0,1)); - add(new Res_PLCADDRESS("倒菜位","M12.7",0,1)); - add(new Res_PLCADDRESS("抽料位","M11.7",0,1)); - add(new Res_PLCADDRESS("清洗位","M13.0",0,1)); - add(new Res_PLCADDRESS("炒菜位1","M12.0",0,1)); - add(new Res_PLCADDRESS("炒菜位2","M12.1",0,1)); - add(new Res_PLCADDRESS("炒菜位3","M12.2",0,1)); - - add(new Res_PLCADDRESS("出餐启动","M11.5",0,1)); - add(new Res_PLCADDRESS("炒锅清洗","M11.6",0,1)); + add(new Res_PLCADDRESS("原点位", "M11.4", 0, 1)); + add(new Res_PLCADDRESS("投料位", "M11.4", 0, 1)); + add(new Res_PLCADDRESS("倒菜位", "M12.7", 0, 1)); + add(new Res_PLCADDRESS("抽料位", "M11.7", 0, 1)); + add(new Res_PLCADDRESS("清洗位", "M13.0", 0, 1)); + add(new Res_PLCADDRESS("炒菜位1", "M12.0", 0, 1)); + add(new Res_PLCADDRESS("炒菜位2", "M12.1", 0, 1)); + add(new Res_PLCADDRESS("炒菜位3", "M12.2", 0, 1)); + + add(new Res_PLCADDRESS("出餐启动", "M11.5", 0, 1)); + add(new Res_PLCADDRESS("炒锅清洗", "M11.6", 0, 1)); //液体料模型 - add(new Res_PLCADDRESS("液体料","-------------",0,0)); - add(new Res_PLCADDRESS("料仓1下料","M11.1",0,1)); - add(new Res_PLCADDRESS("料仓2下料","M11.2",0,1)); - add(new Res_PLCADDRESS("料仓3下料","M11.3",0,1)); - add(new Res_PLCADDRESS("料仓1下料手动","M12.3",0,1)); - add(new Res_PLCADDRESS("料仓2下料手动","M12.4",0,1)); - add(new Res_PLCADDRESS("料仓3下料手动","M12.5",0,1)); - add(new Res_PLCADDRESS("开始校正","M12.6",0,1)); - add(new Res_PLCADDRESS("料仓1需求值","VW106",1,1)); - add(new Res_PLCADDRESS("料仓2需求值","VW108",1,1)); - add(new Res_PLCADDRESS("料仓3需求值","VW110",1,1)); - add(new Res_PLCADDRESS("校准时间","VW112",1,1)); - add(new Res_PLCADDRESS("料仓1校准值","VW114",1,1)); - add(new Res_PLCADDRESS("料仓2校准值","VW116",1,1)); - add(new Res_PLCADDRESS("料仓3校准值","VW118",1,1)); + add(new Res_PLCADDRESS("液体料", "-------------", 0, 0)); + add(new Res_PLCADDRESS("料仓1下料", "M11.1", 0, 1)); + add(new Res_PLCADDRESS("料仓2下料", "M11.2", 0, 1)); + add(new Res_PLCADDRESS("料仓3下料", "M11.3", 0, 1)); + add(new Res_PLCADDRESS("料仓1下料手动", "M12.3", 0, 1)); + add(new Res_PLCADDRESS("料仓2下料手动", "M12.4", 0, 1)); + add(new Res_PLCADDRESS("料仓3下料手动", "M12.5", 0, 1)); + add(new Res_PLCADDRESS("开始校正", "M12.6", 0, 1)); + add(new Res_PLCADDRESS("料仓1需求值", "VW106", 1, 1)); + add(new Res_PLCADDRESS("料仓2需求值", "VW108", 1, 1)); + add(new Res_PLCADDRESS("料仓3需求值", "VW110", 1, 1)); + add(new Res_PLCADDRESS("校准时间", "VW112", 1, 1)); + add(new Res_PLCADDRESS("料仓1校准值", "VW114", 1, 1)); + add(new Res_PLCADDRESS("料仓2校准值", "VW116", 1, 1)); + add(new Res_PLCADDRESS("料仓3校准值", "VW118", 1, 1)); //上下限 - add(new Res_PLCADDRESS("位置上下限","-------------",0,0)); - add(new Res_PLCADDRESS("原点位置下限","VD150",1,1)); - add(new Res_PLCADDRESS("原点位置上限","VD154",1,1)); - add(new Res_PLCADDRESS("洗锅位置下限","VD158",1,1)); - add(new Res_PLCADDRESS("洗锅位置上限","VD162",1,1)); - add(new Res_PLCADDRESS("倒菜位置下限","VD166",1,1)); - add(new Res_PLCADDRESS("倒菜位置上限","VD170",1,1)); - add(new Res_PLCADDRESS("抽调料位置下限","VD174",1,1)); - add(new Res_PLCADDRESS("抽调料位置上限","VD178",1,1)); - add(new Res_PLCADDRESS("1#炒制位置下限","VD182",1,1)); - add(new Res_PLCADDRESS("1#炒制位置上限","VD186",1,1)); - add(new Res_PLCADDRESS("2#炒制位置下限","VD190",1,1)); - add(new Res_PLCADDRESS("2#炒制位置上限","VD194",1,1)); - add(new Res_PLCADDRESS("3#炒制位置下限","VD198",1,1)); - add(new Res_PLCADDRESS("3#炒制位置上限","VD202",1,1)); - add(new Res_PLCADDRESS("炒锅工作范围下限","VD206",1,1)); - add(new Res_PLCADDRESS("炒锅工作范围上限","VD210",1,1)); + add(new Res_PLCADDRESS("位置上下限", "-------------", 0, 0)); + add(new Res_PLCADDRESS("原点位置下限", "VD150", 1, 1)); + add(new Res_PLCADDRESS("原点位置上限", "VD154", 1, 1)); + add(new Res_PLCADDRESS("洗锅位置下限", "VD158", 1, 1)); + add(new Res_PLCADDRESS("洗锅位置上限", "VD162", 1, 1)); + add(new Res_PLCADDRESS("倒菜位置下限", "VD166", 1, 1)); + add(new Res_PLCADDRESS("倒菜位置上限", "VD170", 1, 1)); + add(new Res_PLCADDRESS("抽调料位置下限", "VD174", 1, 1)); + add(new Res_PLCADDRESS("抽调料位置上限", "VD178", 1, 1)); + add(new Res_PLCADDRESS("1#炒制位置下限", "VD182", 1, 1)); + add(new Res_PLCADDRESS("1#炒制位置上限", "VD186", 1, 1)); + add(new Res_PLCADDRESS("2#炒制位置下限", "VD190", 1, 1)); + add(new Res_PLCADDRESS("2#炒制位置上限", "VD194", 1, 1)); + add(new Res_PLCADDRESS("3#炒制位置下限", "VD198", 1, 1)); + add(new Res_PLCADDRESS("3#炒制位置上限", "VD202", 1, 1)); + add(new Res_PLCADDRESS("炒锅工作范围下限", "VD206", 1, 1)); + add(new Res_PLCADDRESS("炒锅工作范围上限", "VD210", 1, 1)); //反馈信号 - add(new Res_PLCADDRESS("反馈信号","-------------",0,0)); - add(new Res_PLCADDRESS("初始化完成","M40.0",1,0)); - add(new Res_PLCADDRESS("设备急停","M40.1",1,0)); - add(new Res_PLCADDRESS("原点位反馈","M40.2",1,0)); - add(new Res_PLCADDRESS("抽料位反馈","M40.3",1,0)); - add(new Res_PLCADDRESS("炒菜位1反馈","M40.4",1,0)); - add(new Res_PLCADDRESS("炒菜位2反馈","M40.5",1,0)); - add(new Res_PLCADDRESS("炒菜位3反馈","M40.6",1,0)); - add(new Res_PLCADDRESS("倒菜位反馈","M40.7",1,0)); - add(new Res_PLCADDRESS("投料位反馈","M41.0",1,0)); - add(new Res_PLCADDRESS("清洗位反馈","M41.1",1,0)); - add(new Res_PLCADDRESS("料仓1下料完成","M41.2",1,0)); - add(new Res_PLCADDRESS("料仓2下料完成","M41.3",1,0)); - add(new Res_PLCADDRESS("料仓3下料完成","M41.4",1,0)); - add(new Res_PLCADDRESS("炒锅清洗反馈","M41.5",1,0)); - add(new Res_PLCADDRESS("出餐启动反馈","M41.6",1,0)); - add(new Res_PLCADDRESS("炒锅倒菜减速位","M41.7",1,0)); + add(new Res_PLCADDRESS("反馈信号", "-------------", 0, 0)); + add(new Res_PLCADDRESS("初始化完成", "M40.0", 1, 0)); + add(new Res_PLCADDRESS("设备急停", "M40.1", 1, 0)); + add(new Res_PLCADDRESS("原点位反馈", "M40.2", 1, 0)); + add(new Res_PLCADDRESS("抽料位反馈", "M40.3", 1, 0)); + add(new Res_PLCADDRESS("炒菜位1反馈", "M40.4", 1, 0)); + add(new Res_PLCADDRESS("炒菜位2反馈", "M40.5", 1, 0)); + add(new Res_PLCADDRESS("炒菜位3反馈", "M40.6", 1, 0)); + add(new Res_PLCADDRESS("倒菜位反馈", "M40.7", 1, 0)); + add(new Res_PLCADDRESS("投料位反馈", "M41.0", 1, 0)); + add(new Res_PLCADDRESS("清洗位反馈", "M41.1", 1, 0)); + add(new Res_PLCADDRESS("料仓1下料完成", "M41.2", 1, 0)); + add(new Res_PLCADDRESS("料仓2下料完成", "M41.3", 1, 0)); + add(new Res_PLCADDRESS("料仓3下料完成", "M41.4", 1, 0)); + add(new Res_PLCADDRESS("炒锅清洗反馈", "M41.5", 1, 0)); + add(new Res_PLCADDRESS("出餐启动反馈", "M41.6", 1, 0)); + add(new Res_PLCADDRESS("炒锅倒菜减速位", "M41.7", 1, 0)); //检测信号 - add(new Res_PLCADDRESS("监测信号","-------------",0,0)); - add(new Res_PLCADDRESS("当前锅底温度","VD300",1,0)); - add(new Res_PLCADDRESS("炒锅搅拌转速","VD304",1,0)); - add(new Res_PLCADDRESS("当前加热档位","VD308",1,0)); - add(new Res_PLCADDRESS("炒锅当前电压","VD312",1,0)); - add(new Res_PLCADDRESS("炒锅当前电流","VD316",1,0)); - add(new Res_PLCADDRESS("炒锅当前功率","VD320",1,0)); - add(new Res_PLCADDRESS("搅拌频率","VW324",1,0)); - add(new Res_PLCADDRESS("搅拌电机电流","VW326",1,0)); - add(new Res_PLCADDRESS("搅拌电机电压","VW328",1,0)); - add(new Res_PLCADDRESS("搅拌变频器温度","VW330",1,0)); - add(new Res_PLCADDRESS("翻转频率","VW332",1,0)); - add(new Res_PLCADDRESS("翻转电机电流","VW334",1,0)); - add(new Res_PLCADDRESS("翻转电机电压","VW336",1,0)); - add(new Res_PLCADDRESS("翻转变频器温度","VW338",1,0)); - add(new Res_PLCADDRESS("编码器当前位值","VD340",1,0)); + add(new Res_PLCADDRESS("监测信号", "-------------", 0, 0)); + add(new Res_PLCADDRESS("当前锅底温度", "VD300", 1, 0)); + add(new Res_PLCADDRESS("炒锅搅拌转速", "VD304", 1, 0)); + add(new Res_PLCADDRESS("当前加热档位", "VD308", 1, 0)); + add(new Res_PLCADDRESS("炒锅当前电压", "VD312", 1, 0)); + add(new Res_PLCADDRESS("炒锅当前电流", "VD316", 1, 0)); + add(new Res_PLCADDRESS("炒锅当前功率", "VD320", 1, 0)); + add(new Res_PLCADDRESS("搅拌频率", "VW324", 1, 0)); + add(new Res_PLCADDRESS("搅拌电机电流", "VW326", 1, 0)); + add(new Res_PLCADDRESS("搅拌电机电压", "VW328", 1, 0)); + add(new Res_PLCADDRESS("搅拌变频器温度", "VW330", 1, 0)); + add(new Res_PLCADDRESS("翻转频率", "VW332", 1, 0)); + add(new Res_PLCADDRESS("翻转电机电流", "VW334", 1, 0)); + add(new Res_PLCADDRESS("翻转电机电压", "VW336", 1, 0)); + add(new Res_PLCADDRESS("翻转变频器温度", "VW338", 1, 0)); + add(new Res_PLCADDRESS("编码器当前位值", "VD340", 1, 0)); //状态上报 - add(new Res_PLCADDRESS("状态上报","-------------",0,0)); - add(new Res_PLCADDRESS("搅拌电机","VW350",1,0)); - add(new Res_PLCADDRESS("翻转电机","VW352",1,0)); - add(new Res_PLCADDRESS("炒锅","VW354",1,0)); + add(new Res_PLCADDRESS("状态上报", "-------------", 0, 0)); + add(new Res_PLCADDRESS("搅拌电机", "VW350", 1, 0)); + add(new Res_PLCADDRESS("翻转电机", "VW352", 1, 0)); + add(new Res_PLCADDRESS("炒锅", "VW354", 1, 0)); }}; + /** + * 大炒工序模型 + */ + public List Process_大炒 = new ArrayList() {{ + add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)"))); + add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)"))); + add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)"))); + add(new ProcessT("主料", Arrays.asList("主料名称", "主料重量", "延迟(秒)", "投料动作"))); + add(new ProcessT("液体料", new ArrayList<>())); + add(new ProcessT("延迟", Arrays.asList("延迟(秒)"))); + add(new ProcessT("出菜", Arrays.asList("延迟(秒)"))); + }}; + /** + * 根据名称获取变量 + * @param item + * @return + */ + public String GetProcessTypeVal(String item) { + String data = ""; + if (item.equals("搅拌动作")) { + data = "正转反转、一直正转、一直反转"; + } else if (item.equals("位置动作")) { + data = "原点位、投料位、出餐启动、倒菜位、抽料位、清洗位、炒菜位1、炒菜位2、炒菜位3"; + } else if (item.equals("投料动作")) { + data = "投出抖动三次、投出等待三秒、直接投出、手动投料"; + } else if (item.equals("正转速度") || item.equals("反转速度") || item.equals("转动速度") || item.equals("搅拌速度")) { + data = "停止、最低、低速、中速、高速、最高、极高"; + } else if (item.equals("加热功率") || item.equals("热锅功率")) { + data = "停止、一档、二档、三档、四档、五档"; + } + return data; + } + /** * 速度 */ - public ConcurrentHashMap StirringSpeed=new ConcurrentHashMap() - {{ - put("停止",0); - put("最低",10); - put("低速",20); - put("中速",30); - put("高速",40); - put("最高",50); - put("极高",60); + public ConcurrentHashMap StirringSpeed = new ConcurrentHashMap() {{ + put("停止", 0); + put("最低", 10); + put("低速", 20); + put("中速", 30); + put("高速", 40); + put("最高", 50); + put("极高", 60); }}; /** * 挡位 功率 */ - public ConcurrentHashMap HeatingGear=new ConcurrentHashMap() - {{ - put("停止",0); - put("一档",2); - put("二档",4); - put("三档",6); - put("四档",8); - put("五档",10); + public ConcurrentHashMap HeatingGear = new ConcurrentHashMap() {{ + put("停止", 0); + put("一档", 2); + put("二档", 4); + put("三档", 6); + put("四档", 8); + put("五档", 10); }}; /** - * 状态上报信息 + * 炒锅状态上报信息 */ - public List statusModes=new ArrayList(){{ + public List statusModes = new ArrayList() {{ //硬件设备 初始化 - add(new StatusMode("急停",false,R.mipmap.jiting,R.mipmap.jiting,0)); - add(new StatusMode("炒锅正限位报警",false,R.mipmap.cg_sxw,R.mipmap.cg_sxw,2)); - add(new StatusMode("炒锅负限位报警",false,R.mipmap.cgxxw,R.mipmap.cgxxw,3)); - add(new StatusMode("编码器通讯异常",false,R.mipmap.bmq,R.mipmap.bmq,4)); - add(new StatusMode("搅拌电机变频器通讯异常",false,R.mipmap.bpq,R.mipmap.bpq,6)); - add(new StatusMode("翻转电机变频器通讯异常",false,R.mipmap.bpq,R.mipmap.bpq,7)); + add(new StatusMode("急停", false, R.mipmap.jiting, R.mipmap.jiting, 0)); + add(new StatusMode("炒锅正限位报警", false, R.mipmap.cg_sxw, R.mipmap.cg_sxw, 2)); + add(new StatusMode("炒锅负限位报警", false, R.mipmap.cgxxw, R.mipmap.cgxxw, 3)); + add(new StatusMode("编码器通讯异常", false, R.mipmap.bmq, R.mipmap.bmq, 4)); + add(new StatusMode("搅拌电机变频器通讯异常", false, R.mipmap.bpq, R.mipmap.bpq, 6)); + add(new StatusMode("翻转电机变频器通讯异常", false, R.mipmap.bpq, R.mipmap.bpq, 7)); }}; /** - * 状态上报信息 - */ - public ConcurrentHashMap statusModes_电机=new ConcurrentHashMap() - {{ - put(0 ,"无故障"); - put(1 ,"过电流"); - put(2 ,"过电压"); - put(3 ,"IGBT过热"); - put(4 ,""); - put(5 ,"变频器过负载"); - put(6 ,"电机过负载"); - put(7 ,"过转矩"); - put(8 ,"外部异常"); - put(9 ,"加速中过电流"); - put(10,"减速中过电流"); - put(11,"恒速中过电流"); - put(12,""); - put(13,"电压不足"); - put(14,"输入电压缺相"); - put(15,""); - put(16,"不适用自动加减速设定"); - put(17,"软件参数密码保护"); - put(18,"CPU写入异常"); - put(19,"CPU读取异常"); - put(20,"端子保护线路异常"); - put(21,"0V保护线路异常"); - put(22,""); - put(23,""); - put(24,"U相硬件异常"); - put(25,"V相硬件异常"); - put(26,"W相硬件异常"); - put(27,"DC,bus 硬件异常"); + * 电机状态上报信息 + */ + public ConcurrentHashMap statusModes_电机 = new ConcurrentHashMap() {{ + put(0, "无故障"); + put(1, "过电流"); + put(2, "过电压"); + put(3, "IGBT过热"); + put(4, ""); + put(5, "变频器过负载"); + put(6, "电机过负载"); + put(7, "过转矩"); + put(8, "外部异常"); + put(9, "加速中过电流"); + put(10, "减速中过电流"); + put(11, "恒速中过电流"); + put(12, ""); + put(13, "电压不足"); + put(14, "输入电压缺相"); + put(15, ""); + put(16, "不适用自动加减速设定"); + put(17, "软件参数密码保护"); + put(18, "CPU写入异常"); + put(19, "CPU读取异常"); + put(20, "端子保护线路异常"); + put(21, "0V保护线路异常"); + put(22, ""); + put(23, ""); + put(24, "U相硬件异常"); + put(25, "V相硬件异常"); + put(26, "W相硬件异常"); + put(27, "DC,bus 硬件异常"); }}; //endregion @@ -430,69 +463,21 @@ public class ConfigName { /** * 云端数据 */ - public ResALLData cloudData=null; + public ResALLData cloudData = null; /** * 云端商品 */ - public List cloudGoods=new ArrayList<>(); + public List cloudGoods = new ArrayList<>(); //endregion -} -// -//{ -// "goodsInfo": { -// "id": "string", -// "isDeleted": 0, -// "deleteAt": "2023-07-11T10:17:20.548Z", -// "deleteBy": "string", -// "updateAt": "2023-07-11T10:17:20.548Z", -// "updateBy": "string", -// "createAt": "2023-07-11T10:17:20.548Z", -// "createBy": "string", -// "status": 0, -// "groupId": "string", -// "goods_Name": "string", -// "goods_TypeID": "string", -// "goods_Descritption": "string", -// "goods_ImgUrl": "string", -// "goods_ImgMode": 0, -// "goods_Sort": 0, -// "goods_Enable": 0, -// "deleteUpdateTime": "2023-07-11T10:17:20.548Z", -// "key": "string", -// "code": "string", -// "price": 0, -// "tasteID": "string", -// "parentTypeID": "string", -// "vipPrice": 0, -// "goodsAttribute": 0, -// "goodsUintId": "string", -// "isWeigh": true, -// "autoKey": 0 -// }, -// "bomInfo": { -// "bomType": "string", -// "name": "string", -// "code": "string", -// "isMain": true, -// "autoKey": 0, -// "bomInfo": "string", -// "sort": 0 -// }, -// "bomTechnologyActionInfo": [ -// { -// "id": "string", -// "stepName": "string", -// "actionJson": "string", -// "bomId": "string", -// "isBatch": true, -// "chnologyId": "string", -// "createAt": "2023-07-11T10:17:20.548Z", -// "groupId": "string", -// "isDeleted": 0, -// "sort": 0 -// } -// ], -// "foodMenuId": "string", -// "storeId": "string" -// } \ No newline at end of file + //region 选配版本信息 + /** + * 版本信息 + */ + public String[] versionSelectionValues = new String[]{"大炒版本", "大炒自动投料版本", "小炒版本"}; + /** + * 选配版本信息 + */ + public String versionSelectionEnum = "大炒版本"; + //endregion +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/BomTypeInfo.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/BomTypeInfo.java new file mode 100644 index 00000000..3ba112f0 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/BomTypeInfo.java @@ -0,0 +1,13 @@ +package com.bonait.bnframework.common.model.mode; + +public class BomTypeInfo { + 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 int pertain ;//1.无 2.TMC +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsUintInfo.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsUintInfo.java index 51ef9fb3..9e294b3a 100644 --- a/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsUintInfo.java +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsUintInfo.java @@ -1,7 +1,7 @@ package com.bonait.bnframework.common.model.mode; public class GoodsUintInfo { - public String goodsType_Name; + public String name; public String remark; public String groupId; public int status; diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/ProcessT.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/ProcessT.java new file mode 100644 index 00000000..43ad8b8f --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/ProcessT.java @@ -0,0 +1,13 @@ +package com.bonait.bnframework.common.model.mode; + +import java.util.List; + +public class ProcessT { + public String name; + public List val; + public ProcessT(String _name,List _val) + { + this.name=_name; + this.val=_val; + } +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/ResALLData.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/ResALLData.java index 67043c91..011e0a64 100644 --- a/app/src/main/java/com/bonait/bnframework/common/model/mode/ResALLData.java +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/ResALLData.java @@ -34,4 +34,9 @@ public class ResALLData { * 商品单位 */ public List goodsUintInfo; + + /** + * 配方分类 + */ + public List bomTypeInfo; } diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/VersionSelectionEnum.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/VersionSelectionEnum.java new file mode 100644 index 00000000..06689cdf --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/VersionSelectionEnum.java @@ -0,0 +1,10 @@ +package com.bonait.bnframework.common.model.mode; + +/** + * 版本信息 + */ +public enum VersionSelectionEnum { + 大炒版本, + 大炒自动投料版本, + 小炒版本, +} diff --git a/app/src/main/java/com/bonait/bnframework/common/view/EditDialog.java b/app/src/main/java/com/bonait/bnframework/common/view/GoodEditDialog.java similarity index 54% rename from app/src/main/java/com/bonait/bnframework/common/view/EditDialog.java rename to app/src/main/java/com/bonait/bnframework/common/view/GoodEditDialog.java index 94e64f06..cc5896c4 100644 --- a/app/src/main/java/com/bonait/bnframework/common/view/EditDialog.java +++ b/app/src/main/java/com/bonait/bnframework/common/view/GoodEditDialog.java @@ -6,16 +6,33 @@ import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; +import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; +import android.widget.Spinner; import android.widget.TextView; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.constant.ConfigName; +import com.bonait.bnframework.common.model.mode.BomTypeInfo; +import com.bonait.bnframework.common.model.mode.FoodMenuInfo; +import com.bonait.bnframework.common.model.mode.GoodsParentTypeInfo; +import com.bonait.bnframework.common.model.mode.GoodsTypeInfo; +import com.bonait.bnframework.common.model.mode.GoodsUintInfo; +import com.bonait.bnframework.common.utils.ToastUtils; -public class EditDialog extends Dialog { +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.Map; + +public class GoodEditDialog extends Dialog { private Button yes, no;//确定按钮 private TextView titleTv;//消息标题文本 - private EditText et_phone;//输入电话 + private Spinner editsp_cp;//菜谱 + private Spinner editsp_dl;//大类 + private Spinner editsp_xl;//小类 + private Spinner editsp_dw;//单位 + private Spinner editsp_fl;//分类 private String titleStr;//从外界设置的title文本 private String messageStr;//从外界设置的消息文本 //确定文本和取消文本的显示内容 @@ -50,7 +67,7 @@ public class EditDialog extends Dialog { this.yesOnclickListener = onYesOnclickListener; } - public EditDialog(Context context) { + public GoodEditDialog(Context context) { super(context, R.style.Dialog_Msg); } @@ -78,8 +95,17 @@ public class EditDialog extends Dialog { yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (yesOnclickListener != null) { - yesOnclickListener.onYesClick(et_phone.getText().toString()); + if(DataVerification()) + { + if (yesOnclickListener != null) { + yesOnclickListener.onYesClick( + map_cp.get(editsp_cp.getSelectedItem().toString()) + ,map_dl.get(editsp_dl.getSelectedItem().toString()) + ,map_xl.get(editsp_xl.getSelectedItem().toString()) + ,map_dw.get(editsp_dw.getSelectedItem().toString()) + ,map_fl.get(editsp_fl.getSelectedItem().toString()) + ); + } } } }); @@ -110,6 +136,11 @@ public class EditDialog extends Dialog { yes.setText(yesStr); } } + Map map_cp = new LinkedHashMap<>(); + Map map_dl = new LinkedHashMap<>(); + Map map_xl = new LinkedHashMap<>(); + Map map_dw = new LinkedHashMap<>(); + Map map_fl = new LinkedHashMap<>(); /** * 初始化界面控件 @@ -118,7 +149,80 @@ public class EditDialog extends Dialog { yes = (Button) findViewById(R.id.yes); no = (Button) findViewById(R.id.no); titleTv = (TextView) findViewById(R.id.title); - et_phone = (EditText) findViewById(R.id.et_phone); + editsp_cp = (Spinner) findViewById(R.id.editsp_cp); + editsp_dl = (Spinner) findViewById(R.id.editsp_dl); + editsp_xl = (Spinner) findViewById(R.id.editsp_xl); + editsp_dw = (Spinner) findViewById(R.id.editsp_dw); + editsp_fl = (Spinner) findViewById(R.id.editsp_fl); + for (FoodMenuInfo item:ConfigName.getInstance().cloudData.foodMenuInfo) + { + map_cp.put(item.name,item.id); + } + for (GoodsParentTypeInfo item:ConfigName.getInstance().cloudData.goodsParentTypeInfo) + { + map_dl.put(item.name,item.id); + } + for (GoodsTypeInfo item:ConfigName.getInstance().cloudData.goodsTypeInfo) + { + map_xl.put(item.goodsType_Name,item.id); + } + for (GoodsUintInfo item:ConfigName.getInstance().cloudData.goodsUintInfo) + { + map_dw.put(item.name,item.id); + } + for (BomTypeInfo item:ConfigName.getInstance().cloudData.bomTypeInfo) + { + map_fl.put(item.name,item.id); + } + SetAdapter(editsp_cp,map_cp); + SetAdapter(editsp_dl,map_dl); + SetAdapter(editsp_xl,map_xl); + SetAdapter(editsp_dw,map_dw); + SetAdapter(editsp_fl,map_fl); + } + + /** + * 数据验证 + * @return + */ + public boolean DataVerification() + { + boolean IsSucees=false; + try + { + if(editsp_cp.getSelectedItem().toString().isEmpty()) + { + ToastUtils.info("菜谱必须选择!"); + return false; + } + if(editsp_dl.getSelectedItem().toString().isEmpty()) + { + ToastUtils.info("大类必须选择!"); + return false; + } + if(editsp_xl.getSelectedItem().toString().isEmpty()) + { + ToastUtils.info("小类必须选择!"); + return false; + } + if(editsp_dw.getSelectedItem().toString().isEmpty()) + { + ToastUtils.info("单位必须选择!"); + return false; + } + return true; + }catch (Exception ex) + { + ToastUtils.error("数据验证异常!"+ex.getMessage()); + return IsSucees; + } + } + + public void SetAdapter(Spinner spinner,Map map) + { + ArrayAdapter adapter = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, new ArrayList<>(map.keySet())); + adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); + spinner.setAdapter(adapter); } /** @@ -143,7 +247,7 @@ public class EditDialog extends Dialog { * 设置确定按钮和取消被点击的接口 */ public interface onYesOnclickListener { - public void onYesClick(String phone); + public void onYesClick(String sp,String dl,String xl,String dw,String fl); } public interface onNoOnclickListener { diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemCsPLCFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemCsPLCFragment.java index b7785c2b..955190f6 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemCsPLCFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemCsPLCFragment.java @@ -112,7 +112,7 @@ public class SystemCsPLCFragment extends BaseFragment { AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { @Override public void onClick(QMUIDialog dialog, int index) { - ConfigData.getInstance().RevertPLC(); + ConfigData.getInstance().RevertPLCProcess(); Init(); ToastUtils.info("初始化成功!"); dialog.dismiss(); diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSeasoningsetFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSeasoningsetFragment.java index 5b508f30..5ee5bc95 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSeasoningsetFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSeasoningsetFragment.java @@ -176,7 +176,7 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL } break; case R.id.huifuchuchang://恢复出 - ConfigData.getInstance().RevertProcess(); + ConfigData.getInstance().RevertPLCProcess(); Initdata_gx(); break; diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java index 09f101f6..1cdbcfba 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java @@ -12,11 +12,13 @@ import android.widget.EditText; import android.widget.Spinner; import com.bonait.bnframework.R; +import com.bonait.bnframework.business.ConfigData; import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.QueryDB; import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET; +import com.bonait.bnframework.common.model.mode.VersionSelectionEnum; import com.bonait.bnframework.common.utils.ToastUtils; import com.orhanobut.logger.Logger; @@ -41,8 +43,13 @@ public class SystemSystemsetFragment extends BaseFragment { @BindView(R.id.environment) Spinner environment; + @BindView(R.id.versionselection) + Spinner versionselection; + ArrayList editTextLists=new ArrayList<>(); Map material_map = new LinkedHashMap<>(); + Map material_map_vis = new LinkedHashMap<>(); + /** * 系统设置参数 */ @@ -93,14 +100,29 @@ public class SystemSystemsetFragment extends BaseFragment { material_map.put("开发环境",0); material_map.put("测试环境",1); material_map.put("正式环境",2); + + for (int i=0;i adapter = new ArrayAdapter<>(context, R.layout.spinner_text_item, new ArrayList<>(material_map.keySet())); adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); environment.setAdapter(adapter); + ArrayAdapter adapter1 = new ArrayAdapter<>(context, R.layout.spinner_text_item, new ArrayList<>(material_map_vis.keySet())); + adapter1.setDropDownViewResource(R.layout.spinner_dropdown_item); + versionselection.setAdapter(adapter1); + bpa_systemsets= QueryDB.GetSystemsetALL(); for (BPA_SYSTEMSET item:bpa_systemsets) { switch (item.type) { - case 0: + case -100: + ConfigName.getInstance().versionSelectionEnum=item.value; + versionselection.setSelection(material_map_vis.get(item.value)); + break; + case -99: ConfigName.getInstance().Environment=item.value; environment.setSelection(material_map.get(item.value)); break; @@ -120,6 +142,7 @@ public class SystemSystemsetFragment extends BaseFragment { ConfigName.getInstance().DeviceAutoKey=item.value; edittext4.setText(item.value); break; + } } } @@ -134,6 +157,14 @@ public class SystemSystemsetFragment extends BaseFragment { ConfigName.getInstance().DeviceAutoKey=edittext4.getText().toString(); ConfigName.getInstance().Environment=environment.getSelectedItem().toString(); + + boolean isgb=false; + if(!ConfigName.getInstance().versionSelectionEnum.equals(versionselection.getSelectedItem().toString())) + { + ConfigName.getInstance().versionSelectionEnum=versionselection.getSelectedItem().toString(); + isgb=true; + } + for (BPA_SYSTEMSET item:bpa_systemsets) { QueryDB.DeleteSystemset(item.id); @@ -148,12 +179,22 @@ public class SystemSystemsetFragment extends BaseFragment { QueryDB.AddSystemset(set); } BPA_SYSTEMSET set=new BPA_SYSTEMSET(); - set.type=0; + set.type=-99; set.value=environment.getSelectedItem().toString(); set.deviceID = ConfigName.getInstance().DeviceId; set.userID = ConfigName.getInstance().user.userID; QueryDB.AddSystemset(set); + BPA_SYSTEMSET set_vis=new BPA_SYSTEMSET(); + set_vis.type=-100; + set_vis.value=versionselection.getSelectedItem().toString(); + set_vis.deviceID = ConfigName.getInstance().DeviceId; + set_vis.userID = ConfigName.getInstance().user.userID; + QueryDB.AddSystemset(set_vis); + if(isgb) + { + ConfigData.getInstance().RevertPLCProcess(); + } ToastUtils.info("保存成功"); break; diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java index f15b2aa2..1e19e7d7 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java @@ -114,7 +114,7 @@ public class QDListSectionAdapter extends QMUIDefaultStickySectionAdapter { ConfigData.getInstance().GetGoodProcess(holder.itemView.getContext(),id); }else { - ToastUtils.info("点击上传按钮,菜品:"+name); + ConfigData.getInstance().UploadGoods(holder.itemView.getContext(),id); } } }); diff --git a/app/src/main/java/com/bonait/bnframework/modules/mine/fragment/MyFragment.java b/app/src/main/java/com/bonait/bnframework/modules/mine/fragment/MyFragment.java index 695a2dc5..c04dd214 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/mine/fragment/MyFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/mine/fragment/MyFragment.java @@ -19,6 +19,7 @@ import android.widget.TextView; import com.allen.library.SuperTextView; import com.bonait.bnframework.R; +import com.bonait.bnframework.business.ConfigData; import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.constant.Constants; @@ -60,6 +61,9 @@ public class MyFragment extends BaseFragment { SuperTextView stvUpdate; @BindView(R.id.stv_logout) SuperTextView stvLogout; + @BindView(R.id.stv_huifu) + SuperTextView stv_huifu; + @BindView(R.id.stv_announcement) SuperTextView stvAnnouncement; @@ -250,6 +254,25 @@ public class MyFragment extends BaseFragment { .show(); } }); + + /** + * 恢复出厂设置 + */ + stv_huifu.setOnSuperTextViewClickListener(new SuperTextView.OnSuperTextViewClickListener() { + @Override + public void onClickListener(SuperTextView superTextView) { + String title = "温馨提示!"; + String message = "客官确定要恢复出厂设置吗,小菠萝温馨提示你,此操作将会影响到实际运行哦?"; + AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + ConfigData.getInstance().RevertPLCProcess(); + ToastUtils.info("恢复出厂设置成功!"); + dialog.dismiss(); + } + }); + } + }); } /** * 跳转登录界面 diff --git a/app/src/main/res/drawable-hdpi/hfccsz.png b/app/src/main/res/drawable-hdpi/hfccsz.png new file mode 100644 index 0000000000000000000000000000000000000000..54ac670363f1248a08ea63e7c2cdcc1f2c36a906 GIT binary patch literal 1530 zcmVPx)v`IukR9Hv7SZhoaR~S9tu!=wtMXU;uT|_CBBHF?hTVLrbw%C_ii?+JNgf^|F z!PY)fW2&^a{;2b4j%_rsULj90o~05H529#6hKRK=;3626GsYix8gtIx ztvqQZ3_4|r23NH4?}phHSghv{gw@(NMhAl1s#X>?tGuIz*IjPoMLJ zY$oL{8f=z42Da*cnDJ^du+`3toCSAeFz|xmgxSP66y8rWUTp%F+A~Z`B-!&H=xydP z0LmVOneI&C4QGaFo1e+<+v{!SzW_{BGc+PB3R(RPnmli9JdgU$_Mq7I@UX~+lo@T} zTINM-Y2r{W1Ur&nL`t~04r+>#Wn0kBcd26uD;(*jk0plmHuD7liE7OGLsGFYPN=H( zINEvzv(6OM_qbiRW z``m8K`R2AEn|TX>nQDyXhOx+w86kn3ay8;ido%uVHK3)d6S2J`kQCMrvj!$faE_a; znE3C`U_YeVkzpF{HN@1=6Qkl_9`URMve5oFwl!AE(o(|*VAsej$=s**quAOgbcIUr zG>nFoY)rljXFzV8qpWJgmCKCC_B8^?!6q8D+f?)cAlEvvsC>k_*kSPx^! zJiQGKx7>=iBG62Vw-(MIBE`Mst$|5crqA?=RJyNY^4VSDcv4gxK8hO+AtOQvrTfHw z6zAQyjjc==hp7XG`M4XdRv^F5rfi5PpA4mzJjTm!6VbXpVk0N?>FX0IxLS@c>q^A& zFOR%{%*esMxt|)Uu&ddQrY^T=Dlkg|@a?MoIMPzDV2TPzZ#6FlAzuz5H0RfT*%2@w z)Evfd&9w;UbSQs(mV}mlt{BH#ulTMF=^c(^qozwRt1q8|@Fy2UC?dVBa1lUX$pNOv zBw~f(X~~q=P+CL`etq;M$(&$jds7V#+_;G5t`0GKLKgi)i=lY{eXmqlOVV?g&^K1L zWW_13h>y8k2(#!dRoO^ zxcDvz``Z4LR~4HyaN^rbC-Ggq@&iqT&qzG5>$qAq)kQ8R@#G(4AUghkm1;dCz&qfcreDk%e2{<%YAoYJ52Gk~axmYL`CzNF2xhqEFq#Gl|N0E+OD)fUX9t4a zEpQo7!&kX)z;ylq>N{PkvPATrJ$=r4i6OCcHuHK0yc^6^;QFG3KhxeMK6OEA^@qb~ z@*O24?`6aHtPQ;t6V(7hWH3`bHP1Yr6ldn#a8A0Vhu?iaO)-YqPNQjaV5Svcr4vpRr16~Y5P*c3;4&Tct5^{*eS zC`4b49O|QmTZaX%{-6s@CcvuqJ$569PzEhaOoz` gS6o&pi<-0l0cJuK8fgW^eE + + + + diff --git a/app/src/main/res/layout/item/layout/dialog_edit.xml b/app/src/main/res/layout/item/layout/dialog_edit.xml index 89a03cab..f916eb93 100644 --- a/app/src/main/res/layout/item/layout/dialog_edit.xml +++ b/app/src/main/res/layout/item/layout/dialog_edit.xml @@ -19,33 +19,114 @@ android:layout_margin="15dp" android:gravity="center" android:text="标题" - android:textColor="@color/black" /> + android:textColor="@color/black" + android:textSize="@dimen/TitleSize"/> + android:layout_height="wrap_content"> + + + + + + + - - + android:layout_marginBottom="@dimen/dp_10" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + + + + + + + + + + + +