Explorar el Código

更新界面12321

茶饮新(现场)
fyf hace 1 año
padre
commit
ec367a6727
Se han modificado 36 ficheros con 976 adiciones y 3093 borrados
  1. +54
    -0
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  2. +80
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  3. +91
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java
  4. +15
    -0
      app/src/main/java/com/bonait/bnframework/common/db/res/Res_PLCADDRESS1.java
  5. +107
    -0
      app/src/main/java/com/bonait/bnframework/common/helper/AutoNextLineLinearLayout.java
  6. +2
    -0
      app/src/main/java/com/bonait/bnframework/common/tabbar/MainNavigateTabBar.java
  7. +0
    -236
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java
  8. +0
    -248
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationActivity.java
  9. +0
    -13
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java
  10. +125
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/devstatus_adapter.java
  11. +0
    -957
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java
  12. +0
    -113
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home2Fragment.java
  13. +0
    -68
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home3Fragment.java
  14. +0
    -17
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/JcsjglActivity.java
  15. +3
    -4
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/RealTimeActivity.java
  16. +0
    -21
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java
  17. +0
    -2
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SzActivity.java
  18. +0
    -2
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/WhActivity.java
  19. +3
    -3
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_lsjy_fragment.java
  20. +14
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_sdkz_fragment.java
  21. +148
    -14
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java
  22. +79
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/sdkz_control.java
  23. +27
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/tab_control.java
  24. +0
    -1
      app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java
  25. +0
    -14
      app/src/main/java/com/bonait/bnframework/modules/welcome/activity/WelcomeActivity.java
  26. +0
    -27
      app/src/main/res/layout/activity_bottom_navigation.xml
  27. +0
    -44
      app/src/main/res/layout/activity_bottom_navigation2.xml
  28. +13
    -16
      app/src/main/res/layout/activity_realtime.xml
  29. +1
    -18
      app/src/main/res/layout/activity_systemparameter.xml
  30. +0
    -999
      app/src/main/res/layout/fragment_home1.xml
  31. +0
    -228
      app/src/main/res/layout/fragment_home2.xml
  32. +0
    -39
      app/src/main/res/layout/fragment_home3.xml
  33. +11
    -4
      app/src/main/res/layout/fragment_jiaoyan_sdkz.xml
  34. +172
    -4
      app/src/main/res/layout/fragment_jiaoyan_zdqx.xml
  35. +21
    -0
      app/src/main/res/layout/item/layout/tab_item.xml
  36. +10
    -0
      app/src/main/res/layout/item/layout/wrapanl_sdkz_item.xml

+ 54
- 0
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java Ver fichero

@@ -102,6 +102,11 @@ public class ExecuteTheRecipe {
*/
public static IRun OnIngredientButtonPressedNotify;

/**
* 清洗完成
*/
public static IRun CleaningComplete;

//endregion

//region 强制结束
@@ -1017,6 +1022,43 @@ public class ExecuteTheRecipe {
}


/**
* 读PLC数据
*
* @return
*/
public static void WritePLCSD(String address ,boolean value, IWriteCallBack callback) {
try {
if (ConfigName.getInstance().PlcIsConnect) {
ModbusTcpServer.get().WriteBool(address, (boolean) value, callback);
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
} finally {
}
}

/**
* 读PLC数据
*
* @return
*/
public static boolean ReadPLCSD(String address) {
final boolean[] ReturnsVariable = {false};
try {
if (ConfigName.getInstance().PlcIsConnect) {
ModbusTcpServer.get().ReadBool(address, 1, val -> {
ReturnsVariable[0] = val[0];
});
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
} finally {
return ReturnsVariable[0];
}
}


/**
* 获取实时状态
*
@@ -1142,6 +1184,18 @@ public class ExecuteTheRecipe {

//校准校正完成信号 M0.7
CompleteListen( "校准完成", OnChargeMixtureComNotPar);

//清洗完成标志
Object obj= ExecuteTheRecipe.ReadPLC("自动清洗完成");
if (obj!=null) {
if((boolean) obj)
{
if(CleaningComplete!=null)
{
CleaningComplete.Run();
}
}
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
} finally {


+ 80
- 0
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java Ver fichero

@@ -11,6 +11,7 @@ import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.db.mode.BPA_USER;
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS;
import com.bonait.bnframework.common.db.res.Res_PLCADDRESS1;
import com.bonait.bnframework.common.db.res.StatusMode;
import com.bonait.bnframework.common.model.AddrType;
import com.bonait.bnframework.common.model.mode.CloudGood;
@@ -401,6 +402,18 @@ public class ConfigName {
add(new Res_PLCADDRESS("果糖右温度下限", "VD400", 1, 1));
add(new Res_PLCADDRESS("果糖右温度加热", "M104.0", 1, 0));

//自动清洗
add(new Res_PLCADDRESS("自动清洗", "-------------", 0, 0));
add(new Res_PLCADDRESS("排水阀排水时间", "VW140", 1, 1));
add(new Res_PLCADDRESS("排水阀进水时间", "VW142", 1, 1));
add(new Res_PLCADDRESS("清洗预加热时间", "VW144", 1, 1));
add(new Res_PLCADDRESS("加清洗剂时间", "VW146", 1, 1));
add(new Res_PLCADDRESS("循环清洗时间", "VW148", 1, 1));
add(new Res_PLCADDRESS("清洗模式", "M0.4", 1, 1));
add(new Res_PLCADDRESS("自动清洗开始", "M0.5", 1, 1));
add(new Res_PLCADDRESS("自动清洗完成", "M0.6", 1, 1));


//手动控制
add(new Res_PLCADDRESS("手动控制", "-------------", 0, 0));
add(new Res_PLCADDRESS("M_外置仓1正转", "M50.0", 1, 1));
@@ -468,6 +481,38 @@ public class ConfigName {
add(new ResSilosModel("果糖仓", 12));
}};

/**
* 大炒基础PLC模型
*/
public List<Res_PLCADDRESS1> PlcAddress_奶茶机_手动=new ArrayList<Res_PLCADDRESS1>(){{

//硬件设备 初始化
add(new Res_PLCADDRESS1("-------------","","加热开关控制",1,0));
add(new Res_PLCADDRESS1("M11.7","M51.7","果糖仓加热(左)",1,1));
add(new Res_PLCADDRESS1("M12.0","M52.0","果糖仓加热(右)",1,1));
add(new Res_PLCADDRESS1("M12.1","M52.1","清洗池加热",1,1));
add(new Res_PLCADDRESS1("-------------","","果糖仓泵/清洗池泵",1,0));
add(new Res_PLCADDRESS1("M11.3","M51.3","进水阀",1,1));
add(new Res_PLCADDRESS1("M11.2","M51.2","排水阀(开)",1,1));
add(new Res_PLCADDRESS1("M12.2","M52.2","排水阀(关)",1,1));
add(new Res_PLCADDRESS1("M11.4","M51.4","清洗池泵",1,1));
add(new Res_PLCADDRESS1("M11.5","M51.5","果糖泵(左)",1,1));
add(new Res_PLCADDRESS1("M11.6","M51.6","果糖泵(右)",1,1));
add(new Res_PLCADDRESS1("-------------","","离心泵控制",1,0));
add(new Res_PLCADDRESS1("M10.5","M50.5","离心泵(一)",1,1));
add(new Res_PLCADDRESS1("M10.6","M50.6","离心泵(二)",1,1));
add(new Res_PLCADDRESS1("M10.7","M50.7","离心泵(三)",1,1));
add(new Res_PLCADDRESS1("M11.0","M51.0","离心泵(四)",1,1));
add(new Res_PLCADDRESS1("M11.1","M51.1","离心泵(五)",1,1));
add(new Res_PLCADDRESS1("-------------","","蠕动泵控制",1,0));
add(new Res_PLCADDRESS1("M10.0","M50.0","蠕动泵(一)",1,1));
add(new Res_PLCADDRESS1("M10.1","M50.1","蠕动泵(二)",1,1));
add(new Res_PLCADDRESS1("M10.2","M50.2","蠕动泵(三)",1,1));
add(new Res_PLCADDRESS1("M10.3","M50.3","蠕动泵(四)",1,1));
add(new Res_PLCADDRESS1("M10.4","M50.4","蠕动泵(五)",1,1));
}};


/**
* 配料吧台基础PLC模型
*/
@@ -699,7 +744,42 @@ public class ConfigName {
add(new ResSilosModel("牛油仓", 13));
}};

/**
* 大炒基础PLC模型
*/
public List<Res_PLCADDRESS1> PlcAddress_配料吧台_手动=new ArrayList<Res_PLCADDRESS1>(){{

//硬件设备 初始化
add(new Res_PLCADDRESS1("-------------","","酱油仓/猪油仓",1,0));
add(new Res_PLCADDRESS1("M51.7","M101.7","酱油仓控制",0,1));
add(new Res_PLCADDRESS1("M52.0","M102.0","醋仓控制",0,1));
add(new Res_PLCADDRESS1("M52.1","M102.1","猪油仓控制",0,1));
add(new Res_PLCADDRESS1("M52.2","M102.2","牛油仓控制",0,1));
add(new Res_PLCADDRESS1("M53.6","M103.6","猪油管道保温",1,1));
add(new Res_PLCADDRESS1("M53.7","M103.7","牛油管道保温",1,1));
add(new Res_PLCADDRESS1("-------------","","外置仓",1,0));
add(new Res_PLCADDRESS1("M50.0","M100.0","外置仓正转(1)",1,1));
add(new Res_PLCADDRESS1("M50.1","M100.1","外置仓正转(2)",1,1));
add(new Res_PLCADDRESS1("M50.2","M100.2","外置仓正转(3)",1,1));
add(new Res_PLCADDRESS1("M50.3","M100.3","外置仓正转(4)",1,1));
add(new Res_PLCADDRESS1("M50.4","M100.4","外置仓正转(5)",1,1));
add(new Res_PLCADDRESS1("M50.5","M100.5","外置仓正转(6)",1,1));
add(new Res_PLCADDRESS1("M50.6","M100.6","外置仓反转(1)",1,1));
add(new Res_PLCADDRESS1("M50.7","M100.7","外置仓反转(2)",1,1));
add(new Res_PLCADDRESS1("M51.0","M101.0","外置仓反转(3)",1,1));
add(new Res_PLCADDRESS1("M51.1","M101.1","外置仓反转(4)",1,1));
add(new Res_PLCADDRESS1("M51.2","M101.2","外置仓反转(5)",1,1));
add(new Res_PLCADDRESS1("M51.3","M101.3","外置仓反转(6)",1,1));
add(new Res_PLCADDRESS1("-------------","","粉料仓",0,0));
add(new Res_PLCADDRESS1("M51.4","M101.4","粉料仓控制(1)",0,1));
add(new Res_PLCADDRESS1("M51.5","M101.5","粉料仓控制(2)",0,1));
add(new Res_PLCADDRESS1("M51.6","M101.6","粉料仓控制(3)",0,1));
add(new Res_PLCADDRESS1("-------------","","水池",1,0));
add(new Res_PLCADDRESS1("M53.4","M103.4","水池进水阀",1,1));
add(new Res_PLCADDRESS1("M53.5","M103.5","水池排水阀",1,1));
add(new Res_PLCADDRESS1("M54.0","M104.0","水池加热",1,1));

}};
/**
* 根据名称获取变量
*


+ 91
- 0
app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java Ver fichero

@@ -1,6 +1,8 @@
package com.bonait.bnframework.common.constant;

import android.app.Activity;
import android.content.Intent;
import android.widget.LinearLayout;

import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
@@ -14,6 +16,7 @@ import com.bonait.bnframework.common.db.mode.BPA_SUBORDER;
import com.bonait.bnframework.common.db.res.MakeStatus;
import com.bonait.bnframework.common.db.res.ResGoodsMake;
import com.bonait.bnframework.common.db.res.ResGoodsRecipe;
import com.bonait.bnframework.common.db.res.Res_PLCADDRESS1;
import com.bonait.bnframework.common.db.res.SilosLsjyMode;
import com.bonait.bnframework.common.db.res.StatusMode;
import com.bonait.bnframework.common.db.res.lcMode;
@@ -25,6 +28,8 @@ import com.bonait.bnframework.modules.home.adapter.lc_adapter;
import com.bonait.bnframework.modules.home.adapter.lsjy_adapter;
import com.bonait.bnframework.modules.home.adapter.sp_adapter;
import com.bonait.bnframework.modules.home.adapter.wdsz_adapter;
import com.bonait.bnframework.modules.home.fragment.mode.sdkz_control;
import com.bonait.bnframework.modules.home.fragment.mode.tab_control;

import java.util.ArrayList;
import java.util.HashMap;
@@ -376,4 +381,90 @@ public class DataBus {
}
}
//endregion

//region 手动控制
public LinearLayout sdkz_linrarlaout=null;
public Activity activity;
public void GetSDKZ(LinearLayout _layout, Activity sdkz_activity)
{
if(_layout!=null)
{
if(sdkz_linrarlaout==null)
{
sdkz_linrarlaout=_layout;
activity=sdkz_activity;
}
}

if(sdkz_linrarlaout!=null)
{
sdkz_linrarlaout.removeAllViews();
List<Res_PLCADDRESS1> plcaddresses=new ArrayList<>();
if (ConfigName.getInstance().versionSelectionEnum.equals("配料吧台")) {
for (Res_PLCADDRESS1 item : ConfigName.getInstance().PlcAddress_配料吧台_手动) {
if(item.address.equals("-------------"))//这是标题
{
if(plcaddresses.size()>0)
{
sdkz_control sdkz = new sdkz_control(sdkz_linrarlaout.getContext(), null, plcaddresses,activity,true);
sdkz_linrarlaout.addView(sdkz);
}
plcaddresses=new ArrayList<>();
tab_control tab = new tab_control(sdkz_linrarlaout.getContext(), null, item.name);
sdkz_linrarlaout.addView(tab);
}else
{
plcaddresses.add(item);
}
}
if(plcaddresses.size()>0)
{
sdkz_control sdkz = new sdkz_control(sdkz_linrarlaout.getContext(), null, plcaddresses,activity,true);
sdkz_linrarlaout.addView(sdkz);
}
}else
{
for (Res_PLCADDRESS1 item : ConfigName.getInstance().PlcAddress_奶茶机_手动) {
if(item.address.equals("-------------"))//这是标题
{
if(plcaddresses.size()>0)
{
sdkz_control sdkz = new sdkz_control(sdkz_linrarlaout.getContext(), null, plcaddresses,activity,true);
sdkz_linrarlaout.addView(sdkz);
}
plcaddresses=new ArrayList<>();
tab_control tab = new tab_control(sdkz_linrarlaout.getContext(), null, item.name);
sdkz_linrarlaout.addView(tab);
}else
{
plcaddresses.add(item);
}
}
if(plcaddresses.size()>0)
{
sdkz_control sdkz = new sdkz_control(sdkz_linrarlaout.getContext(), null, plcaddresses,activity,true);
sdkz_linrarlaout.addView(sdkz);
}
}
}
}
//endregion

//region 设备状态
/**
* 设备状态列表
*/
public List<StatusMode> statusModes = new ArrayList<StatusMode>();

public void Sbzt()
{
if (ConfigName.getInstance().versionSelectionEnum.equals("配料吧台"))
{

}else
{

}
}
//endregion
}

+ 15
- 0
app/src/main/java/com/bonait/bnframework/common/db/res/Res_PLCADDRESS1.java Ver fichero

@@ -0,0 +1,15 @@
package com.bonait.bnframework.common.db.res;

import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS;

public class Res_PLCADDRESS1 extends BPA_PLCADDRESS {
public Res_PLCADDRESS1( String _address,String _zd_address,String _name, int _isread, int _iswrite)
{
this.name=_name;
this.address=_address;
this.zd_address=_zd_address;
this.isread=_isread;
this.iswrite=_iswrite;
this.val=false;
}
}

+ 107
- 0
app/src/main/java/com/bonait/bnframework/common/helper/AutoNextLineLinearLayout.java Ver fichero

@@ -0,0 +1,107 @@
package com.bonait.bnframework.common.helper;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;

import java.util.Hashtable;

/**
* 自动换行的LinearLayout
*/
public class AutoNextLineLinearLayout extends LinearLayout {

int mLeft, mRight, mTop, mBottom;
Hashtable map = new Hashtable();

public AutoNextLineLinearLayout(Context context) {
super(context);
}

public AutoNextLineLinearLayout(Context context, int horizontalSpacing, int verticalSpacing) {
super(context);
}

public AutoNextLineLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

int mWidth = MeasureSpec.getSize(widthMeasureSpec);
int mCount = getChildCount();
int mX = 0;
int mY = 0;
mLeft = 0;
mRight = 0;
mTop = 5;
mBottom = 0;

int j = 0;

for (int i = 0; i < mCount; i++) {
final View child = getChildAt(i);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) child.getLayoutParams();
child.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
// 此处增加onlayout中的换行判断,用于计算所需的高度
int childw = child.getMeasuredWidth()+params.leftMargin + params.rightMargin;
int childh = child.getMeasuredHeight();
mX += childw; // 将每次子控件宽度进行统计叠加,如果大于设定的高度则需要换行,高度即Top坐标也需重新设置

Position position = new Position();
mLeft = getPosition(i - j, i);
mRight = mLeft + child.getMeasuredWidth();
if (mX >= mWidth) {
mX = childw;
mY += childh;
j = i;
mLeft = 0;
mRight = mLeft + child.getMeasuredWidth();
mTop = mY + params.topMargin;
// PS:如果发现高度还是有问题就得自己再细调了
}
mBottom = mTop + child.getMeasuredHeight()+params.bottomMargin;
mY = mTop; // 每次的高度必须记录 否则控件会叠加到一起
position.left = mLeft;
position.top = mTop + 3;
position.right = mRight;
position.bottom = mBottom;
map.put(child, position);
}
setMeasuredDimension(mWidth, mBottom);
}

