Browse Source

现场改动-

tags/old_version_1
fyf 1 year ago
parent
commit
f8bf6f53b3
5 changed files with 57 additions and 27 deletions
  1. +5
    -0
      .idea/jarRepositories.xml
  2. +33
    -26
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  3. +5
    -0
      app/src/main/java/com/bonait/bnframework/common/helper/ActiveMax.java
  4. +13
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java
  5. +1
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java

+ 5
- 0
.idea/jarRepositories.xml View File

@@ -31,5 +31,10 @@
<option name="name" value="MavenRepo" /> <option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" /> <option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository> </remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://maven.aliyun.com/nexus/content/repositories/releases/" />
</remote-repository>
</component> </component>
</project> </project>

+ 33
- 26
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.ContextWrapper; import android.content.ContextWrapper;
import android.os.Handler; import android.os.Handler;
import android.util.Log;


import androidx.annotation.NonNull; import androidx.annotation.NonNull;


@@ -147,12 +148,33 @@ public class ExecuteTheRecipe {
} }
} }
//endregion //endregion
//写入PLC
//写入PLC,直接出料,不用等待
for (Map.Entry<Integer, Integer> entry : formulation.entrySet()) { for (Map.Entry<Integer, Integer> entry : formulation.entrySet()) {
Integer key = entry.getKey(); Integer key = entry.getKey();
Integer value = entry.getValue(); Integer value = entry.getValue();
Write_PLC_Material(key, value); Write_PLC_Material(key, value);
} }

//一直等待下料完成 否则就一直等待 6s超时
for (Map.Entry<Integer, Integer> entry : formulation.entrySet()) {
Integer num = entry.getKey();
Integer val = entry.getValue();
String name = "料仓" + num + "下料完成";
final boolean[] IsComplete = {false};
long a = System.currentTimeMillis();
while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
break;
} else {
Object sb = ReadPLC(name);// ListeningValue.get(name);
if (sb != null) {
IsComplete[0] = (boolean) (sb);
}
}
Thread.sleep(100);//10 *6
}
ToastUtils.info(name);
}
} }
} catch (Exception ex) { } catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage()); ToastUtils.error("异常信息:" + ex.getMessage());
@@ -230,6 +252,8 @@ public class ExecuteTheRecipe {
*/ */
private static void Write_PLC_Material(int num, int val) { private static void Write_PLC_Material(int num, int val) {
try { try {
String name = "料仓" + num + "下料完成";
ExecuteTheRecipe.WritePLC(name, false, null);
WritePLC("料仓" + num + "需求值", val, new IWriteCallBack() { WritePLC("料仓" + num + "需求值", val, new IWriteCallBack() {
@Override @Override
public void onSuccess() { public void onSuccess() {
@@ -240,24 +264,7 @@ public class ExecuteTheRecipe {
public void onFailure(String ErrorMsg) { public void onFailure(String ErrorMsg) {
} }
}); });

//一直等待下料完成 否则就一直等待 6s超时
String name = "料仓" + num + "下料完成";
final boolean[] IsComplete = {false};
long a = System.currentTimeMillis();
while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
break;
} else {
Object sb = ListeningValue.get(name);
if (sb != null) {
IsComplete[0] = (boolean) (sb);
}
}
Thread.sleep(100);//10 *6
}
ToastUtils.info("写入PLC仓号需求:" + num + "," + val); ToastUtils.info("写入PLC仓号需求:" + num + "," + val);

} catch (Exception ex) { } catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage()); ToastUtils.error("异常信息:" + ex.getMessage());
} }
@@ -333,7 +340,7 @@ public class ExecuteTheRecipe {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) { if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
break; break;
} else { } else {
Object sb = ListeningValue.get(name);
Object sb = ReadPLC(name);//ListeningValue.get(name);
if (sb != null) { if (sb != null) {
IsComplete[0] = (boolean) (sb); IsComplete[0] = (boolean) (sb);
} }
@@ -441,6 +448,7 @@ public class ExecuteTheRecipe {


//1.去某一个位置 //1.去某一个位置
BottomClick("平移-去"+writeValue); BottomClick("平移-去"+writeValue);
Log.d("平移", "平移-去"+writeValue);
//一直等待机器移动到该位置,否则就一直等待 6s超时 //一直等待机器移动到该位置,否则就一直等待 6s超时
String name = "平移轴在"+writeValue; String name = "平移轴在"+writeValue;
final boolean[] IsComplete = {false}; final boolean[] IsComplete = {false};
@@ -449,13 +457,14 @@ public class ExecuteTheRecipe {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) { if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
break; break;
} else { } else {
Object sb = ListeningValue.get(name);
Object sb =ReadPLC(name);// ListeningValue.get(name);
if (sb != null) { if (sb != null) {
IsComplete[0] = (boolean) (sb); IsComplete[0] = (boolean) (sb);
} }
} }
Thread.sleep(100);//10 *6 Thread.sleep(100);//10 *6
} }
Log.d("平移", name+"已经就位");


//2.给倒菜启动 //2.给倒菜启动
BottomClick("主料"); BottomClick("主料");
@@ -466,16 +475,15 @@ public class ExecuteTheRecipe {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) { if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
break; break;
} else { } else {
Object sb = ListeningValue.get(name);
Object sb =ReadPLC(name);// ListeningValue.get(name);
if (sb != null) { if (sb != null) {
IsComplete[0] = (boolean) (sb); IsComplete[0] = (boolean) (sb);
} }
} }
Thread.sleep(100);//10 *6 Thread.sleep(100);//10 *6
} }
//
ToastUtils.info("主料倒入完成,继续制作!"); ToastUtils.info("主料倒入完成,继续制作!");
BottomClick("平移-去1号位");
} }
} }
} catch (Exception ex) { } catch (Exception ex) {
@@ -589,8 +597,7 @@ public class ExecuteTheRecipe {
} }
} }
BottomClick("出菜"); BottomClick("出菜");
WritePLC("搅拌", false, null);
WritePLC("加热", false, null);

