@@ -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(); | |||
} | |||
} | |||
/** | |||
@@ -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<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); | |||
} else if (item.name.equals("配方分类")) { | |||
ConfigName.getInstance().cloudData.bomTypeInfo = new Json<BomTypeInfo>().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<BPA_GOODSRECIPE> 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<String> names=new ArrayList<>(); | |||
final HashMap<String,String> formulation=new HashMap<>(); | |||
//region 获取变量名称和值 | |||
String text=item.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 | |||
{ | |||
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<ActionJsonMode> 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<BomTechnologyActionInfo>(); | |||
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<BPA_GOODSRECIPE> 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<String> names = new ArrayList<>(); | |||
final HashMap<String, String> formulation = new HashMap<>(); | |||
//region 获取变量名称和值 | |||
String text = item.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 { | |||
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<ActionJsonMode> 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.<ResAPI<Boolean>>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<ResAPI<Boolean>>(context) { | |||
@Override | |||
public void onSuccess(Response<ResAPI<Boolean>> response) { | |||
ResAPI<Boolean> allDataResAPI = response.body(); | |||
if (allDataResAPI.data) { | |||
ToastUtils.info("上传菜品成功!!!"); | |||
MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good"); | |||
} else { | |||
ToastUtils.warning("上传菜品失败!!!"); | |||
if (isSuceess) { | |||
try { | |||
OkGo.<ResAPI<Boolean>>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<ResAPI<Boolean>>(context) { | |||
@Override | |||
public void onSuccess(Response<ResAPI<Boolean>> response) { | |||
ResAPI<Boolean> 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<Res_PLCADDRESS> plcaddresses = ConfigName.getInstance().PlcAddress_大炒; | |||
List<ProcessT> processTS = ConfigName.getInstance().Process_大炒; | |||
//region 恢复PLC | |||
ArrayList<BPA_PLCADDRESS> 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<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(); | |||
} | |||
//endregion | |||
/** | |||
* 初始化工序模型表 | |||
*/ | |||
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; | |||
//region 恢复工序 | |||
ArrayList<BPA_PROCESS> a = QueryDB.GetProcessALL(); | |||
for (BPA_PROCESS item : a) { | |||
ArrayList<BPA_PROCESSModel> arrayList1 = QueryDB.GetProcessModelALL(); | |||
for (BPA_PROCESSModel item1 : arrayList1) { | |||
QueryDB.DeleteProcessModel(item1); | |||
} | |||
QueryDB.AddProcessModel(processModel); | |||
chidindex++; | |||
QueryDB.DeleteProcess(item); | |||
} | |||
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; | |||
int index = 1; | |||
for (ProcessT key : processTS) { | |||
List<String> 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<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; | |||
// k++; | |||
// QueryDB.AddPlcaddress(plc); | |||
// } | |||
// } 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++; | |||
// } | |||
// } | |||
//endregion | |||
//region PLC初始化 | |||
@@ -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<Res_PLCADDRESS> PlcAddress_大炒=new ArrayList<Res_PLCADDRESS>(){{ | |||
public List<Res_PLCADDRESS> PlcAddress_大炒 = new ArrayList<Res_PLCADDRESS>() {{ | |||
//硬件设备 初始化 | |||
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<ProcessT> Process_大炒 = new ArrayList<ProcessT>() {{ | |||
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<String,Integer> StirringSpeed=new ConcurrentHashMap<String,Integer>() | |||
{{ | |||
put("停止",0); | |||
put("最低",10); | |||
put("低速",20); | |||
put("中速",30); | |||
put("高速",40); | |||
put("最高",50); | |||
put("极高",60); | |||
public ConcurrentHashMap<String, Integer> StirringSpeed = new ConcurrentHashMap<String, Integer>() {{ | |||
put("停止", 0); | |||
put("最低", 10); | |||
put("低速", 20); | |||
put("中速", 30); | |||
put("高速", 40); | |||
put("最高", 50); | |||
put("极高", 60); | |||
}}; | |||
/** | |||
* 挡位 功率 | |||
*/ | |||
public ConcurrentHashMap<String,Integer> HeatingGear=new ConcurrentHashMap<String,Integer>() | |||
{{ | |||
put("停止",0); | |||
put("一档",2); | |||
put("二档",4); | |||
put("三档",6); | |||
put("四档",8); | |||
put("五档",10); | |||
public ConcurrentHashMap<String, Integer> HeatingGear = new ConcurrentHashMap<String, Integer>() {{ | |||
put("停止", 0); | |||
put("一档", 2); | |||
put("二档", 4); | |||
put("三档", 6); | |||
put("四档", 8); | |||
put("五档", 10); | |||
}}; | |||
/** | |||
* 状态上报信息 | |||
* 炒锅状态上报信息 | |||
*/ | |||
public List<StatusMode> statusModes=new ArrayList<StatusMode>(){{ | |||
public List<StatusMode> statusModes = new ArrayList<StatusMode>() {{ | |||
//硬件设备 初始化 | |||
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<Integer,String> statusModes_电机=new ConcurrentHashMap<Integer,String>() | |||
{{ | |||
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<Integer, String> statusModes_电机 = new ConcurrentHashMap<Integer, String>() {{ | |||
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<CloudGood> cloudGoods=new ArrayList<>(); | |||
public List<CloudGood> 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" | |||
// } | |||
//region 选配版本信息 | |||
/** | |||
* 版本信息 | |||
*/ | |||
public String[] versionSelectionValues = new String[]{"大炒版本", "大炒自动投料版本", "小炒版本"}; | |||
/** | |||
* 选配版本信息 | |||
*/ | |||
public String versionSelectionEnum = "大炒版本"; | |||
//endregion | |||
} |
@@ -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 | |||
} |
@@ -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; | |||
@@ -0,0 +1,13 @@ | |||
package com.bonait.bnframework.common.model.mode; | |||
import java.util.List; | |||
public class ProcessT { | |||
public String name; | |||
public List<String> val; | |||
public ProcessT(String _name,List<String> _val) | |||
{ | |||
this.name=_name; | |||
this.val=_val; | |||
} | |||
} |
@@ -34,4 +34,9 @@ public class ResALLData { | |||
* 商品单位 | |||
*/ | |||
public List<GoodsUintInfo> goodsUintInfo; | |||
/** | |||
* 配方分类 | |||
*/ | |||
public List<BomTypeInfo> bomTypeInfo; | |||
} |
@@ -0,0 +1,10 @@ | |||
package com.bonait.bnframework.common.model.mode; | |||
/** | |||
* 版本信息 | |||
*/ | |||
public enum VersionSelectionEnum { | |||
大炒版本, | |||
大炒自动投料版本, | |||
小炒版本, | |||
} |
@@ -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<String,String> map_cp = new LinkedHashMap<>(); | |||
Map<String,String> map_dl = new LinkedHashMap<>(); | |||
Map<String,String> map_xl = new LinkedHashMap<>(); | |||
Map<String,String> map_dw = new LinkedHashMap<>(); | |||
Map<String,String> 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<String,String> map) | |||
{ | |||
ArrayAdapter<String> 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 { |
@@ -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(); | |||
@@ -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; | |||
@@ -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<EditText> editTextLists=new ArrayList<>(); | |||
Map<String,Integer> material_map = new LinkedHashMap<>(); | |||
Map<String,Integer> 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<ConfigName.getInstance().versionSelectionValues.length;i++) | |||
{ | |||
material_map_vis.put(ConfigName.getInstance().versionSelectionValues[i],i); | |||
} | |||
ArrayAdapter<String> 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<String> 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; | |||
@@ -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); | |||
} | |||
} | |||
}); | |||
@@ -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(); | |||
} | |||
}); | |||
} | |||
}); | |||
} | |||
/** | |||
* 跳转登录界面 | |||
@@ -102,6 +102,14 @@ | |||
stv:sLeftTextString="版本更新" | |||
stv:sRightIconRes="@drawable/icon_right" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_huifu" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/ll_height" | |||
stv:sLeftIconRes="@drawable/hfccsz" | |||
stv:sLeftTextString="恢复出厂设置" | |||
stv:sRightIconRes="@drawable/icon_right" /> | |||
<com.allen.library.SuperTextView | |||
android:id="@+id/stv_logout" | |||
android:layout_width="wrap_content" | |||
@@ -120,6 +120,18 @@ | |||
android:padding="3dp" | |||
android:textSize="12dp" /> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:gravity="right" | |||
android:text="版本选择:" /> | |||
<Spinner | |||
android:id="@+id/versionselection" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="80dp" | |||
android:layout_height="24dp" | |||
android:layout_centerVertical="true" /> | |||
</TableRow> | |||
</TableLayout> | |||
@@ -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"/> | |||
<LinearLayout | |||
android:layout_gravity="center" | |||
android:layout_marginBottom="@dimen/dp_10" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
> | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="center" | |||
android:text="选择菜谱" | |||
android:textColor="@color/black" | |||
android:layout_marginRight="@dimen/dp_10"/> | |||
<Spinner | |||
android:id="@+id/editsp_cp" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="140dp" | |||
android:layout_height="24dp" | |||
android:paddingLeft="@dimen/dp_10" | |||
android:layout_centerVertical="true"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_gravity="center" | |||
android:layout_marginBottom="@dimen/dp_10" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="center" | |||
android:text="商品大类" | |||
android:textColor="@color/black" | |||
android:layout_marginRight="@dimen/dp_10"/> | |||
<Spinner | |||
android:id="@+id/editsp_dl" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="140dp" | |||
android:paddingLeft="@dimen/dp_10" | |||
android:layout_height="24dp" | |||
android:layout_centerVertical="true"/> | |||
</LinearLayout> | |||
<Spinner | |||
android:id="@+id/editsp_PF" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="match_parent" | |||
android:layout_height="24dp" | |||
android:layout_centerVertical="true"/> | |||
<EditText | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:id="@+id/et_phone" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
<LinearLayout | |||
android:layout_gravity="center" | |||
android:gravity="center" | |||
android:background="@drawable/input_bj" | |||
android:hint="请输入物料名称" | |||
android:inputType="text" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||
android:textSize="12dp" /> | |||
android:layout_marginBottom="@dimen/dp_10" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="center" | |||
android:text="商品小类" | |||
android:textColor="@color/black" | |||
android:layout_marginRight="@dimen/dp_10"/> | |||
<Spinner | |||
android:id="@+id/editsp_xl" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="140dp" | |||
android:layout_height="24dp" | |||
android:paddingLeft="@dimen/dp_10" | |||
android:layout_centerVertical="true"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_gravity="center" | |||
android:layout_marginBottom="@dimen/dp_10" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="center" | |||
android:text="商品单位" | |||
android:textColor="@color/black" | |||
android:layout_marginRight="@dimen/dp_10"/> | |||
<Spinner | |||
android:id="@+id/editsp_dw" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="140dp" | |||
android:layout_height="24dp" | |||
android:paddingLeft="@dimen/dp_10" | |||
android:layout_centerVertical="true"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_gravity="center" | |||
android:layout_marginBottom="@dimen/dp_10" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="center" | |||
android:text="配方分类" | |||
android:textColor="@color/black" | |||
android:layout_marginRight="@dimen/dp_10"/> | |||
<Spinner | |||
android:id="@+id/editsp_fl" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="140dp" | |||
android:layout_height="24dp" | |||
android:paddingLeft="@dimen/dp_10" | |||
android:layout_centerVertical="true"/> | |||
</LinearLayout> | |||
<View | |||
android:layout_width="match_parent" | |||