@Override
protected LayoutParams generateDefaultLayoutParams() {
return new LayoutParams(0, 0); // default of 1px spacing
}

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {

int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
Position pos = (Position) map.get(child);
if (pos != null) {
child.layout(pos.left, pos.top, pos.right, pos.bottom);
} else {
Log.i("MyLayout", "error");
}
}
}

private static class Position {
int left, top, right, bottom;
}

public int getPosition(int IndexInRow, int childIndex) {
if (IndexInRow > 0) {
return getPosition(IndexInRow - 1, childIndex - 1) + getChildAt(childIndex - 1).getMeasuredWidth()+30;
}
return getPaddingLeft();
}
}

+ 2
- 0
app/src/main/java/com/bonait/bnframework/common/tabbar/MainNavigateTabBar.java Ver fichero

@@ -360,6 +360,8 @@ public class MainNavigateTabBar extends LinearLayout implements View.OnClickList
DataBus.getInstance().GetSilosLsjy();
//刷新温度控制
DataBus.getInstance().GetWdsz();
//刷新手动控制

}
}



+ 0
- 236
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java Ver fichero

@@ -1,236 +0,0 @@
package com.bonait.bnframework.modules.home.activity;

import android.os.Bundle;
import androidx.annotation.NonNull;

import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.helper.I.IThread;
import com.bonait.bnframework.common.helper.MessageLog;
import com.bonait.bnframework.common.helper.ThreadManager;
import com.bonait.bnframework.common.modbus.ModbusTcpServer;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.modules.home.fragment.DingDanfragment;
import com.bonait.bnframework.modules.home.fragment.GongnengFragment;
import com.bonait.bnframework.modules.home.fragment.JiaoYanFragment;
import com.google.android.material.bottomnavigation.BottomNavigationView;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import android.util.Log;
import android.view.KeyEvent;
import android.view.MenuItem;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.message.MessageLooper;
import com.bonait.bnframework.common.message.MessageManager;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.fragment.Home1Fragment;
import com.bonait.bnframework.modules.home.fragment.Home2Fragment;
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter;
import com.bonait.bnframework.modules.mine.fragment.MyFragment;
import com.lzy.okgo.OkGo;
import com.qmuiteam.qmui.widget.QMUIViewPager;

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

import butterknife.BindView;
import butterknife.ButterKnife;

public class BottomNavigation2Activity extends BaseActivity {


@BindView(R.id.navigation)
BottomNavigationView bottomNavigationView;
@BindView(R.id.viewpager)
QMUIViewPager viewPager;

private MenuItem menuItem;
private long exitTime = 0;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bottom_navigation2);
ButterKnife.bind(this);

initFragment();
viewPager.addOnPageChangeListener(pageChangeListener);
// 设置viewPager缓存多少个fragment
viewPager.setOffscreenPageLimit(3);
bottomNavigationView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
Init();
}

@Override
protected void onDestroy() {
ConfigData.getInstance().ColsePLC();
//AliyunIOTManager.getInstance().CloseDev();
super.onDestroy();
}

/**
* viewPager里添加fragment
*/
private void initFragment() {
List<Fragment> fragmentList= new ArrayList<>();
fragmentList.add(new Home2Fragment());
fragmentList.add(new Home1Fragment());
fragmentList.add(new MyFragment());
FragmentAdapter fragmentAdapter = new FragmentAdapter(getSupportFragmentManager(),fragmentList);
// fragmentAdapter.addFragment(new Home2Fragment());
// fragmentAdapter.addFragment(new Home1Fragment());
// fragmentAdapter.addFragment(new MyFragment());
viewPager.setAdapter(fragmentAdapter);

MessageManager.getInstance().registerMessageReceiver(this, MessageName.SelectZY, new MessageLooper.OnMessageListener() {
@Override
public void onMessage(Object msg) {
if (msg != null) {
viewPager.setCurrentItem(1);
}
}
});
}

//-------------------------配置viewPager与fragment关联----------------------------//

/**
* 配置bottom底部菜单栏监听器,手指点击底部菜单监听
*/
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {

@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.bottom_navigation_1:
viewPager.setCurrentItem(0);
return true;
case R.id.bottom_navigation_2:
viewPager.setCurrentItem(1);
return true;
case R.id.bottom_navigation_3:
viewPager.setCurrentItem(2);
return true;
}
return false;
}
};


/**
* 配置ViewPager监听器,手指滑动监听
*/
private ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
MenuItem menuItem = bottomNavigationView.getMenu().getItem(position);
}

@Override
public void onPageSelected(int position) {
menuItem = bottomNavigationView.getMenu().getItem(position);
menuItem.setChecked(true);
}

@Override
public void onPageScrollStateChanged(int state) {

}
};

@Override
protected boolean canDragBack() {
return viewPager.getCurrentItem() == 0;
}

