Browse Source

现场修改

tags/old_version_1
fyf 1 year ago
parent
commit
791be224f6
5 changed files with 61 additions and 14 deletions
  1. +3
    -1
      app/src/main/java/com/bonait/bnframework/business/ConfigData.java
  2. +51
    -8
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  3. +1
    -1
      app/src/main/java/com/bonait/bnframework/business/MainInit.java
  4. +3
    -2
      app/src/main/res/layout/activity_sz.xml
  5. +3
    -2
      app/src/main/res/layout/activity_wh.xml

+ 3
- 1
app/src/main/java/com/bonait/bnframework/business/ConfigData.java View File

@@ -296,7 +296,9 @@ public class ConfigData {
public void GetOrganize(Context context) {
if (NetworkUtils.checkNetworkAvailable(context)) {
//获取店铺信息
OkGo.<ResAPI<OrganizeMode>>get(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetStore + ConfigName.getInstance().ClientAutoKey).tag(context).execute(new JsonDialogCallback<ResAPI<OrganizeMode>>(context) {
OkGo.<ResAPI<OrganizeMode>>get(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetStore + ConfigName.getInstance().ClientAutoKey)
.tag(context)
.execute(new JsonDialogCallback<ResAPI<OrganizeMode>>(context) {
@Override
public void onSuccess(Response<ResAPI<OrganizeMode>> response) {
ResAPI<OrganizeMode> organize = response.body();


+ 51
- 8
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -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<Integer, Integer> formulation = new HashMap<>();
@@ -156,7 +158,9 @@ public class ExecuteTheRecipe {
Write_PLC_Material(key, value);
}

//一直等待下料完成 否则就一直等待 6s超时
Thread.sleep(200);//等待写入完成

//一直等待下料完成 否则就一直等待 40s超时
for (Map.Entry<Integer, Integer> 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<String, String> data) {
try {
int val=0;
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("(秒)")) {
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<String, String> 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<String, String> data) {
try {
ToastUtils.info("准备出菜!");

BottomClick("出菜");



+ 1
- 1
app/src/main/java/com/bonait/bnframework/business/MainInit.java View File

@@ -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); //全局公共参数

}


+ 3
- 2
app/src/main/res/layout/activity_sz.xml View File

@@ -12,14 +12,15 @@

<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/navigation"
android:layout_marginTop="?attr/qmui_topbar_height"
android:layout_marginTop="54dp"
android:layout_width="match_parent"
android:layout_height="@dimen/home_tab_height"
android:layout_gravity="top"
android:background="@drawable/qmui_list_item_bg_with_border_bottom"
app:itemHorizontalTranslationEnabled="false"
app:labelVisibilityMode="labeled"
app:menu="@menu/system" />
app:menu="@menu/system"
android:fitsSystemWindows="true"/>

<com.qmuiteam.qmui.widget.QMUIViewPager
android:layout_marginTop="110dp"


+ 3
- 2
app/src/main/res/layout/activity_wh.xml View File

@@ -9,7 +9,7 @@

<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/navigation"
android:layout_marginTop="?attr/qmui_topbar_height"
android:layout_marginTop="54dp"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_gravity="top"
@@ -18,7 +18,8 @@
app:labelVisibilityMode="labeled"
app:menu="@menu/maintenance"
app:itemIconTint="@null"
app:itemIconSize="0dp"/>
app:itemIconSize="0dp"
android:fitsSystemWindows="true"/>

<com.qmuiteam.qmui.widget.QMUIViewPager
android:id="@+id/viewpager"


Loading…
Cancel
Save