Browse Source

调整测试

master
fyf 11 months ago
parent
commit
163fd4a48d
4 changed files with 146 additions and 39 deletions
  1. +1
    -1
      app/src/main/java/com/bonait/bnframework/business/ExecuteTest.java
  2. +84
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/AutoTestMoreFragment.java
  3. +29
    -37
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/AutoTestOneFragment.java
  4. +32
    -0
      app/src/main/res/layout/fragment_auto_test_more.xml

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

@@ -146,7 +146,7 @@ public class ExecuteTest {
} }
}); });
long a = System.currentTimeMillis(); long a = System.currentTimeMillis();
while (!IsComplete[0]) {
while (!IsComplete[0] && !IsForcedEnd) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) { if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
break; break;
} }


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

@@ -18,12 +18,15 @@ import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;


import com.bonait.bnframework.R; import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTest;
import com.bonait.bnframework.business.ExecuteTheRecipe; import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus; import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.constant.MessageName; import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.db.mode.BPA_GOODS; import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.db.res.MakeStatus; import com.bonait.bnframework.common.db.res.MakeStatus;
import com.bonait.bnframework.common.db.res.StatusMode;
import com.bonait.bnframework.common.helper.I.MyClickListener; import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.image.MyBitmapUtils; import com.bonait.bnframework.common.image.MyBitmapUtils;
import com.bonait.bnframework.common.message.MessageManager; import com.bonait.bnframework.common.message.MessageManager;
@@ -34,7 +37,9 @@ import com.bonait.bnframework.modules.home.fragment.from.Cpxz1Activity;
import com.bonait.bnframework.modules.home.fragment.from.CpxzActivity; import com.bonait.bnframework.modules.home.fragment.from.CpxzActivity;
import com.orhanobut.logger.Logger; import com.orhanobut.logger.Logger;


import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;


import butterknife.BindView; import butterknife.BindView;
@@ -64,7 +69,11 @@ public class AutoTestMoreFragment extends BaseFragment {
@BindView(R.id.jieshutuichu) @BindView(R.id.jieshutuichu)
ImageView jieshutuichu;//结束退出 ImageView jieshutuichu;//结束退出


@BindView(R.id.miaoshu)
EditText miaoshu;//


@BindView(R.id.qingkong)
Button qingkong;//
//endregion //endregion


//region 界面 //region 界面
@@ -130,7 +139,12 @@ public class AutoTestMoreFragment extends BaseFragment {
skipToActivity(Cpxz1Activity.class); skipToActivity(Cpxz1Activity.class);
} }
}); });

qingkong.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ClearMiaosShu();
}
});
DataBus.getInstance().mListener1 = new MyClickListener() { DataBus.getInstance().mListener1 = new MyClickListener() {
@Override @Override
public void clickListener(View v, Object data) { public void clickListener(View v, Object data) {
@@ -178,7 +192,38 @@ public class AutoTestMoreFragment extends BaseFragment {
} }
}).start(); }).start();


new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
//故障信息
for (StatusMode item: ConfigName.getInstance().statusModes)
{
if(ExecuteTheRecipe.getConcurrentHash(item.sort))
{
SetMiaosShu1(item.Name);
}
}

String x1= ConfigName.getInstance().statusModes_电机.get(ExecuteTheRecipe.getConcurrentHash_dj("搅拌电机"));
String x2= ConfigName.getInstance().statusModes_电机.get(ExecuteTheRecipe.getConcurrentHash_dj("翻转电机"));
if(!x1.equals("无故障"))
{
SetMiaosShu1("搅拌电机故障代码:"+x1);
}


if(!x2.equals("无故障"))
{
SetMiaosShu1("翻转电机故障代码:"+x2);
}
Thread.sleep(2000);
} catch (Exception ex) {

}
}
}
}).start();
} }




@@ -267,5 +312,43 @@ public class AutoTestMoreFragment extends BaseFragment {
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent); startActivity(intent);
} }

/**
* 不重复
* @param text
*/
public void SetMiaosShu1(String text) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
String YL= miaoshu.getText().toString();
if(!YL.isEmpty() && YL.contains(text))
{

}else
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
String tempMsg = YL+ formatter.format(date) + ":" + text + "\n";
miaoshu.setText(tempMsg);
ToastUtils.warning(formatter.format(date) + ":" + text);
}
}
});
}

