Browse Source

422

燃气自翻炒锅
fyf 1 year ago
parent
commit
5cb110a863
2 changed files with 148 additions and 6 deletions
  1. +145
    -5
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  2. +3
    -1
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java

+ 145
- 5
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -285,8 +285,10 @@ public class ExecuteTheRecipe {
Write_PLC_Heating(formulation);
break;
case "主料":
if (ConfigName.getInstance().versionSelectionEnum.contains("一拖")) {
Write_PLC_MainIngredients(formulation);
if (ConfigName.getInstance().versionSelectionEnum.contains("一拖四")) {
Write_PLC_MainIngredients4(formulation);
}else if (ConfigName.getInstance().versionSelectionEnum.contains("一拖二")) {
Write_PLC_MainIngredients2(formulation);
} else {
Write_PLC_Ingredients(formulation);
}
@@ -898,11 +900,11 @@ public class ExecuteTheRecipe {
//region 一拖四写PLC工序

/**
* 写PLC主料
* 写PLC主料 一拖4
*
* @param data
*/
private static void Write_PLC_MainIngredients(HashMap<String, String> data) {
private static void Write_PLC_MainIngredients4(HashMap<String, String> data) {
try {
//是否手动
boolean ishand = true;
@@ -1039,6 +1041,144 @@ public class ExecuteTheRecipe {
}
}

/**
* 写PLC主料 一拖2
*
* @param data
*/
private static void Write_PLC_MainIngredients2(HashMap<String, String> data) {
try {
//是否手动
boolean ishand = true;
ToastUtils.info("准备倒入主料!");

//region 判断是否手动
if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) {
ishand = true;
} else {
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key.contains("投料动作")) {
if (value.contains("手动投料")) {
ishand = true;
} else {
ishand = false;
}
}
}
}
//endregion


if (ishand) {
String name = "";
String zl = "";
int val = 0;
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key.contains("名称")) {
name = value;
} else if (key.contains("重量")) {
zl = value;
}
}
ToastUtils.info("工序:手动投料," + name + "," + zl);
String title = "手动投料-温馨提示!";
String message = "客官请投入主料,[" + name + "]重量" + zl + "g,投入后点击[确定]继续流程!";
ExecuteTheRecipe.WritePLC("暂停开关", true, null);

final boolean[] IsComplete = {false};
Activity activity = findActivity(context);
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
try {

new QMUIDialog.MessageDialogBuilder(context)
.setCancelable(false)
.setTitle(title)
.setMessage(message)
.addAction("确定", new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
IsComplete[0] = true;
dialog.dismiss();
}
})
.create(com.qmuiteam.qmui.R.style.QMUI_Dialog).show();

} catch (Exception e) {

}
}
});
}

while (!IsComplete[0]) {
Thread.sleep(100);//10 *6
}
ExecuteTheRecipe.WritePLC("暂停开关", false, null);
ToastUtils.info("确定完成,继续制作!");
} else {
//自动投料
String writeValue = "1号位";
if (ExecuteCurrentOperation != null) {
ExecuteCurrentOperation.Run("主料" + "|" + writeValue);
}

WriteMainPLC("机器人放主料完成", false, null);
WriteMainPLC("炒锅请求投主料", true, null);
boolean isJre=false;
Object K= ReadPLC("加热");
isJre=K==null?false:(boolean) K;
if(isJre) {ExecuteTheRecipe.WritePLC("加热", false, null);}//提前关闭加热

final boolean[] IsComplete = {false};
long a = System.currentTimeMillis();
while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * (whileTime * 10)) {
break;
} else {
Object sb = ReadMainPLC("机器人放主料完成");//ListeningValue.get(name);
if (sb != null) {
IsComplete[0] = (boolean) (sb);
}
}
Thread.sleep(100);//10 *6
}
WriteMainPLC("机器人放主料完成", false, null);
if(isJre) {ExecuteTheRecipe.WritePLC("加热", true, null);}//再次释放加热
}
Log.d("倒菜", "倒菜完成了");

if (IsMoveYiHaoWei()) {
WriteMainPLC("炒锅投主料完成", true, null);
}

//判断是否有烹饪时间
int val = 0;
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key.contains("(秒)")) {
val = Integer.parseInt(value);
}
}
if (val > 0) {
Thread.sleep(val * 1000);
}

Log.d("烹饪时间", "烹饪时间完成了");


} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 写PLC投辅料
*
@@ -1736,7 +1876,7 @@ public class ExecuteTheRecipe {
{
if((boolean) IsJT)//异常情况
{
WritePLC("停止",true,null);
//WritePLC("停止",true,null);
}
}
}


+ 3
- 1
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -1122,13 +1122,14 @@ public class ConfigName {
public ConcurrentHashMap<String, Integer> MainPlcAddress = new ConcurrentHashMap<String, Integer>() {{
put("炒锅空闲状态",1); //实时
put("炒锅出餐完成",2);
put("炒锅投主料完成",3);
put("炒锅投主料完成",3);//准备就绪,开始烹饪
put("炒锅请求投辅料",4);
put("商品数据验证",5);
put("投料机构状态",6); //实时
put("心跳",7); //实时
put("炒菜完成请求出餐",8);
put("炒锅出餐减速到位",9); //实时
put("炒锅请求投主料",10);


put("机器人放主料完成",51);
@@ -1136,6 +1137,7 @@ public class ConfigName {
put("机器人到达炒锅出餐位",53);
put("商品下发",54);
put("机器人急停",55);//true 异常 false 正常
put("机器人放主料完成",56);

put("商品信息",0);
}};


Loading…
Cancel
Save