/**
* 重写返回键,实现双击退出程序效果
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (System.currentTimeMillis() - exitTime > 2000) {
ToastUtils.normal("再按一次退出程序");
exitTime = System.currentTimeMillis();
} else {
OkGo.getInstance().cancelAll();
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
ActivityLifecycleManager.get().appExit();
}
return true;
}
return super.onKeyDown(keyCode, event);
}

/**
* 初始化
*/
public void Init()
{
//1.同步时间
NetworkUtils.SynchronizationTime();
//主持
ConfigData.getInstance().GetOrganize(this);
//判断连接环境
ConfigData.getInstance().ToggleEnvironment();
//2.初始化PLC
ReconnectModbus();
//初始化阿里云连接
//AliyunIOTManager.getInstance().OpenDev(this);
}

/**
* 重新连接plc
*/
public void ReconnectModbus()
{
try {

ThreadManager.Get().StartLong("PLC断线重连线程", true, new IThread() {
@Override
public void Run() throws InterruptedException {
try {
if(ConfigName.getInstance().PlcIsConnect)
{
//ping 不通
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address,1,1);
if(!status) //ping 不通 连接
{
MessageLog.ShowInfo("PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcIsConnect=false;
}
}else
{
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address,1,1);
if(status)
{
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!");
ModbusTcpServer.ConnectPLC();
}else
{
MessageLog.ShowInfo("PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcIsConnect=false;
}
}
Thread.sleep(10000);
} catch (Exception e) {
Log.i("PLC", "PLC重连接失败!"+e.getMessage());
}
}
@Override
public void RunComplete() throws InterruptedException {
}
});
}catch (Exception e) {
MessageLog.ShowInfo("重新连接Modbus异常," +e.getMessage());
}
}
}

+ 0
- 248
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationActivity.java Ver fichero

@@ -1,248 +0,0 @@
package com.bonait.bnframework.modules.home.activity;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.ViewPager;

import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;

import com.bonait.bnframework.R;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.fragment.Home1Fragment;
import com.bonait.bnframework.modules.home.fragment.Home2Fragment;
import com.bonait.bnframework.modules.mine.fragment.MyFragment;
import com.lzy.okgo.OkGo;
import com.qmuiteam.qmui.util.QMUIResHelper;
import com.qmuiteam.qmui.widget.QMUIPagerAdapter;
import com.qmuiteam.qmui.widget.QMUIViewPager;
import com.qmuiteam.qmui.widget.tab.QMUITab;
import com.qmuiteam.qmui.widget.tab.QMUITabBuilder;
import com.qmuiteam.qmui.widget.tab.QMUITabSegment;

import butterknife.BindView;
import butterknife.ButterKnife;

public class BottomNavigationActivity extends BaseActivity {

@BindView(R.id.main_view_pager)
QMUIViewPager mViewPager;
@BindView(R.id.main_tabs)
QMUITabSegment mTabSegment;

private Context context;
private long exitTime = 0;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bottom_navigation);
ButterKnife.bind(this);

context = this;

// 初始化tabs
initTabs();
// 初始化viewPager,并填充fragment
initPagers();
}

/**
* 初始化tab
* */
private void initTabs() {
// int normalColor = QMUIResHelper.getAttrColor(context, R.attr.qmui_config_color_gray_6);
// int selectColor = QMUIResHelper.getAttrColor(context, R.attr.qmui_config_color_blue);
// mTabSegment.setDefaultNormalColor(normalColor);
// mTabSegment.setDefaultSelectedColor(selectColor);
QMUITabBuilder tabBuilder =mTabSegment.tabBuilder().setGravity(Gravity.CENTER);
QMUITab home = tabBuilder
.setNormalDrawable(ContextCompat.getDrawable(context, R.mipmap.icon_tabbar_component))
.setSelectedDrawable(ContextCompat.getDrawable(context, R.mipmap.icon_tabbar_component_selected))
.setText("主页")
.build(context);
QMUITab Lab = tabBuilder
.setNormalDrawable(ContextCompat.getDrawable(context, R.mipmap.icon_tabbar_component))
.setSelectedDrawable(ContextCompat.getDrawable(context, R.mipmap.icon_tabbar_component_selected))
.setText("烹饪")
.build(context);
QMUITab My = tabBuilder
.setNormalDrawable(ContextCompat.getDrawable(context, R.mipmap.icon_tabbar_component))
.setSelectedDrawable(ContextCompat.getDrawable(context, R.mipmap.icon_tabbar_component_selected))
.setText("我的")
.build(context);
mTabSegment.addTab(home)
.addTab(Lab)
.addTab(My);
}

/**
* 初始化viewPager并添加fragment
* */
private void initPagers() {
QMUIPagerAdapter pagerAdapter = new QMUIPagerAdapter() {
private FragmentTransaction mCurrentTransaction;
private Fragment mCurrentPrimaryItem = null;

@Override
public boolean isViewFromObject(View view, Object object) {
return view == ((Fragment) object).getView();
}

@Override
public int getCount() {
return 3;
}

@SuppressLint("CommitTransaction")
@Override
protected Object hydrate(ViewGroup container, int position) {
String name = makeFragmentName(container.getId(), position);
if (mCurrentTransaction == null) {
mCurrentTransaction = getSupportFragmentManager()
.beginTransaction();
}
Fragment fragment = getSupportFragmentManager().findFragmentByTag(name);
if(fragment != null){
return fragment;
}
switch (position) {
case 0:
return new Home2Fragment();
case 1:
return new Home1Fragment();
case 2:
return new MyFragment();
default:
return new Home2Fragment();
}
}

@SuppressLint("CommitTransaction")
@Override
protected void populate(ViewGroup container, Object item, int position) {
String name = makeFragmentName(container.getId(), position);
if (mCurrentTransaction == null) {
mCurrentTransaction = getSupportFragmentManager()
.beginTransaction();
}
Fragment fragment = getSupportFragmentManager().findFragmentByTag(name);
if (fragment != null) {
mCurrentTransaction.attach(fragment);
if(fragment.getView() != null && fragment.getView().getWidth() == 0){
fragment.getView().requestLayout();
}
} else {
fragment = (Fragment) item;
mCurrentTransaction.add(container.getId(), fragment, name);
}
if (fragment != mCurrentPrimaryItem) {
fragment.setMenuVisibility(false);
fragment.setUserVisibleHint(false);
}
}

@SuppressLint("CommitTransaction")
@Override
protected void destroy(ViewGroup container, int position, Object object) {
if (mCurrentTransaction == null) {
mCurrentTransaction = getSupportFragmentManager()
.beginTransaction();
}
mCurrentTransaction.detach((Fragment) object);
}

@Override
public void startUpdate(ViewGroup container) {
if (container.getId() == View.NO_ID) {
throw new IllegalStateException("ViewPager with adapter " + this
+ " requires a view id");
}
}

@Override
public void finishUpdate(ViewGroup container) {
if (mCurrentTransaction != null) {
mCurrentTransaction.commitNowAllowingStateLoss();
mCurrentTransaction = null;
}
}

@Override
public void setPrimaryItem(ViewGroup container, int position, Object object) {
Fragment fragment = (Fragment) object;
if (fragment != mCurrentPrimaryItem) {
if (mCurrentPrimaryItem != null) {
mCurrentPrimaryItem.setMenuVisibility(false);
mCurrentPrimaryItem.setUserVisibleHint(false);
}
if (fragment != null) {
fragment.setMenuVisibility(true);
fragment.setUserVisibleHint(true);
}
mCurrentPrimaryItem = fragment;
}
}

private String makeFragmentName(int viewId, long id) {
return BottomNavigationActivity.class.getSimpleName() + ":" + viewId + ":" + id;
}
};
mViewPager.setAdapter(pagerAdapter);
mViewPager.setOffscreenPageLimit(3);
mViewPager.addOnPageChangeListener(pageChangeListener);
mTabSegment.setupWithViewPager(mViewPager,false);


}

/**
* 配置ViewPager监听器,手指滑动监听
*/
private ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}

@Override
public void onPageSelected(int position) {
}

@Override
public void onPageScrollStateChanged(int state) {

}
};

@Override
protected boolean canDragBack() {
return mViewPager.getCurrentItem() == 0;
}

/**
* 重写返回键,实现双击退出程序效果
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (System.currentTimeMillis() - exitTime > 2000) {
ToastUtils.normal("再按一次退出程序");
exitTime = System.currentTimeMillis();
} else {
OkGo.getInstance().cancelAll();
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
ActivityLifecycleManager.get().appExit();
}
return true;
}
return super.onKeyDown(keyCode, event);
}
}

+ 0
- 13
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java Ver fichero

@@ -14,26 +14,13 @@ import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.helper.I.IThread;
import com.bonait.bnframework.common.helper.MessageLog;
import com.bonait.bnframework.common.helper.ThreadManager;
import com.bonait.bnframework.common.message.MessageLooper;
import com.bonait.bnframework.common.message.MessageManager;
import com.bonait.bnframework.common.modbus.ModbusTcpServer;
import com.bonait.bnframework.common.tabbar.MainNavigateTabBar;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter;
import com.bonait.bnframework.modules.home.fragment.DingDanfragment;
import com.bonait.bnframework.modules.home.fragment.GongnengFragment;
import com.bonait.bnframework.modules.home.fragment.GuanLifragment;
import com.bonait.bnframework.modules.home.fragment.Home1Fragment;
import com.bonait.bnframework.modules.home.fragment.Home2Fragment;
import com.bonait.bnframework.modules.home.fragment.JiaoYanFragment;
import com.bonait.bnframework.modules.home.fragment.MakeGoodFragment;
import com.bonait.bnframework.modules.home.fragment.SheZhifragment;
import com.bonait.bnframework.modules.mine.fragment.MyFragment;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.qmuiteam.qmui.widget.QMUIViewPager;

import java.util.ArrayList;


+ 125
- 0
app/src/main/java/com/bonait/bnframework/modules/home/adapter/devstatus_adapter.java Ver fichero

@@ -0,0 +1,125 @@
package com.bonait.bnframework.modules.home.adapter;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.res.StatusMode;

import java.util.List;

/**
* 制作商品
*/
public class devstatus_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

private final LayoutInflater mLayoutInflater;

private Context context;

List<StatusMode> statusModes = DataBus.getInstance().statusModes;

public devstatus_adapter(Context context) {
this.context = context;
mLayoutInflater = LayoutInflater.from(context);
}

@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View inflate = mLayoutInflater.inflate(R.layout.devstatus, parent, false);
return new devstatus_adapter.MyViewHolder(inflate);

}

@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
try {
if (holder instanceof devstatus_adapter.MyViewHolder) {
devstatus_adapter.MyViewHolder myViewHolder = (devstatus_adapter.MyViewHolder) holder;
StatusMode statusMode= statusModes.get(position);
myViewHolder.title.setText(statusMode.Name);
if(statusMode.Status)
{
myViewHolder.image.setImageResource(statusMode.Url_open);
myViewHolder.text.setText("打开");
myViewHolder.text.setTextColor(ConfigName.getInstance().dishesCon.getResources().getColor(R.color.app_color_blue));
}else
{
myViewHolder.image.setImageResource(statusMode.Url_close);
myViewHolder.text.setText("关闭");
myViewHolder.text.setTextColor(ConfigName.getInstance().dishesCon.getResources().getColor(R.color.black_50p));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
private Activity findActivity(@NonNull Context context) {
if (context instanceof Activity) {
return (Activity) context;
} else if (context instanceof ContextWrapper) {
return findActivity(((ContextWrapper) context).getBaseContext());
} else {
return null;
}
}
/**
* 刷新
* @param
*/
public void refresh(){
Activity activity= findActivity(context);
if(activity!=null)
{
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
notifyDataSetChanged();
} catch (Exception e) {

}
}
});
}
}