/**
* 清空显示
*
* @param
*/
public void ClearMiaosShu() {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
miaoshu.setText("");
}
});
}
//endregion //endregion
} }

+ 29
- 37
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/AutoTestOneFragment.java View File

@@ -278,41 +278,31 @@ public class AutoTestOneFragment extends BaseFragment {
case 0: case 0:
MakeGKCX_JB(); MakeGKCX_JB();
break; break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
} }
}



//故障信息
for (StatusMode item:ConfigName.getInstance().statusModes)
//故障信息
for (StatusMode item:ConfigName.getInstance().statusModes)
{
if(ExecuteTheRecipe.getConcurrentHash(item.sort))
{ {
if(ExecuteTheRecipe.getConcurrentHash(item.sort))
{
SetMiaosShu1(item.Name);
}
SetMiaosShu1(item.Name);
} }
}


String x1= ConfigName.getInstance().statusModes_电机.get(ExecuteTheRecipe.getConcurrentHash_dj("搅拌电机"));
String x2= ConfigName.getInstance().statusModes_电机.get(ExecuteTheRecipe.getConcurrentHash_dj("翻转电机"));
if(!x1.equals("无故障"))
{
SetMiaosShu1("搅拌电机故障代码:"+x1);
}
String x1= ConfigName.getInstance().statusModes_电机.get(ExecuteTheRecipe.getConcurrentHash_dj("搅拌电机"));
String x2= ConfigName.getInstance().statusModes_电机.get(ExecuteTheRecipe.getConcurrentHash_dj("翻转电机"));
if(!x1.equals("无故障"))
{
SetMiaosShu1("搅拌电机故障代码:"+x1);
}


if(!x2.equals("无故障"))
{
SetMiaosShu1("翻转电机故障代码:"+x2);
}
if(!x2.equals("无故障"))
{
SetMiaosShu1("翻转电机故障代码:"+x2);
} }
Thread.sleep(1000);

Thread.sleep(2000);
} catch (Exception ex) { } catch (Exception ex) {


} }
@@ -770,20 +760,22 @@ public class AutoTestOneFragment extends BaseFragment {
add("八档"); add("八档");
}}; }};
for (String item : Dwei) { for (String item : Dwei) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
jiaredangwei.setText(item + "");
}
});
if (ExecuteTest.IsStart) {
for (jiaobanCount = 0; jiareCount < jiareAllCount; jiareAllCount++) {
if (ExecuteTest.IsStart) {
if (ExecuteTest.IsStart && !ExecuteTest.IsForcedEnd) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
jiaredangwei.setText(item + "");
}
});

for (int i = 0; i < jiareAllCount; i++) {
if (ExecuteTest.IsStart && !ExecuteTest.IsForcedEnd) {
ExecuteTest.ExecuteOperationSteps(ExecuteTest.Get加热(item).processname, ExecuteTest.Get加热(item).processvalue); ExecuteTest.ExecuteOperationSteps(ExecuteTest.Get加热(item).processname, ExecuteTest.Get加热(item).processvalue);
ExecuteTest.ThreadDelay(jiareJR);//加热持续多少秒 ExecuteTest.ThreadDelay(jiareJR);//加热持续多少秒
ExecuteTheRecipe.WritePLC("加热", false, null); ExecuteTheRecipe.WritePLC("加热", false, null);
ExecuteTest.ThreadDelay(jiareLQ * 60);//冷却多少分钟 ExecuteTest.ThreadDelay(jiareLQ * 60);//冷却多少分钟


jiareCount=i+1;
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {


+ 32
- 0
app/src/main/res/layout/fragment_auto_test_more.xml View File

@@ -115,6 +115,38 @@
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>


<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="30dp">

<Button
android:id="@+id/qingkong"
android:layout_width="80dp"
android:layout_height="26dp"
android:layout_alignParentRight="true"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/button1"
android:text="清空显示"
android:textSize="14dp" />
</RelativeLayout>

<EditText
android:id="@+id/miaoshu"
android:layout_width="match_parent"
android:layout_height="180dp"
android:background="@drawable/input_bj1"
android:gravity="top"
android:inputType="textMultiLine"
android:padding="3dp"
android:scrollHorizontally="false"
android:text=""
android:textSize="12dp" />
</LinearLayout>


<RelativeLayout <RelativeLayout
android:id="@+id/showbuttomtop" android:id="@+id/showbuttomtop"


Loading…
Cancel
Save