Browse Source

压力锅程序开发

Pressure_Cooker
pry 9 months ago
parent
commit
6d6deb0c22
37 changed files with 2480 additions and 1203 deletions
  1. +3
    -0
      app/src/main/AndroidManifest.xml
  2. +9
    -9
      app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ModbusMaster.java
  3. +1
    -1
      app/src/main/java/com/bonait/bnframework/HBL/DataUtil/NotifyPropVar.java
  4. +5
    -8
      app/src/main/java/com/bonait/bnframework/HBL/Executor.java
  5. +2
    -0
      app/src/main/java/com/bonait/bnframework/HBL/Interface/IRunT.java
  6. +5
    -0
      app/src/main/java/com/bonait/bnframework/HBL/Interface/IRunT2.java
  7. +50
    -0
      app/src/main/java/com/bonait/bnframework/HBL/NotifyEvent.java
  8. +28
    -28
      app/src/main/java/com/bonait/bnframework/business/ConfigData.java
  9. +12
    -1
      app/src/main/java/com/bonait/bnframework/business/ControlAdress.java
  10. +24
    -0
      app/src/main/java/com/bonait/bnframework/business/Func.java
  11. +2
    -0
      app/src/main/java/com/bonait/bnframework/business/MainInit.java
  12. +164
    -74
      app/src/main/java/com/bonait/bnframework/business/ModbusHelper.java
  13. +12
    -1
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  14. +2
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/MessageName.java
  15. +130
    -1
      app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java
  16. +3
    -0
      app/src/main/java/com/bonait/bnframework/common/db/file/DBHelper.java
  17. +58
    -0
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_FORMULA.java
  18. +26
    -251
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java
  19. +6
    -2
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home4Fragment.java
  20. +271
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentDevice.java
  21. +46
    -91
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentPR.java
  22. +455
    -375
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdate1Activity.java
  23. +171
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParSetActivity.java
  24. +26
    -42
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_qupenren.java
  25. +8
    -8
      app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java
  26. BIN
     
  27. +27
    -0
      app/src/main/res/drawable/bg_btn_dialog_qupenren.xml
  28. +35
    -0
      app/src/main/res/drawable/control_but_back.xml
  29. +31
    -0
      app/src/main/res/drawable/edit_border.xml
  30. +10
    -0
      app/src/main/res/drawable/shadow_backcolor.xml
  31. +112
    -155
      app/src/main/res/layout/activity_diy_update1.xml
  32. +282
    -0
      app/src/main/res/layout/activity_system_par_set.xml
  33. +281
    -0
      app/src/main/res/layout/fragment_home_device.xml
  34. +6
    -3
      app/src/main/res/layout/fragment_home_sbkz.xml
  35. +173
    -152
      app/src/main/res/layout/item/layout/dialog_qupenren.xml
  36. +1
    -1
      app/src/main/res/layout/item/layout/spinner_text_item.xml
  37. +3
    -0
      app/src/main/res/values/dimens.xml

+ 3
- 0
app/src/main/AndroidManifest.xml View File

@@ -45,6 +45,9 @@
<activity
android:name=".modules.home.fragment.from.BunkerSetupActivity"
android:exported="false" />
<activity
android:name=".modules.home.fragment.from.SystemParSetActivity"
android:exported="false" />
<activity
android:name=".modules.home.fragment.from.CookingActivity"
android:exported="false"


+ 9
- 9
app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ModbusMaster.java View File

@@ -487,7 +487,7 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{

@Override
public void onFailure(String error){
resultValue.set(OperateResult.CreateFailed(address+",读取异常:"+error));
resultValue.set(OperateResult.CreateFailed(address+",写入异常:"+error));
}
});
return resultValue.get();
@@ -507,7 +507,7 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{

@Override
public void onFailure(String error){
resultValue.set(OperateResult.CreateFailed(address+",读取异常:"+error));
resultValue.set(OperateResult.CreateFailed(address+",写入异常:"+error));
}
});
return resultValue.get();
@@ -534,7 +534,7 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{

@Override
public void onFailure(String error){
resultValue.set(OperateResult.CreateFailed(address+",读取异常:"+error));
resultValue.set(OperateResult.CreateFailed(address+",写入异常:"+error));
}
});
return resultValue.get();
@@ -554,7 +554,7 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{

@Override
public void onFailure(String error){
resultValue.set(OperateResult.CreateFailed(address+",读取异常:"+error));
resultValue.set(OperateResult.CreateFailed(address+",写入异常:"+error));
}
});
return resultValue.get();
@@ -582,7 +582,7 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{

@Override
public void onFailure(String error){
resultValue.set(OperateResult.CreateFailed(address+",读取异常:"+error));
resultValue.set(OperateResult.CreateFailed(address+",写入异常:"+error));
}
});
return resultValue.get();
@@ -603,7 +603,7 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{

@Override
public void onFailure(String error){
resultValue.set(OperateResult.CreateFailed(address+",读取异常:"+error));
resultValue.set(OperateResult.CreateFailed(address+",写入异常:"+error));
}
});
return resultValue.get();
@@ -625,7 +625,7 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{

@Override
public void onFailure(String error){
resultValue.set(OperateResult.CreateFailed(address+",读取异常:"+error));
resultValue.set(OperateResult.CreateFailed(address+",写入异常:"+error));
}
});
return resultValue.get();
@@ -653,7 +653,7 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{

@Override
public void onFailure(String error){
resultValue.set(OperateResult.CreateFailed(address+",读取异常:"+error));
resultValue.set(OperateResult.CreateFailed(address+",写入异常:"+error));
}
});
return resultValue.get();
@@ -674,7 +674,7 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{

@Override
public void onFailure(String error){
resultValue.set(OperateResult.CreateFailed(address+",读取异常:"+error));
resultValue.set(OperateResult.CreateFailed(address+",写入异常:"+error));
}
});
return resultValue.get();


+ 1
- 1
app/src/main/java/com/bonait/bnframework/HBL/DataUtil/NotifyPropVar.java View File

@@ -23,7 +23,7 @@ public class NotifyPropVar<T extends Serializable> {
}