@Override
public int getItemCount() {
return statusModes.size();
}

public static class MyViewHolder extends RecyclerView.ViewHolder {
/**
* 标题
*/
TextView title;
/**
* 图片
*/
ImageView image;
/**
* 描述
*/
TextView text;
public MyViewHolder(View view) {
super(view);
title = (TextView) view.findViewById(R.id.title);
image = (ImageView) view.findViewById(R.id.image);
text=(TextView) view.findViewById(R.id.text);
}
}
}


+ 0
- 957
app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java Ver fichero

@@ -1,957 +0,0 @@
package com.bonait.bnframework.modules.home.fragment;


import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.RectF;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;

import android.os.CountDownTimer;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.SeekBar;

import com.aliyun.alink.linksdk.tmp.devicemodel.Event;
import com.aliyun.alink.linksdk.tmp.devicemodel.Property;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
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.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.res.StatusMode;
import com.bonait.bnframework.common.helper.ByteHelper;
import com.bonait.bnframework.common.helper.I.IThread;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.helper.Json;
import com.bonait.bnframework.common.helper.MessageLog;
import com.bonait.bnframework.common.helper.ThreadManager;
import com.bonait.bnframework.common.modbus.ModbusTcpServer;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.view.MyLayoutManager;
import com.bonait.bnframework.modules.home.adapter.lc_adapter;
import com.bonait.bnframework.modules.home.fragment.from.CpxzActivity;
import com.bonait.bnframework.modules.home.fragment.mode.LocationStatus;
import com.bonait.bnframework.modules.home.fragment.mode.MyStatus;
import com.bonait.bnframework.modules.home.fragment.mode.huoli_control;
import com.bonait.bnframework.modules.home.fragment.mode.imagebutton_control;
import com.capton.colorfulprogressbar.ColorfulProgressbar;
import com.litao.slider.NiftySlider;
import com.litao.slider.SliderEffect;
import com.litao.slider.Utils;
import com.lzy.okgo.OkGo;
import com.orhanobut.logger.Logger;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.QMUITopBarLayout;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import com.qmuiteam.qmui.widget.textview.QMUILinkTextView;
import com.suke.widget.SwitchButton;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
* A simple {@link Fragment} subclass.
*/
public class Home1Fragment extends BaseFragment {
@BindView(R.id.topbar)
QMUITopBarLayout mTopBar;//顶部标题
@BindView(R.id.xzcp)
RelativeLayout xzcp;//选择菜谱
@BindView(R.id.recycler_view)
RecyclerView recyclerView;//料仓列表
@BindView(R.id.caipumingcheng)
QMUILinkTextView caipumingcheng;//菜谱名称
@BindView(R.id.shengyushijian)
QMUILinkTextView shengyushijian;//剩余时间
@BindView(R.id.jingdu)
ColorfulProgressbar jingdu;//进度条
@BindView(R.id.huoli)
huoli_control huoli;//火力控件
@BindView(R.id.startbutton)
ImageView startbutton;//启动安
@BindView(R.id.choushui_control)
imagebutton_control choushui_control;//抽水
@BindView(R.id.fangshui_control)
imagebutton_control fangshui_control;//防水
@BindView(R.id.chaoguo_wendu)
QMUILinkTextView chaoguo_wendu;//
@BindView(R.id.chaoguo_weizhi)
QMUILinkTextView chaoguo_weizhi;//
@BindView(R.id.plc_zhuangtai)
ImageView plc_zhuangtai;//

@BindView(R.id.nifty_slider2)
NiftySlider nifty_slider2;//

@BindView(R.id.nifty_slider3)
NiftySlider nifty_slider3;//


@BindView(R.id.btn_jiaoban)
SwitchButton btn_jiaoban;//
@BindView(R.id.btn_zhuandong_control_left)
Button btn_zhuandong_control_left;//
@BindView(R.id.btn_zhuandong_control_Rift)
Button btn_zhuandong_control_Rift;//

/**
* 商品是否开始制作
*/
public boolean Status = false;
/**
* 当前制作商品信息
*/
BPA_GOODS good = null;
private Context context;

public Home1Fragment() {
}

@Override
protected View onCreateView() {
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home1, null);
ButterKnife.bind(this, root);
return root;
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
context = getContext();
initTopBar();
initData();
HuoLiClicked();
MakeThread();
ControlClicked();

nifty_slider2.setOnValueChangeListener(new NiftySlider.OnValueChangeListener() {
@Override
public void onValueChange(@NonNull NiftySlider niftySlider, float v, boolean b) {
nifty_slider2.setThumbText((int) v + "");
}
});

nifty_slider3.setOnValueChangeListener(new NiftySlider.OnValueChangeListener() {
@Override
public void onValueChange(@NonNull NiftySlider niftySlider, float v, boolean b) {
nifty_slider3.setThumbText((int) v + "");
}
});
}

/**
* 初始化TopBar
*/
private void initTopBar() {
jingdu.showPercentText(true);
jingdu.setAnimation(true);
jingdu.setProgress(0);
jingdu.setSecondProgress(0);
caipumingcheng.setText("");
shengyushijian.setText("预计剩余时间:0s");
startbutton.setImageResource(R.mipmap.qdzz);
Status = false;

mTopBar.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.app_color_theme_4));
mTopBar.setTitle("菜谱烹饪");

}

/**
* 初始化显示数据
*/
private void initData() {
try {
DataBus.getInstance().GetLc();
MyLayoutManager layout = new MyLayoutManager();
layout.setAutoMeasureEnabled(true);
recyclerView.setLayoutManager(layout);

DataBus.getInstance().lcadapter = new lc_adapter(getContext());
recyclerView.setAdapter(DataBus.getInstance().lcadapter);

nifty_slider2.setValue(0, true);
nifty_slider3.setValue(0, true);

} catch (Exception e) {
ToastUtils.info("异常信息:" + e.getMessage());
}
}

/**
* 火力按钮点击
*/
public void HuoLiClicked() {
huoli.mListener = new MyClickListener() {
@Override
public void clickListener(View v, Object data) {
ExecuteTheRecipe.Write_PLC_HuoLI((int) data);
}

@Override
public void clickListenerNew(View v, int k, Object data) {

}
};

DataBus.getInstance().mListener = new MyClickListener() {
@Override
public void clickListener(View v, Object data) {
if (!IsMake(true)) {
return;
}
good = (BPA_GOODS) data;
SetBottonStatus(false);
caipumingcheng.setText(good.name);
SetProcesssUI(good.maketime, 0);
}

@Override
public void clickListenerNew(View v, int k, Object data) {
initData();
}
};
}

/**
* Image Button 按钮点击事件
*/
public void ControlClicked() {
//region 临时屏蔽
// //搅拌挡位
// jiaoban_control.mListener = new MyClickListener() {
// @Override
// public void clickListener(View v, Object data) {
// boolean status = !(boolean) data;
// if (!IsMake(false))
// {
// return;
// }
// jiaoban_control.SetStatus(status);
// int jd = (int) nifty_slider2.getValue();
// ToastUtils.info("点击按钮:搅拌" + status + ".搅拌频率:" + jd);
// ExecuteTheRecipe.WritePLC("搅拌速度", jd, new IWriteCallBack() {
// @Override
// public void onSuccess() {
// if (jd == 0) {
// ExecuteTheRecipe.WritePLC("搅拌", false, null);
// } else {
// ExecuteTheRecipe.WritePLC("搅拌", status, null);
// }
// }
//
// @Override
// public void onFailure(String ErrorMsg) {
// }
// });
//
// }
//
// @Override
// public void clickListenerNew(View v, int k, Object data) {
//
// }
// };
// //转动 左
// zhuandong_control_left.mListener = new MyClickListener() {
// @Override
// public void clickListener(View v, Object data) {
// boolean status = !(boolean) data;
// if (!IsMake(true))
// {
// return;
// }
// zhuandong_control_left.SetStatus(status);
// int jd = (int) nifty_slider3.getValue();
// ToastUtils.info("点击按钮:转动" + status + ".转动频率:" + jd);
// ExecuteTheRecipe.WritePLC("转动速度", jd, new IWriteCallBack() {
// @Override
// public void onSuccess() {
// if (jd == 0) {
// ExecuteTheRecipe.WritePLC("翻转正转", false, null);
// } else {
// ExecuteTheRecipe.WritePLC("翻转正转", status, null);
// }
// }
//
// @Override
// public void onFailure(String ErrorMsg) {
// }
// });
// }
//
// @Override
// public void clickListenerNew(View v, int k, Object data) {
//
// }
// };
// //转动 右
// zhuandong_control_Rift.mListener = new MyClickListener() {
// @Override
// public void clickListener(View v, Object data) {
// boolean status = !(boolean) data;
// if (!IsMake(true))
// {
// return;
// }
// zhuandong_control_Rift.SetStatus(status);
// int jd = (int) nifty_slider3.getValue();
// ToastUtils.info("点击按钮:搅拌" + status + ".转动频率:" + jd);
// ExecuteTheRecipe.WritePLC("转动速度", jd, new IWriteCallBack() {
// @Override
// public void onSuccess() {
// if (jd == 0) {
// ExecuteTheRecipe.WritePLC("翻转反转", false, null);
// } else {
// ExecuteTheRecipe.WritePLC("翻转反转", status, null);
// }
// }
//
// @Override
// public void onFailure(String ErrorMsg) {
// }
// });
// }
//
// @Override
// public void clickListenerNew(View v, int k, Object data) {
//
// }
// };
//endregion

//抽水启动
choushui_control.mListener = new MyClickListener() {
@Override
public void clickListener(View v, Object data) {
boolean status = !(boolean) data;
// if (!IsMake(true))
// {
// return;
// }
choushui_control.SetStatus(status);
ToastUtils.info("点击按钮:炒锅抽水" + status);
ExecuteTheRecipe.WritePLC("炒锅抽水", status, null);
}

@Override
public void clickListenerNew(View v, int k, Object data) {

}
};
//放水启动
fangshui_control.mListener = new MyClickListener() {
@Override
public void clickListener(View v, Object data) {
boolean status = !(boolean) data;
// if (!IsMake(true))
// {
// return;
// }
fangshui_control.SetStatus(status);
ToastUtils.info("点击按钮:炒锅放水" + status);
ExecuteTheRecipe.WritePLC("炒锅放水", status, null);
}

@Override
public void clickListenerNew(View v, int k, Object data) {

}
};

btn_jiaoban.setOnCheckedChangeListener(new SwitchButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(SwitchButton view, boolean isChecked) {
boolean ischick = btn_jiaoban.isChecked();

// if (!IsMake(false))
// {
// return;
// }
int jd = (int) nifty_slider2.getValue();
ExecuteTheRecipe.WritePLC("搅拌速度", jd, new IWriteCallBack() {
@Override
public void onSuccess() {
if (jd == 0) {
ExecuteTheRecipe.WritePLC("搅拌", false, null);
} else {
ExecuteTheRecipe.WritePLC("搅拌", ischick, null);
}
}

@Override
public void onFailure(String ErrorMsg) {
}
});
}
});

