Ver a proveniência

压力锅程序调试

Pressure_Cooker
pry há 7 meses
ascendente
cometimento
e26cb1e133
21 ficheiros alterados com 1003 adições e 303 eliminações
  1. +0
    -5
      app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ExceptionServer.java
  2. +13
    -1
      app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ModbusMaster.java
  3. +6
    -6
      app/src/main/java/com/bonait/bnframework/HBL/Dialog/DialogManager.java
  4. +140
    -0
      app/src/main/java/com/bonait/bnframework/business/AnalogConvert.java
  5. +3
    -1
      app/src/main/java/com/bonait/bnframework/business/ControlAdress.java
  6. +87
    -15
      app/src/main/java/com/bonait/bnframework/business/ModbusHelper.java
  7. +2
    -2
      app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java
  8. +12
    -5
      app/src/main/java/com/bonait/bnframework/common/utils/UpdateAppUtils.java
  9. +64
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java
  10. +71
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home4Fragment.java
  11. +84
    -11
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentDevice.java
  12. +26
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentPR.java
  13. +38
    -163
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdate1Activity.java
  14. +134
    -32
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParSetActivity.java
  15. +2
    -1
      app/src/main/res/layout/activity_diy_update1.xml
  16. +274
    -45
      app/src/main/res/layout/activity_system_par_set.xml
  17. +20
    -5
      app/src/main/res/layout/fragment_home4.xml
  18. +24
    -7
      app/src/main/res/layout/fragment_home_device.xml
  19. BIN
     
  20. BIN
     
  21. +3
    -1
      app/src/main/res/values/dimens.xml

+ 0
- 5
app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ExceptionServer.java Ver ficheiro

@@ -19,19 +19,14 @@ public class ExceptionServer {
}
if (excpet!=null) excpet.onSuccess(add);
} catch (InterruptedException e) {
MessageLog.ShowError("onFailure,Address=" + Address + ",length=" + length + ",msg:" + e.toString());
if (excpet!=null) excpet.onFailure(e.toString());
} catch (ExecutionException e) {
MessageLog.ShowError("onFailure,Address=" + Address + ",length=" + length + ",msg:" + e.toString());
if (excpet!=null) excpet.onFailure(e.toString());
} catch (ModbusTransportException e) {
MessageLog.ShowError("onFailure,Address=" + Address + ",length=" + length + ",msg:" + e.toString());
if (excpet!=null) excpet.onFailure(e.toString());
} catch (ModbusInitException e) {
MessageLog.ShowError("onFailure,Address=" + Address + ",length=" + length + ",msg:" + e.toString());
if (excpet!=null) excpet.onFailure(e.toString());
} catch (ModbusRespException e) {
MessageLog.ShowError("onFailure,Address=" + Address + ",length=" + length + ",msg:" + e.toString());
if (excpet!=null) excpet.onFailure(e.toString());
}
}


+ 13
- 1
app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ModbusMaster.java Ver ficheiro