private T _value;
public T getValue(){ return _value; }
public T getValue(){ return _value; }
public void setValue(T value){
if (value != null && !value.equals(_value) || !IsFirst)
{


+ 5
- 8
app/src/main/java/com/bonait/bnframework/HBL/Executor.java View File

@@ -27,14 +27,11 @@ public class Executor {
private ExecutorService executor= Executors.newCachedThreadPool() ;

public void runThread(IRun run) {
executor.submit(new Runnable(){
@Override
public void run() {
try {
if(run!=null)run.Run();
}catch(Exception ex) {
MessageLog.ShowError("runThread 异常:"+ex.getMessage());
}
executor.submit(()->{
try {
if(run!=null)run.Run();
}catch(Exception ex) {
MessageLog.ShowError("runThread 异常:"+ex.getMessage());
}
});
}


+ 2
- 0
app/src/main/java/com/bonait/bnframework/HBL/Interface/IRunT.java View File

@@ -3,3 +3,5 @@ package com.bonait.bnframework.HBL.Interface;
public interface IRunT<T> {
void Run(T t);
}



+ 5
- 0
app/src/main/java/com/bonait/bnframework/HBL/Interface/IRunT2.java View File

@@ -0,0 +1,5 @@
package com.bonait.bnframework.HBL.Interface;

public interface IRunT2<T1,T2> {
void Run(T1 t1, T2 t2);;
}

+ 50
- 0
app/src/main/java/com/bonait/bnframework/HBL/NotifyEvent.java View File

@@ -0,0 +1,50 @@
package com.bonait.bnframework.HBL;

import com.bonait.bnframework.HBL.Interface.IRun;
import com.bonait.bnframework.HBL.Interface.IRunT;
import com.bonait.bnframework.HBL.Logs.MessageLog;

import java.util.concurrent.ConcurrentHashMap;

public class NotifyEvent {
private static volatile NotifyEvent _instance;
public synchronized static NotifyEvent get(){
if(_instance == null)_instance = new NotifyEvent();
return _instance;
}
private NotifyEvent(){}
private ConcurrentHashMap<String, Object> _runMap = new ConcurrentHashMap<String, Object>();

public void Register(String name,IRun run){
_runMap.put(name,run);
}

public <T> void Register(String name, IRunT<T> run){
_runMap.put(name,run);
}

public void Notify(String name){
try{
if(_runMap.containsKey(name)&&_runMap.get(name)!=null){
if(_runMap.get(name) instanceof IRun){
((IRun)_runMap.get(name)).Run();
}
}
}catch(Exception e){
MessageLog.ShowError(e);
}
}

public <T> void Notify(String name,T value){
try{
if(_runMap.containsKey(name)&&_runMap.get(name)!=null){
if(_runMap.get(name) instanceof IRunT){
((IRunT)_runMap.get(name)).Run(value);
}
}
}catch(Exception e){
MessageLog.ShowError(e);
}
}

}

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

@@ -1020,36 +1020,36 @@ public class ConfigData {
*/
public void RevertPLCProcess() {
try {
List<Res_PLCADDRESS> plcaddresses = ConfigName.getInstance().PlcAddress_大炒;
List<ProcessT> processTS = ConfigName.getInstance().Process_大炒;
if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) {
plcaddresses = ConfigName.getInstance().PlcAddress_大炒;
processTS = ConfigName.getInstance().Process_大炒;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本")) {
plcaddresses = ConfigName.getInstance().PlcAddress_大炒自动投料;
processTS = ConfigName.getInstance().Process_大炒自动投料;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) {
plcaddresses = ConfigName.getInstance().PlcAddress_小炒;
processTS = ConfigName.getInstance().Process_小炒;
}
// List<Res_PLCADDRESS> plcaddresses = ConfigName.getInstance().PlcAddress_大炒;
List<ProcessT> processTS = ConfigName.getInstance().Process_压力锅;
// if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) {
// plcaddresses = ConfigName.getInstance().PlcAddress_大炒;
// processTS = ConfigName.getInstance().Process_大炒;
// } else if (ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本")) {
// plcaddresses = ConfigName.getInstance().PlcAddress_大炒自动投料;
// processTS = ConfigName.getInstance().Process_大炒自动投料;
// } else if (ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) {
// plcaddresses = ConfigName.getInstance().PlcAddress_小炒;
// processTS = ConfigName.getInstance().Process_小炒;
// }

//region 恢复PLC
ArrayList<BPA_PLCADDRESS> arrayList = QueryDB.GetPlcaddressALL();
for (BPA_PLCADDRESS item : arrayList) {
QueryDB.DeletePlcaddress(item);
}
int k = 1;
for (Res_PLCADDRESS item : plcaddresses) {
BPA_PLCADDRESS plc = new BPA_PLCADDRESS();
plc.name = item.name;
plc.address = item.address;
plc.isread = item.isread;
plc.iswrite = item.iswrite;
plc.sort = k;
k++;
QueryDB.AddPlcaddress(plc);
}
// ArrayList<BPA_PLCADDRESS> arrayList = QueryDB.GetPlcaddressALL();
// for (BPA_PLCADDRESS item : arrayList) {
// QueryDB.DeletePlcaddress(item);
// }
// int k = 1;
// for (Res_PLCADDRESS item : plcaddresses) {
// BPA_PLCADDRESS plc = new BPA_PLCADDRESS();
// plc.name = item.name;
// plc.address = item.address;
// plc.isread = item.isread;
// plc.iswrite = item.iswrite;
// plc.sort = k;
// k++;
// QueryDB.AddPlcaddress(plc);
// }
//endregion

//region 恢复工序


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

@@ -20,5 +20,16 @@ public enum ControlAdress {
允许开盖压力,
反转位时间,
防干烧温度,
排冷气温度
排冷气温度,
温度下限,
温度上限,
压力下限,
压力上限,
焖制中,
加热档位,
设定压力,
计时温度,
烹饪时间,
烹饪完成

}

+ 24
- 0
app/src/main/java/com/bonait/bnframework/business/Func.java View File

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

public enum Func {
/**
* 加热功能
* par:加热温度,加热档位
*/
加热,
/**
* 泄压功能
* par:泄压压力
*/
泄压,
/**
* 保温功能
* par:保温温度,保温时间
*/
保温,
/**
*烹饪功能
* par:烹饪温度,烹饪时间
*/
烹饪,
}

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

@@ -233,6 +233,8 @@ public class MainInit {
{
ConfigData.getInstance().RevertPLCProcess();
}

ConfigData.getInstance().RevertPLCProcess();
}
/**
* 删除表-重新生成新表


+ 164
- 74
app/src/main/java/com/bonait/bnframework/business/ModbusHelper.java View File

@@ -1,10 +1,16 @@
package com.bonait.bnframework.business;

import com.bonait.bnframework.HBL.Communication.Modbus.ModbusMaster;
import com.bonait.bnframework.HBL.DataUtil.NotifyPropVar;
import com.bonait.bnframework.HBL.Executor;
import com.bonait.bnframework.HBL.Interface.IRunT;
import com.bonait.bnframework.HBL.Logs.MessageLog;
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 java.util.Random;
import java.util.concurrent.ConcurrentHashMap;

public class ModbusHelper extends ModbusMaster {
@@ -23,48 +29,33 @@ public class ModbusHelper extends ModbusMaster {
put(ControlAdress.锅体正转,new PLCModel("M24",DefaultValue.BOOLEAN,OperationModel.W));
put(ControlAdress.锅体反转,new PLCModel("M25",DefaultValue.BOOLEAN,OperationModel.W));
put(ControlAdress.泄压阀启停,new PLCModel("M26",DefaultValue.BOOLEAN,OperationModel.W));
put(ControlAdress.烹饪完成,new PLCModel("M32",DefaultValue.BOOLEAN,OperationModel.R));
put(ControlAdress.一键上升,new PLCModel("M0",DefaultValue.BOOLEAN,OperationModel.W));
put(ControlAdress.一键下降,new PLCModel("M1",DefaultValue.BOOLEAN,OperationModel.W));
put(ControlAdress.一键翻转,new PLCModel("M4",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("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("D103",DefaultValue.SHORT,OperationModel.RW));
put(ControlAdress.允许开盖压力,new PLCModel("D200",DefaultValue.SHORT,OperationModel.RW));
put(ControlAdress.反转位时间,new PLCModel("D201",DefaultValue.SHORT,OperationModel.RW));
put(ControlAdress.防干烧温度,new PLCModel("D202",DefaultValue.SHORT,OperationModel.RW));
put(ControlAdress.排冷气温度,new PLCModel("D203",DefaultValue.SHORT,OperationModel.RW));
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("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));
}};

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));
}};

static ConcurrentHashMap<OutPut,PLCModel> OutPutModel=new ConcurrentHashMap<OutPut,PLCModel>(){{
put(OutPut.锅盖上升,new PLCModel("Y0",DefaultValue.BOOLEAN,OperationModel.R) );
put(OutPut.锅盖下降,new PLCModel("Y1",DefaultValue.BOOLEAN,OperationModel.R));
put(OutPut.锅盖开启,new PLCModel("Y2",DefaultValue.BOOLEAN,OperationModel.R));
put(OutPut.锅盖关闭,new PLCModel("Y3",DefaultValue.BOOLEAN,OperationModel.R));
put(OutPut.锅体正转,new PLCModel("Y4",DefaultValue.BOOLEAN,OperationModel.R));
put(OutPut.锅体反转,new PLCModel("Y5",DefaultValue.BOOLEAN,OperationModel.R));
put(OutPut.泄压阀启停,new PLCModel("Y6",DefaultValue.BOOLEAN,OperationModel.R));
}};

public void RtuInit(String comName,int baudRate){
new Thread(()->{ RtuConnect(comName,baudRate).OnSource(()->{ GetPlcStatus();});}).start();
}

public void TcpInit(String ip,int port){
new Thread(()->{ TcpConnect(ip,port);}).start();
private void Sleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}

private PLCModel getPLC(ControlAdress func){
@@ -76,25 +67,6 @@ public class ModbusHelper extends ModbusMaster {
}
}

private PLCModel getPLC(Input func){
if(InputModel.containsKey(func)){
return InputModel.get(func);
}else{
MessageLog.ShowInfo("不存在控制地址:"+func.toString());
return new PLCModel();
}
}

private PLCModel getPLC(OutPut func){
if(OutPutModel.containsKey(func)){
return OutPutModel.get(func);
}else{
MessageLog.ShowInfo("不存在控制地址:"+func.toString());
return new PLCModel();
}
}


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

@@ -102,38 +74,156 @@ public class ModbusHelper extends ModbusMaster {

controlAddress.forEach((key,value)->{
if(value.operationModel== OperationModel.R||value.operationModel==OperationModel.RW){
OperateResultT<Short> res = ReadShort(value.PlcAddress);
OperateResultT<Short> res = ReadShort(value.PlcAddress);
if(res.isSuccess){
value.Value .setValue(res.Content);
ExecuteTheRecipe. ListeningValue.put(key.toString(), 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);
ExecuteTheRecipe. ListeningValue.put(key.toString(), res.Content);
}
}
});
Thread.sleep(1);
});
}

OutPutModel.forEach((key,value)->{
if(value.operationModel== OperationModel.R||value.operationModel==OperationModel.RW){
OperateResultT<Boolean> res = ReadBool(value.PlcAddress);
if(res.isSuccess){
value.Value .setValue(res.Content);
ExecuteTheRecipe. ListeningValue.put(key.toString(), res.Content);
}
}
});
public NotifyPropVar<Boolean> IsRunning=new NotifyPropVar<Boolean>(false);

public void RtuInit(String comName,int baudRate){
new Thread(()->{ RtuConnect(comName,baudRate).OnSource(()->{ GetPlcStatus();});}).start();
}

Thread.sleep(1);
});
/**
* 写入系统参数到PLC
* @param func
* @param value
*/
public void WritePar(ControlAdress func,short value){
if(controlAddress.containsKey(func)){
WriteShort(controlAddress.get(func).PlcAddress,value);
}
}

/**
* 写入订单数据到PLC
* @param formula
*/
public void WriteOrder(BPA_FORMULA formula){
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));
ToastUtils.info("开始执行配方:"+formula.Name);
IsRunning.setValue(true);
}catch(Exception e){
MessageLog.ShowError(e);
}
}

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

/**
* 写布尔信号
* @param func
* @param value
*/
public void WriteBoolSingle(ControlAdress func, Boolean value){
if(controlAddress.containsKey(func)){
Executor.get().runThread(()->{
WriteBool(controlAddress.get(func).PlcAddress,value);
});
}
}

/**
* 写脉冲信号
* @param func
*/
public void PulseSignal(ControlAdress func){
if(controlAddress.containsKey(func)){
Executor.get().runThread(()->{
WriteBool(controlAddress.get(func).PlcAddress,true);
Sleep(1000);
WriteBool(controlAddress.get(func).PlcAddress,false);
});
}
}

}





// 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));
// }};
//
// static ConcurrentHashMap<OutPut,PLCModel> OutPutModel=new ConcurrentHashMap<OutPut,PLCModel>(){{
// put(OutPut.锅盖上升,new PLCModel("Y0",DefaultValue.BOOLEAN,OperationModel.R) );
// put(OutPut.锅盖下降,new PLCModel("Y1",DefaultValue.BOOLEAN,OperationModel.R));
// put(OutPut.锅盖开启,new PLCModel("Y2",DefaultValue.BOOLEAN,OperationModel.R));
// put(OutPut.锅盖关闭,new PLCModel("Y3",DefaultValue.BOOLEAN,OperationModel.R));
// put(OutPut.锅体正转,new PLCModel("Y4",DefaultValue.BOOLEAN,OperationModel.R));
// put(OutPut.锅体反转,new PLCModel("Y5",DefaultValue.BOOLEAN,OperationModel.R));
// put(OutPut.泄压阀启停,new PLCModel("Y6",DefaultValue.BOOLEAN,OperationModel.R));
// }};



// 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);
// ExecuteTheRecipe. ListeningValue.put(key.toString(), res.Content);
// }
// }
// });
//
// OutPutModel.forEach((key,value)->{
// if(value.operationModel== OperationModel.R||value.operationModel==OperationModel.RW){
// OperateResultT<Boolean> res = ReadBool(value.PlcAddress);
// if(res.isSuccess){
// value.Value .setValue(res.Content);
// ExecuteTheRecipe. ListeningValue.put(key.toString(), res.Content);
// }
// }
// });



// private PLCModel getPLC(Input func){
// if(InputModel.containsKey(func)){
// return InputModel.get(func);
// }else{
// MessageLog.ShowInfo("不存在控制地址:"+func.toString());
// return new PLCModel();
// }
// }
//
// private PLCModel getPLC(OutPut func){
// if(OutPutModel.containsKey(func)){
// return OutPutModel.get(func);
// }else{
// MessageLog.ShowInfo("不存在控制地址:"+func.toString());
// return new PLCModel();
// }
// }

+ 12
- 1
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -4,6 +4,7 @@ import android.app.Application;
import android.content.Context;

import com.bonait.bnframework.R;
import com.bonait.bnframework.business.Func;
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS;
import com.bonait.bnframework.common.db.mode.BPA_USER;
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS;
@@ -381,6 +382,16 @@ public class ConfigName {
add(new ProcessT("出菜", Arrays.asList("等待(秒)")));
}};

/**
* 压力锅工序模型
*/
public List<ProcessT> Process_压力锅 = new ArrayList<ProcessT>() {{
add(new ProcessT(Func.加热.toString(), Arrays.asList("加热温度", "加热档位")));
add(new ProcessT(Func.泄压.toString(), Arrays.asList("泄压压力")));
add(new ProcessT(Func.保温.toString(), Arrays.asList("保温温度", "保温时间")));
add(new ProcessT(Func.烹饪.toString(), Arrays.asList("烹饪温度", "烹饪时间")));
}};

/**
* 大炒自动投料基础PLC模型
*/
@@ -823,7 +834,7 @@ public class ConfigName {
data = "1号位、2号位、3号位、4号位";
} else if (item.equals("正转速度") || item.equals("反转速度") || item.equals("转动速度") || item.equals("搅拌速度")) {
data = "停止、最低、低速、中速、高速、最高、极高";
} else if (item.equals("加热功率") || item.equals("热锅功率")) {
} else if (item.equals("加热功率") || item.equals("热锅功率")||item.equals("加热档位")) {
data = "停止、一档、二档、三档、四档、五档、六档、七档、八档";
}
return data;


+ 2
- 0
app/src/main/java/com/bonait/bnframework/common/constant/MessageName.java View File

@@ -29,4 +29,6 @@ public interface MessageName {
String OpenMakeGoodFrom="OpenMakeGoodFrom";//打开制作界面

String GoodIsCunZai="GoodIsCunZai";

String OpenDeviceFrom="OpenDeviceFrom";//打开设备页面
}

+ 130
- 1
app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java View File

@@ -6,9 +6,13 @@ import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import android.widget.TableRow;

import com.bonait.bnframework.HBL.Logs.MessageLog;
import com.bonait.bnframework.HBL.Result.OperateResult;
import com.bonait.bnframework.HBL.Result.OperateResultT;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.file.DBHelper;
import com.bonait.bnframework.common.db.mode.BPA_CLOUDDATA;
import com.bonait.bnframework.common.db.mode.BPA_FORMULA;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.file.DBHelper;
import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG;
@@ -47,6 +51,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

@@ -2404,7 +2409,6 @@ public class QueryDB {
}
//endregion


//region BPA_PLCADDRESS PLC地址管理表
/**
* 新增工序模型表
@@ -2864,6 +2868,16 @@ public class QueryDB {
((BPA_PLCADDRESS) data).isread = cursor.getInt((int) cursor.getColumnIndex("isread"));
((BPA_PLCADDRESS) data).iswrite = cursor.getInt((int) cursor.getColumnIndex("iswrite"));
break;
case "BPA_FORMULA":
data = new BPA_FORMULA();
//私有
((BPA_FORMULA) data).Name = cursor.getString( (int)cursor.getColumnIndex("Name"));
((BPA_FORMULA) data).Url = cursor.getString( (int)cursor.getColumnIndex("Url"));
((BPA_FORMULA) data).HeatingGear = cursor.getInt((int) cursor.getColumnIndex("HeatingGear"));
((BPA_FORMULA) data).TimingTemperature = cursor.getInt((int) cursor.getColumnIndex("TimingTemperature"));
((BPA_FORMULA) data).CookingTime = cursor.getInt((int) cursor.getColumnIndex("CookingTime"));
((BPA_FORMULA) data).ReliefPressure = cursor.getInt((int) cursor.getColumnIndex("ReliefPressure"));
break;
}
((ModeBase) data).id = cursor.getString((int) cursor.getColumnIndex("id"));
((ModeBase) data).createTime = cursor.getString((int) cursor.getColumnIndex("createTime"));
@@ -2878,6 +2892,7 @@ public class QueryDB {
cursor.close();
db.close();
} catch (Exception e) {
MessageLog.ShowError(e);
Log.d("查询异常", "查询异常: " + e.getMessage());
db.close();
} finally {
@@ -2886,4 +2901,118 @@ public class QueryDB {
return rlts;
}
//endregion

//region 压力锅配方数据

/**
* 检查名称是否存在
* @param name
* @return
*/
public static boolean checkName(String name){
try{
String orderby = Desc_Time_Up;//出料顺序
String where = "isDelete=? and Name=?";
String[] args = new String[]{"0", name};
List<BPA_FORMULA> data = new ArrayList<>();
ArrayList<Object> obj = Get(BPA_FORMULA.class, where, args, orderby);
for (Object k : obj) {
data.add((BPA_FORMULA) k);
}
return data.size() > 0;
}catch(Exception e){
return false;
}
}

/**
* 获取所有配方数据
* @return
*/
public static OperateResultT<List<BPA_FORMULA>> getFormulaAll(){
try{
String orderby = Desc_Time_Up;//先按排序 创建时间倒序
String where = "isDelete=?";
String[] args = new String[]{"0"};
List<BPA_FORMULA> data = new ArrayList<>();
ArrayList<Object> obj = Get(BPA_FORMULA.class, where, args, orderby);
for (Object k : obj) {
data.add((BPA_FORMULA) k);
}
return OperateResultT.CreateSuccess(data);
}catch(Exception e){
return OperateResultT.CreateFailedT(e);
}
}

public static OperateResultT<BPA_FORMULA> getFormula(String id){
try{
String orderby = Desc_Time_Up;//出料顺序
String where = "isDelete=? and id=?";
String[] args = new String[]{"0", id};
List<BPA_FORMULA> data = new ArrayList<>();
List<Object> obj = Get(BPA_FORMULA.class, where, args, orderby);
for (Object k : obj) {
data.add((BPA_FORMULA) k);
}
if (data.size() > 0) {
return OperateResultT.CreateSuccess(data.get(0));
} else {
return OperateResultT.CreateFailedT("未查询到有效的数据");
}
}catch(Exception e){
return OperateResultT.CreateFailedT(e);
}
}

/**
* 添加配方数据
* @return
*/
public static OperateResult addFormula(BPA_FORMULA formula){
try{
if(formula == null)return OperateResult.CreateFailed("对象内容不正确");
boolean isName = checkName(formula.Name);
if(isName)return OperateResult.CreateFailed("名称已存在");
boolean res = Add(BPA_FORMULA.class, formula);
if(res) return OperateResult.CreateSuccess();
else return OperateResult.CreateFailed("添加数据失败");
}catch(Exception e){
return OperateResult.CreateFailed(e);
}
}

/**
* 修改配方数据
* @param formula
* @return
*/
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 res = Update(BPA_FORMULA.class, formula);
if(res) return OperateResult.CreateSuccess();
else return OperateResult.CreateFailed("修改数据失败");
}catch(Exception e){
return OperateResult.CreateFailed(e);
}
}

/**
* 删除数据配方
* @param id
* @return
*/
public static OperateResult ReamoveFormula(String id){
try{
boolean res = Delete(BPA_FORMULA.class, id);
if(res) return OperateResult.CreateSuccess();
else return OperateResult.CreateFailed("删除数据失败");
}catch(Exception e){
return OperateResult.CreateFailed(e);
}
}
//endregion
}