//一直等待机器移动到该位置,否则就一直等待 6s超时 //一直等待机器移动到该位置,否则就一直等待 6s超时
String name = "出餐启动反馈"; String name = "出餐启动反馈";
final boolean[] IsComplete = {false}; final boolean[] IsComplete = {false};
@@ -599,7 +606,7 @@ public class ExecuteTheRecipe {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) { if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
break; break;
} else { } else {
Object sb = ListeningValue.get(name);
Object sb =ReadPLC(name);//ListeningValue.get(name);
if (sb != null) { if (sb != null) {
IsComplete[0] = (boolean) (sb); IsComplete[0] = (boolean) (sb);
} }


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

@@ -5,6 +5,8 @@ import android.os.Build;
import android.view.View; import android.view.View;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;


import com.qmuiteam.qmui.util.QMUINotchHelper;

import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;


@@ -30,6 +32,9 @@ public class ActiveMax {
{ {
activities.add(activity); activities.add(activity);
} }

//QMUINotchHelper.getSafeInsetBottom(activity)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。 // 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。


+ 13
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java View File

@@ -392,17 +392,29 @@ public class Home1Fragment extends BaseFragment {
//获取工艺 //获取工艺
ArrayList<BPA_GOODSRECIPE> goodsrecipes = QueryDB.GetGoodsSrecipeID(good.id); ArrayList<BPA_GOODSRECIPE> goodsrecipes = QueryDB.GetGoodsSrecipeID(good.id);
for (BPA_GOODSRECIPE item : goodsrecipes) { for (BPA_GOODSRECIPE item : goodsrecipes) {
ExecuteTheRecipe.Execute(item);
boolean status= ExecuteTheRecipe.Execute(item);
} }


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

ExecuteTheRecipe.WritePLC("搅拌", false, null);
ExecuteTheRecipe.WritePLC("加热", false, null);
ExecuteTheRecipe.BottomClick("平移-去1号位");
Activity activity = getActivity(); Activity activity = getActivity();
if (activity != null) { if (activity != null) {
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
SetBottonStatus(false); SetBottonStatus(false);
if(ExecuteTheRecipe.IsForcedEnd)//强制结束
{
ToastUtils.info("客官,当前菜品已强制结束!!!");
//初始化
ExecuteTheRecipe.BottomClick("初始化");
}
} }
}); });
} }


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

@@ -491,6 +491,7 @@ public class DiyActivity extends BaseActivity {
QueryDB.AddGoodsSrecipe(item); QueryDB.AddGoodsSrecipe(item);
} }
ToastUtils.info("菜谱生成成功!"); ToastUtils.info("菜谱生成成功!");
MessageManager.getInstance().sendMessage(MessageName.ScGood,"Good");
dialog.dismiss(); dialog.dismiss();
} }
}); });


Loading…
Cancel
Save