Quellcode durchsuchen

现场改动-

tags/old_version_1
fyf vor 1 Jahr
Ursprung
Commit
f8bf6f53b3
5 geänderte Dateien mit 57 neuen und 27 gelöschten Zeilen
  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 Datei anzeigen

@@ -31,5 +31,10 @@
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</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>
</project>

+ 33
- 26
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java Datei anzeigen

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

import androidx.annotation.NonNull;

@@ -147,12 +148,33 @@ public class ExecuteTheRecipe {
}
}
//endregion
//写入PLC
//写入PLC,直接出料,不用等待
for (Map.Entry<Integer, Integer> entry : formulation.entrySet()) {
Integer key = entry.getKey();
Integer value = entry.getValue();
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) {
ToastUtils.error("异常信息:" + ex.getMessage());
@@ -230,6 +252,8 @@ public class ExecuteTheRecipe {
*/
private static void Write_PLC_Material(int num, int val) {
try {
String name = "料仓" + num + "下料完成";
ExecuteTheRecipe.WritePLC(name, false, null);
WritePLC("料仓" + num + "需求值", val, new IWriteCallBack() {
@Override
public void onSuccess() {
@@ -240,24 +264,7 @@ public class ExecuteTheRecipe {
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);

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

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

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

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


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

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

import com.qmuiteam.qmui.util.QMUINotchHelper;

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

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

//QMUINotchHelper.getSafeInsetBottom(activity)

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


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

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


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

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


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

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


Laden…
Abbrechen
Speichern