+ 3
- 0
app/src/main/java/com/bonait/bnframework/common/db/file/DBHelper.java View File

@@ -6,6 +6,7 @@ import android.database.sqlite.SQLiteOpenHelper;

import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.mode.BPA_CLOUDDATA;
import com.bonait.bnframework.common.db.mode.BPA_FORMULA;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG;
import com.bonait.bnframework.common.db.mode.BPA_CRAFT;
@@ -125,6 +126,8 @@ public class DBHelper extends SQLiteOpenHelper {
CreateTablesAll(BPA_CLOUDDATA.class,null);//云端表
CreateTablesAll(BPA_PLCADDRESS.class,null);//工序模型表

CreateTablesAll(BPA_FORMULA.class,null);//压力锅配方参数表

ForeignKeys();
}
/**


+ 58
- 0
app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_FORMULA.java View File

@@ -0,0 +1,58 @@
package com.bonait.bnframework.common.db.mode;

/**
* 压力锅配方参数表
*/
public class BPA_FORMULA extends ModeBase{
/**
* 配方名称
*/
public String Name;

/**
* 商品Url
*/
public String Url;

/**
* 加热档位
*/
public int HeatingGear;

/**
* 计时温度
*/
public int TimingTemperature;

/**
* 烹饪时间
*/
public int CookingTime;

/**
* 泄压压力
*/
public int ReliefPressure;

/**
* 创建配方数据
* @param name 配方名称
* @param url 图片地址
* @param heatingGear 加热档位
* @param timingsTemperature 计时温度
* @param cookingTime 烹饪时间
* @param reliefPressure 泄压压力
*/
public BPA_FORMULA(String name,String url,int heatingGear,int timingsTemperature,int cookingTime,int reliefPressure){
Name = name;
HeatingGear = heatingGear;
TimingTemperature = timingsTemperature;
CookingTime =cookingTime;
ReliefPressure = reliefPressure;
Url = url;
}

public BPA_FORMULA(){

}
}

+ 26
- 251
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java View File

@@ -1,19 +1,22 @@
package com.bonait.bnframework.modules.home.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
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.NotifyEvent;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.ControlAdress;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.business.ModbusHelper;
import com.bonait.bnframework.common.base.BaseActivity;
@@ -31,20 +34,14 @@ import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.view.BottomNavigationBar;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter;
import com.bonait.bnframework.modules.home.fragment.Home1Fragment;
import com.bonait.bnframework.modules.home.fragment.Home2Fragment;
import com.bonait.bnframework.modules.home.fragment.Home4Fragment;
import com.bonait.bnframework.modules.home.fragment.HomeFragmentDevice;
import com.bonait.bnframework.modules.home.fragment.HomeFragmentPR;
import com.bonait.bnframework.modules.home.fragment.HomeFragmentSBKZ;
import com.bonait.bnframework.modules.home.fragment.from.CookingActivity;
import com.bonait.bnframework.modules.mine.fragment.MyFragment;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.lzy.okgo.OkGo;
import com.qmuiteam.qmui.widget.QMUIViewPager;

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