//正转
btn_zhuandong_control_left.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
Log.e("鼠标", "按下: ");
// if (!IsMake(false))
// {
// return false;
// }
int jd = (int) nifty_slider3.getValue();
ExecuteTheRecipe.WritePLC("转动速度", jd, new IWriteCallBack() {
@Override
public void onSuccess() {
if (jd == 0) {
ExecuteTheRecipe.WritePLC("翻转正转", false, null);
} else {
ExecuteTheRecipe.WritePLC("翻转正转", true, null);
}
}

@Override
public void onFailure(String ErrorMsg) {
}
});
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
Log.e("鼠标", "松开: ");
ExecuteTheRecipe.WritePLC("翻转正转", false, null);
}
return false;
}
});

//反转
btn_zhuandong_control_Rift.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
Log.e("鼠标", "按下: ");
// if (!IsMake(false))
// {
// return false;
// }
int jd = (int) nifty_slider3.getValue();
ExecuteTheRecipe.WritePLC("转动速度", jd, new IWriteCallBack() {
@Override
public void onSuccess() {
if (jd == 0) {
ExecuteTheRecipe.WritePLC("翻转反转", false, null);
} else {
ExecuteTheRecipe.WritePLC("翻转反转", true, null);
}
}

@Override
public void onFailure(String ErrorMsg) {
}
});
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
Log.e("鼠标", "松开: ");
ExecuteTheRecipe.WritePLC("翻转反转", false, null);
}
return false;
}
});

}

int gongxuIndex = 10000;
ArrayList<BPA_GOODSRECIPE> goodsrecipesL = null;

BPA_GOODSRECIPE MakeCipe = null;

/**
* 商品制作线程
*/
public void MakeThread() {
ExecuteTheRecipe.context = context;


new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {

if (Status && good != null) {
try {
//获取工艺
ArrayList<BPA_GOODSRECIPE> goodsrecipes = QueryDB.GetGoodsSrecipeID(good.id);
goodsrecipesL = goodsrecipes;
gongxuIndex = 1;
int m = 0;
for (BPA_GOODSRECIPE item : goodsrecipes) {
MakeCipe = item;
gongxuIndex++;
boolean status = ExecuteTheRecipe.Execute(item, goodsrecipes, m);
m++;
}


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

ExecuteTheRecipe.WritePLC("搅拌", false, null);
ExecuteTheRecipe.WritePLC("加热", false, null);
ExecuteTheRecipe.BottomClick("平移-去1号位");
gongxuIndex = 10000;
MakeCipe = null;
goodsrecipesL = null;
Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
SetBottonStatus(false);
if (ExecuteTheRecipe.IsForcedEnd)//强制结束
{
ToastUtils.info("客官,当前菜品已强制结束!!!");
//初始化
ExecuteTheRecipe.BottomClick("初始化");
}
}
});
}
}
}
Thread.sleep(1000);
} catch (InterruptedException e) {
ToastUtils.info("异常信息:" + e.getMessage());
}
}
}
}).start();

new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {

if (Status && good != null && gongxuIndex != 10000 && goodsrecipesL != null && MakeCipe != null) {
try {
if (ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本") || ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) {
//获取工艺
int k = 1;
ArrayList<BPA_GOODSRECIPE> goodsrecipes = goodsrecipesL;
BPA_GOODSRECIPE recipe = null;
for (BPA_GOODSRECIPE item : goodsrecipes) {
k++;
if (k > gongxuIndex) {
if (item.processname.contains("主料") && !MakeCipe.processname.equals("主料") && recipe == null) {
recipe = item;
}
}
}

if (recipe != null) {
HashMap<String, String> formulation = new HashMap<>();
String text = recipe.processvalue;
//region 获取仓号和值
List<String> data = new ArrayList<>();
if (text.contains("|")) {
String[] res = text.split("[|]");
for (int i = 0; i < res.length; i++) {
data.add(res[i]);
}
} else {
data.add(text);
}
for (String item : data) {
if (!item.isEmpty() && item.contains(",")) {
String[] wl = item.split("[,]");
if (wl != null && wl.length == 2) {
String name = wl[0];
String val = wl[1];
formulation.put(name, val);
}
}
}
//endregion
boolean ishand = true;

//region 判断是否手动
if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) {
ishand = true;
} else {
for (HashMap.Entry<String, String> entry : formulation.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key.contains("投料动作")) {
if (value.contains("手动投料")) {
ishand = true;
} else {
ishand = false;
}
}
}
}
//endregion

if (!ishand) {
String writeValue = "1号位";
for (HashMap.Entry<String, String> entry : formulation.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key.contains("主料位置")) {
writeValue = value;
}
}
ExecuteTheRecipe.BottomClick("平移-去" + writeValue);
Log.d("移动去", writeValue);
} else {
ExecuteTheRecipe.BottomClick("平移-去1号位");
Log.d("移动去", "1号位");
}
} else {
if (!MakeCipe.processname.equals("主料")) {
ExecuteTheRecipe.BottomClick("平移-去1号位");
Log.d("移动去", "1号位");
}
}
}

} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}
Thread.sleep(3000);
} catch (InterruptedException e) {
ToastUtils.info("异常信息:" + e.getMessage());
}
}
}
}).start();

new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
SxUI();
Thread.sleep(1000);
} catch (InterruptedException e) {
ToastUtils.info("异常信息:" + e.getMessage());
}
}
}
}).start();
}

/**
* 刷新UI界面
*/
public void SxUI() {
Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Object val_wd = ExecuteTheRecipe.getListingValue("当前锅底温度");
Object val_wz = ExecuteTheRecipe.getListingValue("编码器当前位值");
// Object val_jbpl = ExecuteTheRecipe.getListingValue("搅拌频率");
// Object val_fzpv = ExecuteTheRecipe.getListingValue("翻转频率");

if (val_wd != null) {
chaoguo_wendu.setText(val_wd + "");
} else {
chaoguo_wendu.setText("未知");
}

if (val_wz != null) {
chaoguo_weizhi.setText(val_wz + "");
} else {
chaoguo_weizhi.setText("未知");
}

// if (val_jbpl != null) {
// int val=Integer.parseInt(String.valueOf(val_jbpl));
// nifty_slider2.setValue(val,true);
// }
//
// if (val_fzpv != null) {
// int val=Integer.parseInt(String.valueOf(val_jbpl));
// nifty_slider3.setValue(val,true);
// }

plc_zhuangtai.setImageResource(ConfigName.getInstance().PlcIsConnect ? R.mipmap.yjzt : R.mipmap.yjzt1);
}
});
}
}

/**
* 设置进度条百分比
*
* @param alltime
* @param usertime 使用时间
*/
public void SetProcesssUI(int alltime, int usertime) {
try {
jingdu.setProgress((usertime * 100) / alltime);
jingdu.setSecondProgress((usertime * 100) / alltime);
shengyushijian.setText("预计剩余时间:" + (alltime - usertime) + "s");
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 设置button状态
*
* @param status
*/
public void SetBottonStatus(boolean status) {
try {
Status = status;
if (status) {
startbutton.setImageResource(R.mipmap.tzzz);
TimerCount(good.maketime, true);//开始计时器,记录进度条
} else {
startbutton.setImageResource(R.mipmap.qdzz);
TimerCount(0, false);//停止计时器
}
if (good != null) {
SetProcesssUI(good.maketime, 0);
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

private CountDownTimer countDownTimer = null;//计时器

/**
* 计时器
* _
*
* @param alltime
* @param status
*/
public void TimerCount(int alltime, boolean status) {
if (status) {
if (countDownTimer == null) {
countDownTimer = new CountDownTimer(alltime * 1000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
int overtime = (int) ((millisUntilFinished) / 1000);//剩余时间
SetProcesssUI(alltime, alltime - overtime);
}

@Override
public void onFinish() {
SetProcesssUI(alltime, alltime);//进度条100%
}
};
}
countDownTimer.start();
} else {
if (countDownTimer != null) {
countDownTimer.cancel();
countDownTimer = null;
}
}
}

/**
* 点击事件
*
* @param view
*/
@OnClick({R.id.xzcp, R.id.startbutton, R.id.qdjb
, R.id.yaoqian, R.id.tingyao
, R.id.ydw, R.id.dcw, R.id.clw, R.id.qxw, R.id.ccw1, R.id.ccw2, R.id.ccw3
, R.id.chushihua, R.id.jiting})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.xzcp://选择菜谱按钮点击
skipToActivity(CpxzActivity.class);
ToastUtils.info("打开菜谱选择界面");
break;
case R.id.startbutton:
if (Status) {
// ToastUtils.info("客官菜谱正在制作过程中,请耐心等待一下,马上就好啦!");
// return;
//按钮点击
String title = "停止操作提示!";
String message = "请问客官确定要停止制作吗,小菠萝会生气的,啊啊啊啊啊啊啊...我的饭饭?";
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
//强制结束
ExecuteTheRecipe.SetForcedEnd();
dialog.dismiss();
}
});
} else {
if (good == null) {
ToastUtils.info("请先选择一个商品");
return;
}
//if (!IsMake(false)) { return; }
//按钮点击
String title = "开始操作提示!";
String message = "请问客官确定要开始制作吗,小菠萝好开心呀,马上就有好吃的耶?";
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
ExecuteTheRecipe.StopForcedEnd();
SetBottonStatus(true);
dialog.dismiss();
}
});
}
break;
case R.id.qdjb://开始清洗
if (!IsMake(true)) {
return;
}
ExecuteTheRecipe.BottomClick("炒锅清洗");
break;
case R.id.yaoqian:
if (!IsMake(true)) {
return;
}
ExecuteTheRecipe.Write_PLC_YaoQian(MyStatus.Start);
break;
case R.id.tingyao:
if (!IsMake(true)) {
return;
}
ExecuteTheRecipe.Write_PLC_YaoQian(MyStatus.Stop);
break;
case R.id.ydw://R.id.ydw, R.id.dcw, R.id.clw,R.id.qxw,R.id.ccw1,R.id.ccw2,R.id.ccw3
if (!IsMake(true)) {
return;
}
ExecuteTheRecipe.BottomClick("原点位");
break;
case R.id.dcw:
if (!IsMake(true)) {
return;
}
ExecuteTheRecipe.BottomClick("倒菜位");
break;
case R.id.clw:
if (!IsMake(true)) {
return;
}
ExecuteTheRecipe.BottomClick("抽料位");
break;
case R.id.qxw:
if (!IsMake(true)) {
return;
}
ExecuteTheRecipe.BottomClick("清洗位");
break;
case R.id.ccw1:
if (!IsMake(true)) {
return;
}
ExecuteTheRecipe.BottomClick("炒菜位1");
break;
case R.id.ccw2:
if (!IsMake(true)) {
return;
}
ExecuteTheRecipe.BottomClick("炒菜位2");
break;
case R.id.ccw3:
if (!IsMake(true)) {
return;
}
ExecuteTheRecipe.BottomClick("炒菜位3");
break;
case R.id.chushihua:
ToastUtils.info("点击按钮:初始化");
ExecuteTheRecipe.BottomClick("初始化");
break;
case R.id.jiting:
ToastUtils.info("点击按钮:急停");
ExecuteTheRecipe.BottomClick("停止");
break;
}
}