@@ -470,7 +470,19 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{
public OperateResult WriteBool(String address, boolean value) {
if(address==null||address.isEmpty()){ return OperateResult.CreateFailed("无效的地址");}
if(!getConnected()){ return OperateResult.CreateFailed("设备未连接");}
return WriteBool(address,new boolean[]{value});
AtomicReference<OperateResult>resultValue=new AtomicReference<>();
new ExceptionServer(address, 1, new IExceptionHandling() {
@Override
public void onSuccess(int add) throws InterruptedException, ExecutionException, ModbusTransportException, ModbusInitException, ModbusRespException {
mw.syncWriteCoil(SlaveId, add, value);
resultValue.set(OperateResult.CreateSuccess());
}
@Override
public void onFailure(String error){
resultValue.set(OperateResult.CreateFailed(address+",写入异常:"+error));
}
});
return resultValue.get();
}

@Override


+ 6
- 6
app/src/main/java/com/bonait/bnframework/HBL/Dialog/DialogManager.java Ver ficheiro

@@ -276,8 +276,8 @@ public class DialogManager {
* @param action 执行回调
*/
public static void showInfo( Activity activity,String message, AlertDialogButton btn, IDialogAction action) {
if(mActivity!=null)
mActivity.runOnUiThread(()->{showDialog(activity,message,btn,DialogType.提示,action);});
if(activity!=null)
activity.runOnUiThread(()->{showDialog(activity,message,btn,DialogType.提示,action);});
else showDialog(activity,message,btn,DialogType.提示,action);
}

@@ -288,8 +288,8 @@ public class DialogManager {
* @param action 执行回调
*/
public static void showWarn(Activity activity,String message, AlertDialogButton btn, IDialogAction action) {
if(mActivity!=null)
mActivity.runOnUiThread(()->{showDialog(activity,message,btn,DialogType.警告,action);});
if(activity!=null)
activity.runOnUiThread(()->{showDialog(activity,message,btn,DialogType.警告,action);});
else showDialog(activity,message,btn,DialogType.警告,action);
}

@@ -300,8 +300,8 @@ public class DialogManager {
* @param action 执行回调
*/
public static void showError( Activity activity,String message, AlertDialogButton btn, IDialogAction action) {
if(mActivity!=null)
mActivity.runOnUiThread(()->{showDialog(activity,message,btn,DialogType.错误,action);});
if(activity!=null)
activity.runOnUiThread(()->{showDialog(activity,message,btn,DialogType.错误,action);});
else showDialog(activity,message,btn,DialogType.错误,action);
}



+ 140
- 0
app/src/main/java/com/bonait/bnframework/business/AnalogConvert.java Ver ficheiro

@@ -0,0 +1,140 @@
package com.bonait.bnframework.business;

import android.content.Context;
import android.widget.EditText;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.helper.ConfigUtil;

import butterknife.BindView;

/**
* 模拟量转换
*/
public class AnalogConvert {

/**
* 模拟量温度上限
*/
public static short et_Temperature_Analog_Upper_Limit=0;

/**
* 模拟量温度下限
*/
public static short et_Temperature_Analog_Lower_Limit=0;

/**
* 实际温度上限
*/
public static short et_Temperature_Upper_Limit=0;

/**
* 实际温度下限
*/
public static short et_Temperature_Lower_Limit=0;

/**
* 模拟量压力上限
*/
public static short et_Pressure_Analog_Upper_Limit=0;

/**
* 模拟量压力下限
*/
public static short et_Pressure_Analog_Lower_Limit=0;

/**
* 实际压力上限
*/
public static short et_Pressure_Upper_Limit=0;

/**
* 实际压力下限
*/
public static short et_Pressure_Lower_Limit=0;

public static short Scale(short InputValue, short InputMax, short InputMin, short OutMax, short OutMin){
try{
float tempValue = (OutMax - OutMin) * (InputValue - InputMin) / (InputMax - InputMin) + OutMin;
short num =(short)tempValue;
if (num > OutMax) return OutMax;
if (num < OutMin) return OutMin;
return num;
}catch(Exception e){

}
return 0;
}

/**
* 获取当前实际压力值
* @param InputValue 当前实际压力的模拟量值
* @return 当前实际压力值
*/
public static short getCurrentPressure(short InputValue){
return Scale(InputValue,et_Pressure_Analog_Upper_Limit,et_Pressure_Analog_Lower_Limit,et_Pressure_Upper_Limit,et_Pressure_Lower_Limit);
}

/**
* 获取当前实际压力的模拟量值
* @param InputValue 当前实际压力值
* @return 对应的模拟量值
*/
public static short getCurrentPressureAnalog(short InputValue){
return Scale(InputValue,et_Pressure_Upper_Limit,et_Pressure_Lower_Limit,et_Pressure_Analog_Upper_Limit,et_Pressure_Analog_Lower_Limit);
}


/**
* 获取当前实际温度值
* @param InputValue 当前实际温度的模拟量值
* @return 当前实际温度值
*/
public static short getCurrentTemperature(short InputValue){
return Scale(InputValue,et_Temperature_Analog_Upper_Limit,et_Temperature_Analog_Lower_Limit,et_Temperature_Upper_Limit,et_Temperature_Lower_Limit);
}

/**
* 获取当前实际温度的模拟量值
* @param InputValue 当前实际压力值
* @return 对应的模拟量值
*/
public static short getCurrentTemperatureAnalog(short InputValue){
return Scale(InputValue,et_Temperature_Upper_Limit,et_Temperature_Lower_Limit,et_Temperature_Analog_Upper_Limit,et_Temperature_Analog_Lower_Limit);
}

public static void SaveConfig(){
Context dishesCon = ConfigName.getInstance().dishesCon;
ConfigUtil.write(dishesCon, "et_Temperature_Analog_Upper_Limit",et_Temperature_Analog_Upper_Limit );
ConfigUtil.write(dishesCon, "et_Temperature_Analog_Lower_Limit",et_Temperature_Analog_Lower_Limit);
ConfigUtil.write(dishesCon, "et_Temperature_Upper_Limit",et_Temperature_Upper_Limit );
ConfigUtil.write(dishesCon, "et_Temperature_Lower_Limit",et_Temperature_Lower_Limit);
ConfigUtil.write(dishesCon, "et_Pressure_Analog_Upper_Limit",et_Pressure_Analog_Upper_Limit );
ConfigUtil.write(dishesCon, "et_Pressure_Analog_Lower_Limit",et_Pressure_Analog_Lower_Limit );
ConfigUtil.write(dishesCon, "et_Pressure_Upper_Limit",et_Pressure_Upper_Limit );
ConfigUtil.write(dishesCon, "et_Pressure_Lower_Limit",et_Pressure_Lower_Limit );
}

private static short getConfig(String key){
try{
Context dishesCon = ConfigName.getInstance().dishesCon;
return (short)ConfigUtil.read(dishesCon, key,0 );
}catch(Exception e){

}
return 0;
}

public static void ReadConfig(){
et_Temperature_Analog_Upper_Limit =getConfig("et_Temperature_Analog_Upper_Limit");
et_Temperature_Analog_Lower_Limit=getConfig("et_Temperature_Analog_Lower_Limit");
et_Temperature_Upper_Limit =getConfig("et_Temperature_Upper_Limit");
et_Temperature_Lower_Limit=getConfig("et_Temperature_Lower_Limit");
et_Pressure_Analog_Upper_Limit =getConfig("et_Pressure_Analog_Upper_Limit");
et_Pressure_Analog_Lower_Limit =getConfig("et_Pressure_Analog_Lower_Limit");
et_Pressure_Upper_Limit =getConfig("et_Pressure_Upper_Limit");
et_Pressure_Lower_Limit =getConfig("et_Pressure_Lower_Limit");
}

}

+ 3
- 1
app/src/main/java/com/bonait/bnframework/business/ControlAdress.java Ver ficheiro

@@ -30,6 +30,8 @@ public enum ControlAdress {
设定压力,
计时温度,
烹饪时间,
烹饪完成
烹饪完成,
配方启动,
当前时间

}

+ 87
- 15
app/src/main/java/com/bonait/bnframework/business/ModbusHelper.java Ver ficheiro

@@ -1,5 +1,7 @@
package com.bonait.bnframework.business;

import androidx.constraintlayout.widget.Guideline;

import com.bonait.bnframework.HBL.Communication.Modbus.ModbusMaster;
import com.bonait.bnframework.HBL.DataUtil.NotifyPropVar;
import com.bonait.bnframework.HBL.Executor;
@@ -9,6 +11,7 @@ import com.bonait.bnframework.HBL.Result.OperateResultT;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.common.db.mode.BPA_FORMULA;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.google.android.material.datepicker.MaterialDatePicker;

import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
@@ -34,20 +37,33 @@ public class ModbusHelper extends ModbusMaster {
put(ControlAdress.一键下降,new PLCModel("M1",DefaultValue.BOOLEAN,OperationModel.W));
put(ControlAdress.一键回位,new PLCModel("M5",DefaultValue.BOOLEAN,OperationModel.W));
put(ControlAdress.停止,new PLCModel("M6",DefaultValue.BOOLEAN,OperationModel.W));
put(ControlAdress.焖制中,new PLCModel("----",DefaultValue.BOOLEAN,OperationModel.RW));
put(ControlAdress.配方启动,new PLCModel("M11",DefaultValue.BOOLEAN,OperationModel.W));
// put(ControlAdress.焖制中,new PLCModel("",DefaultValue.BOOLEAN,OperationModel.RW));
put(ControlAdress.心跳,new PLCModel("D204",DefaultValue.SHORT,OperationModel.W));
put(ControlAdress.当前温度,new PLCModel("D100",DefaultValue.SHORT,OperationModel.R));
put(ControlAdress.当前压力,new PLCModel("D101",DefaultValue.SHORT,OperationModel.R));
put(ControlAdress.允许开盖压力,new PLCModel("D200",DefaultValue.SHORT,OperationModel.W));
put(ControlAdress.排冷气温度,new PLCModel("D203",DefaultValue.SHORT,OperationModel.W));
put(ControlAdress.温度下限,new PLCModel("D210",DefaultValue.SHORT,OperationModel.W));
put(ControlAdress.温度上限,new PLCModel("D211",DefaultValue.SHORT,OperationModel.W));
put(ControlAdress.压力下限,new PLCModel("D213",DefaultValue.SHORT,OperationModel.W));
put(ControlAdress.压力上限,new PLCModel("D214",DefaultValue.SHORT,OperationModel.W));
put(ControlAdress.允许开盖压力,new PLCModel("D200",DefaultValue.SHORT,OperationModel.RW));
put(ControlAdress.排冷气温度,new PLCModel("D203",DefaultValue.SHORT,OperationModel.RW));
put(ControlAdress.温度下限,new PLCModel("D210",DefaultValue.SHORT,OperationModel.RW));
put(ControlAdress.温度上限,new PLCModel("D211",DefaultValue.SHORT,OperationModel.RW));
put(ControlAdress.压力下限,new PLCModel("D213",DefaultValue.SHORT,OperationModel.RW));
put(ControlAdress.压力上限,new PLCModel("D214",DefaultValue.SHORT,OperationModel.RW));
put(ControlAdress.加热档位,new PLCModel("D300",DefaultValue.SHORT,OperationModel.W));
put(ControlAdress.设定压力,new PLCModel("D301",DefaultValue.SHORT,OperationModel.W));
put(ControlAdress.计时温度,new PLCModel("D303",DefaultValue.SHORT,OperationModel.W));
put(ControlAdress.烹饪时间,new PLCModel("D304",DefaultValue.SHORT,OperationModel.W));
put(ControlAdress.当前时间,new PLCModel("D10",DefaultValue.SHORT,OperationModel.R));
}};

static ConcurrentHashMap<Input,PLCModel> InputModel=new ConcurrentHashMap<Input,PLCModel>(){{
put(Input.锅盖上限,new PLCModel("X0",DefaultValue.BOOLEAN,OperationModel.R) );
put(Input.锅盖下限,new PLCModel("X1",DefaultValue.BOOLEAN,OperationModel.R));
put(Input.锅盖开启,new PLCModel("X2",DefaultValue.BOOLEAN,OperationModel.R));
put(Input.锅盖关闭,new PLCModel("X3",DefaultValue.BOOLEAN,OperationModel.R));
put(Input.锅体原点,new PLCModel("X4",DefaultValue.BOOLEAN,OperationModel.R));
put(Input.锅体极限,new PLCModel("X5",DefaultValue.BOOLEAN,OperationModel.R));
put(Input.急停,new PLCModel("X6",DefaultValue.BOOLEAN,OperationModel.R));
put(Input.相序保护器,new PLCModel("X7",DefaultValue.BOOLEAN,OperationModel.R));
}};

private void Sleep(long millis) {
@@ -67,6 +83,17 @@ public class ModbusHelper extends ModbusMaster {
}
}

public int getData(ControlAdress func ){
if(controlAddress.containsKey(func)){
if(controlAddress.get(func).Value.getValue() instanceof Short){
return Integer.parseInt(controlAddress.get(func).Value.getValue().toString()) ;
}
}else{
MessageLog.ShowInfo("不存在控制地址:"+func.toString());
}
return 0;
}

private void GetPlcStatus(){
ThreadManager.get().StartLong("PLC变量状态",true,()->{

@@ -74,7 +101,24 @@ public class ModbusHelper extends ModbusMaster {

controlAddress.forEach((key,value)->{
if(value.operationModel== OperationModel.R||value.operationModel==OperationModel.RW){
OperateResultT<Short> res = ReadShort(value.PlcAddress);
if(value.Value.getValue() instanceof Short){
OperateResultT<Short> res = ReadShort(value.PlcAddress);
if(res.isSuccess){
value.Value .setValue(res.Content);
}
}else if (value.Value.getValue() instanceof Boolean){
OperateResultT<Boolean> res = ReadBool(value.PlcAddress);
if(res.isSuccess){
value.Value .setValue(res.Content);
}
}

}
});

InputModel.forEach((key,value)->{
if(value.operationModel== OperationModel.R||value.operationModel==OperationModel.RW){
OperateResultT<Boolean> res = ReadInputCoil(value.PlcAddress);
if(res.isSuccess){
value.Value .setValue(res.Content);
}
@@ -87,6 +131,8 @@ public class ModbusHelper extends ModbusMaster {

public NotifyPropVar<Boolean> IsRunning=new NotifyPropVar<Boolean>(false);

public int CurrentTime=0;

public void RtuInit(String comName,int baudRate){
new Thread(()->{ RtuConnect(comName,baudRate).OnSource(()->{ GetPlcStatus();});}).start();
}
@@ -102,6 +148,14 @@ public class ModbusHelper extends ModbusMaster {
}
}

public PLCModel getInputStatus(Input key){
if(InputModel.containsKey(key)){
return InputModel.get(key);
}else{
return null;
}
}

/**
* 写入订单数据到PLC
* @param formula
@@ -110,11 +164,15 @@ public class ModbusHelper extends ModbusMaster {
try{
if(formula==null)return;
WriteShort(controlAddress.get(ControlAdress.加热档位).PlcAddress,(short)(formula.HeatingGear));
WriteShort(controlAddress.get(ControlAdress.设定压力).PlcAddress,(short)(formula.ReliefPressure));
WriteShort(controlAddress.get(ControlAdress.计时温度).PlcAddress,(short)(formula.TimingTemperature));
WriteShort(controlAddress.get(ControlAdress.烹饪时间).PlcAddress,(short)(formula.CookingTime*10));
WriteShort(controlAddress.get(ControlAdress.设定压力).PlcAddress,(short)(AnalogConvert.getCurrentPressureAnalog((short)formula.ReliefPressure)));
WriteShort(controlAddress.get(ControlAdress.计时温度).PlcAddress,(short)(AnalogConvert.getCurrentTemperatureAnalog((short)formula.TimingTemperature)));
WriteShort(controlAddress.get(ControlAdress.烹饪时间).PlcAddress,(short)(formula.CookingTime*600));
WriteBool(controlAddress.get(ControlAdress.配方启动).PlcAddress,true);
Sleep(1000);
WriteBool(controlAddress.get(ControlAdress.配方启动).PlcAddress,false);
ToastUtils.info("开始执行配方:"+formula.Name);
IsRunning.setValue(true);
CurrentTime = formula.CookingTime*600;
}catch(Exception e){
MessageLog.ShowError(e);
}
@@ -126,9 +184,21 @@ public class ModbusHelper extends ModbusMaster {
* @param action
* @param <T>
*/
public <T> void setPLCNotify(ControlAdress func, IRunT<T> action){
public <T> void setPLCNotify(ControlAdress func,String key, IRunT<T> action){
if(controlAddress.containsKey(func)){
controlAddress.get(func).Value.ChangeNotify=action;
controlAddress.get(func).Value.Register(key,action);
}
}

/**
* 设置变量监听通知
* @param func
* @param action
* @param <T>
*/
public <T> void setPLCNotify(Input func, IRunT<T> action){
if(InputModel.containsKey(func)){
InputModel.get(func).Value.ChangeNotify=action;
}
}

@@ -137,10 +207,12 @@ public class ModbusHelper extends ModbusMaster {
* @param func
* @param value
*/
public void WriteBoolSingle(ControlAdress func, Boolean value){
public void WriteBoolSingle(ControlAdress func, boolean value){
if(controlAddress.containsKey(func)){
Executor.get().runThread(()->{
WriteBool(controlAddress.get(func).PlcAddress,value);
WriteBool(controlAddress.get(func).PlcAddress,value).OnSource(()->{
MessageLog.ShowInfo("写入 "+controlAddress.get(func).PlcAddress+":"+value);
});
});
}
}


+ 2
- 2
app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java Ver ficheiro

@@ -2990,8 +2990,8 @@ public class QueryDB {
public static OperateResult UpdataFormula(BPA_FORMULA formula){
try{
if(formula == null)return OperateResult.CreateFailed("对象内容不正确");
boolean isName = checkName(formula.Name);
if(isName)return OperateResult.CreateFailed("名称已存在");
// boolean isName = checkName(formula.Name);
// if(isName)return OperateResult.CreateFailed("名称已存在");
boolean res = Update(BPA_FORMULA.class, formula);
if(res) return OperateResult.CreateSuccess();
else return OperateResult.CreateFailed("修改数据失败");


+ 12
- 5
app/src/main/java/com/bonait/bnframework/common/utils/UpdateAppUtils.java Ver ficheiro

@@ -43,7 +43,7 @@ public class UpdateAppUtils {
/**
* 当前版本号
*/
private static String myVersionCode = "1.0";
private static String myVersionCode = "1.4";
/**
* 服务器的版本号
*/
@@ -73,11 +73,18 @@ public class UpdateAppUtils {
*/
private static void doPost(final Context context) {
VersionMode mode=new VersionMode();

//压力锅
mode.productCode="1769564215952125952";
mode.moduleCode="pressurecooker";
mode.serverCode="1769564338190921728";
mode.branchCode="1776859473543016448";

//大炒
mode.productCode="1679306986915368960";
mode.moduleCode="dcdjbbd";
mode.serverCode="1680766359592243200";
mode.branchCode="1679308856555737089";
// mode.productCode="1679306986915368960";
// mode.moduleCode="dcdjbbd";
// mode.serverCode="1680766359592243200";
// mode.branchCode="1679308856555737089";

//小炒网络v版本
// mode.productCode="1679306986915368960";


+ 64
- 1
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java Ver ficheiro

@@ -1,9 +1,16 @@
package com.bonait.bnframework.modules.home.activity;

import androidx.annotation.RequiresApi;
import androidx.viewpager.widget.ViewPager;

import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.view.KeyEvent;
import android.view.View;
import android.widget.LinearLayout;
@@ -12,15 +19,21 @@ import android.widget.TextView;
import com.bonait.bnframework.HBL.Dialog.AlertDialogButton;
import com.bonait.bnframework.HBL.Dialog.DialogManager;
import com.bonait.bnframework.HBL.Interface.IRunT2;
import com.bonait.bnframework.HBL.Logs.MessageLog;
import com.bonait.bnframework.HBL.NotifyEvent;
import com.bonait.bnframework.HBL.Result.OperateResult;
import com.bonait.bnframework.HBL.Result.OperateResultT;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.AnalogConvert;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.ControlAdress;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.business.Input;
import com.bonait.bnframework.business.ModbusHelper;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.Constants;
import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
@@ -29,8 +42,10 @@ import com.bonait.bnframework.common.helper.CountDownTimerExt;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.message.MessageLooper;
import com.bonait.bnframework.common.message.MessageManager;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.utils.UpdateAppUtils;
import com.bonait.bnframework.common.view.BottomNavigationBar;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter;
@@ -40,12 +55,18 @@ import com.bonait.bnframework.modules.home.fragment.HomeFragmentPR;
import com.bonait.bnframework.modules.home.fragment.from.CookingActivity;
import com.lzy.okgo.OkGo;
import com.qmuiteam.qmui.widget.QMUIViewPager;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;

public class BottomNavigationNewActivity extends BaseActivity {

@@ -118,6 +139,7 @@ public class BottomNavigationNewActivity extends BaseActivity {
fragmentAdapter.addFragment(new Home4Fragment());
fragmentAdapter.addFragment(new HomeFragmentDevice());
viewPager.setAdapter(fragmentAdapter);
viewPager.setSwipeable(false);//禁用页面滑动功能

MessageManager.getInstance().registerMessageReceiver(this, MessageName.SelectZY, new MessageLooper.OnMessageListener() {
@Override
@@ -136,6 +158,9 @@ public class BottomNavigationNewActivity extends BaseActivity {
});
}




/**
* 配置ViewPager监听器,手指滑动监听
*/
@@ -207,6 +232,25 @@ public class BottomNavigationNewActivity extends BaseActivity {
}
}

private OperateResultT<List<String>> getSerialPorts(){
try{
File devDirectory = new File("/dev/");
File[] files = devDirectory.listFiles();
List<String> serialPorts=new ArrayList<String>();
if (files != null) {
for (File file : files) {
if (file.getPath().startsWith("/dev/tty")) {
serialPorts.add(file.getPath());
}
}
}
if(serialPorts.size()>0)return OperateResultT.CreateSuccess(serialPorts);
else return OperateResultT.CreateFailedT("未找到串口");
}catch(Exception e){
return OperateResultT.CreateFailedT(e);
}
}

/**
* 初始化
*/
@@ -220,13 +264,32 @@ public class BottomNavigationNewActivity extends BaseActivity {
//2.初始化PLC
ModbusHelper.get().RtuInit("/dev/ttyCOM0",9600);

ModbusHelper.get().<Boolean>setPLCNotify(ControlAdress.烹饪完成,(s)->{
// getSerialPorts().OnSource(s->{
// s.Content.forEach(item->{MessageLog.ShowError(item);});
// });
ModbusHelper.get().<Boolean>setPLCNotify(ControlAdress.烹饪完成,"主界面烹饪完成通知",(s)->{
if(s){
DialogManager.showInfo(this,"烹饪完成,请及时查看!", AlertDialogButton.OK,(result)->{
NotifyEvent.get().Notify("烹饪完成");
ModbusHelper.get().WriteBoolSingle(ControlAdress.烹饪完成,false);
ModbusHelper.get().IsRunning.setValue(false);
});
}
});

ModbusHelper.get().<Boolean>setPLCNotify(Input.相序保护器,(s)->{
if(s){
DialogManager.showError(this,"电机相序错误,请检查设备!", AlertDialogButton.OK,null);
}
}) ;

ModbusHelper.get().<Boolean>setPLCNotify(Input.急停,(s)->{
if(!s){
DialogManager.showError(this,"设备急停中!", AlertDialogButton.OK,null);
}
}) ;

AnalogConvert.ReadConfig();
}

//endregion


+ 71
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home4Fragment.java Ver ficheiro

@@ -2,12 +2,17 @@ package com.bonait.bnframework.modules.home.fragment;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;

import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
@@ -17,10 +22,12 @@ 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.Constants;
import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.message.MessageManager;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.utils.UpdateAppUtils;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.bonait.bnframework.modules.home.fragment.from.BunkerSetupActivity;
import com.bonait.bnframework.modules.home.fragment.from.CpxzActivity;
@@ -37,6 +44,8 @@ import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;

public class Home4Fragment extends BaseFragment {

@@ -72,7 +81,7 @@ public class Home4Fragment extends BaseFragment {
* @param view
*/
@OnClick({R.id.kaishipengren, R.id.shebeikongzhi, R.id.zhuxiaodenglu
, R.id.liaochangshezhi, R.id.caipinyanfa,})
, R.id.liaochangshezhi, R.id.caipinyanfa,R.id.check_update})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.kaishipengren:
@@ -84,6 +93,9 @@ public class Home4Fragment extends BaseFragment {
case R.id.liaochangshezhi:
OpenActivity(SystemParSetActivity.class);
break;
case R.id.check_update:
checkPermission();
break;
case R.id.caipinyanfa:
// OpenActivity(DishTestActivity.class);
DiyUpdate1Activity.SelectId=null;
@@ -103,6 +115,64 @@ public class Home4Fragment extends BaseFragment {
}
}


@AfterPermissionGranted(Constants.UPDATE_APP)
@Override
public void checkPermission() {
// 检查文件读写权限
String[] params = {Manifest.permission.WRITE_EXTERNAL_STORAGE};
if (EasyPermissions.hasPermissions(context,params)) {

//Android 8.0后,安装应用需要检查打开未知来源应用权限
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
checkInstallPermission();
} else {
UpdateAppUtils.updateApp(context);
}
} else {
//未获取权限
EasyPermissions.requestPermissions(this, "更新版本需要读写本地权限!", Constants.UPDATE_APP, params);
}
}

/**
* Android 8.0后,安装应用需要检查打开未知来源应用权限
*/
@RequiresApi(api = Build.VERSION_CODES.O)
private void checkInstallPermission() {
// 判断是否已打开未知来源应用权限
boolean haveInstallPermission = context.getPackageManager().canRequestPackageInstalls();

if (haveInstallPermission) {
//已经打开权限,直接启动版本更新
UpdateAppUtils.updateApp(context);
} else {
AlertDialogUtils.showDialog(getContext(),
"请打开未知来源应用权限",
"为了正常升级APP,请点击设置-高级设置-允许安装未知来源应用,本功能只限用于APP版本升级。",
"权限设置",
new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
// 跳转到系统打开未知来源应用权限,在onActivityResult中启动更新
toInstallPermissionSettingIntent(context);
dialog.dismiss();
}
});
}
}

/**
* 开启安装未知来源权限
*/
@RequiresApi(api = Build.VERSION_CODES.O)
private void toInstallPermissionSettingIntent(Context context) {
Uri packageURI = Uri.parse("package:" + context.getPackageName());
Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, packageURI);
startActivityForResult(intent, Constants.INSTALL_PERMISSION_CODE);
}


/**
* 跳转登录界面
*/


+ 84
- 11
app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentDevice.java Ver ficheiro

@@ -15,9 +15,13 @@ import androidx.annotation.Nullable;

import com.bonait.bnframework.HBL.Dialog.AlertDialogButton;
import com.bonait.bnframework.HBL.Dialog.DialogManager;
import com.bonait.bnframework.HBL.NotifyEvent;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.AnalogConvert;
import com.bonait.bnframework.business.ControlAdress;
import com.bonait.bnframework.business.Input;
import com.bonait.bnframework.business.ModbusHelper;
import com.bonait.bnframework.business.PLCModel;
import com.bonait.bnframework.common.base.BaseFragment;
import com.orhanobut.logger.Logger;

@@ -28,6 +32,9 @@ import butterknife.OnClick;
public class HomeFragmentDevice extends BaseFragment {

//region 控件
@BindView(R.id.tv_time)
TextView tv_time;

/**
* 温度
*/
@@ -132,13 +139,65 @@ public class HomeFragmentDevice extends BaseFragment {
Logger.d("第一页销毁");
}


private boolean Validate(){
try{
PLCModel temp1 = ModbusHelper.get().getInputStatus(Input.相序保护器);
if(temp1!=null){
return Boolean.parseBoolean(temp1.Value.getValue().toString());
}
}catch(Exception e){

}
return false;
}

/**
* 将毫秒转化为 分钟:秒 的格式 100* 1000
*
* @param millisecond 毫秒
* @return
*/
public String formatTime(long millisecond) {
try{
int minute =(int)(millisecond/60000);//分钟
int second=(int)(millisecond%60000)/1000;//秒数
if (minute < 10) {
if (second < 10) {
return "0" + minute + " : " + "0" + second;
} else {
return "0" + minute + " : " + second;
}
} else {
if (second < 10) {
return minute + " : " + "0" + second;
} else {
return minute + " : " + second;
}
}
}catch (Exception e) {
return "00 : 00";
}
}

private void Init(){
ModbusHelper.get().<Short>setPLCNotify(ControlAdress.当前温度,(s)->{
activity.runOnUiThread(()->{tv_temperature.setText("温度:"+ String.format("%.2f",s/10f) +" ℃");});
ModbusHelper.get().<Short>setPLCNotify(ControlAdress.当前温度,"手动控制温度通知",(s)->{
activity.runOnUiThread(()->{tv_temperature.setText("当前温度:"+ AnalogConvert.getCurrentTemperature(s) +" ℃");});
});

ModbusHelper.get().<Short>setPLCNotify(ControlAdress.当前压力,(s)->{
activity.runOnUiThread(()->{tv_pressure.setText("压力:"+ String.format("%.2f",s/10f) +" kpa");});
ModbusHelper.get().<Short>setPLCNotify(ControlAdress.当前压力,"手动控制压力通知",(s)->{
activity.runOnUiThread(()->{tv_pressure.setText("当前压力:"+ AnalogConvert.getCurrentPressure(s) +" kpa");});
});

ModbusHelper.get().<Short>setPLCNotify(ControlAdress.当前时间,"手动控制剩余时间通知",(s)->{
activity.runOnUiThread(()->{tv_time.setText("剩余时间:"+ formatTime((ModbusHelper.get().CurrentTime-s)*100));});
});

ModbusHelper.get().<Boolean>setPLCNotify(Input.相序保护器,(s)->{
if(s) {
DialogManager.showError(getActivity(),"设备相序错误,请检查设备!",AlertDialogButton.OK,null);
}
activity.runOnUiThread(()->{ BtnEnable(!s);});
});

ModbusHelper.get().IsRunning.ChangeNotify=(s)->{
@@ -147,6 +206,14 @@ public class HomeFragmentDevice extends BaseFragment {
});
};

NotifyEvent.get().Register("烹饪完成",()->{
activity.runOnUiThread(()->{
BtnEnable(true);
});
});

if(Validate())BtnEnable(false);

btn_PotLid_Up.setOnTouchListener(touchListener);
btn_PotLid_Down.setOnTouchListener(touchListener);
btn_PotLid_Open.setOnTouchListener(touchListener);
@@ -180,7 +247,7 @@ public class HomeFragmentDevice extends BaseFragment {
btn_OneKey_Home.setTextColor(value?Color.WHITE: Color.GRAY);
}

@OnClick({R.id.btn_OneKey_Up, R.id.btn_OneKey_Down, R.id.btn_OneKey_Home, R.id.btn_Stop})
@OnClick({R.id.btn_OneKey_Up, R.id.btn_OneKey_Down, R.id.btn_OneKey_Home, R.id.btn_Stop,R.id.btn_PotLid_Open,R.id.btn_PotLid_Close})
public void onViewClicked(View view) {
if(!ModbusHelper.get().getConnected()){
DialogManager.showWarn(activity,"设备未连接,请连接后重试!", AlertDialogButton.OK,null);
@@ -196,6 +263,12 @@ public class HomeFragmentDevice extends BaseFragment {
case R.id.btn_OneKey_Home:
ModbusHelper.get().PulseSignal(ControlAdress.一键回位);
break;
case R.id.btn_PotLid_Open:
ModbusHelper.get().WriteBoolSingle(ControlAdress.锅盖开启,true);
break;
case R.id.btn_PotLid_Close:
ModbusHelper.get().WriteBoolSingle(ControlAdress.锅盖关闭,true);
break;
case R.id.btn_Stop:
DialogManager.showWarn(activity,"请问是否停止当前正在焖制的任务?",AlertDialogButton.OKCancel,(s)->{
if(s){
@@ -236,12 +309,12 @@ public class HomeFragmentDevice extends BaseFragment {
case R.id.btn_PotLid_Down:
ModbusHelper.get().WriteBoolSingle(ControlAdress.锅盖下降,IsChick);
break;
case R.id.btn_PotLid_Open:
ModbusHelper.get().WriteBoolSingle(ControlAdress.锅盖开启,IsChick);
break;
case R.id.btn_PotLid_Close:
ModbusHelper.get().WriteBoolSingle(ControlAdress.锅盖关闭,IsChick);
break;
// case R.id.btn_PotLid_Open:
// ModbusHelper.get().WriteBoolSingle(ControlAdress.锅盖开启,IsChick);
// break;
// case R.id.btn_PotLid_Close:
// ModbusHelper.get().WriteBoolSingle(ControlAdress.锅盖关闭,IsChick);
// break;
case R.id.btn_PotBody_Forward:
ModbusHelper.get().WriteBoolSingle(ControlAdress.锅体正转,IsChick);
break;


+ 26
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentPR.java Ver ficheiro

@@ -32,7 +32,9 @@ import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.business.Input;
import com.bonait.bnframework.business.ModbusHelper;
import com.bonait.bnframework.business.PLCModel;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
@@ -207,7 +209,7 @@ public class HomeFragmentPR extends BaseFragment {
break;
case 5: //打开制作窗体
//判断是否正在制作
if(!Validate())return;
if(ModbusHelper.get().IsRunning.getValue()){
DialogManager.showWarn(context,"制作中,请稍后后再试!", AlertDialogButton.OK,null);
}else{
@@ -235,6 +237,29 @@ public class HomeFragmentPR extends BaseFragment {
}
};

private boolean Validate(){
try{
PLCModel temp = ModbusHelper.get().getInputStatus(Input.急停);
PLCModel temp1 = ModbusHelper.get().getInputStatus(Input.相序保护器);
if(temp!=null){
if(!Boolean.parseBoolean(temp.Value.getValue().toString())){
DialogManager.showError(getActivity(),"设备急停中,禁止操作配方!",AlertDialogButton.OK,null);
return false;
}
}

if(temp1!=null){
if(Boolean.parseBoolean(temp1.Value.getValue().toString())){
DialogManager.showError(getActivity(),"设备相序错误,禁止操作配方!",AlertDialogButton.OK,null);
return false;
}
}

}catch(Exception e){

}
return true;
}

/**
* 点击事件


+ 38
- 163
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdate1Activity.java Ver ficheiro

@@ -429,79 +429,6 @@ public class DiyUpdate1Activity extends BaseActivity {
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
break;
// case R.id.add_hrgx://添加工序
// BPA_GOODSRECIPE goodsrecipe = GetSelectItemFromValue();
// if (goodsrecipe != null) {
// bpa_goodsrecipes.add(GetSelectItemFromValue());
// gxbz_adapter.notifyDataSetChanged();
// }
// break;
// case R.id.update_gx://修改工序
// int index_update = gxbz_adapter.getSelectedPosition();
// if (index_update >= 0 && index_update < bpa_goodsrecipes.size()) {
// BPA_GOODSRECIPE obj_update = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_update);
// String selectname = hrgx.getSelectedItem().toString();
// if (!obj_update.processname.equals(selectname)) {
// ToastUtils.info("请先选择工序!");
// return;
// }
// bpa_goodsrecipes.set(index_update, GetSelectItemFromValue());
// gxbz_adapter.notifyDataSetChanged();
// ToastUtils.info("修改步骤" + (index_update + 1) + ":" + obj_update.processname + "成功!");
// } else {
// ToastUtils.info("请先选择工序!");
// }
// break;
// case R.id.delete_gx://删除工序
// int index_delete = gxbz_adapter.getSelectedPosition();
// if (index_delete >= 0 && index_delete < bpa_goodsrecipes.size()) {
// BPA_GOODSRECIPE obj_delete = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_delete);
// bpa_goodsrecipes.remove(obj_delete);
// gxbz_adapter.notifyDataSetChanged();
//
// //移动光标
// if (index_delete - 1 >= 0) {
// SetSelectPos(index_delete - 1);
// }
// ToastUtils.info("删除工序" + obj_delete.processname + "成功!");
// } else {
// ToastUtils.info("请先选择工序!");
// }
// break;
// case R.id.shangyi://上移
// int index_up = gxbz_adapter.getSelectedPosition();
// ;
// if (index_up > 0) {
// BPA_GOODSRECIPE obj_up = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_up);
// bpa_goodsrecipes.remove(obj_up);
// bpa_goodsrecipes.add(index_up - 1, obj_up);
// gxbz_adapter.notifyDataSetChanged();
//
// //移动光标
// SetSelectPos(index_up - 1);
// } else {
// ToastUtils.info("已经最顶部!");
// }
// break;
// case R.id.xiayi://下移
// int index_down = gxbz_adapter.getSelectedPosition();
// if (index_down < bpa_goodsrecipes.size() - 1 && index_down >= 0) {
// BPA_GOODSRECIPE obj_down = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_down);
// bpa_goodsrecipes.remove(obj_down);
// bpa_goodsrecipes.add(index_down + 1, obj_down);
// gxbz_adapter.notifyDataSetChanged();
//
// //移动光标
// SetSelectPos(index_down + 1);
// } else {
// ToastUtils.info("已经最底部!");
// }
// break;
// case R.id.caozuomoshi://操作模式
// Intent intent1 = new Intent(getContext(), DiyMemoryActivity.class);
// intent1.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// startActivity(intent1);
// break;
case R.id.shengchengnewcaipu:
String name1 = edittext.getText().toString();
if(name1.isEmpty()){
@@ -512,6 +439,15 @@ public class DiyUpdate1Activity extends BaseActivity {
DialogManager.showWarn(this,"菜谱名称已存在!", AlertDialogButton.OK,null);
return;
}
try{
if( Integer.parseInt(et_Relief_Pressure.getText().toString())>200){
DialogManager.showError(this,"最大压力不能超过 200", AlertDialogButton.OK,null);
return;
}
}catch (Exception e){
DialogManager.showError(this,"请输入合法的压力值", AlertDialogButton.OK,null);
}


DialogManager.showInfo(this,"请问是否生成 ["+name1+"] 菜谱?", AlertDialogButton.YesNo,(s)->{
if(s){
@@ -533,99 +469,38 @@ public class DiyUpdate1Activity extends BaseActivity {
}
}
});
break;
case R.id.shengchengcaipu://修改菜谱
try{
if(!SelectId.isEmpty()){
String name = edittext.getText().toString();
int heatingGear = Integer.parseInt(hrgx.getSelectedItem().toString());
int timingsTemperature = Integer.parseInt(et_Timing_Temperature.getText().toString());
int cookingTime = Integer.parseInt(et_Cooking_Time.getText().toString());
int reliefPressure = Integer.parseInt(et_Relief_Pressure.getText().toString());

if( Integer.parseInt(et_Relief_Pressure.getText().toString())>200){
DialogManager.showError(this,"最大压力不能超过 200", AlertDialogButton.OK,null);
return;
}


BPA_FORMULA data = new BPA_FORMULA(name,ImageUrl,heatingGear,timingsTemperature,cookingTime,reliefPressure);
data.id=SelectId;
OperateResult result = QueryDB.UpdataFormula(data);
if(result.isSuccess){
ToastUtils.info("菜谱修改成功!");
NotifyEvent.get().Notify("商品信息刷新");
} else DialogManager.showError(this,"修改菜谱失败,"+result.message,AlertDialogButton.OK,null);
// finish();
}else{
DialogManager.showError(this,"修改菜谱失败:无效的菜品信息",AlertDialogButton.OK,null);
}

//
// if (name1.isEmpty()) {
//// ToastUtils.info("菜谱名称不能为空!");
// DialogManager.showWarn(this,"菜谱名称不能为空!", AlertDialogButton.OK,null);
// return;
// } else {
// boolean isSucess = QueryDB.checkName(name1);
// if (isSucess) {
// ToastUtils.info("菜谱名称已存在!");
// return;
// }
// //按钮点击
// String title = "生成菜谱操作提示!";
// String message = "请问客官确定要生成[" + name1 + "]菜谱吗?";
// AlertDialogUtils.showDialog(view.getContext(), title, message, new QMUIDialogAction.ActionListener() {
// @Override
// public void onClick(QMUIDialog dialog, int index) {
// int sc = 60 * 3;
// if (!zzsc.getText().toString().isEmpty() && !zzsc.getText().toString().equals("0")) {
// sc = Integer.parseInt(zzsc.getText().toString());
// }
//
// ArrayList<BPA_GOODS> goods = QueryDB.GetGoodsALL();
// BPA_GOODS good1 = new BPA_GOODS();
// good1.name = name1;
// good1.status = 1;
// good1.sort = goods.size() + 1;
// good1.maketime = sc;
// good1.issc = check.isChecked() ? 1 : 0;
// if(good!=null) good1.url = good.url;
// QueryDB.AddGoods(good1);
// for (int k = 0; k < bpa_goodsrecipes.size(); k++) {
// BPA_GOODSRECIPE item = bpa_goodsrecipes.get(k);
// item.id = java.util.UUID.randomUUID().toString();
// item.goodsID = good1.id;
// item.sort = k + 1;
// QueryDB.AddGoodsSrecipe(item);
// }
// ToastUtils.info("菜谱复刻成功!");
// dialog.dismiss();
// MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good");
// finish();
// }
// });
//
// }
break;
case R.id.shengchengcaipu://修改菜谱
// String name = edittext.getText().toString();
// if (name.isEmpty()) {
// ToastUtils.info("菜谱名称不能为空!");
// return;
// } else {
// boolean isSucess = QueryDB.GetGoodsIs(name, good.id);
// if (isSucess) {
// ToastUtils.info("菜谱名称已存在!");
// return;
// }
// //按钮点击
// String title = "保存菜谱操作提示!";
// String message = "请问客官确定要保存[" + name + "]菜谱吗?";
// AlertDialogUtils.showDialog(view.getContext(), title, message, new QMUIDialogAction.ActionListener() {
// @Override
// public void onClick(QMUIDialog dialog, int index) {
// int sc = 60 * 3;
// if (!zzsc.getText().toString().isEmpty() && !zzsc.getText().toString().equals("0")) {
// sc = Integer.parseInt(zzsc.getText().toString());
// }
// good.maketime = sc;
// good.issc = check.isChecked() ? 1 : 0;
// good.name = name;
// QueryDB.UpdateGoods(good);
// ArrayList<BPA_GOODSRECIPE> pe = QueryDB.GetGoodsSrecipeID(good.id);
// for (BPA_GOODSRECIPE item : pe) {
// QueryDB.DeleteGoodsSrecipe(item);
// }
// for (int k = 0; k < bpa_goodsrecipes.size(); k++) {
// BPA_GOODSRECIPE item = bpa_goodsrecipes.get(k);
// item.goodsID = good.id;
// item.sort = k + 1;
// QueryDB.AddGoodsSrecipe(item);
// }
// ToastUtils.info("菜谱修改成功!");
// dialog.dismiss();
// MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good");
// finish();
// }
// });
//
// }

}catch(Exception e){
DialogManager.showError(this,"修改菜谱失败,"+e.getMessage(),AlertDialogButton.OK,null);
}
break;
}
}


+ 134
- 32
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParSetActivity.java Ver ficheiro

@@ -5,12 +5,16 @@ import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import androidx.core.content.ContextCompat;

import com.bonait.bnframework.HBL.Dialog.AlertDialogButton;
import com.bonait.bnframework.HBL.Dialog.DialogManager;
import com.bonait.bnframework.HBL.Executor;
import com.bonait.bnframework.HBL.Logs.MessageLog;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.AnalogConvert;
import com.bonait.bnframework.business.ControlAdress;
import com.bonait.bnframework.business.ModbusHelper;
import com.bonait.bnframework.common.base.BaseActivity;
@@ -37,25 +41,73 @@ public class SystemParSetActivity extends BaseActivity {
QMUITopBarLayout mTopBar;

/**
* 温度上限
* 实际温度值
*/
@BindView(R.id.tv_Current_temperature)
TextView tv_Current_temperature;

/**
* 实际压力值
*/
@BindView(R.id.tv_Current_pressure)
TextView tv_Current_pressure;

/**
* 模拟量温度值
*/
@BindView(R.id.tv_temperature)
TextView tv_temperature;

/**
* 模拟量压力值
*/
@BindView(R.id.tv_pressure)
TextView tv_pressure;

/**
* 模拟量温度上限
*/
@BindView(R.id.et_Temperature_Analog_Upper_Limit)
EditText et_Temperature_Analog_Upper_Limit;

/**
* 模拟量温度下限
*/
@BindView(R.id.et_Temperature_Analog_Lower_Limit)
EditText et_Temperature_Analog_Lower_Limit;

/**
* 实际温度上限
*/
@BindView(R.id.et_Temperature_Upper_Limit)
EditText et_Temperature_Upper_Limit;

/**
* 温度下限
* 实际温度下限
*/
@BindView(R.id.et_Temperature_Lower_Limit)
EditText et_Temperature_Lower_Limit;

/**
* 压力上限
* 模拟量压力上限
*/
@BindView(R.id.et_Pressure_Analog_Upper_Limit)
EditText et_Pressure_Analog_Upper_Limit;

/**
* 模拟量压力下限
*/
@BindView(R.id.et_Pressure_Analog_Lower_Limit)
EditText et_Pressure_Analog_Lower_Limit;

/**
* 实际压力上限
*/
@BindView(R.id.et_Pressure_Upper_Limit)
EditText et_Pressure_Upper_Limit;

/**
* 压力下限
* 实际压力下限
*/
@BindView(R.id.et_Pressure_Lower_Limit)
EditText et_Pressure_Lower_Limit;
@@ -107,27 +159,55 @@ public class SystemParSetActivity extends BaseActivity {

}

private String getConfig(String key){
Context dishesCon = ConfigName.getInstance().dishesCon;
return String.valueOf(ConfigUtil.read(dishesCon, key,0 ));
}

/**
* 初始化数据
*/
public void InitData() {
try{
et_Temperature_Upper_Limit.setText(getConfig("Temperature_Upper_Limit"));
et_Temperature_Lower_Limit.setText(getConfig("Temperature_Lower_Limit"));
et_Pressure_Upper_Limit.setText(getConfig("Pressure_Upper_Limit"));
et_Pressure_Lower_Limit.setText(getConfig("Pressure_Lower_Limit"));
et_OpenLid_pressure.setText(getConfig("OpenLid_pressure"));
et_Exhaust_Air_Temperature.setText(getConfig("Exhaust_Air_Temperature"));

ModbusHelper.get().<Short>setPLCNotify(ControlAdress.当前温度,"参数设置温度通知",(s)->{
activity.runOnUiThread(()->{
tv_temperature.setText("温度模拟量值:"+ s );
tv_Current_temperature.setText("当前实际温度:"+AnalogConvert.getCurrentTemperature(s)+" ℃");
});
});

ModbusHelper.get().<Short>setPLCNotify(ControlAdress.当前压力,"参数设置压力通知",(s)->{
activity.runOnUiThread(()->{
tv_pressure.setText("压力模拟量值:"+ s);
tv_Current_pressure.setText("当前实际压力:"+AnalogConvert.getCurrentPressure(s)+" Kpa");
});
});

// et_OpenLid_pressure.setText(String.valueOf( AnalogConvert.getCurrentPressure((short)ModbusHelper.get().getData(ControlAdress.允许开盖压力))));
// et_Exhaust_Air_Temperature.setText(String.valueOf( AnalogConvert.getCurrentTemperature((short)ModbusHelper.get().getData(ControlAdress.排冷气温度))));

et_OpenLid_pressure.setText(String.valueOf( ModbusHelper.get().getData(ControlAdress.允许开盖压力)));
et_Exhaust_Air_Temperature.setText(String.valueOf(ModbusHelper.get().getData(ControlAdress.排冷气温度)));

et_Temperature_Analog_Upper_Limit.setText(String.valueOf(AnalogConvert.et_Temperature_Analog_Upper_Limit));
et_Temperature_Analog_Lower_Limit.setText(String.valueOf(AnalogConvert.et_Temperature_Analog_Lower_Limit));
et_Temperature_Upper_Limit.setText(String.valueOf(AnalogConvert.et_Temperature_Upper_Limit));
et_Temperature_Lower_Limit.setText(String.valueOf(AnalogConvert.et_Temperature_Lower_Limit));

et_Pressure_Analog_Upper_Limit.setText(String.valueOf(AnalogConvert.et_Pressure_Analog_Upper_Limit));
et_Pressure_Analog_Lower_Limit.setText(String.valueOf(AnalogConvert.et_Pressure_Analog_Lower_Limit));
et_Pressure_Upper_Limit.setText(String.valueOf(AnalogConvert.et_Pressure_Upper_Limit));
et_Pressure_Lower_Limit.setText(String.valueOf(AnalogConvert.et_Pressure_Lower_Limit));
}catch(Exception e){
MessageLog.ShowError(e);
}
}

private boolean EditValidate(EditText et,String msg){
try{
Short.parseShort(et.getText().toString());
return true;
}catch(Exception e){
DialogManager.showError(this,msg, AlertDialogButton.OK,null);
}
return false;
}

/**
* 点击事件
@@ -139,26 +219,48 @@ public class SystemParSetActivity extends BaseActivity {
switch (view.getId()) {
case R.id.btn_save:
try{
short Temperature_Upper_Limit = Short.parseShort(et_Temperature_Upper_Limit.getText().toString());
short Temperature_Lower_Limit = Short.parseShort(et_Temperature_Lower_Limit.getText().toString());
short Pressure_Upper_Limit = Short.parseShort(et_Pressure_Upper_Limit.getText().toString());
short Pressure_Lower_Limit = Short.parseShort(et_Pressure_Lower_Limit.getText().toString());
if(!EditValidate(et_Temperature_Analog_Upper_Limit,"请输入有效的【温度模拟量上限值】"))return;
if(!EditValidate(et_Temperature_Analog_Lower_Limit,"请输入有效的【温度模拟量下限值】"))return;
if(!EditValidate(et_Temperature_Upper_Limit,"请输入有效的【温度上限值】"))return;
if(!EditValidate(et_Temperature_Lower_Limit,"请输入有效的【温度下限值】"))return;
if(!EditValidate(et_Pressure_Analog_Upper_Limit,"请输入有效的【压力模拟量上限值】"))return;
if(!EditValidate(et_Pressure_Analog_Lower_Limit,"请输入有效的【压力模拟量下限值】"))return;
if(!EditValidate(et_Pressure_Upper_Limit,"请输入有效的【压力上限值】"))return;
if(!EditValidate(et_Pressure_Lower_Limit,"请输入有效的【压力下限值】"))return;
if(!EditValidate(et_OpenLid_pressure,"请输入有效的【开盖压力】"))return;
if(!EditValidate(et_Exhaust_Air_Temperature,"请输入有效的【拍冷气温度】"))return;

AnalogConvert.et_Temperature_Analog_Upper_Limit = Short.parseShort(et_Temperature_Analog_Upper_Limit.getText().toString());
AnalogConvert.et_Temperature_Analog_Lower_Limit = Short.parseShort(et_Temperature_Analog_Lower_Limit.getText().toString());
AnalogConvert.et_Temperature_Upper_Limit = Short.parseShort(et_Temperature_Upper_Limit.getText().toString());
AnalogConvert.et_Temperature_Lower_Limit = Short.parseShort(et_Temperature_Lower_Limit.getText().toString());
AnalogConvert.et_Pressure_Analog_Upper_Limit = Short.parseShort(et_Pressure_Analog_Upper_Limit.getText().toString());
AnalogConvert.et_Pressure_Analog_Lower_Limit = Short.parseShort(et_Pressure_Analog_Lower_Limit.getText().toString());
AnalogConvert.et_Pressure_Upper_Limit = Short.parseShort(et_Pressure_Upper_Limit.getText().toString());
AnalogConvert.et_Pressure_Lower_Limit = Short.parseShort(et_Pressure_Lower_Limit.getText().toString());
short OpenLid_pressure = Short.parseShort(et_OpenLid_pressure.getText().toString());
short Exhaust_Air_Temperature = Short.parseShort(et_Exhaust_Air_Temperature.getText().toString());
Context dishesCon = ConfigName.getInstance().dishesCon;
ConfigUtil.write(dishesCon, "Temperature_Upper_Limit",Temperature_Upper_Limit );
ConfigUtil.write(dishesCon, "Temperature_Lower_Limit",Temperature_Lower_Limit);
ConfigUtil.write(dishesCon, "Pressure_Upper_Limit",Pressure_Upper_Limit );
ConfigUtil.write(dishesCon, "Pressure_Lower_Limit",Pressure_Lower_Limit );
ConfigUtil.write(dishesCon, "OpenLid_pressure",OpenLid_pressure );
ConfigUtil.write(dishesCon, "Exhaust_Air_Temperature", Exhaust_Air_Temperature);

AnalogConvert.SaveConfig();

// Context dishesCon = ConfigName.getInstance().dishesCon;
// ConfigUtil.write(dishesCon, "Temperature_Analog_Upper_Limit",Temperature_Upper_Limit );
// ConfigUtil.write(dishesCon, "Temperature_Analog_Lower_Limit",Temperature_Lower_Limit);
// ConfigUtil.write(dishesCon, "Temperature_Upper_Limit",Temperature_Upper_Limit );
// ConfigUtil.write(dishesCon, "Temperature_Lower_Limit",Temperature_Lower_Limit);
// ConfigUtil.write(dishesCon, "Pressure_Analog_Upper_Limit",Pressure_Upper_Limit );
// ConfigUtil.write(dishesCon, "Pressure_Analog_Lower_Limit",Pressure_Lower_Limit );
// ConfigUtil.write(dishesCon, "Pressure_Upper_Limit",Pressure_Upper_Limit );
// ConfigUtil.write(dishesCon, "Pressure_Lower_Limit",Pressure_Lower_Limit );
// ConfigUtil.write(dishesCon, "OpenLid_pressure",OpenLid_pressure );
// ConfigUtil.write(dishesCon, "Exhaust_Air_Temperature", Exhaust_Air_Temperature);
Executor.get().runThread(()->{
ModbusHelper.get().WritePar(ControlAdress.温度上限,Temperature_Upper_Limit);
ModbusHelper.get().WritePar(ControlAdress.温度下限,Temperature_Lower_Limit);
ModbusHelper.get().WritePar(ControlAdress.压力上限,Pressure_Upper_Limit);
ModbusHelper.get().WritePar(ControlAdress.压力下限,Pressure_Lower_Limit);
ModbusHelper.get().WritePar(ControlAdress.允许开盖压力,OpenLid_pressure);
ModbusHelper.get().WritePar(ControlAdress.排冷气温度,Exhaust_Air_Temperature);
// ModbusHelper.get().WritePar(ControlAdress.温度上限,Temperature_Upper_Limit);
// ModbusHelper.get().WritePar(ControlAdress.温度下限,Temperature_Lower_Limit);
// ModbusHelper.get().WritePar(ControlAdress.压力上限,Pressure_Upper_Limit);
// ModbusHelper.get().WritePar(ControlAdress.压力下限,Pressure_Lower_Limit);
ModbusHelper.get().WritePar(ControlAdress.允许开盖压力,AnalogConvert.getCurrentPressureAnalog(OpenLid_pressure));
ModbusHelper.get().WritePar(ControlAdress.排冷气温度,AnalogConvert.getCurrentTemperatureAnalog(Exhaust_Air_Temperature));
this.runOnUiThread(()->{ ToastUtils.info("保存成功!");});
});
}catch (Exception e){


+ 2
- 1
app/src/main/res/layout/activity_diy_update1.xml Ver ficheiro

@@ -148,8 +148,9 @@
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="vertical">

<LinearLayout


+ 274
- 45
app/src/main/res/layout/activity_system_par_set.xml Ver ficheiro

@@ -15,14 +15,86 @@
android:layout_marginTop="?attr/qmui_topbar_height"
android:orientation="vertical">

<com.bonait.bnframework.HBL.CustomView.ShadowContainer
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:containerCornerRadius="10dp"
app:containerDeltaLength="20px"
app:containerShadowColor="#756bff"
app:containerShadowRadius="20px"
tools:ignore="Pxusage,RtlHardcoded">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shadow_backcolor"
android:padding="10dp">

<TextView
android:id="@+id/tv_temperature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="温度:00.00 ℃"
android:textSize="25sp"/>

<TextView
android:id="@+id/tv_pressure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="压力:00.00 ℃"
android:textSize="25sp"/>

</RelativeLayout>

</com.bonait.bnframework.HBL.CustomView.ShadowContainer>

<com.bonait.bnframework.HBL.CustomView.ShadowContainer
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:containerCornerRadius="10dp"
app:containerDeltaLength="20px"
app:containerShadowColor="#756bff"
app:containerShadowRadius="20px"
tools:ignore="Pxusage,RtlHardcoded">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shadow_backcolor"
android:padding="10dp">

<TextView
android:id="@+id/tv_Current_temperature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="温度:00.00 ℃"
android:textSize="25sp"/>

<TextView
android:id="@+id/tv_Current_pressure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="压力:00.00 ℃"
android:textSize="25sp"/>

</RelativeLayout>

</com.bonait.bnframework.HBL.CustomView.ShadowContainer>

<GridLayout
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_height="360dp"
android:layout_marginTop="?attr/qmui_topbar_height"
android:columnCount="4"
android:rowCount="3">
android:rowCount="7">

<TextView
android:layout_column="0"
@@ -32,10 +104,10 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:textSize="18sp"
android:textSize="@dimen/fontSize"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="温度上限:"/>
android:text="温度模拟量上限:"/>
<LinearLayout
android:layout_column="1"
android:layout_row="0"
@@ -45,19 +117,84 @@
android:layout_height="0dp"
android:orientation="horizontal">

<EditText
android:id="@+id/et_Temperature_Analog_Upper_Limit"
android:layout_width="100dp"
android:layout_height="@dimen/Et_Height"
android:background="@drawable/edit_border"
android:inputType="numberSigned"
android:layout_margin="5dp"
android:textSize="@dimen/fontSize"
android:text="0"/>
</LinearLayout>

<TextView
android:layout_column="2"
android:layout_row="0"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:textSize="@dimen/fontSize"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="温度模拟量下限:"/>
<LinearLayout
android:layout_column="3"
android:layout_row="0"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal">

<EditText
android:id="@+id/et_Temperature_Analog_Lower_Limit"
android:layout_width="100dp"
android:layout_height="@dimen/Et_Height"
android:background="@drawable/edit_border"
android:inputType="numberSigned"
android:layout_margin="5dp"
android:textSize="@dimen/fontSize"
android:text="0"/>
</LinearLayout>

<TextView
android:layout_column="0"
android:layout_row="1"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:textSize="@dimen/fontSize"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="实际温度上限:"/>
<LinearLayout
android:layout_column="1"
android:layout_row="1"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal">

<EditText
android:id="@+id/et_Temperature_Upper_Limit"
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_width="100dp"
android:layout_height="@dimen/Et_Height"
android:background="@drawable/edit_border"
android:inputType="number"
android:inputType="numberSigned"
android:layout_margin="5dp"
android:textSize="@dimen/fontSize"
android:text="0"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textSize="@dimen/fontSize"
android:layout_marginTop="5dp"
android:text="℃"/>

@@ -65,19 +202,19 @@

<TextView
android:layout_column="2"
android:layout_row="0"
android:layout_row="1"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:textSize="18sp"
android:textSize="@dimen/fontSize"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="温度下限:"/>
android:text="实际温度下限:"/>
<LinearLayout
android:layout_column="3"
android:layout_row="0"
android:layout_row="1"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
@@ -86,37 +223,113 @@

<EditText
android:id="@+id/et_Temperature_Lower_Limit"
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_width="100dp"
android:layout_height="@dimen/Et_Height"
android:background="@drawable/edit_border"
android:inputType="number"
android:inputType="numberSigned"
android:layout_margin="5dp"
android:textSize="@dimen/fontSize"
android:text="0"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="18sp"
android:textSize="@dimen/fontSize"
android:text="℃"/>

</LinearLayout>

<LinearLayout
android:layout_columnSpan="4"
android:layout_column="0"
android:layout_row="2"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal">
</LinearLayout>

<TextView
android:layout_column="0"
android:layout_row="1"
android:layout_row="3"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:textSize="18sp"
android:textSize="@dimen/fontSize"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="压力上限:"/>
android:text="压力模拟量上限:"/>
<LinearLayout
android:layout_column="1"
android:layout_row="1"
android:layout_row="3"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal">

<EditText
android:id="@+id/et_Pressure_Analog_Upper_Limit"
android:layout_width="100dp"
android:layout_height="@dimen/Et_Height"
android:background="@drawable/edit_border"
android:inputType="number"
android:layout_margin="5dp"
android:textSize="@dimen/fontSize"
android:text="0"/>
</LinearLayout>

<TextView
android:layout_column="2"
android:layout_row="3"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:textSize="@dimen/fontSize"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="压力模拟量下限:"/>
<LinearLayout
android:layout_column="3"
android:layout_row="3"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal">

<EditText
android:id="@+id/et_Pressure_Analog_Lower_Limit"
android:layout_width="100dp"
android:layout_height="@dimen/Et_Height"
android:background="@drawable/edit_border"
android:inputType="number"
android:layout_margin="5dp"
android:textSize="@dimen/fontSize"
android:text="0"/>
</LinearLayout>

<TextView
android:layout_column="0"
android:layout_row="4"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:textSize="@dimen/fontSize"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="实际压力上限:"/>
<LinearLayout
android:layout_column="1"
android:layout_row="4"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
@@ -125,37 +338,38 @@

<EditText
android:id="@+id/et_Pressure_Upper_Limit"
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_width="100dp"
android:layout_height="@dimen/Et_Height"
android:background="@drawable/edit_border"
android:inputType="number"
android:layout_margin="5dp"
android:textSize="@dimen/fontSize"
android:text="0"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="18sp"
android:textSize="@dimen/fontSize"
android:text="kpa"/>

</LinearLayout>

<TextView
android:layout_column="2"
android:layout_row="1"
android:layout_row="4"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:textSize="18sp"
android:textSize="@dimen/fontSize"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="压力下限:"/>
android:text="实际压力下限:"/>
<LinearLayout
android:layout_column="3"
android:layout_row="1"
android:layout_row="4"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
@@ -164,37 +378,49 @@

<EditText
android:id="@+id/et_Pressure_Lower_Limit"
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_width="100dp"
android:layout_height="@dimen/Et_Height"
android:background="@drawable/edit_border"
android:inputType="number"
android:layout_margin="5dp"
android:textSize="@dimen/fontSize"
android:text="0"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="18sp"
android:textSize="@dimen/fontSize"
android:text="kpa"/>

</LinearLayout>

<LinearLayout
android:layout_columnSpan="4"
android:layout_column="0"
android:layout_row="5"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal">
</LinearLayout>

<TextView
android:layout_column="0"
android:layout_row="2"
android:layout_row="6"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:textSize="18sp"
android:textSize="@dimen/fontSize"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="允许开盖压力:"/>
<LinearLayout
android:layout_column="1"
android:layout_row="2"
android:layout_row="6"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
@@ -203,37 +429,38 @@

<EditText
android:id="@+id/et_OpenLid_pressure"
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_width="100dp"
android:layout_height="@dimen/Et_Height"
android:background="@drawable/edit_border"
android:inputType="number"
android:inputType="numberSigned"
android:layout_margin="5dp"
android:textSize="@dimen/fontSize"
android:text="0"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="18sp"
android:textSize="@dimen/fontSize"
android:text="kpa"/>

</LinearLayout>

<TextView
android:layout_column="2"
android:layout_row="2"
android:layout_row="6"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:textSize="18sp"
android:textSize="@dimen/fontSize"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="排冷气温度:"/>
<LinearLayout
android:layout_column="3"
android:layout_row="2"
android:layout_row="6"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
@@ -242,18 +469,19 @@

<EditText
android:id="@+id/et_Exhaust_Air_Temperature"
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_width="100dp"
android:layout_height="@dimen/Et_Height"
android:background="@drawable/edit_border"
android:inputType="number"
android:inputType="numberSigned"
android:layout_margin="5dp"
android:textSize="@dimen/fontSize"
android:text="0"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="18sp"
android:textSize="@dimen/fontSize"
android:text="℃"/>

</LinearLayout>
@@ -262,10 +490,11 @@

<Button
android:id="@+id/btn_save"
android:layout_marginTop="20dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_height="50dp"
android:background="@drawable/bg_btn_login_selected"
android:textColor="#fefefe"
android:text="保存参数"


+ 20
- 5
app/src/main/res/layout/fragment_home4.xml Ver ficheiro

@@ -47,7 +47,8 @@

<ImageView
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_height="200dp"
android:layout_margin="40dp"
android:src="@mipmap/home_kspr" />

</LinearLayout>
@@ -60,9 +61,9 @@
android:orientation="vertical">

<ImageView
android:layout_margin="40dp"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_height="200dp"
android:src="@mipmap/home_sbkz" />

</LinearLayout>
@@ -83,7 +84,8 @@

<ImageView
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_height="200dp"
android:layout_margin="40dp"
android:src="@mipmap/home_lcsz" />
</LinearLayout>

@@ -96,7 +98,8 @@

<ImageView
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_height="200dp"
android:layout_margin="40dp"
android:src="@mipmap/home_cpyf" />

</LinearLayout>
@@ -124,5 +127,17 @@
android:layout_marginBottom="50dp"
android:background="@mipmap/home2"
android:elevation="40dp"></RelativeLayout>

<RelativeLayout
android:id="@+id/check_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginLeft="-40dp"
android:layout_marginBottom="50dp"
android:background="@mipmap/check_update"
android:elevation="40dp"></RelativeLayout>

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

+ 24
- 7
app/src/main/res/layout/fragment_home_device.xml Ver ficheiro

@@ -74,7 +74,7 @@
android:background="@drawable/shadow_backcolor"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_height="210dp"
android:columnCount="4"
android:rowCount="2">

@@ -195,7 +195,7 @@
android:background="@drawable/shadow_backcolor"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_height="120dp"
android:columnCount="4"
android:rowCount="1">

@@ -259,12 +259,13 @@

</com.bonait.bnframework.HBL.CustomView.ShadowContainer>



</LinearLayout>

</RelativeLayout>


<ImageView
<RelativeLayout
android:layout_rowWeight="1"
android:layout_row="1"
android:layout_column="0"
@@ -273,9 +274,25 @@
android:layout_height="0dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginBottom="40dp"
android:antialias="true"
android:src="@drawable/ylg" />
android:layout_marginBottom="40dp">

<TextView
android:id="@+id/tv_time"
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="剩余时间:00 : 00"
android:textSize="40sp"/>

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:antialias="true"
android:src="@drawable/ylg" />

</RelativeLayout>



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



+ 3
- 1
app/src/main/res/values/dimens.xml Ver ficheiro

@@ -52,5 +52,7 @@
<dimen name="radus_dp">60dp</dimen>

<dimen name="button_text_size">20dp</dimen>
<dimen name="control_btn_margin">5dp</dimen>
<dimen name="control_btn_margin">20dp</dimen>
<dimen name="fontSize">20sp</dimen>
<dimen name="Et_Height">40dp</dimen>
</resources>

Carregando…
Cancelar
Guardar