import butterknife.BindView;
import butterknife.ButterKnife;
@@ -119,7 +116,7 @@ public class BottomNavigationNewActivity extends BaseActivity {
FragmentAdapter fragmentAdapter = new FragmentAdapter(getSupportFragmentManager());
fragmentAdapter.addFragment(new HomeFragmentPR());
fragmentAdapter.addFragment(new Home4Fragment());
fragmentAdapter.addFragment(new HomeFragmentSBKZ());
fragmentAdapter.addFragment(new HomeFragmentDevice());
viewPager.setAdapter(fragmentAdapter);

MessageManager.getInstance().registerMessageReceiver(this, MessageName.SelectZY, new MessageLooper.OnMessageListener() {
@@ -134,17 +131,8 @@ public class BottomNavigationNewActivity extends BaseActivity {
}
});

//打开制作界面
MessageManager.getInstance().registerMessageReceiver(this, MessageName.OpenMakeGoodFrom, new MessageLooper.OnMessageListener() {
@Override
public void onMessage(Object msg) {
if (msg != null) {
String id = (String) msg;
goods = QueryDB.GetGoodsId(id);
cooking.initData(goods, activity, myClickListener);
cooking.setVisibility(View.VISIBLE);
}
}
NotifyEvent.get().Register(MessageName.OpenDeviceFrom,()->{
this.runOnUiThread(()->{viewPager.setCurrentItem(2);});
});
}

@@ -193,8 +181,7 @@ public class BottomNavigationNewActivity extends BaseActivity {
*
* @param view
*/
@OnClick({R.id.penrenzhong
})
@OnClick({R.id.penrenzhong})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.penrenzhong:
@@ -232,55 +219,16 @@ public class BottomNavigationNewActivity extends BaseActivity {
ConfigData.getInstance().ToggleEnvironment();
//2.初始化PLC
ModbusHelper.get().RtuInit("/dev/ttyCOM0",9600);
// ReconnectModbus();
//制作线程
MakeThread();
//初始化阿里云连接
//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());
// }
ModbusHelper.get().<Boolean>setPLCNotify(ControlAdress.烹饪完成,(s)->{
if(s){
DialogManager.showInfo(this,"烹饪完成,请及时查看!", AlertDialogButton.OK,(result)->{
ModbusHelper.get().WriteBoolSingle(ControlAdress.烹饪完成,false);
});
}
});
}

//endregion

//region 制作
@@ -290,184 +238,16 @@ public class BottomNavigationNewActivity extends BaseActivity {
//商品
public BPA_GOODS goods = null;

/**
* 商品制作线程
*/
public void MakeThread() {
ExecuteTheRecipe.context = this;
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
if (ExecuteTheRecipe.IsStart && goods != null) {
long startTime= System.currentTimeMillis(); //起始时间
try {
//获取工艺
ArrayList<BPA_GOODSRECIPE> goodsrecipes = QueryDB.GetGoodsSrecipeID(goods.id);
goodsrecipesL = goodsrecipes;
gongxuIndex = 1;
int m = 0;
for (BPA_GOODSRECIPE item : goodsrecipes) {
while (ExecuteTheRecipe.IsPause)
{
ToastUtils.info("客官,当前菜品已暂停炒制!!!");
Thread.sleep(1000);
}
MakeCipe = item;
gongxuIndex++;
runOnUiThread(new Runnable() {
@Override
public void run() {
cooking.SetMiaoShu("正在执行:" + item.processms);
}
});
boolean status = ExecuteTheRecipe.Execute(item, goodsrecipes, m);
m++;
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
} finally {
// ExecuteTheRecipe.WritePLC("搅拌", false, null);
// ExecuteTheRecipe.WritePLC("加热", false, null);
ConfigName.getInstance().IsOpenHuoLi = false;
ExecuteTheRecipe.BottomClick("平移-去1号位");
gongxuIndex = 10000;
MakeCipe = null;
goodsrecipesL = null;
ExecuteTheRecipe.IsStart = false;

long endTime = System.currentTimeMillis(); //结束时间
int time=(int) ((endTime-startTime)/1000);
Log.e("运行时长",String.format("方法使用时间 %d s",time));

if (!ExecuteTheRecipe.IsForcedEnd){QueryDB.UpdateGoodsMakeTime(goods.id,time);}

ExecuteTheRecipe.all_list=new ArrayList<>();
runOnUiThread(new Runnable() {
@Override
public void run() {
onRecordStop();
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 (ExecuteTheRecipe.IsStart && goods != 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());
}
}
private void analysis(String[] funcs, IRunT2<String,String> action){
for(int i=0;i<funcs.length;i++) {
String[] pars = funcs[i].split("[,]");
if(pars!=null&&pars.length==2){
if(action!=null)action.Run(pars[0],pars[1]);
}
}).start();
}
}


/**
* 点击事件
*/
@@ -478,17 +258,12 @@ public class BottomNavigationNewActivity extends BaseActivity {
switch (v.getId()) {
case R.id.start_goodmake://启动按钮
ExecuteTheRecipe.IsPause = false;
// ExecuteTheRecipe.WritePLC("暂停开关",false,null);
if (Status) {
onRecordStart();
}
// else {
// onRecordStop();
// }
break;
case R.id.zanting_goodmake://暂停按钮
ExecuteTheRecipe.IsPause = Status;
// ExecuteTheRecipe.WritePLC("暂停开关",Status,null);
if (Status) {
onRecordPause();
} else {


+ 6
- 2
app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home4Fragment.java View File

@@ -25,6 +25,8 @@ import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.bonait.bnframework.modules.home.fragment.from.BunkerSetupActivity;
import com.bonait.bnframework.modules.home.fragment.from.CpxzActivity;
import com.bonait.bnframework.modules.home.fragment.from.DishTestActivity;
import com.bonait.bnframework.modules.home.fragment.from.DiyUpdate1Activity;
import com.bonait.bnframework.modules.home.fragment.from.SystemParSetActivity;
import com.bonait.bnframework.modules.home.fragment.mode.MyStatus;
import com.bonait.bnframework.modules.welcome.activity.LoginActivity;
import com.orhanobut.logger.Logger;
@@ -80,10 +82,12 @@ public class Home4Fragment extends BaseFragment {
MessageManager.getInstance().sendMessage(MessageName.SelectZY, 2);
break;
case R.id.liaochangshezhi:
OpenActivity(BunkerSetupActivity.class);
OpenActivity(SystemParSetActivity.class);
break;
case R.id.caipinyanfa:
OpenActivity(DishTestActivity.class);
// OpenActivity(DishTestActivity.class);
DiyUpdate1Activity.SelectId=null;
OpenActivity(DiyUpdate1Activity.class);
break;
case R.id.zhuxiaodenglu:
String title = "温馨提示!";


+ 271
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentDevice.java View File

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

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

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

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

public class HomeFragmentDevice extends BaseFragment {

//region 控件
/**
* 温度
*/
@BindView(R.id.tv_temperature)
TextView tv_temperature;

/**
* 压力
*/
@BindView(R.id.tv_pressure)
TextView tv_pressure;

/**
* 锅盖上升
*/
@BindView(R.id.btn_PotLid_Up)
Button btn_PotLid_Up;

/**
* 锅盖下降
*/
@BindView(R.id.btn_PotLid_Down)
Button btn_PotLid_Down;

/**
* 锅盖开启
*/
@BindView(R.id.btn_PotLid_Open)
Button btn_PotLid_Open;

/**
* 锅盖关闭
*/
@BindView(R.id.btn_PotLid_Close)
Button btn_PotLid_Close;

/**
* 锅体正转
*/
@BindView(R.id.btn_PotBody_Forward)
Button btn_PotBody_Forward;

/**
* 锅体反转
*/
@BindView(R.id.btn_PotBody_Reversal)
Button btn_PotBody_Reversal;

/**
* 泄压阀控制
*/
@BindView(R.id.btn_PressureReliefValve)
Button btn_PressureReliefValve;

/**
* 一键上升
*/
@BindView(R.id.btn_OneKey_Up)
Button btn_OneKey_Up;

/**
* 一键下降
*/
@BindView(R.id.btn_OneKey_Down)
Button btn_OneKey_Down;

/**
* 一键回位
*/
@BindView(R.id.btn_OneKey_Home)
Button btn_OneKey_Home;

/**
* 停止
*/
@BindView(R.id.btn_Stop)
Button btn_Stop;

//endregion

private Context context;
public Activity activity = null;

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

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

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

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_pressure.setText("压力:"+ String.format("%.2f",s/10f) +" kpa");});
});

ModbusHelper.get().IsRunning.ChangeNotify=(s)->{
activity.runOnUiThread(()->{
BtnEnable(!s);
});
};

btn_PotLid_Up.setOnTouchListener(touchListener);
btn_PotLid_Down.setOnTouchListener(touchListener);
btn_PotLid_Open.setOnTouchListener(touchListener);
btn_PotLid_Close.setOnTouchListener(touchListener);
btn_PotBody_Forward.setOnTouchListener(touchListener);
btn_PotBody_Reversal.setOnTouchListener(touchListener);
btn_PressureReliefValve.setOnTouchListener(touchListener);
}

private void BtnEnable(boolean value){
btn_PotLid_Up.setEnabled(value);
btn_PotLid_Down.setEnabled(value);
btn_PotLid_Open.setEnabled(value);
btn_PotLid_Close.setEnabled(value);
btn_PotBody_Forward.setEnabled(value);
btn_PotBody_Reversal.setEnabled(value);
btn_PressureReliefValve.setEnabled(value);
btn_OneKey_Up.setEnabled(value);
btn_OneKey_Down.setEnabled(value);
btn_OneKey_Home.setEnabled(value);

btn_PotLid_Up.setTextColor(value?Color.WHITE: Color.GRAY);
btn_PotLid_Down.setTextColor(value?Color.WHITE: Color.GRAY);
btn_PotLid_Open.setTextColor(value?Color.WHITE: Color.GRAY);
btn_PotLid_Close.setTextColor(value?Color.WHITE: Color.GRAY);
btn_PotBody_Forward.setTextColor(value?Color.WHITE: Color.GRAY);
btn_PotBody_Reversal.setTextColor(value?Color.WHITE: Color.GRAY);
btn_PressureReliefValve.setTextColor(value?Color.WHITE: Color.GRAY);
btn_OneKey_Up.setTextColor(value?Color.WHITE: Color.GRAY);
btn_OneKey_Down.setTextColor(value?Color.WHITE: Color.GRAY);
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})
public void onViewClicked(View view) {
if(!ModbusHelper.get().getConnected()){
DialogManager.showWarn(activity,"设备未连接,请连接后重试!", AlertDialogButton.OK,null);
return ;
}
switch (view.getId()) {
case R.id.btn_OneKey_Up:
ModbusHelper.get().PulseSignal(ControlAdress.一键上升);
break;
case R.id.btn_OneKey_Down:
ModbusHelper.get().PulseSignal(ControlAdress.一键下降);
break;
case R.id.btn_OneKey_Home:
ModbusHelper.get().PulseSignal(ControlAdress.一键回位);
break;
case R.id.btn_Stop:
DialogManager.showWarn(activity,"请问是否停止当前正在焖制的任务?",AlertDialogButton.OKCancel,(s)->{
if(s){
ModbusHelper.get().PulseSignal(ControlAdress.停止);
ModbusHelper.get().IsRunning.setValue(false);
}
});
break;
}
}

public View.OnTouchListener touchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {

if(!ModbusHelper.get().getConnected()){
if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){
DialogManager.showWarn(activity,"设备未连接,请连接后重试!", AlertDialogButton.OK,null);
}
return false;
}

if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
InchingControl(view,true);//手指按下
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
InchingControl(view,false);//手指松开
}
return false;
}
};

public void InchingControl(View view,Boolean IsChick)
{
switch (view.getId()) {
case R.id.btn_PotLid_Up:
ModbusHelper.get().WriteBoolSingle(ControlAdress.锅盖上升,IsChick);
break;
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_PotBody_Forward:
ModbusHelper.get().WriteBoolSingle(ControlAdress.锅体正转,IsChick);
break;
case R.id.btn_PotBody_Reversal:
ModbusHelper.get().WriteBoolSingle(ControlAdress.锅体反转,IsChick);
break;
case R.id.btn_PressureReliefValve:
ModbusHelper.get().WriteBoolSingle(ControlAdress.泄压阀启停,IsChick);
break;
}
}

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

}

+ 46
- 91
app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentPR.java View File

@@ -23,9 +23,16 @@ import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

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.HBL.NotifyEvent;
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.ModbusHelper;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
@@ -102,7 +109,7 @@ public class HomeFragmentPR extends BaseFragment {
activity = getActivity();
initTopBar();
SelectTab(1);
NotifyEvent.get().Register("商品信息刷新",()->{initData();});
}

@SuppressLint("HandlerLeak")
@@ -122,57 +129,6 @@ public class HomeFragmentPR extends BaseFragment {
mTopBar.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.topbj1));
mTopBar.setTitle("菜谱");
mTopBar.addRightTextButton("设备状态:"+(ConfigName.getInstance().PlcIsConnect ? "已连接" : "未连接"),R.id.status_image);

new Thread(new Runnable() {
@Override
public void run() {
while (true)
{
try {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
mTopBar.removeAllRightViews();
mTopBar.addRightTextButton("设备状态:"+(ConfigName.getInstance().PlcIsConnect ? "已连接" : "未连接"),R.id.status_image);
}
});
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
}
}).start();
/**
* 刷新菜品
*/
MessageManager.getInstance().registerMessageReceiver(activity, MessageName.GetOrganize, new MessageLooper.OnMessageListener() {
@Override
public void onMessage(Object msg) {
if (msg != null && isAdded()) {
ConfigData.getInstance().GetGevGood(context, mHandler);
}
}
});
/**
* 刷新菜品
*/
MessageManager.getInstance().registerMessageReceiver(activity, MessageName.ScGood, new MessageLooper.OnMessageListener() {
@Override
public void onMessage(Object msg) {
if (msg != null && isAdded()) {
String str = (String) msg;
if (str.equals("Good")) {
initData();
if (qupenren.getVisibility() == View.VISIBLE) {
qupenren.RefreshData();
}
} else {
ConfigData.getInstance().GetGevGood(context, mHandler);
}
}
}
});

search_view.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
@@ -187,44 +143,29 @@ public class HomeFragmentPR extends BaseFragment {
});
}



/**
* 初始化显示数据
*/
private void initData() {
StaggeredGridLayoutManager layout = new StaggeredGridLayoutManager
(3, StaggeredGridLayoutManager.VERTICAL);
StaggeredGridLayoutManager layout = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL);
recycler_view.setLayoutManager(layout);

ArrayList<BPA_GOODS> good = new ArrayList<>();
String name = search_view.getQuery().toString();
if (name.isEmpty()) {
good = QueryDB.GetGoodsALL();
} else {
good = QueryDB.GetGoodsLike(name);
}