/**
* 是否可以制作商品
*
* @return
*/
public boolean IsMake(boolean k) {
if (!ConfigName.getInstance().PlcIsConnect) {
ToastUtils.warning("PLC未准备就绪!!!");
return false;
}

Object chushiover = ExecuteTheRecipe.getListingValue("初始化完成");
//Object jiting = ExecuteTheRecipe.getListingValue("设备急停");
if (chushiover == null || !(boolean) chushiover) {
ToastUtils.warning("设备未初始化,请先手动初始化设备!!!");
return false;
}

// if (jiting == null || !(boolean) jiting) {
// ToastUtils.warning("设备已急停,请检查设备!!!");
// return false;
// }

if (Status && k) {
ToastUtils.warning("客官,商品制作未结束请勿进行其他操作.请耐心等待商品制作结束!!!");
return false;
}


return true;
}


@Override
public void onDestroy() {
super.onDestroy();
Logger.d("第一页销毁");
}

/**
* 当在activity设置viewPager + BottomNavigation + fragment时,
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题,
* 必须加上此方法,禁止fragment左滑返回上一界面。
* <p>
* 切记!切记!切记!否则会闪退!
* <p>
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。
*/
@Override
protected boolean canDragBack() {
return false;
}
}

+ 0
- 113
app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home2Fragment.java Ver fichero

@@ -1,113 +0,0 @@
package com.bonait.bnframework.modules.home.fragment;


import static com.bonait.bnframework.MainApplication.getContext;

import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;

import android.view.LayoutInflater;
import android.view.View;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.message.MessageManager;
import com.bonait.bnframework.common.utils.ScreenUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.fragment.from.CpActivity;
import com.bonait.bnframework.modules.home.fragment.from.DiyActivity;
import com.bonait.bnframework.modules.home.fragment.from.SzActivity;
import com.bonait.bnframework.modules.home.fragment.from.WhActivity;
import com.orhanobut.logger.Logger;
import com.qmuiteam.qmui.widget.QMUIAppBarLayout;
import com.qmuiteam.qmui.widget.QMUICollapsingTopBarLayout;
import com.qmuiteam.qmui.widget.QMUITopBar;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
* A simple {@link Fragment} subclass.
*/
public class Home2Fragment extends BaseFragment {

@BindView(R.id.collapsing_topbar_layout)
QMUICollapsingTopBarLayout mCollapsingTopBarLayout;
@BindView(R.id.appbarlayout)
QMUIAppBarLayout appbarlayout;

@BindView(R.id.topbar)
QMUITopBar mTopBar;
private Context context;
public Home2Fragment() {
}

@Override
protected View onCreateView() {
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home2, null);
ButterKnife.bind(this, root);
return root;
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
context = getContext();
initTopBar();

appbarlayout.setExpanded(ConfigName.getInstance().IsPortraitScreen);
}

private void initTopBar() {
mCollapsingTopBarLayout.setTitle("功能菜单");
}

@OnClick({R.id.kshr,R.id.diy,R.id.cp,R.id.wh,R.id.sz})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.kshr://开始制作商品
MessageManager.getInstance().sendMessage(MessageName.SelectZY,"Open");
break;
case R.id.diy://diy模式
skipToActivity(DiyActivity.class);
break;
case R.id.cp://菜谱
skipToActivity(CpActivity.class);
break;
case R.id.wh://维护界面
skipToActivity(WhActivity.class);
break;
case R.id.sz://系统设置界面
skipToActivity(SzActivity.class);
break;
}
}

@Override
public void onDestroy() {
super.onDestroy();
Logger.d("第二页销毁");
}

/**
* 当在activity设置viewPager + BottomNavigation + fragment时,
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题,
* 必须加上此方法,禁止fragment左滑返回上一界面。
*
* 切记!切记!切记!否则会闪退!
*
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。
* */
@Override
protected boolean canDragBack() {
return false;
}
}

+ 0
- 68
app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home3Fragment.java Ver fichero

@@ -1,68 +0,0 @@
package com.bonait.bnframework.modules.home.fragment;


import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.orhanobut.logger.Logger;
import com.qmuiteam.qmui.widget.QMUITopBarLayout;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
* A simple {@link Fragment} subclass.
*/
public class Home3Fragment extends BaseFragment {

@BindView(R.id.topbar)
QMUITopBarLayout mTopBar;

public Home3Fragment() {
// Required empty public constructor
}

@Override
protected View onCreateView() {
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home3, null);
ButterKnife.bind(this, root);
Logger.d("第三页创建");

initTopBar();
return root;
}

private void initTopBar() {
mTopBar.setTitle("第三页");
}

@OnClick(R.id.button)
public void onViewClicked() {
ToastUtils.info("我的");
}

@Override
public void onDestroy() {
super.onDestroy();
Logger.d("第三页销毁");
}

/**
* 当在activity设置viewPager + BottomNavigation + fragment时,
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题,
* 必须加上此方法,禁止fragment左滑返回上一界面。
*
* 切记!切记!切记!否则会闪退!
*
* 若底层是BottomNavigationFragment设置viewPager则不会出现这个问题。
* */
@Override
protected boolean canDragBack() {
return false;
}
}

+ 0
- 17
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/JcsjglActivity.java Ver fichero

@@ -22,32 +22,15 @@ import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.tabbar.MainNavigateTabBar;
import com.bonait.bnframework.modules.home.activity.BottomNavigationActivity;
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter;
import com.bonait.bnframework.modules.home.adapter.MyQMUIFragmentPagerAdapter;
import com.bonait.bnframework.modules.home.fragment.GongnengFragment;
import com.bonait.bnframework.modules.home.fragment.Home1Fragment;
import com.bonait.bnframework.modules.home.fragment.Home2Fragment;
import com.bonait.bnframework.modules.home.fragment.from.fragment.Jcsjgl_sxgl_fragment;
import com.bonait.bnframework.modules.home.fragment.from.fragment.Jcsjgl_wl_fragment;
import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsControlFragment;
import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsFltlFragment;
import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsMonitorFragment;
import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsPLCFragment;
import com.bonait.bnframework.modules.mine.fragment.MyFragment;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.qmuiteam.qmui.arch.QMUIFragment;
import com.qmuiteam.qmui.arch.QMUIFragmentPagerAdapter;
import com.qmuiteam.qmui.widget.QMUIPagerAdapter;
import com.qmuiteam.qmui.widget.QMUITopBarLayout;
import com.qmuiteam.qmui.widget.QMUIViewPager;
import com.qmuiteam.qmui.widget.tab.QMUIBasicTabSegment;
import com.qmuiteam.qmui.widget.tab.QMUITab;
import com.qmuiteam.qmui.widget.tab.QMUITabBuilder;
import com.qmuiteam.qmui.widget.tab.QMUITabSegment;

import java.util.ArrayList;


+ 3
- 4
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/RealTimeActivity.java Ver fichero

@@ -3,6 +3,7 @@ package com.bonait.bnframework.modules.home.fragment.from;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Context;
import android.os.Bundle;
@@ -28,10 +29,8 @@ public class RealTimeActivity extends BaseFragment {

@BindView(R.id.topbar)
QMUITopBarLayout mTopBar;
@BindView(R.id.tabs)
QMUITabSegment tabs;
@BindView(R.id.viewpager_wl)
QMUIViewPager viewpager_wl;
@BindView(R.id.recycler_view)
RecyclerView recycler_view;
private Context context;

@Override


+ 0
- 21
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java Ver fichero

@@ -54,8 +54,6 @@ public class SystemParameterActivity extends BaseFragment {
@BindView(R.id.versionselection)
Spinner versionselection;

@BindView(R.id.HuoLi)
Spinner HuoLi;


ArrayList<EditText> editTextLists = new ArrayList<>();
@@ -124,11 +122,6 @@ public class SystemParameterActivity extends BaseFragment {
versionselection.setAdapter(adapter1);


ArrayAdapter<String> adapter2 = new ArrayAdapter<>(context, R.layout.spinner_text_item, new ArrayList<>(ConfigName.getInstance().HeatingGearL.keySet()));
adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item);
HuoLi.setAdapter(adapter2);
HuoLi.setSelection(ConfigName.getInstance().HeatingGearL.get(ConfigName.getInstance().HuoLi));

bpa_systemsets = QueryDB.GetSystemsetALL();
for (BPA_SYSTEMSET item : bpa_systemsets) {
switch (item.type) {
@@ -165,21 +158,7 @@ public class SystemParameterActivity extends BaseFragment {
* 初始化选中
*/
public void initSelect() {
HuoLi.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
@Override
/*public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

}*/
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
ConfigName.getInstance().HuoLi=HuoLi.getSelectedItem().toString();
ConfigData.getInstance().SavePZ();
}

@Override
public void onNothingSelected(AdapterView<?> parent) {

}
});

}



+ 0
- 2
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SzActivity.java Ver fichero

@@ -2,8 +2,6 @@ package com.bonait.bnframework.modules.home.fragment.from;

import androidx.annotation.NonNull;

import com.bonait.bnframework.modules.home.fragment.Home1Fragment;
import com.bonait.bnframework.modules.home.fragment.Home2Fragment;
import com.bonait.bnframework.modules.mine.fragment.MyFragment;
import com.google.android.material.bottomnavigation.BottomNavigationView;



+ 0
- 2
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/WhActivity.java Ver fichero

@@ -2,8 +2,6 @@ package com.bonait.bnframework.modules.home.fragment.from;

import androidx.annotation.NonNull;

import com.bonait.bnframework.modules.home.fragment.Home1Fragment;
import com.bonait.bnframework.modules.home.fragment.Home2Fragment;
import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsPLCFragment;
import com.bonait.bnframework.modules.mine.fragment.MyFragment;
import com.google.android.material.bottomnavigation.BottomNavigationView;


+ 3
- 3
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_lsjy_fragment.java Ver fichero

@@ -181,9 +181,9 @@ public class JiaoYan_lsjy_fragment extends BaseFragment {
return;
}

if(zl<=1)
if(zl<=0)
{
ToastUtils.warning("出料重量至少大于1g!");
ToastUtils.warning("出料重量至少大于0g!");
return;
}

@@ -332,7 +332,7 @@ public class JiaoYan_lsjy_fragment extends BaseFragment {
}

}
}, 2000);
}, 3000);
} catch (Exception e) {
ToastUtils.error("重量解析显示异常!" + e.getMessage());
}


+ 14
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_sdkz_fragment.java Ver fichero

@@ -8,16 +8,29 @@ import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;

