Pārlūkot izejas kodu

44

味魔方Android
fyf pirms 1 gada
vecāks
revīzija
aa429a70f7
2 mainītis faili ar 26 papildinājumiem un 11 dzēšanām
  1. +2
    -1
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  2. +24
    -10
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_manguan_control.java

+ 2
- 1
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java Parādīt failu

@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.ContextWrapper;
import android.media.MediaPlayer;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;

import androidx.annotation.NonNull;
@@ -189,7 +190,7 @@ public class ExecuteTheRecipe {
try
{
WritePLC(name,true,null);
new Handler().postDelayed(new Runnable() {
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
ExecuteTheRecipe.WritePLC(name, false, null);


+ 24
- 10
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_manguan_control.java Parādīt failu

@@ -2,9 +2,11 @@ package com.bonait.bnframework.modules.home.fragment.mode;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
@@ -119,7 +121,7 @@ public class add_manguan_control extends LinearLayout {
@Override
public void onChronometerTick(Chronometer chronometer) {
//如果计时到现在超过了一小时秒 10s
if (SystemClock.elapsedRealtime() - runtime.getBase() > 120 * 1000) {
if (SystemClock.elapsedRealtime() - runtime.getBase() > 20 * 1000) {
StopTime();
}
}
@@ -158,16 +160,28 @@ public class add_manguan_control extends LinearLayout {
ExecuteTheRecipe.WritePLC("手自切换", false, null);
for (BPA_SILOS item:siloslist)
{
int time=item.bValue<=0?5:item.bValue;//默认5秒
ExecuteTheRecipe.WritePLC("手动控制"+item.num,true,null);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ExecuteTheRecipe.WritePLC("手动控制"+item.num,false,null);
mHandler.sendEmptyMessage(0);
i++;
if(!item.name.equals("果糖仓") && !item.name.equals("粉料仓") )
{
int time=item.bValue<=0?5:item.bValue;//默认5秒
ExecuteTheRecipe.WritePLC("手动控制"+item.num,true,null);

try {
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
ExecuteTheRecipe.WritePLC("手动控制"+item.num,false,null);
mHandler.sendEmptyMessage(0);
i++;
}
}, time * 1000);
}catch (Exception ex)
{
Log.d("异常信息", ex.getMessage());
}
}, time * 1000);
}else
{
i++;
}
}

return false;


Notiek ielāde…
Atcelt
Saglabāt