List<String> Bendi_id = new ArrayList<>();
ArrayList<SectionItem> contents_bdcp = new ArrayList<>();
ArrayList<SectionItem> contents_ydcp = new ArrayList<>();
for (BPA_GOODS item : good) {
if (item.url == null) {
item.url = "未知";
QueryDB.getFormulaAll().OnFinally(s->{
if(s.isSuccess){
ArrayList<SectionItem> contents_bdcp = new ArrayList<>();
s.Content.forEach(item->{
if (item.Url == null) {item.Url = "未知"; }
contents_bdcp.add(new SectionItem(item.Name, "", item.id, item.Url, false, false, true));
});
good_adapter adapter = new good_adapter(context, contents_bdcp, myClickListener);
recycler_view.setAdapter(adapter);
}else{
MessageLog.ShowError(s.message);
}
contents_bdcp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id, item.url, item.issc == 1, false, true));
Bendi_id.add(item.id);
}

for (CloudGood item : ConfigName.getInstance().cloudGoods) {
contents_ydcp.add(new SectionItem(item.goods_Name, "180", item.id, item.goods_ImgUrl, false, true, Bendi_id.contains(item.id) ? true : false));
}
});

if (SelectIndex == 1) {
good_adapter adapter = new good_adapter(context, contents_bdcp, myClickListener);
recycler_view.setAdapter(adapter);
} else {
good_adapter adapter = new good_adapter(context, contents_ydcp, myClickListener);
recycler_view.setAdapter(adapter);
}
}

public MyClickListener myClickListener = new MyClickListener() {
@@ -240,8 +181,7 @@ public class HomeFragmentPR extends BaseFragment {
switch (k) {

case 1:
QueryDB.DeleteGoodsid(goodid);
QueryDB.DeleteGoodsSrecipeList(goodid);
QueryDB.ReamoveFormula(goodid);
initData();
break;
case 2:
@@ -252,6 +192,7 @@ public class HomeFragmentPR extends BaseFragment {
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("id", goodid);
startActivity(intent);
qupenren.setVisibility(View.GONE);
break;
case 99:
Intent intent1 = new Intent(getContext(), CookingSimulatedActivity.class);
@@ -262,14 +203,29 @@ public class HomeFragmentPR extends BaseFragment {
case 4: //打开查看窗体
qupenren.SetData(item, myClickListener);
qupenren.setVisibility(View.VISIBLE);
DiyUpdate1Activity.SelectId=goodid;
break;
case 5: //打开制作窗体
//判断是否正在制作
if (ExecuteTheRecipe.IsStart) {
ToastUtils.warning("请耐心等待商品制作结束!!!");
} else {
MessageManager.getInstance().sendMessage(MessageName.OpenMakeGoodFrom, goodid);
qupenren.setVisibility(View.GONE);

if(ModbusHelper.get().IsRunning.getValue()){
DialogManager.showWarn(context,"制作中,请稍后后再试!", AlertDialogButton.OK,null);
}else{
if(ModbusHelper.get().getConnected()){
DialogManager.showInfo(context,"是否开始制作商品?", AlertDialogButton.YesNo,(s)->{
if(s){
QueryDB.getFormula(goodid).OnSource(order->{
Executor.get().runThread(()->{
ModbusHelper.get().WriteOrder(order.Content);
getActivity().runOnUiThread( ()->{qupenren.setVisibility(View.GONE);});
NotifyEvent.get().Notify(MessageName.OpenDeviceFrom);
});
});
}
});
}else{
DialogManager.showWarn(context,"设备未连接,请连接后重试!", AlertDialogButton.OK,null);
}
}
break;
case 0://关闭窗体
@@ -285,8 +241,7 @@ public class HomeFragmentPR extends BaseFragment {
*
* @param view
*/
@OnClick({R.id.quanbucaipu, R.id.yunduancaipu
})
@OnClick({R.id.quanbucaipu, R.id.yunduancaipu})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.quanbucaipu:


+ 455
- 375
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdate1Activity.java View File

@@ -13,6 +13,7 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
@@ -20,11 +21,17 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Spinner;

import com.bonait.bnframework.HBL.Dialog.AlertDialogButton;
import com.bonait.bnframework.HBL.Dialog.DialogManager;
import com.bonait.bnframework.HBL.NotifyEvent;
import com.bonait.bnframework.HBL.Result.OperateResult;
import com.bonait.bnframework.HBL.Result.OperateResultT;
import com.bonait.bnframework.R;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_FORMULA;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
@@ -66,13 +73,35 @@ public class DiyUpdate1Activity extends BaseActivity {
@BindView(R.id.check)
CheckBox check;//默认收藏
@BindView(R.id.hrgx)
Spinner hrgx;//工序
Spinner hrgx;//档位

@BindView(R.id.shengchengnewcaipu)
Button shengchengnewcaipu;

/**
* 加热计时温度
*/
@BindView(R.id.Timing_Temperature)
EditText et_Timing_Temperature;

/**
* 泄压压力
*/
@BindView(R.id.Relief_Pressure)
EditText et_Relief_Pressure;

/**
* 烹饪时间
*/
@BindView(R.id.Cooking_Time)
EditText et_Cooking_Time;

Map<String, String> hrgx_map = new LinkedHashMap<>();
Map<String, Integer> hrgx_map_index = new LinkedHashMap<>();
@BindView(R.id.gxchid)
LinearLayout gxchid;//工序子集
@BindView(R.id.datatab_gxbz)
ListView datatab_gxbz;//工序步骤
// @BindView(R.id.gxchid)
// LinearLayout gxchid;//工序子集
// @BindView(R.id.datatab_gxbz)
// ListView datatab_gxbz;//工序步骤
public gongxubuzhou_adapter gxbz_adapter = null;
/**
* 工序步骤
@@ -86,7 +115,10 @@ public class DiyUpdate1Activity extends BaseActivity {
/**
* 当前商品
*/
public BPA_GOODS good = null;
public BPA_FORMULA good = null;

public String ImageUrl;
public static String SelectId;

@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -96,71 +128,67 @@ public class DiyUpdate1Activity extends BaseActivity {
initTopBar();
initData();
SetGood();




}

private void initData() {
//1.初始化轮播图
//Drawable_Get(Banner_list);
//2.初始化工序
ArrayList<BPA_PROCESS> data = QueryDB.GetProcessALL();
int i = 0;
String id = "";
for (BPA_PROCESS item : data) {
hrgx_map.put(item.name, item.id);
hrgx_map_index.put(item.name, i);
if (i == 0) {
id = item.id;
}
i++;

List<Integer> spinners = new ArrayList<Integer>();
for (int i =1;i<=8;i++){
spinners.add(i);
}
ArrayAdapter<String> adapter_kk = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, new ArrayList<>(hrgx_map.keySet()));
ArrayAdapter<Integer> adapter_kk = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, spinners);
adapter_kk.setDropDownViewResource(R.layout.spinner_dropdown_item);
hrgx.setAdapter(adapter_kk);

hrgx.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
isUserClicked = true;
view.performClick();
return false;
}
});
hrgx.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
if (isUserClicked)//不是用户点击返回
{
String id = hrgx_map.get(hrgx.getSelectedItem().toString());
SelectItemFrom(id);
isUserClicked = false;
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
SelectItemFrom(id);
// hrgx.setOnTouchListener(new View.OnTouchListener() {
// @Override
// public boolean onTouch(View view, MotionEvent motionEvent) {
// isUserClicked = true;
// view.performClick();
// return false;
// }
// });
// hrgx.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
// @Override
// public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
// if (isUserClicked)//不是用户点击返回
// {
// String id = hrgx_map.get(hrgx.getSelectedItem().toString());
// SelectItemFrom(id);
// isUserClicked = false;
// }
// }
//
// @Override
// public void onNothingSelected(AdapterView<?> adapterView) {
// }
// });
// SelectItemFrom(1);
//3.工序步骤
gxbz_adapter = new gongxubuzhou_adapter(getContext(), R.layout.gx_item1, (List<BPA_GOODSRECIPE>) bpa_goodsrecipes, null);
datatab_gxbz.setAdapter(gxbz_adapter);
datatab_gxbz.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long l) {
// TODO Auto-generated method stub
gxbz_adapter.setSelectedPosition(position);
gxbz_adapter.notifyDataSetInvalidated();
SetSelectGX(bpa_goodsrecipes.get(position));//单击工序行,显示变量
}
});
// gxbz_adapter = new gongxubuzhou_adapter(getContext(), R.layout.gx_item1, (List<BPA_GOODSRECIPE>) bpa_goodsrecipes, null);
// datatab_gxbz.setAdapter(gxbz_adapter);
// datatab_gxbz.setOnItemClickListener(new AdapterView.OnItemClickListener() {
// @Override
// public void onItemClick(AdapterView<?> parent, View view, int position, long l) {
// // TODO Auto-generated method stub
// gxbz_adapter.setSelectedPosition(position);
// gxbz_adapter.notifyDataSetInvalidated();
//
// SetSelectGX(bpa_goodsrecipes.get(position));//单击工序行,显示变量
// }
// });
//图标选择
MessageManager.getInstance().registerMessageReceiver(this, MessageName.ClickImage, new MessageLooper.OnMessageListener() {
@Override
public void onMessage(Object msg) {
if (msg != null) {
good.url = (String) msg;
new MyBitmapUtils().disPlay(cpfm, good.url);
good.Url = (String) msg;
ImageUrl=(String) msg;
new MyBitmapUtils().disPlay(cpfm, good.Url);
}
}
});
@@ -181,60 +209,60 @@ public class DiyUpdate1Activity extends BaseActivity {
});
}

/**
* 根据选中步骤显示变量
*
* @param goodsrecipe
*/
public void SetSelectGX(BPA_GOODSRECIPE goodsrecipe) {
try {
//1.根据工序名称显示工序集合
hrgx.setSelection(hrgx_map_index.get(goodsrecipe.processname));
String id = hrgx_map.get(hrgx.getSelectedItem().toString());
SelectItemFrom(id);
//2.根据工序变量集合-获取变量名称和值
final HashMap<String, String> formulation = new HashMap<>();
//region 获取变量名称和值
String text = goodsrecipe.processvalue;
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
//3.查询子集-填充变量
for (Map.Entry<String, String> entry : formulation.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
String STR = formulation.get(key);
}
for (int i = 0; i < gxchid.getChildCount(); i++) {
fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i);
String res = formulation.get(gongxu.model.name);
if (res != null) {
gongxu.SetValues(res);
}
}
} catch (Exception ex) {
}
}
// /**
// * 根据选中步骤显示变量
// *
// * @param goodsrecipe
// */
// public void SetSelectGX(BPA_GOODSRECIPE goodsrecipe) {
// try {
// //1.根据工序名称显示工序集合
// hrgx.setSelection(hrgx_map_index.get(goodsrecipe.processname));
// String id = hrgx_map.get(hrgx.getSelectedItem().toString());
// SelectItemFrom(id);
//
// //2.根据工序变量集合-获取变量名称和值
// final HashMap<String, String> formulation = new HashMap<>();
// //region 获取变量名称和值
// String text = goodsrecipe.processvalue;
// 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
//
// //3.查询子集-填充变量
// for (Map.Entry<String, String> entry : formulation.entrySet()) {
// String key = entry.getKey();
// String value = entry.getValue();
// String STR = formulation.get(key);
// }
//
//// for (int i = 0; i < gxchid.getChildCount(); i++) {
//// fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i);
//// String res = formulation.get(gongxu.model.name);
//// if (res != null) {
//// gongxu.SetValues(res);
//// }
//// }
// } catch (Exception ex) {
// }
// }