import com.bonait.bnframework.R;
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.db.res.Res_PLCADDRESS1;
import com.bonait.bnframework.modules.home.fragment.mode.sdkz_control;
import com.bonait.bnframework.modules.home.fragment.mode.tab_control;
import com.orhanobut.logger.Logger;

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

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class JiaoYan_sdkz_fragment extends BaseFragment {

@BindView(R.id.sdkz_linrarlaout)
LinearLayout sdkz_linrarlaout;//手动控制
private Context context;
@Override
protected View onCreateView() {
@@ -57,7 +70,7 @@ public class JiaoYan_sdkz_fragment extends BaseFragment {
*/
public void Initdata() {
try {
DataBus.getInstance().GetSDKZ(sdkz_linrarlaout,getActivity());
} catch (Exception e) {

}


+ 148
- 14
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java Ver fichero

@@ -3,23 +3,43 @@ package com.bonait.bnframework.modules.home.fragment.from.fragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager.widget.ViewPager;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.orhanobut.logger.Logger;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class JiaoYan_zdqx_fragment extends BaseFragment {



public class JiaoYan_zdqx_fragment extends BaseFragment {

@BindView(R.id.edittext_pssj)
EditText edittext_pssj;//排水阀排水时间
@BindView(R.id.edittext_jssj)
EditText edittext_jssj;//排水阀进水时间
@BindView(R.id.edittext_jrsj)
EditText edittext_jrsj;//清洗预加热时间
@BindView(R.id.edittext_qxjsj)
EditText edittext_qxjsj;//加清洗剂时间
@BindView(R.id.edittext_xhsj)
EditText edittext_xhsj;//循环清洗时间

@BindView(R.id.bt_start)
Button bt_start;//开始时间
private Context context;
@Override
protected View onCreateView() {
@@ -42,15 +62,102 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
Initdata();
}


// @OnClick({R.id.add_wl})
// public void onViewClicked(View view) {
// switch (view.getId()) {
// case R.id.add_wl:
//
// break;
// }
// }
boolean IsStart = false;
@OnClick({R.id.save_time,R.id.bt_start})
public void onViewClicked(View view) {
double js = Double.parseDouble(edittext_jssj.getText().toString());
double qxj = Double.parseDouble(edittext_qxjsj.getText().toString());
switch (view.getId()) {
case R.id.save_time://保存时间
if (qxj >= js ) {
ToastUtils.warning("加清洗剂时间不能大于进水时间!");
return;
}
new Thread(new Runnable() {
@Override
public void run() {
try {
if (!edittext_pssj.getText().toString().equals("")) {
int k= (int)Math.round((Double.parseDouble(edittext_pssj.getText().toString()) * 10));
ExecuteTheRecipe.WritePLC("排水阀排水时间",(short)k,null);
Thread.sleep(200);
}
if (!edittext_jssj.getText().toString().equals("")) {
int k= (int)Math.round((Double.parseDouble(edittext_jssj.getText().toString()) * 10));
ExecuteTheRecipe.WritePLC("排水阀进水时间",(short)k,null);
Thread.sleep(200);
}
if (!edittext_jrsj.getText().toString().equals("")) {
int k= (int)Math.round((Double.parseDouble(edittext_jrsj.getText().toString()) * 10));
ExecuteTheRecipe.WritePLC("清洗预加热时间",(short)k,null);
Thread.sleep(200);
}
if (!edittext_qxjsj.getText().toString().equals("")) {
int k= (int)Math.round((Double.parseDouble(edittext_qxjsj.getText().toString()) * 10));
ExecuteTheRecipe.WritePLC("加清洗剂时间",(short)k,null);
Thread.sleep(200);
}

if (!edittext_xhsj.getText().toString().equals("")) {
int k= (int)Math.round((Double.parseDouble(edittext_xhsj.getText().toString()) * 10));
ExecuteTheRecipe.WritePLC("循环清洗时间",(short)k,null);
Thread.sleep(200);
}

} catch (InterruptedException e) {

} catch (Exception e) {

}

}
}).start();
ToastUtils.info("保存成功!");
break;
case R.id.bt_start://开始清洗
if (qxj >= js /*|| qxj >= ps*/) {
ToastUtils.warning("加清洗剂时间不能大于进水时间!");
return;
}

if (IsStart) {
ToastUtils.warning("正在清洗中,请勿重复点击!");
return;
}

new Thread(new Runnable() {
@Override
public void run() {
try {
ExecuteTheRecipe.WritePLC("清洗模式",true,null);
ExecuteTheRecipe.WritePLC("自动清洗开始", true, new IWriteCallBack() {
@Override
public void onSuccess() {
//UI线程操作UI控件
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
IsStart=true;
bt_start.setText("正在清洗");
}
});
}

@Override
public void onFailure(String ErrorMsg) {

}
});

} catch (Exception e) {

}

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


//region 数据加载
@@ -59,7 +166,34 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
*/
public void Initdata() {
try {

//填充数据
Object t1= ExecuteTheRecipe.ReadPLC("排水阀排水时间");
edittext_pssj.setText(t1==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t1.toString())/10))));

Object t2= ExecuteTheRecipe.ReadPLC("排水阀进水时间");
edittext_jssj.setText(t2==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t2.toString())/10))));

Object t3= ExecuteTheRecipe.ReadPLC("清洗预加热时间");
edittext_jrsj.setText(t3==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t3.toString())/10))));

Object t4= ExecuteTheRecipe.ReadPLC("加清洗剂时间");
edittext_qxjsj.setText(t4==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t4.toString())/10))));

Object t5= ExecuteTheRecipe.ReadPLC("循环清洗时间");
edittext_xhsj.setText(t5==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t5.toString())/10))));


ExecuteTheRecipe.CleaningComplete=new IRun() {
@Override
public void Run() {
if (IsStart) {
IsStart = false;
bt_start.setText("开始清洗");
ExecuteTheRecipe.WritePLC("清洗模式",false,null);
ToastUtils.info("清洗完成");
}
}
};
} catch (Exception e) {

}


+ 79
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/sdkz_control.java Ver fichero

@@ -0,0 +1,79 @@
package com.bonait.bnframework.modules.home.fragment.mode;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Switch;

import androidx.annotation.Nullable;

import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.res.Res_PLCADDRESS1;
import com.bonait.bnframework.common.helper.AutoNextLineLinearLayout;
import com.bonait.bnframework.common.utils.ToastUtils;

import java.util.List;

public class sdkz_control extends LinearLayout {
AutoNextLineLinearLayout tagLayout;
private View root;

public sdkz_control(Context context, @Nullable AttributeSet attrs, List<Res_PLCADDRESS1> address, Activity activity, boolean Issd) {
super(context, attrs);
root= LayoutInflater.from(context).inflate(R.layout.wrapanl_sdkz_item, this);
tagLayout=this.findViewById(R.id.tagLayout);
Init(address,activity,Issd);
}

/**
* <Switch
* android:id="@+id/out_switch"
* android:layout_width="wrap_content"
* android:layout_height="wrap_content"
* android:background="@drawable/qs_switch"
* android:text="出口称重模块校准"
* android:layout_margin="5dp"/>
* @param plcaddresses
*/
public void Init(List<Res_PLCADDRESS1> plcaddresses,Activity activity,boolean Issd)
{
for (Res_PLCADDRESS1 item:plcaddresses)
{
Switch aSwitch=new Switch(activity);
AutoNextLineLinearLayout.LayoutParams params = new AutoNextLineLinearLayout
.LayoutParams(AutoNextLineLinearLayout.LayoutParams.WRAP_CONTENT,
AutoNextLineLinearLayout.LayoutParams.WRAP_CONTENT);
//通过这个属性可以控制 排列方式
params.setMargins(20, 10, 0, 0);
aSwitch.setLayoutParams(params);
//aSwitch.setWidth(120);
aSwitch.setText(item.name);
if(Issd)
{
aSwitch.setTag(item.address);
aSwitch.setChecked(ExecuteTheRecipe.ReadPLCSD(item.address));
}else
{
aSwitch.setTag(item.zd_address);
aSwitch.setChecked(ExecuteTheRecipe.ReadPLCSD(item.address));
}
aSwitch.setHeight(55);
aSwitch.setBackground(ConfigName.getInstance().dishesCon.getResources().getDrawable(R.drawable.button2));
aSwitch.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
boolean isopen= aSwitch.isChecked();
String addr= aSwitch.getTag().toString();
ExecuteTheRecipe.WritePLCSD(addr,isopen,null);
ToastUtils.info(aSwitch.getText().toString()+",地址:"+addr+".状态:"+isopen);
}
});
tagLayout.addView(aSwitch);
}
}
}

+ 27
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/tab_control.java Ver fichero

@@ -0,0 +1,27 @@
package com.bonait.bnframework.modules.home.fragment.mode;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.bonait.bnframework.R;

/**
* Tab-控件
*/
public class tab_control extends LinearLayout {
TextView name;
private View root;

public tab_control(Context context, @Nullable AttributeSet attrs, String _name) {
super(context, attrs);
root= LayoutInflater.from(context).inflate(R.layout.tab_item, this);
name=this.findViewById(R.id.name);
name.setText(_name+"");
}
}

+ 0
- 1
app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java Ver fichero

@@ -40,7 +40,6 @@ import com.bonait.bnframework.common.utils.KeyboardToolUtils;
import com.bonait.bnframework.common.utils.PreferenceUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.bonait.bnframework.modules.home.activity.BottomNavigation2Activity;
import com.bonait.bnframework.modules.home.activity.BottomNavigationMainActivity;
import com.bonait.bnframework.modules.welcome.model.AppLoginPo;
import com.bonait.bnframework.test.TestActivity;


+ 0
- 14
app/src/main/java/com/bonait/bnframework/modules/welcome/activity/WelcomeActivity.java Ver fichero

@@ -18,7 +18,6 @@ import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.Constants;
import com.bonait.bnframework.common.utils.ScreenUtils;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.bonait.bnframework.modules.home.activity.BottomNavigation2Activity;
import com.bonait.bnframework.test.TestActivity;
import com.lzy.okgo.OkGo;

@@ -174,19 +173,6 @@ public class WelcomeActivity extends BaseActivity {
}


