Browse Source

4233

燃气自翻炒锅
fyf 1 year ago
parent
commit
0ab73d2a86
4 changed files with 100 additions and 5 deletions
  1. +54
    -2
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  2. +5
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  3. +17
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DishTestActivity.java
  4. +24
    -3
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyMemoryActivity.java

+ 54
- 2
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -47,7 +47,8 @@ public class ExecuteTheRecipe {
/**
* 等待超时时间
*/
public static int whileTime = 40;
//public static int whileTime = 40;
public static int whileTime = 2;

/**
* 监听变量值
@@ -145,6 +146,11 @@ public class ExecuteTheRecipe {
ExecuteOperationSteps(data3.processname, data3.processvalue);
}
ExecuteOperationSteps(recipe.processname, recipe.processvalue);

if (recipe.processname.equals("出菜")) {
BPA_GOODSRECIPE data4 = Get位置("最高", "炒菜位1");
ExecuteOperationSteps(data4.processname, data4.processvalue);
}
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
@@ -282,6 +288,9 @@ public class ExecuteTheRecipe {
case "出菜":
Write_PLC_Outdishes(formulation);
break;
case "清洗":
Write_PLC_CleanPan(formulation);
break;
}


@@ -792,7 +801,50 @@ public class ExecuteTheRecipe {
Thread.sleep(100);//10 *6
}

ToastUtils.info("出菜完成,结束制作!");
ToastUtils.info("出菜完成,锅体准备回到原位!");
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 写PLC 清洗
*
* @param data
*/
private static void Write_PLC_CleanPan(HashMap<String, String> data) {
try {
ToastUtils.info("准备清洗!");
//先延迟
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("工序:" + key + "," + value);
if (key.contains("(秒)")) {
int val = Integer.parseInt(value);
Thread.sleep(val * 1000);
}
}

BottomClick("炒锅清洗");

//一直等待机器移动到该位置,否则就一直等待 6s超时
String name = "炒锅清洗反馈";
final boolean[] IsComplete = {false};
long a = System.currentTimeMillis();
while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * (whileTime*5)) {
break;
} else {
Object sb = ReadPLC(name);//ListeningValue.get(name);
if (sb != null) {
IsComplete[0] = (boolean) (sb);
}
}
Thread.sleep(100);//10 *6
}

ToastUtils.info("炒锅清洗完成!");
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}


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

@@ -385,6 +385,7 @@ public class ConfigName {
add(new ProcessT("液体料", new ArrayList<>()));
add(new ProcessT("延迟", Arrays.asList("延迟(秒)")));
add(new ProcessT("出菜", Arrays.asList("等待(秒)")));
add(new ProcessT("清洗", Arrays.asList("等待(秒)")));
}};

/**
@@ -604,6 +605,8 @@ public class ConfigName {
add(new ProcessT("液体料", new ArrayList<>()));
add(new ProcessT("延迟", Arrays.asList("延迟(秒)")));
add(new ProcessT("出菜", Arrays.asList("等待(秒)")));
add(new ProcessT("清洗", Arrays.asList("等待(秒)")));

}};
/**
* 小炒基础PLC模型
@@ -821,6 +824,8 @@ public class ConfigName {
add(new ProcessT("液体料", new ArrayList<>()));
add(new ProcessT("延迟", Arrays.asList("延迟(秒)")));
add(new ProcessT("出菜", Arrays.asList("等待(秒)")));
add(new ProcessT("清洗", Arrays.asList("等待(秒)")));

}};

/**


+ 17
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DishTestActivity.java View File

@@ -1077,10 +1077,13 @@ public class DishTestActivity extends BaseActivity {
int time_c = time - ClikTime;
BPA_GOODSRECIPE data = Get出菜(time_c);
DataBus.getInstance().bpa_goodsrecipes.add(data);
BPA_GOODSRECIPE data2 = Get清洗(0);
DataBus.getInstance().bpa_goodsrecipes.add(data);
new Thread(new Runnable() {
@Override
public void run() {
ExecuteTheRecipe.ExecuteOperationSteps(data.processname, data.processvalue);
ExecuteTheRecipe.ExecuteOperationSteps(data2.processname, data2.processvalue);
}
}).start();
}
@@ -1225,6 +1228,20 @@ public class DishTestActivity extends BaseActivity {
return pf;
}

/**
* 获取清洗
*
* @return
*/
public BPA_GOODSRECIPE Get清洗(int k) {
BPA_GOODSRECIPE pf = new BPA_GOODSRECIPE();
pf.materialType = 1;
pf.processname = "清洗";
pf.processms = "清洗(" + k + ")";
pf.processvalue = "等待(秒)," + k;
return pf;
}

/**
* 获取选中行的变量
*


+ 24
- 3
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyMemoryActivity.java View File

@@ -300,6 +300,8 @@ public class DiyMemoryActivity extends BaseActivity {
{
BPA_GOODSRECIPE data1=Get出菜(time_c);
DataBus.getInstance().bpa_goodsrecipes.add(data1);
BPA_GOODSRECIPE data2 = Get清洗(0);
DataBus.getInstance().bpa_goodsrecipes.add(data2);
MakeRecipe(data1);
ClikTime=time;
}
@@ -401,11 +403,18 @@ public class DiyMemoryActivity extends BaseActivity {
{
BPA_GOODSRECIPE data1=Get位置("最高","炒菜位1");
ExecuteTheRecipe.ExecuteOperationSteps(data1.processname,data1.processvalue);

ExecuteTheRecipe.ExecuteOperationSteps(recipe.processname,recipe.processvalue);
}else
{
ExecuteTheRecipe.ExecuteOperationSteps(recipe.processname,recipe.processvalue);
if(recipe.processname.equals("出菜"))
{
ExecuteTheRecipe.ExecuteOperationSteps(recipe.processname,recipe.processvalue);
BPA_GOODSRECIPE data2 = Get清洗(0);
ExecuteTheRecipe.ExecuteOperationSteps(data2.processname,data2.processvalue);
}else
{
ExecuteTheRecipe.ExecuteOperationSteps(recipe.processname,recipe.processvalue);
}
}
}
isMake=false;
@@ -471,7 +480,19 @@ public class DiyMemoryActivity extends BaseActivity {
pf.processvalue="延迟(秒),"+time;
return pf;
}

/**
* 获取清洗
*
* @return
*/
public BPA_GOODSRECIPE Get清洗(int k) {
BPA_GOODSRECIPE pf = new BPA_GOODSRECIPE();
pf.materialType = 1;
pf.processname = "清洗";
pf.processms = "清洗(" + k + ")";
pf.processvalue = "等待(秒)," + k;
return pf;
}
/**
* 获取主料
* @param wz


Loading…
Cancel
Save