/**
* 设置当前商品
@@ -243,121 +271,139 @@ public class DiyUpdate1Activity extends BaseActivity {
*/
public void SetGood() {
try {
Intent intent = getIntent();
String id = intent.getStringExtra("id");
if (!id.isEmpty()) {
good = QueryDB.GetGoodsId(id);
if (good != null) {
bpa_goodsrecipes.clear();
ArrayList<BPA_GOODSRECIPE> goodsrecipes = QueryDB.GetGoodsSrecipeID(good.id);
for (BPA_GOODSRECIPE item : goodsrecipes) {
bpa_goodsrecipes.add(item);
if(SelectId!=null&&!SelectId.isEmpty()) {
QueryDB.getFormula(SelectId).OnSource(s->{
good=s.Content;
ArrayAdapter adapter = (ArrayAdapter) hrgx.getAdapter();
for (int i = 0; i < adapter.getCount(); i++) {
if (String.valueOf(good.HeatingGear).equals(adapter.getItem(i).toString())) {
hrgx.setSelection(i);
break;
}
}
edittext.setText(good.name);
check.setChecked(good.issc == 1);
zzsc.setText(good.maketime + "");
gxbz_adapter.notifyDataSetChanged();//刷新商品配方
new MyBitmapUtils().disPlay(cpfm, good.url);
}
edittext.setText(good.Name);
et_Timing_Temperature.setText(String.valueOf(good.TimingTemperature));
et_Cooking_Time.setText(String.valueOf(good.CookingTime));
et_Relief_Pressure.setText(String.valueOf(good.ReliefPressure));
});
}
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
} catch (Exception ex) {

}
}

/**
* 根据选中工序id显示集合
*
* @param id
*/
public void SelectItemFrom(String id) {
try {
gxchid.removeAllViews();
ArrayList<BPA_PROCESSModel> mode = QueryDB.GetProcessModelProcessID(id);
if (mode.size() > 0)//工序
{
for (BPA_PROCESSModel item : mode) {
item_gx gx = new item_gx();
gx.datatype = item.datatype;
gx.name = item.name;
gx.data = item.data;
gx.IsWL = false;
fragment_gx gongxu = new fragment_gx(this, null, gx);
gxchid.addView(gongxu);
}
} else //物料
{
ArrayList<BPA_MATERIAL> materials = QueryDB.GetMaterialALL();
for (BPA_MATERIAL item2 : materials) {
item_gx gx = new item_gx();
gx.datatype = 0;//液体料都是数字
gx.name = item2.name;
gx.IsWL = true;
fragment_gx gongxu = new fragment_gx(this, null, gx);
gxchid.addView(gongxu);
}
}
//
// Intent intent = getIntent();
// String id = intent.getStringExtra("id");
// if (!id.isEmpty()) {
// good = QueryDB.GetGoodsId(id);
// if (good != null) {
// bpa_goodsrecipes.clear();
// ArrayList<BPA_GOODSRECIPE> goodsrecipes = QueryDB.GetGoodsSrecipeID(good.id);
// for (BPA_GOODSRECIPE item : goodsrecipes) {
// bpa_goodsrecipes.add(item);
// }
// edittext.setText(good.name);
// check.setChecked(good.issc == 1);
// zzsc.setText(good.maketime + "");
// gxbz_adapter.notifyDataSetChanged();//刷新商品配方
// new MyBitmapUtils().disPlay(cpfm, good.url);
// }
// }
// getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
} catch (Exception ex) {
}
}

/**
* 获取选中行的变量
*
* @return
*/
public BPA_GOODSRECIPE GetSelectItemFromValue() {
BPA_GOODSRECIPE pf = new BPA_GOODSRECIPE();
try {
String name = hrgx.getSelectedItem().toString();
boolean IsVerify = true;
String description = "";
// 延迟,100|延迟,100|延迟,100|延迟,100|
String data = "";
String desc = "";
if (name.contains("液体料")) {
pf.materialType = 0;
for (int i = 0; i < gxchid.getChildCount(); i++) {
fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i);
String values = gongxu.GetValues();
if (!values.isEmpty()) {
data += gongxu.model.name + "," + values + "|";
desc += values + ",";
}
}

if (data.isEmpty()) {
IsVerify = false;
description += "物料-不能为空,请勾选一个物料\n";
}
} else {
pf.materialType = 1;
for (int i = 0; i < gxchid.getChildCount(); i++) {
fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i);
String values = gongxu.GetValues();
if (values.isEmpty()) {
IsVerify = false;
description += gongxu.model.name + "-不能为空\n";
} else {
data += gongxu.model.name + "," + values + "|";
desc += values + ",";
}
}
}
if (IsVerify) {
pf.processname = name;
pf.processms = name + "(" + desc.substring(0, desc.length() - 1) + ")";
pf.processvalue = data.substring(0, data.length() - 1);
return pf;
} else {
ToastUtils.info("数据验证失败,原因:" + description);
return null;
}
} catch (Exception ex) {
return null;
}
}

// /**
// * 根据选中工序id显示集合
// *
// * @param id
// */
// public void SelectItemFrom(String id) {
// try {
//// gxchid.removeAllViews();
//// ArrayList<BPA_PROCESSModel> mode = QueryDB.GetProcessModelProcessID(id);
//// if (mode.size() > 0)//工序
//// {
//// for (BPA_PROCESSModel item : mode) {
//// item_gx gx = new item_gx();
//// gx.datatype = item.datatype;
//// gx.name = item.name;
//// gx.data = item.data;
//// gx.IsWL = false;
//// fragment_gx gongxu = new fragment_gx(this, null, gx);
//// gxchid.addView(gongxu);
//// }
//// } else //物料
//// {
//// ArrayList<BPA_MATERIAL> materials = QueryDB.GetMaterialALL();
//// for (BPA_MATERIAL item2 : materials) {
//// item_gx gx = new item_gx();
//// gx.datatype = 0;//液体料都是数字
//// gx.name = item2.name;
//// gx.IsWL = true;
//// fragment_gx gongxu = new fragment_gx(this, null, gx);
//// gxchid.addView(gongxu);
//// }
//// }
// } catch (Exception ex) {
// }
// }

// /**
// * 获取选中行的变量
// *
// * @return
// */
// public BPA_GOODSRECIPE GetSelectItemFromValue() {
// BPA_GOODSRECIPE pf = new BPA_GOODSRECIPE();
// try {
// String name = hrgx.getSelectedItem().toString();
// boolean IsVerify = true;
// String description = "";
// // 延迟,100|延迟,100|延迟,100|延迟,100|
// String data = "";
// String desc = "";
// if (name.contains("液体料")) {
// pf.materialType = 0;
//// for (int i = 0; i < gxchid.getChildCount(); i++) {
//// fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i);
//// String values = gongxu.GetValues();
//// if (!values.isEmpty()) {
//// data += gongxu.model.name + "," + values + "|";
//// desc += values + ",";
//// }
//// }
//
// if (data.isEmpty()) {
// IsVerify = false;
// description += "物料-不能为空,请勾选一个物料\n";
// }
// } else {
// pf.materialType = 1;
//// for (int i = 0; i < gxchid.getChildCount(); i++) {
//// fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i);
//// String values = gongxu.GetValues();
//// if (values.isEmpty()) {
//// IsVerify = false;
//// description += gongxu.model.name + "-不能为空\n";
//// } else {
//// data += gongxu.model.name + "," + values + "|";
//// desc += values + ",";
//// }
//// }
// }
// if (IsVerify) {
// pf.processname = name;
// pf.processms = name + "(" + desc.substring(0, desc.length() - 1) + ")";
// pf.processvalue = data.substring(0, data.length() - 1);
// return pf;
// } else {
// ToastUtils.info("数据验证失败,原因:" + description);
// return null;
// }
// } catch (Exception ex) {
// return null;
// }
// }
private void initTopBar() {
mTopBar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.topbj1));
mTopBar.setTitle("编辑菜谱");
@@ -374,7 +420,7 @@ public class DiyUpdate1Activity extends BaseActivity {
*
* @param view
*/
@OnClick({R.id.add_hrgx, R.id.update_gx, R.id.delete_gx, R.id.shangyi, R.id.xiayi, R.id.caozuomoshi, R.id.shengchengcaipu, R.id.shengchengnewcaipu, R.id.cpfm})
@OnClick({ R.id.shengchengcaipu, R.id.shengchengnewcaipu, R.id.cpfm})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.cpfm://菜谱封面
@@ -383,169 +429,203 @@ 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.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()) {
ToastUtils.info("菜谱名称不能为空!");
if(name1.isEmpty()){
DialogManager.showWarn(this,"菜谱名称不能为空!", AlertDialogButton.OK,null);
return;
} else {
boolean isSucess = QueryDB.GetGoodsIs(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());
}
}
if(QueryDB.checkName(name1)){
DialogManager.showWarn(this,"菜谱名称已存在!", AlertDialogButton.OK,null);
return;
}

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;
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);
DialogManager.showInfo(this,"请问是否生成 ["+name1+"] 菜谱?", AlertDialogButton.YesNo,(s)->{
if(s){
try{
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());
OperateResult result = QueryDB.addFormula(new BPA_FORMULA(name1,ImageUrl,heatingGear,timingsTemperature,cookingTime,reliefPressure));
if(result.isSuccess)
{
ToastUtils.info("菜谱添加成功!");
NotifyEvent.get().Notify("商品信息刷新");
}
ToastUtils.info("菜谱复刻成功!");
dialog.dismiss();
MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good");
else DialogManager.showError(this,"添加菜谱失败,"+result.message,AlertDialogButton.OK,null);
finish();
}catch(Exception e){
DialogManager.showError(this,"添加菜谱失败,"+e.getMessage(),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();
}
});

}
// 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();
// }
// });
//
// }
break;
}
}


+ 171
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParSetActivity.java View File

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

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import androidx.core.content.ContextCompat;

import com.bonait.bnframework.HBL.Executor;
import com.bonait.bnframework.HBL.Logs.MessageLog;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ControlAdress;
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.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.res.lcMode;
import com.bonait.bnframework.common.helper.ConfigUtil;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.fragment.mode.add_silos_message;
import com.bonait.bnframework.modules.home.fragment.mode.imagebuttom;
import com.bonait.bnframework.modules.home.fragment.mode.jingdutiao1;
import com.qmuiteam.qmui.widget.QMUITopBarLayout;

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

public class SystemParSetActivity extends BaseActivity {

//region 变量
@BindView(R.id.topbar)
QMUITopBarLayout mTopBar;

/**
* 温度上限
*/
@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_Upper_Limit)
EditText et_Pressure_Upper_Limit;

/**
* 压力下限
*/
@BindView(R.id.et_Pressure_Lower_Limit)
EditText et_Pressure_Lower_Limit;

/**
* 允许开盖压力
*/
@BindView(R.id.et_OpenLid_pressure)
EditText et_OpenLid_pressure;

/**
* 排冷气温度
*/
@BindView(R.id.et_Exhaust_Air_Temperature)
EditText et_Exhaust_Air_Temperature;

public Context context;
public Activity activity=null;
//endregion

//region 界面实例
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_system_par_set);
ButterKnife.bind(this);
context = this;
activity=this;
initTopBar();
InitData();
}
//endregion

//region 私有方法

/**
* 初始化顶部弹框
*/
private void initTopBar() {
mTopBar.setBackgroundColor(ContextCompat.getColor(context, R.color.topbj1));
mTopBar.setTitle("系统参数设置");
mTopBar.addLeftImageButton(R.mipmap.fanhui, R.id.topbar).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});


}

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"));
}catch(Exception e){
MessageLog.ShowError(e);
}
}


/**
* 点击事件
*
* @param view
*/
@OnClick({R.id.btn_save})
public void onViewClicked(View view) {
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());
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);
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);
this.runOnUiThread(()->{ ToastUtils.info("保存成功!");});
});
}catch (Exception e){
MessageLog.ShowError(e);
}
break;
}
}
//endregion
}

+ 26
- 42
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_qupenren.java View File

@@ -14,8 +14,13 @@ import android.widget.TextView;

import androidx.annotation.Nullable;