/**
* 跳转到主界面
* */
private void skipToMainActivity() {
// token未过期,跳转到主界面
Intent intent = new Intent(WelcomeActivity.this, BottomNavigation2Activity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
// 结束所有Activity
ActivityLifecycleManager.get().finishAllActivity();
}

/**
* 跳转到登录页面
* */


+ 0
- 27
app/src/main/res/layout/activity_bottom_navigation.xml Ver fichero

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>

<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_primary_color">

<com.qmuiteam.qmui.widget.QMUIViewPager
android:id="@+id/main_view_pager"
android:background="?attr/app_content_bg_color"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/home_tab_height"
android:fitsSystemWindows="true"/>

<com.qmuiteam.qmui.widget.tab.QMUITabSegment
android:id="@+id/main_tabs"
android:layout_gravity="bottom"
android:background="@color/qmui_config_color_white"
app:qmui_bottomDividerColor="?attr/qmui_skin_support_color_separator"
app:qmui_bottomDividerHeight="1px"
android:textSize="12sp"
app:qmui_tab_icon_position="top"
android:layout_width="match_parent"
android:layout_height="@dimen/home_tab_height"/>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 0
- 44
app/src/main/res/layout/activity_bottom_navigation2.xml Ver fichero

@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_primary_color"
tools:context=".modules.home.activity.BottomNavigation2Activity">

<com.qmuiteam.qmui.widget.QMUIViewPager
android:id="@+id/viewpager"
android:background="?attr/app_content_bg_color"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/home_tab_height"
android:fitsSystemWindows="true"/>

<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="@dimen/home_tab_height"
android:layout_gravity="bottom"
android:background="@drawable/qmui_list_item_bg_with_border_top"
app:itemHorizontalTranslationEnabled="false"
app:labelVisibilityMode="labeled"
app:menu="@menu/navigation"/>


<com.bonait.bnframework.common.watermark.WaterMarkView
android:singleLine="false"
android:id="@+id/wm"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:water_mark_align="CENTER"
app:water_mark_degree="-30"
app:water_mark_dx="300px"
app:water_mark_dy="340px"
app:water_mark_sync="true"
app:water_mark_text="黑菠萝技术部"
app:water_mark_textColor="@color/watermarkcolor"
app:water_mark_textBold="true"
app:water_mark_textSize="14px" />

</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 13
- 16
app/src/main/res/layout/activity_realtime.xml Ver fichero

@@ -8,26 +8,23 @@
android:background="@color/white"
android:fitsSystemWindows="true">

<com.qmuiteam.qmui.widget.tab.QMUITabSegment
<RelativeLayout
android:id="@+id/tabs"
android:layout_marginTop="54dp"
android:layout_width="match_parent"
android:layout_height="43dp"
android:background="@drawable/qmui_list_item_bg_with_border_bottom"
android:textSize="14sp"
app:qmui_tab_selected_text_size="16sp"
app:qmui_tab_normal_text_size="14sp"
app:qmui_tab_indicator_height="2dp"
app:qmui_tab_indicator_top="false"
app:qmui_tab_has_indicator="true"
/>
<com.qmuiteam.qmui.widget.QMUIViewPager
android:id="@+id/viewpager_wl"
android:layout_marginTop="100dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/app_content_bg_color" />

android:background="@color/main_background">
<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:fadingEdge="vertical"
tools:ignore="Suspicious0dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</ScrollView>
</RelativeLayout>
<com.qmuiteam.qmui.widget.QMUITopBarLayout
android:id="@+id/topbar"
android:layout_width="match_parent"


+ 1
- 18
app/src/main/res/layout/activity_systemparameter.xml Ver fichero

@@ -142,24 +142,7 @@
android:layout_centerVertical="true" />
</TableRow>

<!-- Table3-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_margin="5dp">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="火力最大级别:" />
<Spinner
android:id="@+id/HuoLi"
style="@style/commonSpinnerStyle"
android:layout_width="80dp"
android:layout_height="24dp"
android:layout_centerVertical="true" />
</TableRow>

</TableLayout>




+ 0
- 999
app/src/main/res/layout/fragment_home1.xml
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 0
- 228
app/src/main/res/layout/fragment_home2.xml Ver fichero

@@ -1,228 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/qmui_config_color_white"
app:qmui_skin_background="?attr/app_skin_common_background">

<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.qmuiteam.qmui.widget.QMUIAppBarLayout
android:id="@+id/appbarlayout"
android:layout_width="match_parent"
android:layout_height="256dp">

<com.qmuiteam.qmui.widget.QMUICollapsingTopBarLayout
android:id="@+id/collapsing_topbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:qmui_collapsedTitleGravity="center"
app:qmui_contentScrim="?attr/qmui_config_color_blue"
app:qmui_expandedTitleGravity="center_horizontal|bottom"
app:qmui_expandedTitleMarginBottom="20dp"
app:qmui_statusBarScrim="?attr/qmui_config_color_blue"
android:minHeight="?attr/qmui_topbar_height">

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
android:scaleType="centerCrop"
android:contentDescription="@string/common_example"
android:src="@mipmap/gongnengbeijing"
app:qmui_layout_collapseMode="parallax"
app:qmui_layout_collapseParallaxMultiplier="0.7"/>

<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="?attr/qmui_topbar_height"
app:qmui_layout_collapseMode="pin"
android:background="@color/qmui_config_color_transparent"
app:qmui_bottomDividerHeight="0px"/>
</com.qmuiteam.qmui.widget.QMUICollapsingTopBarLayout>
</com.qmuiteam.qmui.widget.QMUIAppBarLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"

app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:orientation="vertical">
<com.qmuiteam.qmui.layout.QMUIRelativeLayout
android:id="@+id/kshr"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginTop="10dp"
android:background="@drawable/hr_bj">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@mipmap/hr"
android:layout_centerVertical="true"
android:layout_marginLeft="40dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="150dp"
android:text="开始烹饪"
android:textColor="@color/white"
android:textSize="@dimen/card_view_in_height" />
</com.qmuiteam.qmui.layout.QMUIRelativeLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.qmuiteam.qmui.layout.QMUIRelativeLayout
android:id="@+id/diy"
android:layout_width="140dp"
android:layout_height="120dp"
android:layout_marginTop="10dp"
android:background="@drawable/diy_bj">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@mipmap/diy"
android:layout_centerInParent="true"
android:layout_marginLeft="20dp"/>
</com.qmuiteam.qmui.layout.QMUIRelativeLayout>

<com.qmuiteam.qmui.layout.QMUIRelativeLayout
android:id="@+id/cp"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="@dimen/dp_10"
android:background="@drawable/cp_bj">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@mipmap/cp"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"/>
<TextView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="120dp"
android:text="菜谱"
android:textColor="@color/white"
android:textSize="@dimen/card_view_in_height" />
</com.qmuiteam.qmui.layout.QMUIRelativeLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.qmuiteam.qmui.layout.QMUIRelativeLayout
android:id="@+id/wh"
android:layout_width="180dp"
android:layout_height="120dp"
android:layout_marginTop="10dp"
android:background="@drawable/wh_bj">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@mipmap/wh"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="100dp"
android:text="维护"
android:textColor="@color/white"
android:textSize="@dimen/card_view_in_height" />
</com.qmuiteam.qmui.layout.QMUIRelativeLayout>


<com.qmuiteam.qmui.layout.QMUIRelativeLayout
android:id="@+id/sz"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="@dimen/dp_10"
android:background="@drawable/sz_bj">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@mipmap/sz"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="100dp"
android:text="设置"
android:textColor="@color/white"
android:textSize="@dimen/card_view_in_height" />
</com.qmuiteam.qmui.layout.QMUIRelativeLayout>
</LinearLayout>
</LinearLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/app_color_blue"
android:text="四川黑菠萝科技有限公司@2023">
</TextView>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>
<!--<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"-->
<!-- xmlns:app="http://schemas.android.com/apk/res-auto"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent">-->

<!-- <ScrollView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_marginTop="?attr/qmui_topbar_height"-->
<!-- android:background="@color/qmui_config_color_white"-->
<!-- android:fitsSystemWindows="true">-->

<!-- <RelativeLayout style="@style/button_wrapper_style">-->

<!-- <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton-->
<!-- android:id="@+id/button"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerInParent="true"-->
<!-- android:clickable="true"-->
<!-- android:gravity="center"-->
<!-- android:padding="10dp"-->
<!-- android:text="fragment2"-->
<!-- android:textColor="@color/qmui_s_link_color"-->
<!-- app:qmui_borderColor="@color/qmui_s_link_color"-->
<!-- app:qmui_borderWidth="1px"/>-->

<!-- </RelativeLayout>-->
<!-- </ScrollView>-->

<!-- <com.qmuiteam.qmui.widget.QMUITopBarLayout-->
<!-- android:id="@+id/topbar"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:fitsSystemWindows="true"/>-->

<!--</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>-->

+ 0
- 39
app/src/main/res/layout/fragment_home3.xml Ver fichero

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>

<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/qmui_topbar_height"
android:background="@color/qmui_config_color_white"
android:fitsSystemWindows="true">

<RelativeLayout style="@style/button_wrapper_style">

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:clickable="true"
android:gravity="center"
android:padding="10dp"
android:text="fragment3"
android:textColor="@color/qmui_s_link_color"
app:qmui_borderColor="@color/qmui_s_link_color"
app:qmui_borderWidth="1px"/>

</RelativeLayout>
</ScrollView>

<com.qmuiteam.qmui.widget.QMUITopBarLayout
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"/>

</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 11
- 4
app/src/main/res/layout/fragment_jiaoyan_sdkz.xml Ver fichero

@@ -10,10 +10,17 @@
android:layout_height="match_parent"
android:background="@color/main_background"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="手动控制"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_marginLeft="@dimen/dp_40"
android:id="@+id/sdkz_linrarlaout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"></LinearLayout>
</ScrollView>

<!-- 物料信息管理 -->
</LinearLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 172
- 4
app/src/main/res/layout/fragment_jiaoyan_zdqx.xml Ver fichero

@@ -5,15 +5,183 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".modules.home.fragment.from.fragment.JiaoYan_zdqx_fragment">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/main_background"
android:orientation="vertical">
<TextView
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="自动清洗"/>
android:layout_centerInParent="true"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="① 填入时间"
android:textAlignment="center" />
<ImageView
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@mipmap/jt_x"/>
<LinearLayout
android:layout_width="300dp"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="排水阀排水时间"
android:textAlignment="center" />
<TextView
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="排水阀进水时间"
android:textAlignment="center" />
<TextView
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="清洗预加热时间"
android:textAlignment="center" />
<TextView
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="加清洗剂时间"
android:textAlignment="center" />
<TextView
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="循环清洗时间"
android:textAlignment="center" />
</LinearLayout>
<RelativeLayout
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_width="2dp"
android:layout_height="200dp"
android:background="@color/app_color_blue">
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:layout_marginLeft="20dp"
android:id="@+id/edittext_pssj"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:background="@drawable/input_bj"
android:hint="请输入"
android:inputType="text"
android:digits="0123456789."
android:maxLines="1"
android:padding="3dp"
android:textSize="12dp" />
<EditText
android:layout_marginLeft="20dp"
android:layout_marginTop="17dp"
android:id="@+id/edittext_jssj"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:background="@drawable/input_bj"
android:hint="请输入"
android:inputType="text"
android:digits="0123456789."
android:maxLines="1"
android:padding="3dp"
android:textSize="12dp" />
<EditText
android:layout_marginLeft="20dp"
android:layout_marginTop="17dp"
android:id="@+id/edittext_jrsj"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:background="@drawable/input_bj"
android:hint="请输入"
android:inputType="text"
android:digits="0123456789."
android:maxLines="1"
android:padding="3dp"
android:textSize="12dp" />
<EditText
android:layout_marginLeft="20dp"
android:layout_marginTop="17dp"
android:id="@+id/edittext_qxjsj"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:background="@drawable/input_bj"
android:hint="请输入"
android:inputType="text"
android:digits="0123456789."
android:maxLines="1"
android:padding="3dp"
android:textSize="12dp" />
<EditText
android:layout_marginLeft="20dp"
android:layout_marginTop="17dp"
android:id="@+id/edittext_xhsj"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:background="@drawable/input_bj"
android:hint="请输入"
android:inputType="text"
android:digits="0123456789."
android:maxLines="1"
android:padding="3dp"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>

<ImageView
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@mipmap/jt_x"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="② 点击保存"
android:textAlignment="center" />
<Button
android:id="@+id/save_time"
android:layout_marginTop="@dimen/dp_10"
android:layout_width="match_parent"
android:layout_height="26dp"
android:layout_centerInParent="true"
android:background="@drawable/bg_btn_login_selected"
android:text="保存"
android:textColor="@color/white"
android:textSize="14dp" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/bt_start"
android:layout_marginTop="40dp"
android:layout_width="120dp"
android:layout_height="80dp"
android:background="@drawable/wh_bj"
android:layout_centerInParent="true"
android:text="开始清洗"
android:textColor="@color/white" />
</RelativeLayout>

</LinearLayout>
<!-- 物料信息管理 -->
</LinearLayout>
</RelativeLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 21
- 0
app/src/main/res/layout/item/layout/tab_item.xml Ver fichero

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="24dp"
android:orientation="horizontal">

<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="2dp"
android:text="订单列表"
android:textSize="19dp"
android:textStyle="bold"></TextView>
</RelativeLayout>
</LinearLayout>

+ 10
- 0
app/src/main/res/layout/item/layout/wrapanl_sdkz_item.xml Ver fichero

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.bonait.bnframework.common.helper.AutoNextLineLinearLayout
android:id="@+id/tagLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"/>
</LinearLayout>

Cargando…
Cancelar
Guardar