diff --git a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java index a8fae7d2..9955f1a2 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java +++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java @@ -296,7 +296,9 @@ public class ConfigData { public void GetOrganize(Context context) { if (NetworkUtils.checkNetworkAvailable(context)) { //获取店铺信息 - OkGo.>get(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetStore + ConfigName.getInstance().ClientAutoKey).tag(context).execute(new JsonDialogCallback>(context) { + OkGo.>get(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetStore + ConfigName.getInstance().ClientAutoKey) + .tag(context) + .execute(new JsonDialogCallback>(context) { @Override public void onSuccess(Response> response) { ResAPI organize = response.body(); diff --git a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java index 241a0b05..43ff38eb 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -44,7 +44,7 @@ public class ExecuteTheRecipe { /** * 等待超时时间 */ - public static int whileTime = 20; + public static int whileTime = 30; /** * 监听变量值 @@ -120,6 +120,8 @@ public class ExecuteTheRecipe { */ private static void ExecuteMaterialIssuance(String text) { try { + ToastUtils.info("准备下料!!!"); + if (!text.isEmpty()) { //仓号 值 HashMap formulation = new HashMap<>(); @@ -156,7 +158,9 @@ public class ExecuteTheRecipe { Write_PLC_Material(key, value); } - //一直等待下料完成 否则就一直等待 6s超时 + Thread.sleep(200);//等待写入完成 + + //一直等待下料完成 否则就一直等待 40s超时 for (Map.Entry entry : formulation.entrySet()) { Integer num = entry.getKey(); Integer val = entry.getValue(); @@ -253,18 +257,31 @@ public class ExecuteTheRecipe { */ private static void Write_PLC_Material(int num, int val) { try { + ToastUtils.info("准备写入PLC仓号需求:" + num + "," + val/10.0); + String name = "料仓" + num + "下料完成"; ExecuteTheRecipe.WritePLC(name, false, null); + + final boolean[] IsComplete = {false}; + WritePLC("料仓" + num + "需求值", val, new IWriteCallBack() { @Override public void onSuccess() { BottomClick("料仓" + num + "下料"); + IsComplete[0] = true; } @Override public void onFailure(String ErrorMsg) { } }); + long a = System.currentTimeMillis(); + while (!IsComplete[0]) { + if ((System.currentTimeMillis() - a) > 1000 * whileTime) { + break; + } + Thread.sleep(100);//10 *6 + } ToastUtils.info("写入PLC仓号需求:" + num + "," + val/10.0); } catch (Exception ex) { ToastUtils.error("异常信息:" + ex.getMessage()); @@ -289,7 +306,6 @@ public class ExecuteTheRecipe { ToastUtils.info("工序:" + key + "," + value); if (key.contains("(秒)")) { val = Integer.parseInt(value); - Thread.sleep(val * 1000); } else { int writeValue = GetMXValue(key, value); WritePLC(key, writeValue, new IWriteCallBack() { @@ -326,18 +342,23 @@ public class ExecuteTheRecipe { private static void Write_PLC_Location(HashMap data) { try { int val=0; - + ToastUtils.info("准备控制炒锅移动!!!"); for (HashMap.Entry entry : data.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); - ToastUtils.info("工序:" + key + "," + value); if (key.contains("(秒)")) { val = Integer.parseInt(value); - Thread.sleep(val * 1000); } else if (key.contains("速度")) { int writeValue = GetMXValue(key, value); WritePLC(key, writeValue, null); - } else { + } + } + + for (HashMap.Entry entry : data.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + ToastUtils.info("工序:" + key + "," + value); + if (!key.contains("(秒)") && !key.contains("速度")) { //原点位,等待机器移动倒响应位置 BottomClick(value); @@ -378,6 +399,7 @@ public class ExecuteTheRecipe { try { //是否手动 boolean ishand=true; + ToastUtils.info("准备倒入主料!"); //region 判断是否手动 if(ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) @@ -529,13 +551,33 @@ public class ExecuteTheRecipe { { try { + final boolean[] IsComplete = {false}; + long a = System.currentTimeMillis(); + WritePLC(name,true,null); new Handler().postDelayed(new Runnable() { @Override public void run() { - ExecuteTheRecipe.WritePLC(name, false, null); + ExecuteTheRecipe.WritePLC(name, false, new IWriteCallBack() { + @Override + public void onSuccess() { + IsComplete[0]=true; + } + + @Override + public void onFailure(String ErrorMsg) { + IsComplete[0]=true; + } + }); } }, 500); + + while (!IsComplete[0]) { + if ((System.currentTimeMillis() - a) > 1000 * 3) { + break; + } + Thread.sleep(100);//10 *6 + } }catch (Exception ex) { @@ -623,6 +665,7 @@ public class ExecuteTheRecipe { */ private static void Write_PLC_Outdishes(HashMap data) { try { + ToastUtils.info("准备出菜!"); BottomClick("出菜"); diff --git a/app/src/main/java/com/bonait/bnframework/business/MainInit.java b/app/src/main/java/com/bonait/bnframework/business/MainInit.java index 78350243..56f88d16 100644 --- a/app/src/main/java/com/bonait/bnframework/business/MainInit.java +++ b/app/src/main/java/com/bonait/bnframework/business/MainInit.java @@ -284,7 +284,7 @@ public class MainInit { .setOkHttpClient(builder.build()) //建议设置OkHttpClient,不设置将使用默认的 .setCacheMode(CacheMode.NO_CACHE) //全局统一缓存模式,默认不使用缓存,可以不传 .setCacheTime(CacheEntity.CACHE_NEVER_EXPIRE) //全局统一缓存时间,默认永不过期,可以不传 - .setRetryCount(3); //全局统一超时重连次数,默认为三次,那么最差的情况会请求4次(一次原始请求,三次重连请求),不需要可以设置为0 + .setRetryCount(0); //全局统一超时重连次数,默认为三次,那么最差的情况会请求4次(一次原始请求,三次重连请求),不需要可以设置为0 //.addCommonParams(params); //全局公共参数 } diff --git a/app/src/main/res/layout/activity_sz.xml b/app/src/main/res/layout/activity_sz.xml index 2ab4d10b..62b233e2 100644 --- a/app/src/main/res/layout/activity_sz.xml +++ b/app/src/main/res/layout/activity_sz.xml @@ -12,14 +12,15 @@ + app:menu="@menu/system" + android:fitsSystemWindows="true"/> + app:itemIconSize="0dp" + android:fitsSystemWindows="true"/>