import com.bonait.bnframework.HBL.Dialog.AlertDialogButton;
import com.bonait.bnframework.HBL.Dialog.DialogManager;
import com.bonait.bnframework.HBL.Executor;
import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.business.ModbusHelper;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
@@ -38,30 +43,33 @@ public class add_qupenren extends LinearLayout {
@BindView(R.id.quzhizuo)
Button quzhizuo;

@BindView(R.id.edit_func)
Button edit_func;

@BindView(R.id.quzhizuo_ms)
TextView quzhizuo_ms;
@BindView(R.id.bianji)
RelativeLayout bianji;
// @BindView(R.id.bianji)
// RelativeLayout bianji;

@BindView(R.id.chaozhi)
RelativeLayout chaozhi;
// @BindView(R.id.chaozhi)
// RelativeLayout chaozhi;
@BindView(R.id.close_from)
Button close_from;

@BindView(R.id.good_name)
TextView good_name;//商品名称

@BindView(R.id.yihao_text)
TextView yihao_text;//1号
@BindView(R.id.erhao_text)
TextView erhao_text;//1号
@BindView(R.id.sanhao_text)
TextView sanhao_text;//1号
@BindView(R.id.sihao_text)
TextView sihao_text;//1号
// @BindView(R.id.yihao_text)
// TextView yihao_text;//1号
//
// @BindView(R.id.erhao_text)
// TextView erhao_text;//1号
//
// @BindView(R.id.sanhao_text)
// TextView sanhao_text;//1号
//
// @BindView(R.id.sihao_text)
// TextView sihao_text;//1号
/**
* 点击事件
*/
@@ -93,11 +101,6 @@ public class add_qupenren extends LinearLayout {

ConcurrentHashMap<Integer,String> resultData= DataBus.getInstance().GetMainDisplayText(id);

yihao_text.setText(resultData.get(1)+"");
erhao_text.setText(resultData.get(2)+"");
sanhao_text.setText(resultData.get(3)+"");
sihao_text.setText(resultData.get(4)+"");

if(ExecuteTheRecipe.IsStart)
{
quzhizuo.setVisibility(View.GONE);
@@ -138,25 +141,14 @@ public class add_qupenren extends LinearLayout {

private void initEvent() {
if (ConfigName.getInstance().user.userID.equals("研发用户")) {
bianji.setVisibility(View.VISIBLE);
edit_func.setVisibility(View.VISIBLE);
} else {
bianji.setVisibility(View.GONE);
edit_func.setVisibility(View.GONE);
}

quzhizuo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (!ConfigName.getInstance().PlcIsConnect) {
ToastUtils.warning("PLC未准备就绪!!!");
return;
}

Object chushiover = ExecuteTheRecipe.getListingValue("初始化完成");
//Object jiting = ExecuteTheRecipe.getListingValue("设备急停");
if (chushiover == null || !(boolean) chushiover) {
ToastUtils.warning("设备未初始化,请先手动初始化设备!!!");
return;
}
if (mListener != null) {
mListener.clickListenerNew(view, 5, mode);
}
@@ -171,7 +163,7 @@ public class add_qupenren extends LinearLayout {
}
});

bianji.setOnClickListener(new OnClickListener() {
edit_func.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (mListener != null) {
@@ -180,13 +172,5 @@ public class add_qupenren extends LinearLayout {
}
});

chaozhi.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (mListener != null) {
mListener.clickListenerNew(view, 99, mode);
}
}
});
}
}

+ 8
- 8
app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java View File

@@ -348,17 +348,17 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL
QMUIStatusBarHelper.setStatusBarDarkMode(LoginActivity.this);


