|
|
@@ -80,7 +80,7 @@ public class WokControlDialog extends DialogFragment { |
|
|
|
Object val_wd = ModbusCenter.getWokListingValue(deviceNum,"当前锅底温度"); |
|
|
|
Object OBJ = ModbusCenter.getWokListingValue(deviceNum,"搅拌"); |
|
|
|
Object sudu = ModbusCenter.getWokListingValue(deviceNum,"搅拌速度"); |
|
|
|
if (!(OBJ != null && (boolean) OBJ)) { |
|
|
|
if (OBJ != null && (boolean) OBJ) { |
|
|
|
if(sudu!=null){ |
|
|
|
viewBinding.tvJiaoban.setText("搅拌中 "+sudu); |
|
|
|
}else { |
|
|
@@ -94,38 +94,9 @@ public class WokControlDialog extends DialogFragment { |
|
|
|
} else { |
|
|
|
viewBinding.tvWokWendu.setText("??°C"); |
|
|
|
} |
|
|
|
String wokChaoXiang = "检测中"; |
|
|
|
|
|
|
|
Object cx3 = ModbusCenter.getWokListingValue(deviceNum,"抽料位"); |
|
|
|
Object cx1 = ModbusCenter.getWokListingValue(deviceNum,"原点位"); |
|
|
|
Object cx2 = ModbusCenter.getWokListingValue(deviceNum,"倒菜位"); |
|
|
|
Object cx4 = ModbusCenter.getWokListingValue(deviceNum,"维护位"); |
|
|
|
Object cx5 = ModbusCenter.getWokListingValue(deviceNum,"清洗位"); |
|
|
|
Object cx6 = ModbusCenter.getWokListingValue(deviceNum,"炒菜位1"); |
|
|
|
Object cx7 = ModbusCenter.getWokListingValue(deviceNum,"炒菜位2"); |
|
|
|
Object cx8 = ModbusCenter.getWokListingValue(deviceNum,"炒菜位3"); |
|
|
|
if(cx1!=null){ |
|
|
|
if((Boolean)cx1){ |
|
|
|
wokChaoXiang = "原点位/抽料位"; |
|
|
|
}else if((Boolean)cx3){ |
|
|
|
wokChaoXiang = "抽料位/原点位"; |
|
|
|
}else if((Boolean)cx2){ |
|
|
|
wokChaoXiang = "倒菜位"; |
|
|
|
}else if((Boolean)cx4){ |
|
|
|
wokChaoXiang = "维护位"; |
|
|
|
}else if((Boolean)cx5){ |
|
|
|
wokChaoXiang = "清洗位"; |
|
|
|
}else if((Boolean)cx6){ |
|
|
|
wokChaoXiang = "炒菜位1/炒菜位高"; |
|
|
|
}else if((Boolean)cx7){ |
|
|
|
wokChaoXiang = "炒菜位2/炒菜位低"; |
|
|
|
}else if((Boolean)cx8){ |
|
|
|
wokChaoXiang = "炒菜位3"; |
|
|
|
} |
|
|
|
} |
|
|
|
viewBinding.tvGuokoucaoxiang.setText("当前锅口朝向:"+wokChaoXiang); |
|
|
|
|
|
|
|
freshFireNum(); |
|
|
|
freshChaoxiang(); |
|
|
|
if(handler.hasMessages(1)){ |
|
|
|
handler.removeMessages(1); |
|
|
|
} |
|
|
@@ -134,25 +105,101 @@ public class WokControlDialog extends DialogFragment { |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
public void freshPlc(){ |
|
|
|
ThreadManager.get().StartLong(TAG, true, () -> { |
|
|
|
for (Res_PLCADDRESS item : ConfigName.getInstance().PlcAddress_Wok) { |
|
|
|
if(item!=null){ |
|
|
|
if (checkNames.contains(item.name)) { |
|
|
|
if(deviceNum==1){ |
|
|
|
if(Wok2ModbusTcpServer.get().plcIsConnect){ |
|
|
|
Object val = ModbusCenter.wokReadPlc(2,item.name); |
|
|
|
Wok2ModbusTcpServer.get().listeningValue.put(item.name, val); |
|
|
|
} |
|
|
|
}else if(deviceNum == 2){ |
|
|
|
if(Wok1ModbusTcpServer.get().plcIsConnect){ |
|
|
|
Object val = ModbusCenter.wokReadPlc(2,item.name); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put(item.name, val); |
|
|
|
} |
|
|
|
} |
|
|
|
private void freshChaoxiang(){ |
|
|
|
try{ |
|
|
|
String wokChaoXiang = "检测中"; |
|
|
|
Object cx3 = ModbusCenter.getWokListingValue(deviceNum,"抽料位反馈"); |
|
|
|
Object cx1 = ModbusCenter.getWokListingValue(deviceNum,"原点位反馈"); |
|
|
|
Object cx2 = ModbusCenter.getWokListingValue(deviceNum,"倒菜位反馈"); |
|
|
|
Object cx4 = ModbusCenter.getWokListingValue(deviceNum,"维护位反馈"); |
|
|
|
Object cx5 = ModbusCenter.getWokListingValue(deviceNum,"清洗位反馈"); |
|
|
|
Object cx6 = ModbusCenter.getWokListingValue(deviceNum,"炒菜位1反馈"); |
|
|
|
Object cx7 = ModbusCenter.getWokListingValue(deviceNum,"炒菜位2反馈"); |
|
|
|
Object cx8 = ModbusCenter.getWokListingValue(deviceNum,"炒菜位3反馈"); |
|
|
|
LogUtils.d("freshChaoxiang "+cx1+cx2+cx3+cx4+cx5+cx6+cx7+cx8); |
|
|
|
if(cx1!=null) { |
|
|
|
if ((boolean) cx1) { |
|
|
|
wokChaoXiang = "原点位/抽料位"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(cx3!=null) { |
|
|
|
if ((boolean) cx3) { |
|
|
|
wokChaoXiang = "抽料位/原点位"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(cx2!=null) { |
|
|
|
if ((boolean) cx2) { |
|
|
|
wokChaoXiang = "倒菜位"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(cx4!=null) { |
|
|
|
if ((boolean) cx4) { |
|
|
|
wokChaoXiang = "维护位"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(cx5!=null) { |
|
|
|
if ((boolean) cx5) { |
|
|
|
wokChaoXiang = "清洗位"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(cx6!=null) { |
|
|
|
if ((boolean) cx6) { |
|
|
|
wokChaoXiang = "炒菜位1/炒菜位高"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(cx7!=null) { |
|
|
|
if ((boolean) cx7) { |
|
|
|
wokChaoXiang = "炒菜位2/炒菜位低"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(cx8!=null) { |
|
|
|
if ((boolean) cx8) { |
|
|
|
wokChaoXiang = "炒菜位3"; |
|
|
|
} |
|
|
|
} |
|
|
|
viewBinding.tvGuokoucaoxiang.setText("当前锅口朝向:"+wokChaoXiang); |
|
|
|
}catch (Exception e){ |
|
|
|
LogUtils.d("异常信息:" + e.getMessage()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void freshPlc(){ |
|
|
|
ThreadManager.get().StartLong(TAG, false, () -> { |
|
|
|
// "搅拌速度,抽料位,原点位,倒菜位,维护位,清洗位,炒菜位1,炒菜位2,炒菜位3" |
|
|
|
try{ |
|
|
|
if(deviceNum==1){ |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("加热功率", ModbusCenter.wokReadPlc(deviceNum,"加热功率")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("加热", ModbusCenter.wokReadPlc(deviceNum,"加热")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("搅拌", ModbusCenter.wokReadPlc(deviceNum,"搅拌")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("搅拌速度", ModbusCenter.wokReadPlc(deviceNum,"搅拌速度")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("抽料位反馈", ModbusCenter.wokReadPlc(deviceNum,"抽料位反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("原点位反馈", ModbusCenter.wokReadPlc(deviceNum,"原点位反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("倒菜位反馈", ModbusCenter.wokReadPlc(deviceNum,"倒菜位反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("维护位反馈", ModbusCenter.wokReadPlc(deviceNum,"维护位反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("清洗位反馈", ModbusCenter.wokReadPlc(deviceNum,"清洗位反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("炒菜位1反馈", ModbusCenter.wokReadPlc(deviceNum,"炒菜位1反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("炒菜位2反馈", ModbusCenter.wokReadPlc(deviceNum,"炒菜位2反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("炒菜位3反馈", ModbusCenter.wokReadPlc(deviceNum,"炒菜位3反馈")); |
|
|
|
}else if(deviceNum==2){ |
|
|
|
Wok2ModbusTcpServer.get().listeningValue.put("加热", ModbusCenter.wokReadPlc(deviceNum,"加热")); |
|
|
|
Wok2ModbusTcpServer.get().listeningValue.put("加热功率", ModbusCenter.wokReadPlc(deviceNum,"加热功率")); |
|
|
|
Wok2ModbusTcpServer.get().listeningValue.put("搅拌", ModbusCenter.wokReadPlc(deviceNum,"搅拌")); |
|
|
|
Wok2ModbusTcpServer.get().listeningValue.put("搅拌速度", ModbusCenter.wokReadPlc(deviceNum,"搅拌速度")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("抽料位反馈", ModbusCenter.wokReadPlc(deviceNum,"抽料位反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("原点位反馈", ModbusCenter.wokReadPlc(deviceNum,"原点位反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("倒菜位反馈", ModbusCenter.wokReadPlc(deviceNum,"倒菜位反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("维护位反馈", ModbusCenter.wokReadPlc(deviceNum,"维护位反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("清洗位反馈", ModbusCenter.wokReadPlc(deviceNum,"清洗位反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("炒菜位1反馈", ModbusCenter.wokReadPlc(deviceNum,"炒菜位1反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("炒菜位2反馈", ModbusCenter.wokReadPlc(deviceNum,"炒菜位2反馈")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("炒菜位3反馈", ModbusCenter.wokReadPlc(deviceNum,"炒菜位3反馈")); |
|
|
|
} |
|
|
|
|
|
|
|
Thread.sleep(500); |
|
|
|
}catch (Exception ex){ |
|
|
|
LogUtils.d("异常信息:" + ex.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
@@ -210,35 +257,33 @@ public class WokControlDialog extends DialogFragment { |
|
|
|
} |
|
|
|
|
|
|
|
private void initData(){ |
|
|
|
if(!ConfigName.getInstance().guokouChaoxiang.isEmpty()){ |
|
|
|
viewBinding.guokoucaoxiang.setText("锅口朝向\n"+ConfigName.getInstance().guokouChaoxiang); |
|
|
|
} |
|
|
|
if(!ConfigName.getInstance().fanchaoSpeed.isEmpty()){ |
|
|
|
viewBinding.tvSpeed.setText(ConfigName.getInstance().fanchaoSpeed); |
|
|
|
} |
|
|
|
|
|
|
|
viewBinding.fireControl.deviceNum = deviceNum; |
|
|
|
freshFireNum(); |
|
|
|
|
|
|
|
} |
|
|
|
private void freshFireNum(){ |
|
|
|
Object object = ModbusCenter.ReadPlc(deviceNum,"加热功率"); |
|
|
|
Object oOpen = ModbusCenter.ReadPlc(deviceNum,"加热"); |
|
|
|
if(oOpen instanceof Boolean){ |
|
|
|
if((Boolean)oOpen){ |
|
|
|
if(object instanceof Short){ |
|
|
|
short num = (short) object; |
|
|
|
int fire = (int) num; |
|
|
|
viewBinding.fireControl.SetLevel(fire); |
|
|
|
try { |
|
|
|
Object object = ModbusCenter.getWokListingValue(deviceNum,"加热功率"); |
|
|
|
Object oOpen = ModbusCenter.getWokListingValue(deviceNum,"加热"); |
|
|
|
if(oOpen instanceof Boolean){ |
|
|
|
if((Boolean)oOpen){ |
|
|
|
if(object instanceof Short){ |
|
|
|
short num = (short) object; |
|
|
|
int fire = (int) num; |
|
|
|
viewBinding.fireControl.SetLevel(fire); |
|
|
|
}else { |
|
|
|
viewBinding.fireControl.SetLevel(0); |
|
|
|
} |
|
|
|
}else { |
|
|
|
viewBinding.fireControl.SetLevel(0); |
|
|
|
} |
|
|
|
}else { |
|
|
|
viewBinding.fireControl.SetLevel(0); |
|
|
|
} |
|
|
|
}else { |
|
|
|
viewBinding.fireControl.SetLevel(0); |
|
|
|
} |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@SuppressLint("ClickableViewAccessibility") |
|
|
@@ -504,6 +549,13 @@ public class WokControlDialog extends DialogFragment { |
|
|
|
*/ |
|
|
|
public void SetFire(int data) { |
|
|
|
ExecuteTheRecipe.Write_PLC_HuoLI(deviceNum,(int) data); |
|
|
|
if(deviceNum==1){ |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("加热功率", ModbusCenter.wokReadPlc(deviceNum,"加热功率")); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("加热", ModbusCenter.wokReadPlc(deviceNum,"加热")); |
|
|
|
}else if(deviceNum == 2){ |
|
|
|
Wok2ModbusTcpServer.get().listeningValue.put("加热功率", ModbusCenter.wokReadPlc(deviceNum,"加热功率")); |
|
|
|
Wok2ModbusTcpServer.get().listeningValue.put("加热", ModbusCenter.wokReadPlc(deviceNum,"加热")); |
|
|
|
} |
|
|
|
if(data==0){ |
|
|
|
NewToastUtil.getInstance().showToast("关闭加热"); |
|
|
|
}else { |
|
|
@@ -530,42 +582,34 @@ public class WokControlDialog extends DialogFragment { |
|
|
|
case 原点位: |
|
|
|
ExecuteTheRecipe.BottomClick(deviceNum,"原点位"); |
|
|
|
viewBinding.guokoucaoxiang.setText("锅口朝向\n原点位"); |
|
|
|
ConfigName.getInstance().guokouChaoxiang = "原点位"; |
|
|
|
break; |
|
|
|
case 炒菜位1: |
|
|
|
ExecuteTheRecipe.BottomClick(deviceNum,"炒菜位1"); |
|
|
|
viewBinding.guokoucaoxiang.setText("锅口朝向\n炒菜位1"); |
|
|
|
ConfigName.getInstance().guokouChaoxiang = "炒菜位1"; |
|
|
|
break; |
|
|
|
case 炒菜位2: |
|
|
|
ExecuteTheRecipe.BottomClick(deviceNum,"炒菜位2"); |
|
|
|
viewBinding.guokoucaoxiang.setText("锅口朝向\n炒菜位2"); |
|
|
|
ConfigName.getInstance().guokouChaoxiang = "炒菜位2"; |
|
|
|
break; |
|
|
|
case 炒菜位3: |
|
|
|
ExecuteTheRecipe.BottomClick(deviceNum,"炒菜位3"); |
|
|
|
viewBinding.guokoucaoxiang.setText("锅口朝向\n炒菜位3"); |
|
|
|
ConfigName.getInstance().guokouChaoxiang = "炒菜位3"; |
|
|
|
break; |
|
|
|
case 维护位: |
|
|
|
ExecuteTheRecipe.BottomClick(deviceNum,"维护位"); |
|
|
|
viewBinding.guokoucaoxiang.setText("锅口朝向\n维护位"); |
|
|
|
ConfigName.getInstance().guokouChaoxiang = "维护位"; |
|
|
|
break; |
|
|
|
case 抽料位: |
|
|
|
ExecuteTheRecipe.BottomClick(deviceNum,"抽料位"); |
|
|
|
viewBinding.guokoucaoxiang.setText("锅口朝向\n抽料位"); |
|
|
|
ConfigName.getInstance().guokouChaoxiang = "抽料位"; |
|
|
|
break; |
|
|
|
case 倒菜位: |
|
|
|
ExecuteTheRecipe.BottomClick(deviceNum,"倒菜位"); |
|
|
|
viewBinding.guokoucaoxiang.setText("锅口朝向\n倒菜位"); |
|
|
|
ConfigName.getInstance().guokouChaoxiang = "倒菜位"; |
|
|
|
break; |
|
|
|
case 清洗位: |
|
|
|
ExecuteTheRecipe.BottomClick(deviceNum,"清洗位"); |
|
|
|
viewBinding.guokoucaoxiang.setText("锅口朝向\n清洗位"); |
|
|
|
ConfigName.getInstance().guokouChaoxiang = "清洗位"; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
@@ -583,22 +627,18 @@ public class WokControlDialog extends DialogFragment { |
|
|
|
case 快: |
|
|
|
_speed = 60; |
|
|
|
viewBinding.tvSpeed.setText("翻炒速度:快-"+_speed); |
|
|
|
ConfigName.getInstance().fanchaoSpeed = "翻炒速度:快-"+_speed; |
|
|
|
break; |
|
|
|
case 中: |
|
|
|
_speed = 40; |
|
|
|
viewBinding.tvSpeed.setText("翻炒速度:中-"+_speed); |
|
|
|
ConfigName.getInstance().fanchaoSpeed = "翻炒速度:中-"+_speed; |
|
|
|
break; |
|
|
|
case 慢: |
|
|
|
_speed = 20; |
|
|
|
viewBinding.tvSpeed.setText("翻炒速度:慢-"+_speed); |
|
|
|
ConfigName.getInstance().fanchaoSpeed = "翻炒速度:慢-"+_speed; |
|
|
|
break; |
|
|
|
case 停: |
|
|
|
_speed = 0; |
|
|
|
viewBinding.tvSpeed.setText("翻炒速度:停-"+_speed); |
|
|
|
ConfigName.getInstance().fanchaoSpeed = "翻炒速度:停-"+_speed; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
@@ -613,6 +653,13 @@ public class WokControlDialog extends DialogFragment { |
|
|
|
} else { |
|
|
|
ModbusCenter.WritePlc(deviceNum,"搅拌", true, null); |
|
|
|
} |
|
|
|
if(deviceNum== 1){ |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("搅拌速度", (short)final_speed); |
|
|
|
Wok1ModbusTcpServer.get().listeningValue.put("搅拌", final_speed != 0); |
|
|
|
}else if(deviceNum== 2){ |
|
|
|
Wok2ModbusTcpServer.get().listeningValue.put("搅拌速度", (short)final_speed); |
|
|
|
Wok2ModbusTcpServer.get().listeningValue.put("搅拌", final_speed != 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|