if(ConfigName.getInstance().user.name.equals("admin") || ConfigName.getInstance().user.account.equals("admin") || ConfigName.getInstance().user.userID.equals("超级管理员"))
{
Intent intent = new Intent(LoginActivity.this, BottomNavigation2Activity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}else
{
// if(ConfigName.getInstance().user.name.equals("admin") || ConfigName.getInstance().user.account.equals("admin") || ConfigName.getInstance().user.userID.equals("超级管理员"))
// {
// Intent intent = new Intent(LoginActivity.this, BottomNavigation2Activity.class);
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// startActivity(intent);
// }else
// {
Intent intent = new Intent(LoginActivity.this, BottomNavigationNewActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
// }
ToastUtils.info("登录成功!");
// 结束所有Activity
ActivityLifecycleManager.get().finishAllActivity();


BIN
View File


+ 27
- 0
app/src/main/res/drawable/bg_btn_dialog_qupenren.xml View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#7FEF5362"
android:radius="-1dp">

<item android:state_pressed="true">
<shape>
<solid android:color="#beaa6a" />
<corners android:radius="15dp" />
</shape>
</item>

<item android:state_enabled="false">
<shape>
<solid android:color="#AAbeaa6a" />
<corners android:radius="15dp" />
</shape>
</item>


<item>
<shape>
<solid android:color="#beaa6a" />
<corners android:radius="15dp" />
</shape>
</item>
</ripple>

+ 35
- 0
app/src/main/res/drawable/control_but_back.xml View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#7FEF5362"
android:radius="-1dp">

<item android:state_pressed="true">
<shape>
<solid android:color="#756bff" />
<corners android:radius="10dp" />
</shape>
</item>

<item android:state_enabled="false">
<shape>
<solid android:color="#55F0184B" />
<corners android:radius="10dp" />
</shape>
</item>

<item>
<shape>
<solid android:color="#aa756bff" />
<corners android:radius="10dp" />
</shape>
</item>



<!-- &lt;!&ndash;背景色&ndash;&gt;-->
<!-- <solid android:color="#756bff"/>-->

<!-- &lt;!&ndash;设置圆角&ndash;&gt;-->
<!-- <corners android:radius="10dp"/>-->

</ripple>

+ 31
- 0
app/src/main/res/drawable/edit_border.xml View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/blue"
android:radius="-1dp">

<item android:state_pressed="true">
<shape>
<stroke android:width="1dp" android:color="@color/blue"/>
<corners android:radius="4dp" />
<solid android:color="@color/transparent"/>
</shape>
</item>

<item android:state_enabled="false">
<shape>
<stroke android:width="1dp" android:color="#D6D3D3"/>
<corners android:radius="4dp" />
<solid android:color="@color/transparent"/>
</shape>
</item>


<item>
<shape>
<stroke android:width="1dp" android:color="@color/gray"/>
<corners android:radius="4dp" />
<solid android:color="@color/transparent"/>
<padding android:bottom="0dp" android:left="4dp" android:right="0dp" android:top="0dp"/>
</shape>
</item>
</ripple>

+ 10
- 0
app/src/main/res/drawable/shadow_backcolor.xml View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

<!--背景色-->
<solid android:color="#ffdcbe"/>

<!--设置圆角-->
<corners android:radius="10dp"/>

</shape>

+ 112
- 155
app/src/main/res/layout/activity_diy_update1.xml View File

@@ -143,161 +143,118 @@
android:layout_marginBottom="@dimen/dp_10"
android:background="@color/color3" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="400dp">

<RelativeLayout
android:layout_width="200dp"
android:layout_height="wrap_content">

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

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="步骤:"
android:textColor="#567722"
android:textSize="19dp" />

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true">

<ImageView
android:id="@+id/shangyi"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@mipmap/ll5" />

<ImageView
android:id="@+id/xiayi"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="15dp"
android:src="@mipmap/ll6" />
</LinearLayout>

</RelativeLayout>

<ListView
android:id="@+id/datatab_gxbz"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="50dp"
android:divider="#00000000"
android:dividerHeight="3dp" />
</LinearLayout>

<ImageView
android:id="@+id/caozuomoshi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="@mipmap/ll4" />
</RelativeLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10">
<!--边框分割细线-->
<RelativeLayout
android:layout_width="@dimen/dp_10"
android:layout_height="match_parent"
android:layout_alignParentLeft="true">

<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginBottom="@dimen/dp_40"
android:background="@color/color3" />
</RelativeLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_10"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="烹饪工序:"
android:textColor="#BEAA6A"
android:textSize="19dp" />

<Spinner
android:id="@+id/hrgx"
style="@style/commonSpinnerStyle"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_centerVertical="true" />
</LinearLayout>

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:layout_marginBottom="50dp">

<LinearLayout
android:id="@+id/gxchid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"></LinearLayout>
</ScrollView>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10">

<ImageView
android:id="@+id/add_hrgx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ll3" />

<ImageView
android:id="@+id/update_gx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:src="@mipmap/ll2" />

<ImageView
android:id="@+id/delete_gx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:src="@mipmap/ll1" />
</LinearLayout>
</RelativeLayout>

</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

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

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="加热档位:"
android:textSize="20sp"/>
<Spinner
android:id="@+id/hrgx"
style="@style/commonSpinnerStyle"
android:layout_width="200dp"
android:layout_height="30dp"
android:layout_centerVertical="true" />
</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="计时温度:"
android:textSize="20sp"/>
<EditText
android:id="@+id/Timing_Temperature"
android:layout_width="200dp"
android:layout_height="30dp"
android:background="@drawable/edit_border"
android:inputType="number"
android:layout_margin="5dp"
android:text="0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="℃"
android:textSize="20sp"/>
</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="烹饪时间:"
android:textSize="20sp"/>
<EditText
android:id="@+id/Cooking_Time"
android:layout_width="200dp"
android:layout_height="30dp"
android:background="@drawable/edit_border"
android:inputType="number"
android:layout_margin="5dp"
android:text="0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="分"
android:textSize="20sp"/>
</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="泄压压力:"
android:textSize="20sp"/>
<EditText
android:id="@+id/Relief_Pressure"
android:layout_width="200dp"
android:layout_height="30dp"
android:background="@drawable/edit_border"
android:inputType="number"
android:layout_margin="5dp"
android:text="0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Kpa"
android:textSize="20sp"/>
</LinearLayout>

</LinearLayout>





</RelativeLayout>

<RelativeLayout
android:layout_width="match_parent"


+ 282
- 0
app/src/main/res/layout/activity_system_par_set.xml View File

@@ -0,0 +1,282 @@
<?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:fitsSystemWindows="true"
android:orientation="vertical"
android:background="@color/qmui_config_color_white"
tools:context=".modules.home.fragment.from.SystemParSetActivity">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/qmui_topbar_height"
android:orientation="vertical">

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

<TextView
android:layout_column="0"
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="18sp"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="温度上限:"/>
<LinearLayout
android:layout_column="1"
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_Upper_Limit"
android:layout_width="70dp"
android:layout_height="30dp"
android:background="@drawable/edit_border"
android:inputType="number"
android:layout_margin="5dp"
android:text="0"/>

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

</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="18sp"
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_Lower_Limit"
android:layout_width="70dp"
android:layout_height="30dp"
android:background="@drawable/edit_border"
android:inputType="number"
android:layout_margin="5dp"
android:text="0"/>

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

</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="18sp"
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_Pressure_Upper_Limit"
android:layout_width="70dp"
android:layout_height="30dp"
android:background="@drawable/edit_border"
android:inputType="number"
android:layout_margin="5dp"
android:text="0"/>

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

</LinearLayout>

<TextView
android:layout_column="2"
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:gravity="right"
android:layout_marginTop="5dp"
android:text="压力下限:"/>
<LinearLayout
android:layout_column="3"
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_Pressure_Lower_Limit"
android:layout_width="70dp"
android:layout_height="30dp"
android:background="@drawable/edit_border"
android:inputType="number"
android:layout_margin="5dp"
android:text="0"/>

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

</LinearLayout>

<TextView
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:layout_alignParentRight="true"
android:textSize="18sp"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="允许开盖压力:"/>
<LinearLayout
android:layout_column="1"
android:layout_row="2"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal">

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

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

</LinearLayout>

<TextView
android:layout_column="2"
android:layout_row="2"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:textSize="18sp"
android:gravity="right"
android:layout_marginTop="5dp"
android:text="排冷气温度:"/>
<LinearLayout
android:layout_column="3"
android:layout_row="2"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal">

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

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

</LinearLayout>

</GridLayout>

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

</LinearLayout>

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

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

+ 281
- 0
app/src/main/res/layout/fragment_home_device.xml View File

@@ -0,0 +1,281 @@
<?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">


<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:columnCount="1"
android:rowCount="2">

<RelativeLayout
android:layout_margin="5dp"
android:layout_row="0"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_column="0"
android:layout_columnWeight="1"
android:layout_height="0dp">

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

<com.bonait.bnframework.HBL.CustomView.ShadowContainer
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_width="match_parent"
android:layout_height="wrap_content"
app:containerCornerRadius="10dp"
app:containerDeltaLength="20px"
app:containerShadowColor="#756bff"
app:containerShadowRadius="20px"
tools:ignore="Pxusage,RtlHardcoded">

<GridLayout
android:background="@drawable/shadow_backcolor"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="130dp"
android:columnCount="4"
android:rowCount="2">

<Button
android:id="@+id/btn_PotLid_Up"
android:layout_column="0"
android:layout_row="0"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="@dimen/control_btn_margin"
android:background="@drawable/control_but_back"
android:textColor="#fefefe"
android:textSize="@dimen/button_text_size"
android:text="锅盖上升"/>

<Button
android:id="@+id/btn_PotLid_Down"
android:layout_column="1"
android:layout_row="0"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="@dimen/control_btn_margin"
android:background="@drawable/control_but_back"
android:textColor="#fefefe"
android:textSize="@dimen/button_text_size"
android:text="锅盖下降"/>

<Button
android:id="@+id/btn_PotLid_Open"
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_margin="@dimen/control_btn_margin"
android:background="@drawable/control_but_back"
android:textColor="#fefefe"
android:textSize="@dimen/button_text_size"
android:text="锅盖开启"/>

<Button
android:id="@+id/btn_PotLid_Close"
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:layout_margin="@dimen/control_btn_margin"
android:background="@drawable/control_but_back"
android:textColor="#fefefe"
android:textSize="@dimen/button_text_size"
android:text="锅盖关闭"/>

<Button
android:id="@+id/btn_PotBody_Forward"
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_margin="@dimen/control_btn_margin"
android:background="@drawable/control_but_back"
android:textColor="#fefefe"
android:textSize="@dimen/button_text_size"
android:text="锅体正转"/>

<Button
android:id="@+id/btn_PotBody_Reversal"
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:layout_margin="@dimen/control_btn_margin"
android:background="@drawable/control_but_back"
android:textColor="#fefefe"
android:textSize="@dimen/button_text_size"
android:text="锅体反转"/>

<Button
android:id="@+id/btn_PressureReliefValve"
android:layout_column="2"
android:layout_row="1"
android:layout_columnWeight="1"
android:layout_columnSpan="2"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="@dimen/control_btn_margin"
android:background="@drawable/control_but_back"
android:textColor="#fefefe"
android:textSize="@dimen/button_text_size"
android:text="泄压阀启停"/>


</GridLayout>

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

<com.bonait.bnframework.HBL.CustomView.ShadowContainer
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">

<GridLayout
android:background="@drawable/shadow_backcolor"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="80dp"
android:columnCount="4"
android:rowCount="1">

<Button
android:id="@+id/btn_OneKey_Up"
android:layout_column="0"
android:layout_row="0"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="@dimen/control_btn_margin"
android:background="@drawable/control_but_back"
android:textColor="#fefefe"
android:textSize="@dimen/button_text_size"
android:text="一键上升"/>

<Button
android:id="@+id/btn_OneKey_Down"
android:layout_column="1"
android:layout_row="0"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="@dimen/control_btn_margin"
android:background="@drawable/control_but_back"
android:textColor="#fefefe"
android:textSize="@dimen/button_text_size"
android:text="一键下降"/>

<Button
android:id="@+id/btn_OneKey_Home"
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_margin="@dimen/control_btn_margin"
android:background="@drawable/control_but_back"
android:textColor="#fefefe"
android:textSize="@dimen/button_text_size"
android:text="一键回位"/>

<Button
android:id="@+id/btn_Stop"
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:layout_margin="@dimen/control_btn_margin"
android:background="@drawable/control_but_back"
android:textColor="#fefefe"
android:textSize="@dimen/button_text_size"
android:text="停止"/>

</GridLayout>

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

</LinearLayout>

</RelativeLayout>


<ImageView
android:layout_rowWeight="1"
android:layout_row="1"
android:layout_column="0"
android:layout_columnWeight="1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginBottom="40dp"
android:antialias="true"
android:src="@drawable/ylg" />

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

+ 6
- 3
app/src/main/res/layout/fragment_home_sbkz.xml View File

@@ -48,13 +48,16 @@
android:layout_weight="4">

<ImageView
android:layout_margin="@dimen/dp_10"
android:id="@+id/device_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:antialias="true"
android:scaleType="fitXY"
android:src="@mipmap/device1"
android:antialias="true"/>
android:src="@drawable/ylg" />

<!-- 温度 -->
<LinearLayout


+ 173
- 152
app/src/main/res/layout/item/layout/dialog_qupenren.xml View File

@@ -11,7 +11,7 @@
android:layout_centerInParent="true"
android:layout_margin="50dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="400dp"
android:background="@drawable/common_bg_with_radius_and_border">

<Button
@@ -39,139 +39,160 @@
</TextView>


<!-- <LinearLayout-->
<!-- android:layout_marginTop="70dp"-->
<!-- android:layout_marginBottom="100dp"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="vertical">-->
<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content">-->

<!-- <ImageView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerInParent="true"-->
<!-- android:layout_marginLeft="40dp"-->
<!-- android:layout_marginRight="40dp"-->
<!-- android:src="@mipmap/newsilos" />-->
<!-- </RelativeLayout>-->

<!-- <LinearLayout-->
<!-- android:layout_marginTop="20dp"-->
<!-- android:layout_marginLeft="40dp"-->
<!-- android:layout_marginRight="40dp"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content">-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="①"-->
<!-- android:textColor="@color/topbj1"-->
<!-- android:textSize="20dp"-->
<!-- android:textStyle="bold" />-->
<!-- <TextView-->
<!-- android:id="@+id/yihao_text"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text=""-->
<!-- android:textColor="@color/topbj1"-->
<!-- android:textSize="20dp"-->
<!-- android:textStyle="bold" />-->
<!-- </LinearLayout>-->

<!-- <LinearLayout-->
<!-- android:layout_marginTop="20dp"-->
<!-- android:layout_marginLeft="40dp"-->
<!-- android:layout_marginRight="40dp"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content">-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="②"-->
<!-- android:textColor="@color/topbj1"-->
<!-- android:textSize="20dp"-->
<!-- android:textStyle="bold" />-->
<!-- <TextView-->
<!-- android:id="@+id/erhao_text"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text=""-->
<!-- android:textColor="@color/topbj1"-->
<!-- android:textSize="20dp"-->
<!-- android:textStyle="bold" />-->
<!-- </LinearLayout>-->

<!-- <LinearLayout-->
<!-- android:layout_marginTop="20dp"-->
<!-- android:layout_marginLeft="40dp"-->
<!-- android:layout_marginRight="40dp"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content">-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="③"-->
<!-- android:textColor="@color/topbj1"-->
<!-- android:textSize="20dp"-->
<!-- android:textStyle="bold" />-->
<!-- <TextView-->
<!-- android:id="@+id/sanhao_text"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text=""-->
<!-- android:textColor="@color/topbj1"-->
<!-- android:textSize="20dp"-->
<!-- android:textStyle="bold" />-->
<!-- </LinearLayout>-->

<!-- <LinearLayout-->
<!-- android:layout_marginTop="20dp"-->
<!-- android:layout_marginLeft="40dp"-->
<!-- android:layout_marginRight="40dp"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content">-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="④"-->
<!-- android:textColor="@color/topbj1"-->
<!-- android:textSize="20dp"-->
<!-- android:textStyle="bold" />-->
<!-- <TextView-->
<!-- android:id="@+id/sihao_text"-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text=""-->
<!-- android:textColor="@color/topbj1"-->
<!-- android:textSize="20dp"-->
<!-- android:textStyle="bold" />-->
<!-- </LinearLayout>-->

<!-- </LinearLayout>-->

<LinearLayout
android:layout_marginTop="70dp"
android:layout_marginBottom="100dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:src="@mipmap/newsilos" />
</RelativeLayout>

<LinearLayout
android:layout_marginTop="20dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="①"
android:textColor="@color/topbj1"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/yihao_text"
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/topbj1"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>

<LinearLayout
android:layout_marginTop="20dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="②"
android:textColor="@color/topbj1"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/erhao_text"
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/topbj1"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>

<LinearLayout
android:layout_marginTop="20dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="③"
android:textColor="@color/topbj1"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/sanhao_text"
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/topbj1"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>

<LinearLayout
android:layout_marginTop="20dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="④"
android:textColor="@color/topbj1"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/sihao_text"
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/topbj1"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>

<Button
android:id="@+id/quzhizuo"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="210dp"
android:layout_height="70dp"
android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/bg_btn_dialog_qupenren"
android:textColor="@color/white"
android:text="去烹饪"
android:textSize="30sp"/>

<Button
android:id="@+id/edit_func"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="210dp"
android:layout_height="70dp"
android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/bg_btn_dialog_qupenren"
android:textColor="@color/white"
android:text="编辑工艺"
android:textSize="30sp"/>

</LinearLayout>

<Button
android:layout_alignParentBottom="true"
android:id="@+id/quzhizuo"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/dp_10"
android:background="@mipmap/newbuttom2"
android:textColor="@color/white"
android:textSize="18sp"/>
<TextView
android:id="@+id/quzhizuo_ms"
android:layout_marginLeft="10dp"
@@ -186,28 +207,28 @@
android:text="请等待烹饪结束..."
android:visibility="gone"/>

<RelativeLayout
android:layout_alignParentBottom="true"
android:id="@+id/bianji"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@mipmap/bjgy1"
android:textColor="@color/white"
android:layout_marginBottom="150dp"
android:layout_marginRight="-15dp">
</RelativeLayout>
<RelativeLayout
android:layout_alignParentBottom="true"
android:id="@+id/chaozhi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@mipmap/mncz1"
android:textColor="@color/white"
android:layout_marginBottom="100dp"
android:layout_marginRight="-15dp">
</RelativeLayout>
<!-- <RelativeLayout-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:id="@+id/bianji"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:background="@mipmap/bjgy1"-->
<!-- android:textColor="@color/white"-->
<!-- android:layout_marginBottom="150dp"-->
<!-- android:layout_marginRight="-15dp">-->
<!-- </RelativeLayout>-->
<!-- <RelativeLayout-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:id="@+id/chaozhi"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:background="@mipmap/mncz1"-->
<!-- android:textColor="@color/white"-->
<!-- android:layout_marginBottom="100dp"-->
<!-- android:layout_marginRight="-15dp">-->
<!-- </RelativeLayout>-->
</RelativeLayout>
</RelativeLayout>

+ 1
- 1
app/src/main/res/layout/item/layout/spinner_text_item.xml View File

@@ -9,7 +9,7 @@
android:textAlignment="inherit"
android:gravity="center_vertical"
android:text="请选择"
android:textSize="12dp"
android:textSize="20sp"
android:textColor="@color/black">
</TextView>



+ 3
- 0
app/src/main/res/values/dimens.xml View File

@@ -50,4 +50,7 @@
<dimen name="text_size_10">10sp</dimen>
<dimen name="text_size_16">16sp</dimen>
<dimen name="radus_dp">60dp</dimen>

<dimen name="button_text_size">20dp</dimen>
<dimen name="control_btn_margin">5dp</dimen>
</resources>

Loading…
Cancel
Save