Browse Source

小炒机工序执行修改

tags/old_version_1
liup 8 months ago
parent
commit
31da1c43be
64 changed files with 4697 additions and 397 deletions
  1. +10
    -0
      .idea/deploymentTargetDropDown.xml
  2. +10
    -0
      .idea/migrations.xml
  3. +0
    -1
      .idea/misc.xml
  4. +6
    -0
      app/build.gradle
  5. +6
    -0
      app/src/main/AndroidManifest.xml
  6. +132
    -0
      app/src/main/assets/error_code.json
  7. +2
    -0
      app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ExceptionServer.java
  8. +4
    -1
      app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ModbusMaster.java
  9. +2
    -0
      app/src/main/java/com/bonait/bnframework/HBL/DataUtil/DataType.java
  10. +39
    -0
      app/src/main/java/com/bonait/bnframework/HBL/DataUtil/ErrorCodeManager.java
  11. +64
    -0
      app/src/main/java/com/bonait/bnframework/HBL/DataUtil/ErrorCodeUtil.java
  12. +6
    -2
      app/src/main/java/com/bonait/bnframework/HBL/Logs/MessageLog.java
  13. +34
    -0
      app/src/main/java/com/bonait/bnframework/Model/ErrorCodeBean.java
  14. +3
    -0
      app/src/main/java/com/bonait/bnframework/Service/AnalogConvert.java
  15. +42
    -8
      app/src/main/java/com/bonait/bnframework/Service/ControlAdress.java
  16. +222
    -74
      app/src/main/java/com/bonait/bnframework/Service/ModbusHelper.java
  17. +114
    -110
      app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/BottomNavigationNewActivity.java
  18. +410
    -0
      app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/CookingNewActivity.java
  19. +36
    -2
      app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/DishTestActivity.java
  20. +13
    -0
      app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/DiyMemoryActivity.java
  21. +157
    -53
      app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/DiyUpdate1Activity.java
  22. +2
    -0
      app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/WelcomeActivity.java
  23. +85
    -0
      app/src/main/java/com/bonait/bnframework/ViewModel/Adapter/silos_calibrate_adapter.java
  24. +5
    -0
      app/src/main/java/com/bonait/bnframework/ViewModel/Adapter/sp_adapter.java
  25. +285
    -0
      app/src/main/java/com/bonait/bnframework/ViewModel/CustomView/XComDialog.java
  26. +12
    -9
      app/src/main/java/com/bonait/bnframework/ViewModel/CustomView/add_qupenren.java
  27. +55
    -0
      app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/HomeDeviceFragment.java
  28. +9
    -0
      app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/HomeFragmentPR.java
  29. +148
    -1
      app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/SystemSeasoningsetFragment.java
  30. +229
    -118
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  31. +46
    -3
      app/src/main/java/com/bonait/bnframework/business/MainInit.java
  32. +2
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  33. +6
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java
  34. +128
    -1
      app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java
  35. +19
    -1
      app/src/main/java/com/bonait/bnframework/common/db/file/DBHelper.java
  36. +3
    -0
      app/src/main/java/com/bonait/bnframework/common/db/file/Table.java
  37. +23
    -0
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_GOODS.java
  38. +24
    -0
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_GOODSRECIPE.java
  39. +16
    -0
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_PROCESS.java
  40. +18
    -0
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_PROCESSModel.java
  41. +25
    -0
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SILOS.java
  42. +41
    -0
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SILOS_CALIBRATE.java
  43. +14
    -0
      app/src/main/java/com/bonait/bnframework/common/db/mode/ModeBase.java
  44. +3
    -0
      app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java
  45. +15
    -0
      app/src/main/java/com/bonait/bnframework/common/utils/AlertDialogUtils.java
  46. +24
    -0
      app/src/main/java/com/bonait/bnframework/common/utils/FileUtils.java
  47. +13
    -3
      app/src/main/res/layout/activity_bottom_navigation_new.xml
  48. +145
    -0
      app/src/main/res/layout/activity_cooking_new.xml
  49. +27
    -1
      app/src/main/res/layout/activity_dishtest.xml
  50. +1
    -1
      app/src/main/res/layout/activity_diy_memory.xml
  51. +1
    -0
      app/src/main/res/layout/activity_diy_update1.xml
  52. +119
    -0
      app/src/main/res/layout/datatab/layout/silos_calibrate_item.xml
  53. +76
    -0
      app/src/main/res/layout/dialog_with_cancel_confirm.xml
  54. +32
    -0
      app/src/main/res/layout/fragment_home_device.xml
  55. +3
    -3
      app/src/main/res/layout/fragment_home_sbkz.xml
  56. +151
    -0
      app/src/main/res/layout/fragment_system_seasoningset.xml
  57. +148
    -0
      app/src/main/res/layout/season_jiaozhun_layout.xml
  58. BIN
     
  59. BIN
     
  60. BIN
     
  61. BIN
     
  62. +1418
    -4
      app/src/main/res/values/dimens.xml
  63. +7
    -0
      app/src/main/res/values/strings.xml
  64. +7
    -1
      app/src/main/res/values/styles.xml

+ 10
- 0
.idea/deploymentTargetDropDown.xml View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<value>
<entry key="app">
<State />
</entry>
</value>
</component>
</project>

+ 10
- 0
.idea/migrations.xml View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

+ 0
- 1
.idea/misc.xml View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="corretto-11" project-jdk-type="JavaSDK" />

+ 6
- 0
app/build.gradle View File

@@ -54,6 +54,9 @@ android {

}
}
buildFeatures {
viewBinding = true
}
}

dependencies {
@@ -162,4 +165,7 @@ dependencies {
//MQTT
// implementation files('libs\\org.eclipse.paho.android.service-1.1.1.jar')
// implementation files('libs\\org.eclipse.paho.client.mqttv3-1.2.5.jar')

//日志工具 可定位代码行数
api 'com.apkfuns.logutils:library:1.7.5'
}

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

@@ -176,6 +176,12 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</receiver>
<!-- <meta-data-->
<!-- android:name="design_width_in_dp"-->
<!-- android:value="800" />-->
<!-- <meta-data-->
<!-- android:name="design_height_in_dp"-->
<!-- android:value="1280" />-->
</application>

</manifest>

+ 132
- 0
app/src/main/assets/error_code.json View File

@@ -0,0 +1,132 @@
[
{
"code": "1",
"description": "机芯散热器温度超过 78℃",
"name": "IGBT过热"
},
{
"code": "2",
"description": "电源电压过高大于 450V",
"name": "直流母线过压"
},
{
"code": "3",
"description": "直流母线欠压",
"name": "电源电压过低低于300V"
},
{
"code": "4",
"description": "",
"name": ""
},
{
"code": "5",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
},
{
"code": "",
"description": "",
"name": ""
}
]

+ 2
- 0
app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ExceptionServer.java View File

@@ -13,6 +13,7 @@ public class ExceptionServer {
{
try {
int add = GetAddress(Address);
MessageLog.ShowInfo( "ExceptionServer add="+add);
if (add < 0) {
MessageLog.ShowError("地址解析失败=" + Address);
return;
@@ -32,6 +33,7 @@ public class ExceptionServer {
}

public int GetAddress(String address) {
MessageLog.ShowInfo("GetAddress address="+address);
if (address == null) return -1;
if (address.length() > 0) {
address = address.trim();


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

@@ -2,6 +2,7 @@ package com.bonait.bnframework.HBL.Communication.Modbus;

import static com.bonait.bnframework.HBL.DataUtil.DataConvertLib.ByteToShort;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Communication.CommBase;
import com.bonait.bnframework.HBL.DataUtil.FloatLib;
import com.bonait.bnframework.HBL.DataUtil.IntLib;
@@ -187,7 +188,7 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{
}
public <T> OperateResult Write(String address,T value) {
if(!getConnected()){ return OperateResult.CreateFailed("设备未连接");}
AtomicReference<OperateResult>resultValue=new AtomicReference<>();
AtomicReference<OperateResult> resultValue=new AtomicReference<>();
try{
String typeName= value.getClass().getCanonicalName();
switch(typeName){
@@ -327,8 +328,10 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{
if(!getConnected()){ return OperateResultT.CreateFailedT("设备未连接");}
AtomicReference<OperateResultT<Short>>resultValue=new AtomicReference<>();
ReadShort(address,1).OnSource((s)->{
LogUtils.d("ReadShort 读操作 返回结果:"+s.Content[0]);
resultValue.set(OperateResultT.CreateSuccess(s.Content[0]));
}).OnFailed(s->{
LogUtils.d("ReadShort 读操作 失败:"+s.message);
resultValue.set(OperateResultT.CreateFailedT(s.message));
});
return resultValue.get();


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

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

import java.io.Serializable;

public class DataType {
public static final String STRING="";
public static final byte BYTE=0;


+ 39
- 0
app/src/main/java/com/bonait/bnframework/HBL/DataUtil/ErrorCodeManager.java View File

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

import com.alibaba.fastjson.JSON;
import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.Model.ErrorCodeBean;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.utils.FileUtils;

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

/**
* 设备故障错误码
* */
public class ErrorCodeManager {
private static final String ERROR_CODE_FILE_NAME = "error_code.json";
private static volatile ErrorCodeManager mInstance = new ErrorCodeManager();
private List<ErrorCodeBean> mDataBeans = new ArrayList<>();
private ErrorCodeManager() {

}

public static ErrorCodeManager getInstance() {
if (mInstance==null) {
synchronized (ErrorCodeManager.class){
if(mInstance == null){
mInstance = new ErrorCodeManager();
}
}
}
return mInstance;
}

public void initData(){
String cache = FileUtils.getJson("error_code.json", MainApplication.getContext());
mDataBeans = JSON.parseArray(cache,ErrorCodeBean.class);
}

}

+ 64
- 0
app/src/main/java/com/bonait/bnframework/HBL/DataUtil/ErrorCodeUtil.java View File

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

import android.widget.Switch;

import androidx.annotation.NonNull;

public class ErrorCodeUtil {
public String errorCodeToString(int code) {
String result = "正常";
switch (code){
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
case 10:
break;
case 11:
break;
case 12:
break;
case 13:
break;
case 14:
break;
case 15:
break;
case 16:
break;
case 17:
break;
case 18:
break;
case 19:
break;
case 20:
break;
case 21:
break;
case 22:
break;
case 23:
break;
case 24:
break;
case 25:
break;
}
return result;
}
}

+ 6
- 2
app/src/main/java/com/bonait/bnframework/HBL/Logs/MessageLog.java View File

@@ -2,6 +2,7 @@ package com.bonait.bnframework.HBL.Logs;

import android.util.Log;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG;
@@ -15,17 +16,20 @@ public class MessageLog {
MsgNotify = new IMessageLogNotify() {
@Override
public void ErrorMsg(String msg) {
Log.e("错误日志",msg);
// Log.e("错误日志",msg);
LogUtils.e("错误日志"+msg);
}

@Override
public void InfoMsg(String msg) {
Log.i("信息日志",msg);
// Log.i("信息日志",msg);
LogUtils.i("信息日志"+msg);
}

@Override
public void WarnMsg(String msg) {
Log.w("警告日志",msg);
LogUtils.w("警告日志"+msg);
}
};
ThreadManager.get().StartLong("日志信息保存",true,()->{


+ 34
- 0
app/src/main/java/com/bonait/bnframework/Model/ErrorCodeBean.java View File

@@ -0,0 +1,34 @@
package com.bonait.bnframework.Model;

import java.util.List;

public class ErrorCodeBean {

private String code;
private String name;
private String description;

public String getCode() {
return code;
}

public void setCode(String code) {
this.code = code;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}
}

+ 3
- 0
app/src/main/java/com/bonait/bnframework/Service/AnalogConvert.java View File

@@ -52,6 +52,9 @@ public class AnalogConvert {

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


+ 42
- 8
app/src/main/java/com/bonait/bnframework/Service/ControlAdress.java View File

@@ -1,13 +1,47 @@
package com.bonait.bnframework.Service;

public enum ControlAdress {
心跳,
加热档位,
启动加热,
停止加热,
加热模组状态,
急停按钮状态,
升降电机上升,

心跳,//D0
掉线标志,//M100
加热档位,//D51 0-100
启动加热,//M50 (启动时需判断是否正在加热状态)
停止加热,//M51
错误码,//M52
加水,//M4
加水时间,//D1000
液体1,//M5
液体2,//M6
液体3,//M7
液体4,//M8
液体5,//M9
液体6,//M10
液体时间1,//D1001
液体时间2,//D1002
液体时间3,//D1003
液体时间4,//D1004
液体时间5,//D1005
液体时间6,//D1006
液体7,//M11
液体8,//M12
液体9,//M13
液体时间7,//D1007
液体时间8,//D1008
液体时间9,//D1009
勾芡,//M14
勾芡时间,//D1010
主料1,//M17
主料2,//M18
主料3,//M19
主料4,//M20
主料5,//M21
上升,//M22
下降,//M23
搅拌正转,//M24
搅拌反转,//M24
搅拌停止,//M26
搅拌档位,//M26
搅拌检测,//X2
升降检测上限位,//X1
升降检测下限位,//X4

}

+ 222
- 74
app/src/main/java/com/bonait/bnframework/Service/ModbusHelper.java View File

@@ -1,63 +1,87 @@
package com.bonait.bnframework.Service;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Communication.Modbus.ModbusMaster;
import com.bonait.bnframework.HBL.DataUtil.DataType;
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.OperateResult;
import com.bonait.bnframework.HBL.Result.OperateResultT;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_CALIBRATION_PAR;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE;

import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;

public class ModbusHelper extends ModbusMaster {
private static volatile ModbusHelper instance = null;
public synchronized static ModbusHelper get(){
if(instance==null)instance=new ModbusHelper();
if(instance==null){
synchronized (ModbusHelper.class){
if(instance==null){
instance=new ModbusHelper();
}
}
}
return instance;
}
private ModbusHelper(){}

// static ConcurrentHashMap<ControlAdress, PLCModel> controlAddress=new ConcurrentHashMap<ControlAdress,PLCModel>(){{
// put(ControlAdress.锅盖上升,new PLCModel("M20", DataType.BOOLEAN, OperationModel.W) );
// put(ControlAdress.锅盖下降,new PLCModel("M21",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.锅盖开启,new PLCModel("M22",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.锅盖关闭,new PLCModel("M23",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.锅体正转,new PLCModel("M24",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.锅体反转,new PLCModel("M25",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.泄压阀启停,new PLCModel("M26",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.烹饪完成,new PLCModel("M32",DataType.BOOLEAN,OperationModel.R));
// put(ControlAdress.一键上升,new PLCModel("M0",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.一键下降,new PLCModel("M1",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.一键回位,new PLCModel("M5",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.停止,new PLCModel("M6",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.配方启动,new PLCModel("M11",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.心跳,new PLCModel("D204",DataType.SHORT,OperationModel.W));
// put(ControlAdress.当前温度,new PLCModel("D100",DataType.SHORT,OperationModel.R));
// put(ControlAdress.当前压力,new PLCModel("D101",DataType.SHORT,OperationModel.R));
// put(ControlAdress.允许开盖压力,new PLCModel("D200",DataType.SHORT,OperationModel.RW));
// put(ControlAdress.排冷气温度,new PLCModel("D203",DataType.SHORT,OperationModel.RW));
// put(ControlAdress.温度下限,new PLCModel("D210",DataType.SHORT,OperationModel.RW));
// put(ControlAdress.温度上限,new PLCModel("D211",DataType.SHORT,OperationModel.RW));
// put(ControlAdress.压力下限,new PLCModel("D213",DataType.SHORT,OperationModel.RW));
// put(ControlAdress.压力上限,new PLCModel("D214",DataType.SHORT,OperationModel.RW));
// put(ControlAdress.加热档位,new PLCModel("D300",DataType.SHORT,OperationModel.W));
// put(ControlAdress.设定压力,new PLCModel("D301",DataType.SHORT,OperationModel.W));
// put(ControlAdress.计时温度,new PLCModel("D303",DataType.SHORT,OperationModel.W));
// put(ControlAdress.烹饪时间,new PLCModel("D304",DataType.SHORT,OperationModel.W));
// put(ControlAdress.当前时间,new PLCModel("D10",DataType.SHORT,OperationModel.R));
// }};

private ConcurrentHashMap<String, BPA_CALIBRATION_PAR> calibrationParMap=new ConcurrentHashMap<>();
public void Add(BPA_CALIBRATION_PAR item){
if(item==null)return ;
calibrationParMap.put(item.Name,item);
}
private OperateResultT<BPA_CALIBRATION_PAR> getCalibrationPar(String name){
public ConcurrentHashMap<ControlAdress, PLCModel> controlAddress=new ConcurrentHashMap<ControlAdress,PLCModel>(){{
put(ControlAdress.心跳,new PLCModel("D0", DataType.SHORT, OperationModel.W) );
// put(ControlAdress.掉线标志,new PLCModel("M100",DataType.BOOLEAN,OperationModel.R));
put(ControlAdress.加热档位,new PLCModel("D51",DataType.SHORT,OperationModel.W));
put(ControlAdress.启动加热,new PLCModel("M50",DataType.BOOLEAN,OperationModel.RW));
put(ControlAdress.停止加热,new PLCModel("M51",DataType.BOOLEAN,OperationModel.RW));
put(ControlAdress.错误码,new PLCModel("M52",DataType.BOOLEAN,OperationModel.R));
put(ControlAdress.加水时间,new PLCModel("D1000",DataType.SHORT,OperationModel.W));
put(ControlAdress.加水,new PLCModel("M4",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.液体时间1,new PLCModel("D1001",DataType.SHORT,OperationModel.W));
put(ControlAdress.液体1,new PLCModel("M5",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.液体时间2,new PLCModel("D1002",DataType.SHORT,OperationModel.W));
put(ControlAdress.液体2,new PLCModel("M6",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.液体时间3,new PLCModel("D1003",DataType.SHORT,OperationModel.W));
put(ControlAdress.液体3,new PLCModel("M7",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.液体时间4,new PLCModel("D1004",DataType.SHORT,OperationModel.W));
put(ControlAdress.液体4,new PLCModel("M8",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.液体时间5,new PLCModel("D1005",DataType.SHORT,OperationModel.W));
put(ControlAdress.液体5,new PLCModel("M9",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.液体时间6,new PLCModel("D1006",DataType.SHORT,OperationModel.W));
put(ControlAdress.液体6,new PLCModel("M10",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.液体时间7,new PLCModel("D1007",DataType.SHORT,OperationModel.W));
put(ControlAdress.液体7,new PLCModel("M11",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.液体时间8,new PLCModel("D1008",DataType.SHORT,OperationModel.W));
put(ControlAdress.液体8,new PLCModel("M12",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.液体时间9,new PLCModel("D1009",DataType.SHORT,OperationModel.W));
put(ControlAdress.液体9,new PLCModel("M13",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.勾芡时间,new PLCModel("D1010",DataType.SHORT,OperationModel.W));
put(ControlAdress.勾芡,new PLCModel("M14",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.主料1,new PLCModel("M17",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.主料2,new PLCModel("M18",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.主料3,new PLCModel("M19",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.主料4,new PLCModel("M20",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.主料5,new PLCModel("M21",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.上升,new PLCModel("M22",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.下降,new PLCModel("M23",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.搅拌正转,new PLCModel("M24",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.搅拌反转,new PLCModel("M24",DataType.BOOLEAN,OperationModel.W));
put(ControlAdress.搅拌停止,new PLCModel("M26",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.搅拌档位,new PLCModel("M26",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.升降检测上限位,new PLCModel("X2",DataType.BOOLEAN,OperationModel.W));
// put(ControlAdress.升降检测下限位,new PLCModel("X4",DataType.BOOLEAN,OperationModel.W));
}};

private ConcurrentHashMap<String, BPA_SILOS_CALIBRATE> calibrationParMap=new ConcurrentHashMap<>();
public void Add(ArrayList<BPA_SILOS_CALIBRATE> list){
if(list.isEmpty())return ;
list.forEach(item ->{
calibrationParMap.put(item.name,item);
});
}
private OperateResultT<BPA_SILOS_CALIBRATE> getCalibrationPar(String name){
if(calibrationParMap.containsKey(name)){
return OperateResultT.CreateSuccess(calibrationParMap.get(name));
}else{
@@ -79,66 +103,190 @@ public class ModbusHelper extends ModbusMaster {
* @param GearPosition 加热档位
* @param command 启动或停止
*/
public void Heating(short GearPosition,boolean command){
public void Heating(int GearPosition,boolean command){
//D51:档位设置,M50:启动加热,M51:停止加热
WriteBool(command?"M51":"M50",false);
WriteShort("D51",command?GearPosition:0);
WriteShort("D51", (short) (command?GearPosition:0));
WriteBool(command?"M50":"M51",true);
MessageLog.ShowInfo("Heating GearPosition="+GearPosition + ";command="+command);
}

/**
* 加水控制
* @param value
*/
public void AddWater(short value){
getCalibrationPar("加水阀1").OnSource(item->{
WriteShort("D1000",value);
WriteBool("M4",true);
public void addWater(int value){
getCalibrationPar(ControlAdress.加水.toString()).OnSource(item->{
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE)item.Content;
WriteShort(getPLC(ControlAdress.加水时间).PlcAddress,
AnalogConvert.Scale((short) value, (short) bean.inputWightMax, (short) bean.inputWightMin,
(short) bean.outputTimeMax, (short) bean.outputTimeMin));
WriteBool(getPLC(ControlAdress.加水).PlcAddress,true);
}) ;
}

public void AddLiquid(){
/**
* 液体料控制
* @param value 量
* @param position 几号仓
*/
public void addSeason(int value,int position){
ControlAdress controlAdress = ControlAdress.液体1;
ControlAdress controlTimeAdress = ControlAdress.液体时间1;
switch (position){
case 1:
controlAdress = ControlAdress.液体1;
controlTimeAdress = ControlAdress.液体时间1;
break;
case 2:
controlAdress = ControlAdress.液体2;
controlTimeAdress = ControlAdress.液体时间2;
break;
case 3:
controlAdress = ControlAdress.液体3;
controlTimeAdress = ControlAdress.液体时间3;
break;
case 4:
controlAdress = ControlAdress.液体4;
controlTimeAdress = ControlAdress.液体时间4;
break;
case 5:
controlAdress = ControlAdress.液体5;
controlTimeAdress = ControlAdress.液体时间5;
break;
case 6:
controlAdress = ControlAdress.液体6;
controlTimeAdress = ControlAdress.液体时间6;
break;
case 7:
controlAdress = ControlAdress.液体7;
controlTimeAdress = ControlAdress.液体时间7;
break;
case 8:
controlAdress = ControlAdress.液体8;
controlTimeAdress = ControlAdress.液体时间8;
break;
case 9:
controlAdress = ControlAdress.液体9;
controlTimeAdress = ControlAdress.液体时间9;
break;

}
ControlAdress finalControlTimeAdress = controlTimeAdress;
ControlAdress finalControlAdress = controlAdress;
getCalibrationPar(controlAdress.toString()).OnSource(item->{
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE)item.Content;
WriteShort(getPLC(finalControlTimeAdress).PlcAddress,
AnalogConvert.Scale((short) value, (short) bean.inputWightMax, (short) bean.inputWightMin,
(short) bean.outputTimeMax, (short) bean.outputTimeMin));
WriteBool(getPLC(finalControlAdress).PlcAddress,true);
}) ;
LogUtils.d("液体料控制 addSeason value="+value+";position="+position);
}

/**
* 勾芡控制
* @param value
*/
public void addThickenWater(int value){
getCalibrationPar(ControlAdress.勾芡.toString()).OnSource(item->{
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE)item.Content;
WriteShort(getPLC(ControlAdress.勾芡时间).PlcAddress,
AnalogConvert.Scale((short) value, (short) bean.inputWightMax, (short) bean.inputWightMin,
(short) bean.outputTimeMax, (short) bean.outputTimeMin));
WriteBool(getPLC(ControlAdress.勾芡).PlcAddress,true);
}) ;
LogUtils.d("勾芡控制 addThickenWater value="+value);
}

/**
* 主料控制
* @param position
*/
public void addMainFood(int position){
ControlAdress controlAdress = ControlAdress.主料1;
switch (position){
case 1:
controlAdress = ControlAdress.主料1;
break;
case 2:
controlAdress = ControlAdress.主料2;
break;
case 3:
controlAdress = ControlAdress.主料3;
break;
case 4:
controlAdress = ControlAdress.主料4;
break;
case 5:
controlAdress = ControlAdress.主料5;
break;
}
WriteBool(getPLC(controlAdress).PlcAddress,true);
LogUtils.d("添加主料 addMainFood position="+position);
}

/**
* 升降电机控制
* @param status 1 上升 2下降
*/
public void setUpdDownMotor(int status){
if(status == 2){
WriteBool(getPLC(ControlAdress.上升).PlcAddress,false);
WriteBool(getPLC(ControlAdress.下降).PlcAddress,true);
}else {
WriteBool(getPLC(ControlAdress.下降).PlcAddress,false);
WriteBool(getPLC(ControlAdress.上升).PlcAddress,true);
}
LogUtils.d("升降电机控制 setUpdDownMotor status="+status);
}

/**
* 搅拌电机控制
* @param status 1 正转启动 2停止
*/
public void setStirMotor(int status){
if(status == 2){
WriteBool(getPLC(ControlAdress.搅拌正转).PlcAddress,false);
WriteBool(getPLC(ControlAdress.搅拌停止).PlcAddress,true);
}else {
WriteBool(getPLC(ControlAdress.搅拌正转).PlcAddress,true);
WriteBool(getPLC(ControlAdress.搅拌停止).PlcAddress,false);
}
LogUtils.d("升降电机控制 setStirMotor status="+status);
}




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


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

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

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


+ 114
- 110
app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/BottomNavigationNewActivity.java View File

@@ -10,10 +10,12 @@ import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Logs.MessageLog;
import com.bonait.bnframework.HBL.Thread.IThread;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.R;
import com.bonait.bnframework.ViewModel.FragmentViewModel.HomeDeviceFragment;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseActivity;
@@ -55,7 +57,7 @@ public class BottomNavigationNewActivity extends BaseActivity {
QMUIViewPager viewPager;

@BindView(R.id.cooking)
CookingActivity cooking;
CookingNewActivity cooking;

@BindView(R.id.penrenzhong)
LinearLayout penrenzhong;
@@ -114,7 +116,8 @@ 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 HomeFragmentSBKZ());
fragmentAdapter.addFragment(new HomeDeviceFragment());
viewPager.setAdapter(fragmentAdapter);

MessageManager.getInstance().registerMessageReceiver(this, MessageName.SelectZY, new MessageLooper.OnMessageListener() {
@@ -297,6 +300,7 @@ public class BottomNavigationNewActivity extends BaseActivity {
try {
//获取工艺
ArrayList<BPA_GOODSRECIPE> goodsrecipes = QueryDB.GetGoodsSrecipeID(goods.id);
LogUtils.d("制作线程 MakeThread 启动 ==》 菜品配方 goodsrecipes="+goodsrecipes.toString());
goodsrecipesL = goodsrecipes;
gongxuIndex = 1;
int m = 0;
@@ -311,7 +315,7 @@ public class BottomNavigationNewActivity extends BaseActivity {
runOnUiThread(new Runnable() {
@Override
public void run() {
cooking.SetMiaoShu("正在执行:" + item.processms);
cooking.SetMiaoShu("正在执行:名称" + item.processms+";描述="+item.processms+";变量="+item.processvalue);
}
});
boolean status = ExecuteTheRecipe.Execute(item, goodsrecipes, m);
@@ -320,10 +324,10 @@ public class BottomNavigationNewActivity extends BaseActivity {
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
} finally {
ExecuteTheRecipe.WritePLC("搅拌", false, null);
ExecuteTheRecipe.WritePLC("加热", false, null);
// ExecuteTheRecipe.WritePLC("搅拌", false, null);
// ExecuteTheRecipe.WritePLC("加热", false, null);
ConfigName.getInstance().IsOpenHuoLi = false;
ExecuteTheRecipe.BottomClick("平移-去1号位");
// ExecuteTheRecipe.BottomClick("平移-去1号位");
gongxuIndex = 10000;
MakeCipe = null;
goodsrecipesL = null;
@@ -331,7 +335,7 @@ public class BottomNavigationNewActivity extends BaseActivity {

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

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

@@ -344,7 +348,7 @@ public class BottomNavigationNewActivity extends BaseActivity {
{
ToastUtils.info("客官,当前菜品已强制结束!!!");
//初始化
ExecuteTheRecipe.BottomClick("初始化");
// ExecuteTheRecipe.BottomClick("初始化");
}
}
});
@@ -358,106 +362,106 @@ public class BottomNavigationNewActivity extends BaseActivity {
}
}).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());
}
}
}
}).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());
// }
// }
// }
// }).start();
}

/**
@@ -470,7 +474,7 @@ public class BottomNavigationNewActivity extends BaseActivity {
switch (v.getId()) {
case R.id.start_goodmake://启动按钮
ExecuteTheRecipe.IsPause = false;
ExecuteTheRecipe.WritePLC("暂停开关",false,null);
// ExecuteTheRecipe.WritePLC("暂停开关",false,null);
if (Status) {
onRecordStart();
}
@@ -480,7 +484,7 @@ public class BottomNavigationNewActivity extends BaseActivity {
break;
case R.id.zanting_goodmake://暂停按钮
ExecuteTheRecipe.IsPause = Status;
ExecuteTheRecipe.WritePLC("暂停开关",Status,null);
// ExecuteTheRecipe.WritePLC("暂停开关",Status,null);
if (Status) {
onRecordPause();
} else {


+ 410
- 0
app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/CookingNewActivity.java View File

@@ -0,0 +1,410 @@
package com.bonait.bnframework.ViewModel.ActivityViewModel;

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

import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Interface.IRunT;
import com.bonait.bnframework.R;
import com.bonait.bnframework.ViewModel.CustomView.imagebuttom;
import com.bonait.bnframework.ViewModel.CustomView.imagebuttom3;
import com.bonait.bnframework.ViewModel.CustomView.jingdutiao;
import com.bonait.bnframework.ViewModel.CustomView.newhuoli_control;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.message.MessageManager;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.qmuiteam.qmui.widget.QMUITopBarLayout;

import java.util.concurrent.ConcurrentHashMap;

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

public class CookingNewActivity extends LinearLayout {

//region 变量
@BindView(R.id.device_image)
ImageView device_image;

// @BindView(R.id.touliao_k)
// LinearLayout touliao_k;
//
// @BindView(R.id.touliao_m)
// LinearLayout touliao_m;

@BindView(R.id.goodname)
TextView goodname;
//
// @BindView(R.id.chaoguo_wendu)
// TextView chaoguo_wendu;

@BindView(R.id.gongxumiaoshu)
TextView gongxumiaoshu;//工序描述

@BindView(R.id.start_goodmake)
imagebuttom start_goodmake;//开始

@BindView(R.id.zanting_goodmake)
public imagebuttom zanting_goodmake;//暂停
@BindView(R.id.runtime)
TextView runtime;//计时器 倒计时

@BindView(R.id.t_jindu)
jingdutiao t_jindu;//计时器

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


// @BindView(R.id.huoli)
// newhuoli_control huoli;
//
// @BindView(R.id.fanchaoshudu)
// imagebuttom3 fanchaoshudu;
//
//
// @BindView(R.id.guokoucaoxiang)
// imagebuttom3 guokoucaoxiang;
//
// @BindView(R.id.chushui)
// imagebuttom3 chushui;
//
// @BindView(R.id.touliao1)
// imagebuttom3 touliao1;
//
// @BindView(R.id.touliao2)
// imagebuttom3 touliao2;
//
// @BindView(R.id.touliao3)
// imagebuttom3 touliao3;
//
// @BindView(R.id.touliao4)
// imagebuttom3 touliao4;
//
// @BindView(R.id.yeliao1)
// imagebuttom3 yeliao1;
// @BindView(R.id.yeliao2)
// imagebuttom3 yeliao2;
// @BindView(R.id.yeliao3)
// imagebuttom3 yeliao3;

private Context contextMian;
private View root;

public Activity activity = null;
//endregion

//region 界面实例
public CookingNewActivity(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
contextMian = context;
root = LayoutInflater.from(context).inflate(R.layout.activity_cooking_new, this);
ButterKnife.bind(this, root);
initTopBar();

SxUIThread();
}
//endregion

//region 公共方法

/**
* 初始化数据
*/
public void initData(BPA_GOODS goods, Activity ac, MyClickListener listener) {
//根据商品id查询
activity = ac;

// yeliao1.setTag(ConfigName.getInstance().SilosDisplayMaterial.get(1)+"");
// yeliao1.Init();
//
// yeliao2.setTag(ConfigName.getInstance().SilosDisplayMaterial.get(2)+"");
// yeliao2.Init();
//
// yeliao3.setTag(ConfigName.getInstance().SilosDisplayMaterial.get(3)+"");
// yeliao3.Init();
//
// ConcurrentHashMap<Integer,String> resultData= DataBus.getInstance().GetMainDisplayText(goods.id);
// touliao1.setTag(resultData.get(1)+"-按钮");
// touliao1.Init();
//
// touliao2.setTag(resultData.get(2)+"-按钮");
// touliao2.Init();
//
// touliao3.setTag(resultData.get(3)+"-按钮");
// touliao3.Init();
//
// touliao4.setTag(resultData.get(4)+"-按钮");
// touliao4.Init();

goodname.setText(goods.name + "");
start_goodmake.mListener = listener;
zanting_goodmake.mListener = listener;
SetReset();
SetRest1();
SetProcess(goods.maketime, 0);
SetMiaoShu("等待开始...");
LogUtils.d("制作时长goods.maketime="+goods.maketime);
runtime.setText(formatTime(goods.maketime));

// if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) {
// touliao_k.setVisibility(View.GONE);
// touliao_m.setVisibility(View.GONE);
// device_image.setImageResource(R.mipmap.device00);
// }else
// {
// touliao_k.setVisibility(View.VISIBLE);
// touliao_m.setVisibility(View.VISIBLE);
// device_image.setImageResource(R.mipmap.device1);
// }
}

/**
* 设置描述
*
* @param text
*/
public void SetMiaoShu(String text) {
gongxumiaoshu.setText(text + "");
}

/**
* 设置进度条
*
* @param
*/
public void SetProcess(int alltime, int usertime) {
try {
t_jindu.SetValue((usertime * 100) / alltime);
runtime.setText(formatTime((alltime - usertime)));
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 复位
*/
public void SetReset() {
SetMiaoShu("等待开始...");
zanting_goodmake.SetStatus(false);
zanting_goodmake.setVisibility(View.GONE);
}

/**
* 复位
*/
public void SetZanTing(boolean data) {
zanting_goodmake.setVisibility(data ? View.VISIBLE : View.GONE);
}

public void SetRest1() {
start_goodmake.SetStatus(false);
if(flicker_buttom!=null)
{
flicker_buttom.setVisibility(View.VISIBLE);
flicker_buttom.SetStatusKK(false);
flicker_buttom=null;
}
// huoli.SetLevel(0);
}
//endregion

//region 私有方法

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

/**
* 初始化顶部弹框
*/
private void initTopBar() {
mTopBar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.topbj1));
mTopBar.setTitle("菜谱烹饪");
mTopBar.addLeftImageButton(R.mipmap.fanhui, R.id.topbar).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (ExecuteTheRecipe.IsStart) {
ToastUtils.warning("请等待制作完成后退出...");
return;
}
setVisibility(View.GONE);
}
});
}

/**
* 点击事件
*
* @param view
*/
@OnClick({R.id.kancaipu})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.kancaipu://看菜谱
MessageManager.getInstance().sendMessage(MessageName.SelectZY, 0);
break;
}
}

/**
* 闪烁buttom
*/
public imagebuttom3 flicker_buttom=null;
/**
* 刷新UI界面
*/
public void SxUIThread() {
new Thread(new Runnable() {
@Override
public void run() {

while (true) {
try {
if (activity != null && getVisibility() == View.VISIBLE) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Object val_wd = ExecuteTheRecipe.getListingValue("当前锅底温度");
if (val_wd != null) {
// chaoguo_wendu.setText(val_wd + "°C");
} else {
// chaoguo_wendu.setText("??°C");
}

//闪烁
if (flicker_buttom != null) {
flicker_buttom.setVisibility(flicker_buttom.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE);
}
}
});
}
Thread.sleep(1000);
} catch (InterruptedException e) {
ToastUtils.info("异常信息:" + e.getMessage());
}
}
}
}).start();

ExecuteTheRecipe.ExecuteCurrentOperation=new IRunT() {
@Override
public void Run(Object o) {
String data=(String)o;
if (activity != null && getVisibility() == View.VISIBLE) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if(data.contains("|"))
{
String[] K= data.split("[|]");
if (K.length>=2)
{
String name=K[0];
String val=K[1];
if(flicker_buttom!=null)
{
flicker_buttom.setVisibility(View.VISIBLE);
flicker_buttom.SetStatusKK(false);
}
flicker_buttom=null;
// switch (name) {
// case "搅拌":
// flicker_buttom=fanchaoshudu;
// flicker_buttom.SetStatusKK(true);
// break;
// case "位置":
// flicker_buttom=guokoucaoxiang;
// flicker_buttom.SetStatusKK(true);
// break;
// case "加热":
// huoli.SetLevel(Integer.parseInt(val));
// break;
// case "主料":
// if(val.equals("1号位"))
// {
// flicker_buttom=touliao1;
// }else if(val.equals("2号位"))
// {
// flicker_buttom=touliao2;
// }else if(val.equals("3号位"))
// {
// flicker_buttom=touliao3;
// }else if(val.equals("4号位"))
// {
// flicker_buttom=touliao4;
// }
// flicker_buttom.SetStatusKK(true);
// break;
// case "加水":
// flicker_buttom=chushui;
// flicker_buttom.SetStatusKK(true);
// break;
// case "液体料":
// if(val.equals("1"))
// {
// flicker_buttom=yeliao1;
// flicker_buttom.SetStatusKK(true);
// }else if(val.equals("2"))
// {
// flicker_buttom=yeliao2;
// flicker_buttom.SetStatusKK(true);
// }else if(val.equals("3"))
// {
// flicker_buttom=yeliao3;
// flicker_buttom.SetStatusKK(true);
// }
// break;
// }
}
}
}
});
}
}
};
}
//endregion

//region 外部调用
//endregion

}

+ 36
- 2
app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/DishTestActivity.java View File

@@ -102,7 +102,8 @@ public class DishTestActivity extends BaseActivity {

@BindView(R.id.touliao4)
imagebuttom3 touliao4;

@BindView(R.id.touliao5)
imagebuttom3 touliao5;
@BindView(R.id.yeliao1)
imagebuttom3 yeliao1;
@BindView(R.id.yeliao2)
@@ -174,7 +175,10 @@ public class DishTestActivity extends BaseActivity {

@BindView(R.id.liaohe4)
TextView liaohe4;
@BindView(R.id.liaohe5)
TextView liaohe5;
public String liaohetext4 = "";
public String liaohetext5 = "";


@BindView(R.id.gongyibuzhoujilu)
@@ -453,6 +457,9 @@ public class DishTestActivity extends BaseActivity {
case 4:
liaohetext4 = data1 + "";
break;
case 5:
liaohetext5 = data1 + "";
break;
}
ShowIndex++;
SetShowNameData(ShowIndex);
@@ -532,11 +539,12 @@ public class DishTestActivity extends BaseActivity {
liaohe2.setVisibility(liaohetext2.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe3.setVisibility(liaohetext3.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe4.setVisibility(liaohetext4.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe5.setVisibility(liaohetext5.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe1.setText(liaohetext1 + "");
liaohe2.setText(liaohetext2 + "");
liaohe3.setText(liaohetext3 + "");
liaohe4.setText(liaohetext4 + "");
liaohe5.setText(liaohetext5 + "");

liaohedata_num.setText("①号料盒");
liaohedata_text.setText(liaohetext1 + "");
@@ -549,10 +557,12 @@ public class DishTestActivity extends BaseActivity {
liaohe2.setVisibility(liaohetext2.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe3.setVisibility(liaohetext3.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe4.setVisibility(liaohetext4.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe5.setVisibility(liaohetext5.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe1.setText(liaohetext1 + "");
liaohe2.setText(liaohetext2 + "");
liaohe3.setText(liaohetext3 + "");
liaohe4.setText(liaohetext4 + "");
liaohe5.setText(liaohetext5 + "");
liaohedata_num.setText("②号料盒");
liaohedata_text.setText(liaohetext2 + "");
break;
@@ -564,10 +574,12 @@ public class DishTestActivity extends BaseActivity {
liaohe2.setVisibility(liaohetext2.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe3.setVisibility(liaohetext3.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe4.setVisibility(liaohetext4.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe5.setVisibility(liaohetext5.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe1.setText(liaohetext1 + "");
liaohe2.setText(liaohetext2 + "");
liaohe3.setText(liaohetext3 + "");
liaohe4.setText(liaohetext4 + "");
liaohe5.setText(liaohetext5 + "");
liaohedata_num.setText("③号料盒");
liaohedata_text.setText(liaohetext3 + "");
break;
@@ -579,14 +591,33 @@ public class DishTestActivity extends BaseActivity {
liaohe2.setVisibility(liaohetext2.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe3.setVisibility(liaohetext3.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe4.setVisibility(liaohetext4.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe5.setVisibility(liaohetext5.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe1.setText(liaohetext1 + "");
liaohe2.setText(liaohetext2 + "");
liaohe3.setText(liaohetext3 + "");
liaohe4.setText(liaohetext4 + "");
liaohe5.setText(liaohetext5 + "");
liaohedata_num.setText("④号料盒");
liaohedata_text.setText(liaohetext4 + "");
break;
case 5:
caipingmingchen.setVisibility(View.GONE);
liaohedata.setVisibility(View.VISIBLE);

liaohe1.setVisibility(liaohetext1.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe2.setVisibility(liaohetext2.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe3.setVisibility(liaohetext3.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe4.setVisibility(liaohetext4.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe5.setVisibility(liaohetext5.isEmpty() ? View.INVISIBLE : View.VISIBLE);
liaohe1.setText(liaohetext1 + "");
liaohe2.setText(liaohetext2 + "");
liaohe3.setText(liaohetext3 + "");
liaohe4.setText(liaohetext4 + "");
liaohe5.setText(liaohetext5 + "");
liaohedata_num.setText("⑤号料盒");
liaohedata_text.setText(liaohetext5 + "");
break;
case 6:
caipingmingchen.setVisibility(View.GONE);
liaohedata.setVisibility(View.GONE);

@@ -602,6 +633,9 @@ public class DishTestActivity extends BaseActivity {

touliao4.setTag(liaohetext4 + "-按钮");
touliao4.Init();

touliao5.setTag(liaohetext5 + "-按钮");
touliao5.Init();
break;
}
}


+ 13
- 0
app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/DiyMemoryActivity.java View File

@@ -6,11 +6,15 @@ import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Interface.IRun;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
@@ -261,6 +265,15 @@ public class DiyMemoryActivity extends BaseActivity {
ClickZL(time,time_c,4);
break;
case R.id.ydw://原点位
final float scale = getResources().getDisplayMetrics().density;
int width = ((Button)findViewById(R.id.ydw)).getWidth();
int width2 = ((LinearLayout)findViewById(R.id.start_bj)).getWidth();
int height = ((Button)findViewById(R.id.ydw)).getWidth();
WindowManager wm = (WindowManager) (getSystemService(Context.WINDOW_SERVICE));
DisplayMetrics dm = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(dm);
int mScreenWidth = dm.widthPixels;
LogUtils.d(" 屏幕分辨率 width="+width+";scale="+scale+";width2="+width2+";height="+height+";mScreenWidth="+mScreenWidth);
ClickWZ(time,time_c,"原点位");
break;
case R.id.dcw://到菜位


+ 157
- 53
app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/DiyUpdate1Activity.java View File

@@ -16,8 +16,12 @@ import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.TextView;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Logs.MessageLog;
import com.bonait.bnframework.R;
import com.bonait.bnframework.ViewModel.CustomView.XComDialog;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.constant.MessageName;
@@ -165,11 +169,13 @@ public class DiyUpdate1Activity extends BaseActivity {
MessageManager.getInstance().registerMessageReceiver(this, MessageName.DIY, new MessageLooper.OnMessageListener() {
@Override
public void onMessage(Object msg) {
MessageLog.ShowInfo("onMessage 图标选择 msg="+msg);
if (msg != null) {
bpa_goodsrecipes.clear();
for (BPA_GOODSRECIPE item : DataBus.getInstance().bpa_goodsrecipes) {
bpa_goodsrecipes.add(item);
}
LogUtils.e("图标选择 bpa_goodsrecipes="+bpa_goodsrecipes.toString());
zzsc.setText(DataBus.getInstance().TimeOut + "");
gxbz_adapter.notifyDataSetChanged();
}
@@ -228,6 +234,7 @@ public class DiyUpdate1Activity extends BaseActivity {
gongxu.SetValues(res);
}
}
LogUtils.e("SetSelectGX formulation="+formulation.toString());
} catch (Exception ex) {
}
}
@@ -249,6 +256,7 @@ public class DiyUpdate1Activity extends BaseActivity {
for (BPA_GOODSRECIPE item : goodsrecipes) {
bpa_goodsrecipes.add(item);
}
LogUtils.e("SetGood bpa_goodsrecipes="+bpa_goodsrecipes.toString());
edittext.setText(good.name);
check.setChecked(good.issc == 1);
zzsc.setText(good.maketime + "");
@@ -280,6 +288,7 @@ public class DiyUpdate1Activity extends BaseActivity {
gx.data = item.data;
gx.IsWL = false;
fragment_gx gongxu = new fragment_gx(this, null, gx);
LogUtils.d("SelectItemFrom gx="+gx.toString());
gxchid.addView(gongxu);
}
} else //物料
@@ -291,6 +300,7 @@ public class DiyUpdate1Activity extends BaseActivity {
gx.name = item2.name;
gx.IsWL = true;
fragment_gx gongxu = new fragment_gx(this, null, gx);
LogUtils.d("SelectItemFrom gx="+gx.toString());
gxchid.addView(gongxu);
}
}
@@ -345,6 +355,7 @@ public class DiyUpdate1Activity extends BaseActivity {
pf.processname = name;
pf.processms = name + "(" + desc.substring(0, desc.length() - 1) + ")";
pf.processvalue = data.substring(0, data.length() - 1);
LogUtils.d("修改工序 pf="+pf.toString());
return pf;
} else {
ToastUtils.info("数据验证失败,原因:" + description);
@@ -466,37 +477,85 @@ public class DiyUpdate1Activity extends BaseActivity {
//按钮点击
String title = "生成菜谱操作提示!";
String message = "请问客官确定要生成[" + name1 + "]菜谱吗?";
AlertDialogUtils.showDialog(view.getContext(), title, message, new QMUIDialogAction.ActionListener() {
// 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;
// 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();
// }
// });
AlertDialogUtils.showCancelAndConfirmDialog(this, new XComDialog.OnDialogListener(){

@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;
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();
public void onDialogClick(View layoutView, XComDialog xCom) {
TextView tvTitle = layoutView.findViewById(R.id.tv_title);
TextView tvContent = layoutView.findViewById(R.id.tv_content);
TextView tvCancel = layoutView.findViewById(R.id.tv_cancel);
TextView tvConfirm = layoutView.findViewById(R.id.tv_confirm);

tvTitle.setText(getString(R.string.tip_create_menu_title));
tvContent.setText(getString(R.string.tip_create_menu_content,name1));
tvCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
xCom.dismissX();
}
});
tvConfirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
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;
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("菜谱复刻成功!");
xCom.dismissX();
MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good");
finish();
}
});
}
});

}
break;
case R.id.shengchengcaipu://修改菜谱
@@ -513,34 +572,79 @@ public class DiyUpdate1Activity extends BaseActivity {
//按钮点击
String title = "保存菜谱操作提示!";
String message = "请问客官确定要保存[" + name + "]菜谱吗?";
AlertDialogUtils.showDialog(view.getContext(), title, message, new QMUIDialogAction.ActionListener() {
// 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();
// }
// });
AlertDialogUtils.showCancelAndConfirmDialog(this, new XComDialog.OnDialogListener(){

@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();
public void onDialogClick(View layoutView, XComDialog xCom) {
TextView tvTitle = layoutView.findViewById(R.id.tv_title);
TextView tvContent = layoutView.findViewById(R.id.tv_content);
TextView tvCancel = layoutView.findViewById(R.id.tv_cancel);
TextView tvConfirm = layoutView.findViewById(R.id.tv_confirm);

tvTitle.setText(getString(R.string.tip_save_menu_title));
tvContent.setText(getString(R.string.tip_save_menu_content,name));
tvCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
xCom.dismissX();
}
});
tvConfirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
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("菜谱修改成功!");
xCom.dismissX();
MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good");
finish();
}
});
}
});

}
break;
}


+ 2
- 0
app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/WelcomeActivity.java View File

@@ -9,6 +9,7 @@ import androidx.annotation.NonNull;

import android.view.KeyEvent;

import com.bonait.bnframework.HBL.DataUtil.ErrorCodeManager;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.MainInit;
import com.bonait.bnframework.common.base.BaseActivity;
@@ -189,6 +190,7 @@ public class WelcomeActivity extends BaseActivity {
private void skipToLoginActivity() {
//初始化
MainInit.Init(ConfigName.getInstance().app);
ErrorCodeManager.getInstance().initData();
ConfigName.getInstance().IsPortraitScreen=ScreenUtils.IsPortraitScreen(this);

// 跳转到登录页面


+ 85
- 0
app/src/main/java/com/bonait/bnframework/ViewModel/Adapter/silos_calibrate_adapter.java View File

@@ -0,0 +1,85 @@
package com.bonait.bnframework.ViewModel.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

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

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE;
import com.bonait.bnframework.common.db.res.lcMode;
import com.bonait.bnframework.common.helper.I.MyClickListener;

import java.util.List;


/**
* 料仓校准表
*/
public class silos_calibrate_adapter extends ArrayAdapter<BPA_SILOS_CALIBRATE> {
/**
* 内部点击事件
*/
private MyClickListener mListener;
private List<BPA_SILOS_CALIBRATE> datas;
int resource1;
public silos_calibrate_adapter(@NonNull Context context, int resource, @NonNull List<BPA_SILOS_CALIBRATE> objects, MyClickListener listener) {
super(context, resource, objects);
mListener = listener;
datas=objects;
this.resource1=resource;
}
//每个子项被滚动到屏幕内的时候会被调用
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE) getItem(position);//得到当前项选中item实例
//为每一个子项加载设定的布局
View view = LayoutInflater.from(getContext()).inflate(resource1, parent, false);
//分别获取 image view 和 textview 的实例

TextView num = view.findViewById(R.id.tv_num);
TextView desc = view.findViewById(R.id.tv_desc);
TextView outputMax = view.findViewById(R.id.tv_output_max);
TextView outputMin = view.findViewById(R.id.tv_output_min);
TextView inputMax = view.findViewById(R.id.tv_intput_max);
TextView inputMin = view.findViewById(R.id.tv_intput_min);
// 设置要显示的图片和文字
num.setText(bean.num+"");
desc.setText(bean.name+"");
outputMax.setText(bean.outputTimeMax+"");
outputMin.setText(bean.outputTimeMin+"");
inputMax.setText(bean.inputWightMax+"");
inputMin.setText(bean.inputWightMin+"");
outputMax.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bean);
}
});
outputMin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bean);
}
});
inputMax.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bean);
}
});
inputMin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bean);
}
});
return view;
}
}

+ 5
- 0
app/src/main/java/com/bonait/bnframework/ViewModel/Adapter/sp_adapter.java View File

@@ -41,6 +41,11 @@ public class sp_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
mLayoutInflater = LayoutInflater.from(context);
}

public void updateData(){
goods = DataBus.getInstance().Goods;
notifyDataSetChanged();
}

@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {


+ 285
- 0
app/src/main/java/com/bonait/bnframework/ViewModel/CustomView/XComDialog.java View File

@@ -0,0 +1,285 @@
package com.bonait.bnframework.ViewModel.CustomView;


import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Rect;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.LinearLayout;

import androidx.appcompat.app.AppCompatActivity;

import com.bonait.bnframework.R;


/**
*
* <<==通用弹框封装==>>
* 如果设置动画无效,可能 mDialog.show()先调用有影响
*
* new XComDialog(this,R.layout.view_xcom_dialog)
* .init()
* .setWindowSize()
* .setDialogListener(new XComDialog.OnDialogListener() {
* @Override
* public void onViewClick(View mLayoutView, final AlertDialog mDialog) {
* Button button= mLayoutView.findViewById(R.id.bt_colse);
* button.setOnClickListener(new View.OnClickListener() {
* @Override
* public void onClick(View v) {
* mDialog.dismiss();
* }
* });
* }
* });
*
*/

public class XComDialog {
private AppCompatActivity mContext;//上下文
private int mThemeResId;//主题
private View mLayoutView;//布局
private Window window;//窗口
private Dialog mDialog;//弹框
public XComDialog xComDialog;


/**
* 布局接口
*/
public static interface OnDialogListener {
public void onDialogClick(View layoutView, XComDialog xCom);//监听
}
/**
* 布局接口
*/
public static interface OnDialogListener2 {
public void onDialogClick(View layoutView, XComDialog xCom,Dialog mDialog);//监听
}

/**
* 对外监听
*/
public XComDialog setDialogListener(OnDialogListener listener) {
listener.onDialogClick(mLayoutView, xComDialog);
return this;
}
/**
* 对外监听
*/
public XComDialog setDialogListener2(OnDialogListener2 listener) {
listener.onDialogClick(mLayoutView, xComDialog,mDialog);
return this;
}

/**
* 默认主题
*
* @param context
* @param id_Layout
*/
public XComDialog(AppCompatActivity context, int id_Layout) {
this.mContext = context;
this.mThemeResId = R.style.dialogCommonTheme;
this.mLayoutView = LayoutInflater.from(mContext).inflate(id_Layout, null);
this.xComDialog=this;
}

/**
* 自定主题
*
* @param context
* @param themeResId
* @param id_Layout
*/
public XComDialog(AppCompatActivity context, int themeResId, int id_Layout) {
this.mContext = context;
this.mThemeResId = themeResId;
this.mLayoutView = LayoutInflater.from(mContext).inflate(id_Layout, null);
this.xComDialog=this;
}

/**
* 初始化Dialog
*/
public XComDialog init() {
// mDialog = new AlertDialog.Builder(mContext, mThemeResId).create();
mDialog = new Dialog(mContext);
mDialog.setCanceledOnTouchOutside(true);//点击外部不消失
mDialog.setCancelable(true);//按返回键退出
mDialog.show();
return this;
}
public XComDialog init(boolean isBack, boolean isOut ) {
// mDialog = new AlertDialog.Builder(mContext, mThemeResId).create();
mDialog = new Dialog(mContext,mThemeResId);
mDialog.setCancelable(isBack);//按返回键退出
mDialog.setCanceledOnTouchOutside(isOut);
mDialog.show();
return this;
}
public XComDialog init(boolean isBack, boolean isOut,boolean isSetShowInput) {
// mDialog = new AlertDialog.Builder(mContext, mThemeResId).create();
mDialog = new Dialog(mContext,mThemeResId);//用Dialog代替AlertDialog才能弹出键盘
mDialog.setCancelable(isBack);//按返回键退出
mDialog.setCanceledOnTouchOutside(isOut);
ShowInput(isSetShowInput);
mDialog.show();

return this;
}

/**
* 默认 弹框大小 透明度
*/
public XComDialog setWindowSize() {
mDialog.getWindow().setDimAmount(0.5f);//设置透明度
window = mDialog.getWindow();
window.setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
window.setContentView(mLayoutView);//设置弹框布局

moveTop();
window.setGravity(Gravity.CENTER);

return this;
}


/**
* 默认 弹框大小 透明度
*/
public XComDialog setWindowSizeMax() {
mDialog.getWindow().setDimAmount(0.5f);//设置透明度
window = mDialog.getWindow();
window.setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
window.setContentView(mLayoutView);//设置弹框布局

moveTop();
window.setGravity(Gravity.CENTER);

return this;
}


/**
* 设置 大小与透明度
*
* @param width
* @param height
* @param amount
* @return
*/
public XComDialog setWindowSize(int width, int height, float amount) {

mDialog.getWindow().setDimAmount(amount);//设置透明度
window = mDialog.getWindow();
window.setLayout(width, height);
window.setContentView(mLayoutView);//设置弹框布局

return this;
}

/**
* 设置弹框大小 透明度 当含listview数据时使用
*
* @param width
* @param height
* @param self true自适应高度 ,false指定高度
* @param amount
* @return
*/
public XComDialog setWindowSize(int width, int height, boolean self, float amount) {
if (self) {
mDialog.getWindow().setDimAmount(amount);//设置透明度
window = mDialog.getWindow();
window.setLayout(width, LinearLayout.LayoutParams.WRAP_CONTENT);
window.setContentView(mLayoutView);//设置弹框布局

return this;
} else {
mDialog.getWindow().setDimAmount(amount);//设置透明度
window = mDialog.getWindow();
window.setLayout(width, height);
window.setContentView(mLayoutView);//设置弹框布局

return this;
}
}

/**
* 方式 与位置
*/
public XComDialog setGravity(int animation, int gravity) {
window.setWindowAnimations(animation); //添加动画
window.setGravity(gravity);
if (gravity == Gravity.CENTER) {
moveTop();
}
return this;
}



//关闭
public void dismissX() {
if (mDialog != null && mDialog.isShowing()) {
mDialog.dismiss();
mDialog = null;//清空对象
window = null;
}
}

/**
* 向上移动 虚拟键一般高度
* 使至弹框居中
*/
private void moveTop() {
WindowManager.LayoutParams lp = window.getAttributes();
int y = getBotBarHeight();//虚拟键高度
lp.y = -y / 2; // 偏移原来坐标 向上
window.setAttributes(lp);
}

/**
* 获取底部 虚拟键 高度
*
* @return
*/
public int getBotBarHeight() {
Rect rect = new Rect();
mContext.getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
int winHeight = mContext.getWindow().getDecorView().getHeight();
return winHeight - rect.bottom;
}

/**
* 是否显示输入法
* @param isSet
*/
private void ShowInput(boolean isSet){
if(isSet) {
mDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
InputMethodManager inputMethodManager =
(InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
}
});
mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
InputMethodManager inputMethodManager =
(InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(mContext.getWindow().getDecorView().getWindowToken(), 0);
}
});
}
}
}

+ 12
- 9
app/src/main/java/com/bonait/bnframework/ViewModel/CustomView/add_qupenren.java View File

@@ -136,17 +136,20 @@ public class add_qupenren extends LinearLayout {
quzhizuo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (!ConfigName.getInstance().PlcIsConnect) {
ToastUtils.warning("PLC未准备就绪!!!");
return;
if(!ConfigName.TEST){
if (!ConfigName.getInstance().PlcIsConnect) {
ToastUtils.warning("PLC未准备就绪!!!");
return;
}

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


+ 55
- 0
app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/HomeDeviceFragment.java View File

@@ -0,0 +1,55 @@
package com.bonait.bnframework.ViewModel.FragmentViewModel;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

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

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.DataUtil.DataType;
import com.bonait.bnframework.HBL.DataUtil.NotifyPropVar;
import com.bonait.bnframework.HBL.Interface.IRunT;
import com.bonait.bnframework.R;
import com.bonait.bnframework.Service.ControlAdress;
import com.bonait.bnframework.Service.ModbusHelper;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.databinding.FragmentHomeDeviceBinding;

import butterknife.ButterKnife;

public class HomeDeviceFragment extends BaseFragment {
protected FragmentHomeDeviceBinding mViewBinding;
@Override
protected View onCreateView() {
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home_device, null);
ButterKnife.bind(this, root);
mViewBinding = FragmentHomeDeviceBinding.inflate(getLayoutInflater());
return root;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
init();
}


private void init(){
NotifyPropVar<Short> notifyPropVar = (NotifyPropVar<Short>)ModbusHelper.get().getPLC(ControlAdress.错误码).Value;
if(notifyPropVar!=null){
notifyPropVar.Register(HomeDeviceFragment.class.getSimpleName(), new IRunT<Short>() {
@Override
public void Run(Short aShort) {
LogUtils.d("HomeDeviceFragment aShort="+aShort);
mViewBinding.deviceErrorCode.post(new Runnable() {
@Override
public void run() {
mViewBinding.deviceErrorCode.setText(" "+aShort);
}
});
}
});
}
}
}

+ 9
- 0
app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/HomeFragmentPR.java View File

@@ -12,6 +12,7 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -181,6 +182,14 @@ public class HomeFragmentPR extends BaseFragment {
StaggeredGridLayoutManager layout = new StaggeredGridLayoutManager
(3, StaggeredGridLayoutManager.VERTICAL);
recycler_view.setLayoutManager(layout);
// recycler_view.addItemDecoration(new RecyclerView.ItemDecoration() {
// @Override
// public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
// @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
// super.getItemOffsets(outRect, view, parent, state);
// outRect.right = getResources().getDimensionPixelSize(R.dimen.dp_12);
// }
// });

ArrayList<BPA_GOODS> good = new ArrayList<>();
String name = search_view.getQuery().toString();


+ 148
- 1
app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/SystemSeasoningsetFragment.java View File

@@ -20,6 +20,7 @@ import android.widget.ListView;
import android.widget.Spinner;

import com.bonait.bnframework.R;
import com.bonait.bnframework.ViewModel.Adapter.silos_calibrate_adapter;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
@@ -28,6 +29,7 @@ import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_PROCESS;
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE;
import com.bonait.bnframework.common.db.res.lcMode;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
@@ -66,7 +68,11 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL

@BindView(R.id.datatab_lc)
ListView datatab_lc;//料仓

@BindView(R.id.datatab_silos_calibrate)
ListView datatab_silos_calibrate;//料仓校准
ArrayList<lcMode> lcModes = new ArrayList<>();
ArrayList<BPA_SILOS_CALIBRATE> silosCalibrates = new ArrayList<>();

@BindView(R.id.datatab_gxmx)
ListView datatab_gxmx;//工序
@@ -101,6 +107,7 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL
Initdata_wl();
Initdata_lc();
Initdata_gx();
Initdata_silos_calibrate();
}

@SuppressLint("HandlerLeak")
@@ -111,6 +118,7 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL
Initdata_wl();
Initdata_lc();
Initdata_gx();
Initdata_silos_calibrate();
}
}
};
@@ -222,6 +230,146 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL
}
}

/**
* 初始化料仓校准数据加载
*/
public void Initdata_silos_calibrate() {
try {
silosCalibrates = QueryDB.GetSilosCalibrateAll();
silos_calibrate_adapter adapter2 = new silos_calibrate_adapter(context, R.layout.silos_calibrate_item, silosCalibrates, new MyClickListener() {
@Override
public void clickListener(View v, Object data) {
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE)data;
switch (v.getId()){
case R.id.tv_output_max:
final QMUIDialog.EditTextDialogBuilder builder1 = new QMUIDialog.EditTextDialogBuilder(context);
assert bean != null;
builder1.setTitle(bean.name + " 输出时间最大值(s)")
.setPlaceholder("在此输入值")
.setDefaultText(bean.outputTimeMax + "")
.setInputType(InputType.TYPE_CLASS_NUMBER)
.addAction("取消", new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
dialog.dismiss();
}
})
.addAction("确定", new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
CharSequence text = builder1.getEditText().getText();
if (text != null && text.length() > 0) {
QueryDB.UpdateSilosCalibrate(bean.id, Integer.parseInt(text.toString()),-1,-1,-1);
Initdata_silos_calibrate();
dialog.dismiss();
} else {
//请填入昵称
ToastUtils.info("值不能为空!");
}
}
})
.show();
break;
case R.id.tv_output_min:
final QMUIDialog.EditTextDialogBuilder builder2 = new QMUIDialog.EditTextDialogBuilder(context);
assert bean != null;
builder2.setTitle(bean.name + " 输出时间最小值(s)")
.setPlaceholder("在此输入值")
.setDefaultText(bean.outputTimeMin + "")
.setInputType(InputType.TYPE_CLASS_NUMBER)
.addAction("取消", new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
dialog.dismiss();
}
})
.addAction("确定", new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
CharSequence text = builder2.getEditText().getText();
if (text != null && text.length() > 0) {
QueryDB.UpdateSilosCalibrate(bean.id, -1,Integer.parseInt(text.toString()),-1,-1);
Initdata_silos_calibrate();
dialog.dismiss();
} else {
//请填入昵称
ToastUtils.info("值不能为空!");
}
}
})
.show();
break;
case R.id.tv_intput_max:
final QMUIDialog.EditTextDialogBuilder builder3 = new QMUIDialog.EditTextDialogBuilder(context);
assert bean != null;
builder3.setTitle(bean.name + " 输出重量最大值(g)")
.setPlaceholder("在此输入值")
.setDefaultText(bean.outputTimeMin + "")
.setInputType(InputType.TYPE_CLASS_NUMBER)
.addAction("取消", new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
dialog.dismiss();
}
})
.addAction("确定", new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
CharSequence text = builder3.getEditText().getText();
if (text != null && text.length() > 0) {
QueryDB.UpdateSilosCalibrate(bean.id, -1,1,Integer.parseInt(text.toString()),-1);
Initdata_silos_calibrate();
dialog.dismiss();
} else {
//请填入昵称
ToastUtils.info("值不能为空!");
}
}
})
.show();
break;
case R.id.tv_intput_min:
final QMUIDialog.EditTextDialogBuilder builder4 = new QMUIDialog.EditTextDialogBuilder(context);
assert bean != null;
builder4.setTitle(bean.name + " 输出重量最大值(g)")
.setPlaceholder("在此输入值")
.setDefaultText(bean.outputTimeMin + "")
.setInputType(InputType.TYPE_CLASS_NUMBER)
.addAction("取消", new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
dialog.dismiss();
}
})
.addAction("确定", new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
CharSequence text = builder4.getEditText().getText();
if (text != null && text.length() > 0) {
QueryDB.UpdateSilosCalibrate(bean.id, -1,1,-1,Integer.parseInt(text.toString()));
Initdata_silos_calibrate();
dialog.dismiss();
} else {
//请填入昵称
ToastUtils.info("值不能为空!");
}
}
})
.show();
break;
}
}

@Override
public void clickListenerNew(View v, int k, Object data) {
}
});
datatab_silos_calibrate.setAdapter(adapter2);
} catch (Exception e) {

}
}

/**
* 初始化数据加载
*/
@@ -324,7 +472,6 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL

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

lcMode lc = (lcMode) data;
switch (v.getId()) {
case R.id.name://修改物料


+ 229
- 118
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -9,6 +9,7 @@ import android.util.Log;

import androidx.annotation.NonNull;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Interface.IRun;
import com.bonait.bnframework.HBL.Interface.IRunT;
import com.bonait.bnframework.HBL.Thread.IThread;
@@ -19,6 +20,7 @@ import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.db.mode.ModeBase;
import com.bonait.bnframework.common.helper.ByteHelper;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.ViewModel.CustomView.MyStatus;
@@ -121,23 +123,33 @@ public class ExecuteTheRecipe {
return false;
}
ToastUtils.info("开始执行:" + recipe.sort + "、" + recipe.processms);
LogUtils.d("开始执行 "+ recipe.sort + "、" + recipe.processms);
// if (recipe.materialType == 0)//正常物料
// {
// //先到达抽料位
// BPA_GOODSRECIPE data1 = Get位置("最高", "抽料位");
// ExecuteOperationSteps(data1.processname, data1.processvalue);
//
// ExecuteMaterialIssuance(recipe.processvalue);
// } else if (recipe.materialType == 1)//工序模型
// {
// if (recipe.processname.equals("抽水")) {
// BPA_GOODSRECIPE data1 = Get位置("最高", "抽料位");
// ExecuteOperationSteps(data1.processname, data1.processvalue);
// } else if (recipe.processname.equals("主料")) {
// BPA_GOODSRECIPE data1 = Get位置("最高", "炒菜位1");
// ExecuteOperationSteps(data1.processname, data1.processvalue);
// }
//
// ExecuteOperationSteps(recipe.processname, recipe.processvalue);
// }

if (recipe.materialType == 0)//正常物料
{
//先到达抽料位
BPA_GOODSRECIPE data1 = Get位置("最高", "抽料位");
ExecuteOperationSteps(data1.processname, data1.processvalue);

ExecuteOperationSteps(selectpf.processname, selectpf.processvalue);
ExecuteMaterialIssuance(recipe.processvalue);
} else if (recipe.materialType == 1)//工序模型
{
if (recipe.processname.equals("抽水")) {
BPA_GOODSRECIPE data1 = Get位置("最高", "抽料位");
ExecuteOperationSteps(data1.processname, data1.processvalue);
} else if (recipe.processname.equals("主料")) {
BPA_GOODSRECIPE data1 = Get位置("最高", "炒菜位1");
ExecuteOperationSteps(data1.processname, data1.processvalue);
}

ExecuteOperationSteps(recipe.processname, recipe.processvalue);
}
} catch (Exception ex) {
@@ -196,25 +208,25 @@ public class ExecuteTheRecipe {
Thread.sleep(200);//等待写入完成

//一直等待下料完成 否则就一直等待 40s超时
for (Map.Entry<BPA_SILOS, Integer> entry : formulation.entrySet()) {
BPA_SILOS silos = entry.getKey();
Integer val = entry.getValue();
String name = "料仓" + silos.num + "下料完成";
final boolean[] IsComplete = {false};
long a = System.currentTimeMillis();
while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
break;
} else {
// Object sb = ReadPLC(name);// ListeningValue.get(name);
// if (sb != null) {
// IsComplete[0] = (boolean) (sb);
// }
}
Thread.sleep(100);//10 *6
}
ToastUtils.info(name);
}
// for (Map.Entry<BPA_SILOS, Integer> entry : formulation.entrySet()) {
// BPA_SILOS silos = entry.getKey();
// Integer val = entry.getValue();
// String name = "料仓" + silos.num + "下料完成";
// final boolean[] IsComplete = {false};
// long a = System.currentTimeMillis();
// while (!IsComplete[0]) {
// if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
// break;
// } else {
//// Object sb = ReadPLC(name);// ListeningValue.get(name);
//// if (sb != null) {
//// IsComplete[0] = (boolean) (sb);
//// }
// }
// Thread.sleep(100);//10 *6
// }
// ToastUtils.info(name);
// }
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
@@ -254,13 +266,14 @@ public class ExecuteTheRecipe {
//endregion
//写入PLC
if (formulation.size() > 0) {
LogUtils.d("ExecuteOperationSteps 执行工序步骤 processname="+processname+"; formulation="+formulation);
switch (processname) {
case "搅拌":
Write_PLC_Stir(formulation);
break;
case "位置":
Write_PLC_Location(formulation);
break;
// case "位置":
// Write_PLC_Location(formulation);
// break;
case "加热":
Write_PLC_Heating(formulation);
break;
@@ -273,12 +286,16 @@ public class ExecuteTheRecipe {
case "延迟":
Write_PLC_Delay(formulation);
break;
case "勾芡":
Write_PLC_addThickenWater(formulation);
break;
case "升降":
Write_PLC_setUpdDownMotor(formulation);
break;
case "出菜":
Write_PLC_Outdishes(formulation);
break;
}


}
}
} catch (Exception ex) {
@@ -300,23 +317,24 @@ public class ExecuteTheRecipe {
if (ExecuteCurrentOperation != null) {
ExecuteCurrentOperation.Run("液体料|" + silos.num);
}
ToastUtils.info("准备写入PLC仓号需求:" + silos.num + "," + val / 10.0);
ToastUtils.info("准备写入仓号需求:" + silos.num + "," + val / 10.0);//为啥
ModbusHelper.get().addSeason(val,silos.num);

String name = "料仓" + silos.num + "下料完成";
// String name = "料仓" + silos.num + "下料完成";
// ExecuteTheRecipe.WritePLC(name, false, null);

final boolean[] IsComplete = {false};
WritePLC("料仓" + silos.num + "需求值", val,()->{
BottomClick("料仓" + silos.num + "下料");
IsComplete[0] = true;
});
long a = System.currentTimeMillis();
while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
break;
}
Thread.sleep(100);//10 *6
}
// final boolean[] IsComplete = {false};
// WritePLC("料仓" + silos.num + "需求值", val,()->{
// BottomClick("料仓" + silos.num + "下料");
// IsComplete[0] = true;
// });
// long a = System.currentTimeMillis();
// while (!IsComplete[0]) {
// if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
// break;
// }
// Thread.sleep(100);//10 *6
// }

//減去料仓数量
int otherG = silos.silosmargin - (val / 10);
@@ -346,18 +364,26 @@ public class ExecuteTheRecipe {
val = Integer.parseInt(value);
} else {
ToastUtils.info("工序:" + key + "," + value);
int writeValue = GetMXValue(key, value);
if (ExecuteCurrentOperation != null) {
ExecuteCurrentOperation.Run("搅拌" + "|" + writeValue);
ExecuteCurrentOperation.Run("搅拌" + "|" + value);
}
if(value.contains("启动")){
ModbusHelper.get().setStirMotor(1);
}else {
ModbusHelper.get().setStirMotor(2);
}
// int writeValue = GetMXValue(key, value);
// if (ExecuteCurrentOperation != null) {
// ExecuteCurrentOperation.Run("搅拌" + "|" + writeValue);
// }
// WritePLC(key, writeValue, ()->{
// if (writeValue == 0) {
// WritePLC("搅拌", false, null);
// } else {
// WritePLC("搅拌", true, null);
// }
// });

WritePLC(key, writeValue, ()->{
if (writeValue == 0) {
WritePLC("搅拌", false, null);
} else {
WritePLC("搅拌", true, null);
}
});
}
}

@@ -437,29 +463,28 @@ public class ExecuteTheRecipe {
private static void Write_PLC_Ingredients(HashMap<String, String> data) {
try {
//是否手动
boolean ishand = true;
ToastUtils.info("准备倒入主料!");
// boolean ishand = true;
// ToastUtils.info("准备倒入主料!");

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


if (ishand) {
/*if (ishand) {
if (ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本") || ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) {
ExecuteTheRecipe.BottomClick("平移-去1号位");
}
@@ -576,17 +601,28 @@ public class ExecuteTheRecipe {
ExecuteTheRecipe.BottomClick("平移-去1号位");
Log.d("移动去", "1号位");
}
}
}*/

//判断是否有烹饪时间
int val = 0;
int position = 1;//几号位
String name = "";//主料名称
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key.contains("(秒)")) {
val = Integer.parseInt(value);
} else if(key.contains("名称")){
name = value;
}else if(key.contains("位置")){
position = Integer.parseInt(value);
}
}
ToastUtils.info("工序: 主料名称:"+name + " 主料位置:" + position);
if (ExecuteCurrentOperation != null) {
ExecuteCurrentOperation.Run("主料" + "|" + position);
}
ModbusHelper.get().addMainFood(position);
if (val > 0) {
Thread.sleep(val * 1000);
}
@@ -638,28 +674,42 @@ public class ExecuteTheRecipe {
private static void Write_PLC_Heating(HashMap<String, String> data) {
try {
int val = 0;
int hotNum = 0;//加热档位
boolean startHot = false;//是否启动加热
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key.contains("(秒)")) {
val = Integer.parseInt(value);
} else {
} else if(key.contains("档位")){
hotNum = Integer.parseInt(value);
}else {
ToastUtils.info("工序:" + key + "," + value);
int writeValue = GetMXValue(key, value);
if (ExecuteCurrentOperation != null) {
ExecuteCurrentOperation.Run("加热" + "|" + writeValue);
ExecuteCurrentOperation.Run("加热" + "|" + value);
}
WritePLC(key, writeValue, ()->{
if (writeValue == 0) {
ConfigName.getInstance().IsOpenHuoLi = false;
WritePLC("加热", false, null);
} else {
ConfigName.getInstance().IsOpenHuoLi = true;
WritePLC("加热", true, null);
}
});
if(value.contains("启动")){
startHot = true;
}else {
startHot= false;
}

// int writeValue = GetMXValue(key, value);
// if (ExecuteCurrentOperation != null) {
// ExecuteCurrentOperation.Run("加热" + "|" + writeValue);
// }
// WritePLC(key, writeValue, ()->{
// if (writeValue == 0) {
// ConfigName.getInstance().IsOpenHuoLi = false;
// WritePLC("加热", false, null);
// } else {
// ConfigName.getInstance().IsOpenHuoLi = true;
// WritePLC("加热", true, null);
// }
// });
}
}
ModbusHelper.get().Heating(hotNum,startHot);

if (val > 0) {
Thread.sleep(val * 1000);
@@ -690,13 +740,14 @@ public class ExecuteTheRecipe {
ExecuteCurrentOperation.Run("加水" + "|" + val);
}
if (val > 0) {
WritePLC("炒锅抽水", true,null);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
ExecuteTheRecipe.WritePLC("炒锅抽水", false, null);
}
}, val * 1000);
ModbusHelper.get().addWater(val);
// WritePLC("炒锅抽水", true,null);
// new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
// @Override
// public void run() {
// ExecuteTheRecipe.WritePLC("炒锅抽水", false, null);
// }
// }, val * 1000);
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
@@ -713,7 +764,7 @@ public class ExecuteTheRecipe {
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("工序:" + key + "," + value);
ToastUtils.info("工序:" + "等待"+value+"秒");
if (key.contains("(秒)")) {
int val = Integer.parseInt(value);
Thread.sleep(val * 1000);
@@ -731,36 +782,33 @@ public class ExecuteTheRecipe {
*/
private static void Write_PLC_Outdishes(HashMap<String, String> data) {
try {
ToastUtils.info("准备出菜!");

//先延迟
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("工序:" + key + "," + value);
ToastUtils.info("工序: 等待"+value+"秒后出菜");
if (key.contains("(秒)")) {
int val = Integer.parseInt(value);
Thread.sleep(val * 1000);
}
}

BottomClick("出菜");
// BottomClick("出菜");

//一直等待机器移动到该位置,否则就一直等待 6s超时
String name = "出餐启动反馈";
final boolean[] IsComplete = {false};
long a = System.currentTimeMillis();
while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * 120) {
break;
} else {
Object sb = ReadPLC(name);//ListeningValue.get(name);
if (sb != null) {
IsComplete[0] = (boolean) (sb);
}
}
Thread.sleep(100);//10 *6
}
// String name = "出餐启动反馈";
// final boolean[] IsComplete = {false};
// long a = System.currentTimeMillis();
// while (!IsComplete[0]) {
// if ((System.currentTimeMillis() - a) > 1000 * 120) {
// break;
// } else {
// Object sb = ReadPLC(name);//ListeningValue.get(name);
// if (sb != null) {
// IsComplete[0] = (boolean) (sb);
// }
// }
// Thread.sleep(100);//10 *6
// }

ToastUtils.info("出菜完成,结束制作!");
} catch (Exception ex) {
@@ -805,6 +853,69 @@ public class ExecuteTheRecipe {
}
//endregion

/**
* 写PLC 出菜
*
* @param data
*/
private static void Write_PLC_addThickenWater(HashMap<String, String> data) {
try {

//先延迟
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("工序:" + key + "," + value);
if (key.contains("(秒)")) {
int val = Integer.parseInt(value);
ToastUtils.info("工序:" + "勾芡," + value);
if (ExecuteCurrentOperation != null) {
ExecuteCurrentOperation.Run("勾芡" + "|" + value);
}
ModbusHelper.get().addThickenWater(val);
}
}
ToastUtils.info("出菜完成,结束制作!");
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 写PLC 出菜
*
* @param data
*/
private static void Write_PLC_setUpdDownMotor(HashMap<String, String> data) {
try {
int val = 0;
//先延迟
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("工序:" + key + "," + value);
if (key.contains("(秒)")) {
val = Integer.parseInt(value);
ToastUtils.info("工序:" + "升降," + value);
if (ExecuteCurrentOperation != null) {
ExecuteCurrentOperation.Run("升降" + "|" + value);
}
}else if(key.contains("升降")){
if(value.contains("升")){
ModbusHelper.get().setUpdDownMotor(1);
}else {
ModbusHelper.get().setUpdDownMotor(2);
}
}
}
if(val > 0){
Thread.sleep(val * 1000);
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

//region 主页按钮

/**


+ 46
- 3
app/src/main/java/com/bonait/bnframework/business/MainInit.java View File

@@ -2,9 +2,15 @@ package com.bonait.bnframework.business;

import android.app.Activity;
import android.app.Application;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.BuildConfig;
import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.Service.ControlAdress;
import com.bonait.bnframework.Service.ModbusHelper;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.Constants;
import com.bonait.bnframework.common.constant.DataBus;
@@ -18,6 +24,7 @@ import com.bonait.bnframework.common.db.mode.BPA_LOG;
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE;
import com.bonait.bnframework.common.db.mode.BPA_USER;
import com.bonait.bnframework.common.db.res.AlertLogEnum;
import com.bonait.bnframework.common.db.res.UserLogEnum;
@@ -212,9 +219,9 @@ public class MainInit {



//10个料仓
if (QueryDB.GetSilosALL().size() == 0) {
for (int i = 0; i < 11; i++) {
//9个料仓
if (QueryDB.GetSilosALL().isEmpty()) {
for (int i = 0; i < 9; i++) {
BPA_SILOS silo = new BPA_SILOS();
silo.id = java.util.UUID.randomUUID().toString();
silo.num = i + 1;
@@ -233,6 +240,42 @@ public class MainInit {
{
ConfigData.getInstance().RevertPLCProcess();
}

//11个料仓 1-9个液体 10水阀 11勾芡
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SILOS_CALIBRATE.class,null);
if (QueryDB.GetSilosCalibrateAll().isEmpty()) {
if(!DBHelper.getInstance(MainApplication.getContext()).doesTableExist(BPA_SILOS_CALIBRATE.class)){
DBHelper.getInstance(MainApplication.getContext()).CreateTablesAll(BPA_SILOS_CALIBRATE.class,null);
}
for (int i = 1; i < 10; i++) {
BPA_SILOS_CALIBRATE silo = new BPA_SILOS_CALIBRATE();
silo.name = "液体"+i;
silo.num = i;
silo.outputTimeMax = 5;
silo.outputTimeMin = 0;
silo.inputWightMax = 100;
silo.inputWightMin = 0;
QueryDB.AddSilosCalibrate(silo);
}
BPA_SILOS_CALIBRATE silo = new BPA_SILOS_CALIBRATE();
silo.name = ControlAdress.加水.toString();
silo.num = 10;
silo.outputTimeMax = 5;
silo.outputTimeMin = 0;
silo.inputWightMax = 100;
silo.inputWightMin = 0;
QueryDB.AddSilosCalibrate(silo);
BPA_SILOS_CALIBRATE silo2 = new BPA_SILOS_CALIBRATE();
silo2.name = ControlAdress.勾芡.toString();
silo2.num = 11;
silo2.outputTimeMax = 5;
silo2.outputTimeMin = 0;
silo2.inputWightMax = 100;
silo2.inputWightMin = 0;
QueryDB.AddSilosCalibrate(silo2);
LogUtils.d(" 首次创建 料仓校准 silo2="+silo2.toString()+QueryDB.GetSilosCalibrateAll());
}
ModbusHelper.get().Add(QueryDB.GetSilosCalibrateAll());
}
/**
* 删除表-重新生成新表


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

@@ -30,6 +30,8 @@ import java.util.concurrent.ConcurrentHashMap;
* 配置文件
*/
public class ConfigName {
//是否是测试模式
public final static boolean TEST = true;
//region 单例模式
private static ConfigName mInstance; //实例变量设置私有,防止直接通过类名访问



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

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

import com.bonait.bnframework.HBL.Interface.IRun;
import com.bonait.bnframework.Model.ErrorCodeBean;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
@@ -47,6 +48,7 @@ public class DataBus {
String text2="";
String text3="";
String text4="";
String text5="";
try
{
ArrayList<BPA_GOODSRECIPE> goodsrecipes= QueryDB.GetGoodsSrecipeID(goodid);
@@ -99,6 +101,9 @@ public class DataBus {
}else if(formulation.get("主料位置").toString().equals("4号位"))
{
text4+=formulation.get("主料名称");
}else if(formulation.get("主料位置").toString().equals("5号位"))
{
text5+=formulation.get("主料名称");
}
}
}
@@ -112,6 +117,7 @@ public class DataBus {
resultData.put(2,text2);
resultData.put(3,text3);
resultData.put(4,text4);
resultData.put(5,text5);
return resultData;
}
//endregion


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

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

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.file.DBHelper;
import com.bonait.bnframework.common.db.mode.BPA_CLOUDDATA;
@@ -28,6 +29,7 @@ import com.bonait.bnframework.common.db.mode.BPA_PROCESS;
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE;
import com.bonait.bnframework.common.db.mode.BPA_SUBORDER;
import com.bonait.bnframework.common.db.mode.BPA_SUGAR;
import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET;
@@ -164,6 +166,7 @@ public class QueryDB {
for (Object k : obj) {
data.add((BPA_MATERIAL) k);
}
LogUtils.d("GetMaterialALL 获取所有物料信息 data="+data.toString());
return data;
}

@@ -320,6 +323,7 @@ public class QueryDB {
for (Object k : obj) {
data.add((BPA_SILOS) k);
}
LogUtils.d(" GetSilosALL 获取所有料仓管理 data="+data.toString());
return data;
}

@@ -637,6 +641,7 @@ public class QueryDB {
data.add(silos);
}
}
LogUtils.d("根据物料名称查询料仓 GetSolisByMaterialName data="+data.toString());
return data;
}
//endregion
@@ -732,6 +737,7 @@ public class QueryDB {
for (Object k : obj) {
data.add((BPA_GOODS) k);
}
LogUtils.d("GetGoodsALL 获取所有商品(菜谱) data=" + data.toString());
return data;
}

@@ -741,7 +747,7 @@ public class QueryDB {
* @return
*/
public static ArrayList<BPA_GOODS> GetGoodsLike(String name) {
String orderby = Desc_Sort_Up + ',' + Desc_Time_Up;//先按排序 创建时间倒序
String orderby = Desc_Sort_Up;//先按排序 创建时间倒序
String where = "isDelete=? and name like ?";
String[] args = new String[]{"0","%" + name + "%"};
ArrayList<BPA_GOODS> data = new ArrayList<>();
@@ -749,6 +755,7 @@ public class QueryDB {
for (Object k : obj) {
data.add((BPA_GOODS) k);
}
LogUtils.d("GetGoodsLike 模糊查询商品(菜谱) data=" + data.toString());
return data;
}

@@ -766,6 +773,7 @@ public class QueryDB {
for (Object k : obj) {
data.add((BPA_GOODS) k);
}
LogUtils.d("GetGoodsStateALL 获取所有启用的商品 data=" + data.toString());
return data;
}

@@ -784,6 +792,7 @@ public class QueryDB {
data.add((BPA_GOODS) k);
}
if (data.size() > 0) {
LogUtils.d("GetGoodsId根据id查询商品 data=" + data.toString());
return data.get(0);
} else {
return null;
@@ -806,6 +815,7 @@ public class QueryDB {
for (Object k : obj) {
data.add((BPA_GOODS) k);
}
LogUtils.d("GetGoodsIs 判断商品数据是否存在 data=" + data.toString());
return data.size() > 0;
}

@@ -863,6 +873,7 @@ public class QueryDB {
for (Object k : obj) {
data = (BPA_GOODS) k;
}
LogUtils.d("GetGoodsSortIs 根据排序查询商品 data=" + data.toString());
return data;
}

@@ -945,6 +956,7 @@ public class QueryDB {
for (Object k : obj) {
data.add((BPA_GOODSRECIPE) k);
}
LogUtils.d("GetGoodsSrecipeALL 获取所有商品配方明细 data=" + data.toString());
return data;
}
/**
@@ -963,6 +975,7 @@ public class QueryDB {
BPA_GOODSRECIPE k = (BPA_GOODSRECIPE) item;
data.add(k);
}
LogUtils.d("GetGoodsSrecipeID 根据商品id查询配方信息 data=" + data.toString());
return data;
}
/**
@@ -2197,6 +2210,7 @@ public class QueryDB {
for (Object k : obj) {
data.add((BPA_PROCESS) k);
}
LogUtils.d("GetProcessID data=" + data.toString());
return data;
}

@@ -2218,6 +2232,7 @@ public class QueryDB {
for (Object k : obj) {
bpa_material = (BPA_PROCESS) k;
}
LogUtils.d("GetProcessID data=" + data.toString());
return bpa_material;
} catch (Exception e) {
Log.d("物料ID查询工序信息", "物料ID查询工序信息异常: " + e.getMessage());
@@ -2287,6 +2302,7 @@ public class QueryDB {
for (Object k : obj) {
data.add((BPA_PROCESSModel) k);
}
LogUtils.d("GetProcessModelALL data=" + data.toString());
return data;
}
/**
@@ -2306,6 +2322,7 @@ public class QueryDB {
for (Object k : obj) {
data.add((BPA_PROCESSModel) k);
}
LogUtils.d("GetProcessModelProcessID 工序ID查询工序模型表 data=" + data.toString());
return data;
} catch (Exception e) {
Log.d("物料ID查询工序信息", "物料ID查询工序信息异常: " + e.getMessage());
@@ -2331,6 +2348,7 @@ public class QueryDB {
for (Object k : obj) {
bpa_material = (BPA_PROCESSModel) k;
}
LogUtils.d("GetProcessModelID ID查询工序模型表 data=" + data.toString());
return bpa_material;
} catch (Exception e) {
Log.d("物料ID查询工序信息", "物料ID查询工序信息异常: " + e.getMessage());
@@ -2400,6 +2418,7 @@ public class QueryDB {
for (Object k : obj) {
data.add((BPA_CLOUDDATA) k);
}
LogUtils.d("GetClouddataALL 获取所有工序模型表 data=" + data.toString());
return data;
}
//endregion
@@ -2453,6 +2472,7 @@ public class QueryDB {
for (Object k : obj) {
data.add((BPA_PLCADDRESS) k);
}
LogUtils.d("GetPlcaddressALL 获取所有工序模型表 data=" + data.toString());
return data;
}
/**
@@ -2473,6 +2493,7 @@ public class QueryDB {
for (Object k : obj) {
bpa_material = (BPA_PLCADDRESS) k;
}
LogUtils.d("GetPlcaddressID ID查询工序模型表 data=" + data.toString());
return bpa_material;
} catch (Exception e) {
return null;
@@ -2489,6 +2510,99 @@ public class QueryDB {
Update(BPA_PLCADDRESS.class, material);
}
}

//BPA_SILOS_CALIBRATE 料仓校准表
/**
* 新增料仓校准
* add liup 20240418
*
* @param data
* @return 是否成功
*/
public static boolean AddSilosCalibrate(BPA_SILOS_CALIBRATE data) {
return Add(BPA_SILOS_CALIBRATE.class, data);
}

/**
* 查询所有料仓校准
* add liup 20240418
* @return
*/
public static ArrayList<BPA_SILOS_CALIBRATE> GetSilosCalibrateAll() {
String orderby = "num";//先按排序 创建时间倒序
String where = "isDelete=?";
String[] args = new String[]{"0"};
ArrayList<BPA_SILOS_CALIBRATE> data = new ArrayList<>();
ArrayList<Object> obj = Get(BPA_SILOS_CALIBRATE.class, where, args, orderby);
for (Object k : obj) {
data.add((BPA_SILOS_CALIBRATE) k);
}
LogUtils.d(" GetSilosCalibrateLIst 查询所有料仓校准 data="+data.toString());
return data;
}

/**
* 根据ID查询料仓校准
*
* @return
*/
public static BPA_SILOS_CALIBRATE GetSilosCalibrate(String id) {
BPA_SILOS_CALIBRATE data = null;
String orderby = Desc_Sort_Up + ',' + Desc_Time_Up;//先按排序 创建时间倒序
String where = "isDelete=? and id=?";
String[] args = new String[]{"0", id};
ArrayList<Object> obj = Get(BPA_SILOS_CALIBRATE.class, where, args, orderby);
for (Object k : obj) {
data = (BPA_SILOS_CALIBRATE) k;
}
return data;
}

/**
* 根据名称查询料仓校准
*
* @return
*/
public static BPA_SILOS_CALIBRATE GetSilosCalibrateByNum(int num) {
BPA_SILOS_CALIBRATE data = null;
String orderby = Desc_Sort_Up + ',' + Desc_Time_Up;//先按排序 创建时间倒序
String where = "isDelete=? and num=?";
String[] args = new String[]{"0", num+""};
ArrayList<Object> obj = Get(BPA_SILOS_CALIBRATE.class, where, args, orderby);
for (Object k : obj) {
data = (BPA_SILOS_CALIBRATE) k;
}
return data;
}

/**
* 修改料仓校准
*
* @param id
* @param outputMax
* @param outputMin
* @param inputMax
* @param inputMin
*/
public static void UpdateSilosCalibrate(String id, int outputMax,int outputMin,int inputMax,int inputMin) {
BPA_SILOS_CALIBRATE silos = GetSilosCalibrate(id);
if (silos != null) {
if(outputMax>=0){
silos.outputTimeMax = outputMax;
}
if(outputMin>=0){
silos.outputTimeMin = outputMin;
}
if(inputMax>=0){
silos.inputWightMax = inputMax;
}
if(inputMin>=0){
silos.inputWightMin = inputMin;
}
Update(BPA_SILOS_CALIBRATE.class, silos);
}
}

//endregion

//region 私有
@@ -2532,6 +2646,7 @@ public class QueryDB {
long insert = db.insert(c.getSimpleName(), null, cv);
db.close();
isSucess= insert > 0;
LogUtils.d(" 添加表数据 "+c.getSimpleName()+" "+isSucess);
} catch (Exception e) {
db.close();
isSucess= false;
@@ -2583,6 +2698,7 @@ public class QueryDB {
db.update(c.getSimpleName(), cv, "id = ?", new String[]{id});
db.close();
isSucess= true;
LogUtils.d("修改数据 Update "+c.getSimpleName());
} catch (Exception e) {
db.close();
isSucess= false;
@@ -2863,6 +2979,17 @@ 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_SILOS_CALIBRATE":
data = new BPA_SILOS_CALIBRATE();
//私有
((BPA_SILOS_CALIBRATE) data).name = cursor.getString((int) cursor.getColumnIndex("name"));
((BPA_SILOS_CALIBRATE) data).num = cursor.getInt((int) cursor.getColumnIndex("num"));
((BPA_SILOS_CALIBRATE) data).outputTimeMax = cursor.getInt((int) cursor.getColumnIndex("outputTimeMax"));
((BPA_SILOS_CALIBRATE) data).outputTimeMin = cursor.getInt((int) cursor.getColumnIndex("outputTimeMin"));
((BPA_SILOS_CALIBRATE) data).inputWightMin = cursor.getInt((int) cursor.getColumnIndex("inputWightMin"));
((BPA_SILOS_CALIBRATE) data).inputWightMax = cursor.getInt((int) cursor.getColumnIndex("inputWightMax"));

break;
}
((ModeBase) data).id = cursor.getString((int) cursor.getColumnIndex("id"));


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

@@ -1,9 +1,11 @@
package com.bonait.bnframework.common.db.file;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.mode.BPA_CLOUDDATA;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
@@ -24,6 +26,7 @@ import com.bonait.bnframework.common.db.mode.BPA_PROCESS;
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE;
import com.bonait.bnframework.common.db.mode.BPA_SUBORDER;
import com.bonait.bnframework.common.db.mode.BPA_SUGAR;
import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET;
@@ -124,6 +127,7 @@ public class DBHelper extends SQLiteOpenHelper {

CreateTablesAll(BPA_CLOUDDATA.class,null);//云端表
CreateTablesAll(BPA_PLCADDRESS.class,null);//工序模型表
CreateTablesAll(BPA_SILOS_CALIBRATE.class,null);//料仓校准模型表

ForeignKeys();
}
@@ -131,7 +135,7 @@ public class DBHelper extends SQLiteOpenHelper {
* 创建数据库表
* @param c
*/
private void CreateTablesAll(Class c,String premarykey)
public void CreateTablesAll(Class c,String premarykey)
{
if (premarykey == null){

@@ -160,6 +164,20 @@ public class DBHelper extends SQLiteOpenHelper {
db.endTransaction();
}

/**
* 判断表是否存在
* @param c
* @return
*/
public boolean doesTableExist(Class c) {
SQLiteDatabase db =this.getWritableDatabase();
Cursor cursor = db.rawQuery("SELECT name FROM sqlite_master WHERE type='table' AND name=?", new String[]{c.getSimpleName()});
boolean exists = cursor.moveToFirst();
cursor.close();
LogUtils.d(" doesTableExist 判断表是否存在 "+c.getSimpleName()+" exists="+exists);
return exists;
}

private void CreateRelationshipTables(Class c, Map<String,String> map){
SQLiteDatabase db =this.getWritableDatabase();
db.beginTransaction();


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

@@ -2,6 +2,8 @@ package com.bonait.bnframework.common.db.file;

import android.util.Log;

import com.apkfuns.logutils.LogUtils;

import java.util.ArrayList;
import java.util.Map;

@@ -47,6 +49,7 @@ public class Table {
sb.deleteCharAt(sb.length()-1);
sb.append(")");
Log.i("sql:",sb.toString());
LogUtils.d(" createSQL 创建表 "+sb);
return sb.toString();
}



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

@@ -1,5 +1,7 @@
package com.bonait.bnframework.common.db.mode;

import com.google.gson.Gson;

/**
* BPA_GOODS[商品表]
* 创建人:fengyoufu add 20230412
@@ -19,4 +21,25 @@ public class BPA_GOODS extends ModeBase {
public int issc;
//工艺id
public String gyid;

@Override
public String toString() {
return "BPA_GOODS{" +
"name='" + name + '\'' +
", url='" + url + '\'' +
", sort=" + sort +
", status=" + status +
", maketime=" + maketime +
", issc=" + issc +
", gyid='" + gyid + '\'' +
", id='" + id + '\'' +
", createTime='" + createTime + '\'' +
", updateTime='" + updateTime + '\'' +
", deleteTime='" + deleteTime + '\'' +
", deviceID='" + deviceID + '\'' +
", userID='" + userID + '\'' +
", isDelete=" + isDelete +
", exp='" + exp + '\'' +
'}';
}
}

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

@@ -1,5 +1,7 @@
package com.bonait.bnframework.common.db.mode;

import androidx.annotation.NonNull;

/**
* BPA_GOODSRECIPE[商品配方明细表]
* 创建人:fengyoufu add 20230412
@@ -22,4 +24,26 @@ public class BPA_GOODSRECIPE extends ModeBase {

//模型变量
public String processvalue;

@Override
public String toString() {
return "BPA_GOODSRECIPE{" +
"goodsID='" + goodsID + '\'' +
", materialID='" + materialID + '\'' +
", value=" + value +
", sort=" + sort +
", materialType=" + materialType +
", processms='" + processms + '\'' +
", processname='" + processname + '\'' +
", processvalue='" + processvalue + '\'' +
", id='" + id + '\'' +
", createTime='" + createTime + '\'' +
", updateTime='" + updateTime + '\'' +
", deleteTime='" + deleteTime + '\'' +
", deviceID='" + deviceID + '\'' +
", userID='" + userID + '\'' +
", isDelete=" + isDelete +
", exp='" + exp + '\'' +
'}';
}
}

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

@@ -8,4 +8,20 @@ public class BPA_PROCESS extends ModeBase{
public int sort;
//名称
public String name;

@Override
public String toString() {
return "BPA_PROCESS{" +
"sort=" + sort +
", name='" + name + '\'' +
", id='" + id + '\'' +
", createTime='" + createTime + '\'' +
", updateTime='" + updateTime + '\'' +
", deleteTime='" + deleteTime + '\'' +
", deviceID='" + deviceID + '\'' +
", userID='" + userID + '\'' +
", isDelete=" + isDelete +
", exp='" + exp + '\'' +
'}';
}
}

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

@@ -25,4 +25,22 @@ public class BPA_PROCESSModel extends ModeBase{
*/
public int sort;

@Override
public String toString() {
return "BPA_PROCESSModel{" +
"processid='" + processid + '\'' +
", name='" + name + '\'' +
", datatype=" + datatype +
", data='" + data + '\'' +
", sort=" + sort +
", id='" + id + '\'' +
", createTime='" + createTime + '\'' +
", updateTime='" + updateTime + '\'' +
", deleteTime='" + deleteTime + '\'' +
", deviceID='" + deviceID + '\'' +
", userID='" + userID + '\'' +
", isDelete=" + isDelete +
", exp='" + exp + '\'' +
'}';
}
}

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

@@ -27,4 +27,29 @@ public class BPA_SILOS extends ModeBase {
public int silosmargin;
//料仓总量
public int siloszl;

@Override
public String toString() {
return "BPA_SILOS{" +
"num=" + num +
", name='" + name + '\'' +
", warningValue=" + warningValue +
", thrsoleValue=" + thrsoleValue +
", plcValue='" + plcValue + '\'' +
", bValue=" + bValue +
", jValue=" + jValue +
", status=" + status +
", Sort=" + Sort +
", silosmargin=" + silosmargin +
", siloszl=" + siloszl +
", id='" + id + '\'' +
", createTime='" + createTime + '\'' +
", updateTime='" + updateTime + '\'' +
", deleteTime='" + deleteTime + '\'' +
", deviceID='" + deviceID + '\'' +
", userID='" + userID + '\'' +
", isDelete=" + isDelete +
", exp='" + exp + '\'' +
'}';
}
}

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

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

/**
* BPA_SILOS[料仓管理表]
* 创建人:fengyoufu add 20230412
*/
public class BPA_SILOS_CALIBRATE extends ModeBase {
//料仓名称
public String name;
//料仓编号
public int num;
//输出时间最大值:s
public int outputTimeMax;
//输出时间最小值:s
public int outputTimeMin;
//输入重量最大值: g
public int inputWightMax;
//输入重量最小值: g
public int inputWightMin;


@Override
public String toString() {
return "BPA_SILOS_CALIBRATE{" +
"name='" + name + '\'' +
"num='" + num + '\'' +
", outputTimeMax=" + outputTimeMax +
", outputTimeMin=" + outputTimeMin +
", inputWightMax=" + inputWightMax +
", inputWightMin=" + inputWightMin +
", id='" + id + '\'' +
", createTime='" + createTime + '\'' +
", updateTime='" + updateTime + '\'' +
", deleteTime='" + deleteTime + '\'' +
", deviceID='" + deviceID + '\'' +
", userID='" + userID + '\'' +
", isDelete=" + isDelete +
", exp='" + exp + '\'' +
'}';
}
}

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

@@ -31,4 +31,18 @@ public class ModeBase {
isDelete=0;
//Log.i("日志","创建时间:"+ createTime);
}

@Override
public String toString() {
return "ModeBase{" +
"id='" + id + '\'' +
", createTime='" + createTime + '\'' +
", updateTime='" + updateTime + '\'' +
", deleteTime='" + deleteTime + '\'' +
", deviceID='" + deviceID + '\'' +
", userID='" + userID + '\'' +
", isDelete=" + isDelete +
", exp='" + exp + '\'' +
'}';
}
}

+ 3
- 0
app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java View File

@@ -13,6 +13,8 @@ import android.os.SystemClock;
import android.util.Log;
import android.widget.Toast;

import com.bonait.bnframework.common.constant.ConfigName;

import java.io.File;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
@@ -85,6 +87,7 @@ public class CrashHandler implements UncaughtExceptionHandler {
* @return true:��������˸��쳣��Ϣ; ���򷵻�false.
*/
private boolean handleException(Throwable ex) {
if(ConfigName.TEST) return false;
if (ex == null)
return false;



+ 15
- 0
app/src/main/java/com/bonait/bnframework/common/utils/AlertDialogUtils.java View File

@@ -1,7 +1,12 @@
package com.bonait.bnframework.common.utils;

import android.app.Activity;
import android.content.Context;

import androidx.appcompat.app.AppCompatActivity;

import com.bonait.bnframework.R;
import com.bonait.bnframework.ViewModel.CustomView.XComDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;

@@ -65,6 +70,16 @@ public class AlertDialogUtils {
.create(mCurrentDialogStyle).show();
}

/**
* 对话框,有取消确定按钮
* */
public static void showCancelAndConfirmDialog(AppCompatActivity activity, XComDialog.OnDialogListener onClickListener) {
new XComDialog(activity, R.layout.dialog_with_cancel_confirm)
.init(true, true)
.setWindowSizeMax()
.setDialogListener(onClickListener);
}

/**
* 对话框,自定义确定按钮
* */


+ 24
- 0
app/src/main/java/com/bonait/bnframework/common/utils/FileUtils.java View File

@@ -1,7 +1,11 @@
package com.bonait.bnframework.common.utils;

import android.content.Context;
import android.content.res.AssetManager;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
@@ -9,6 +13,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
@@ -1297,4 +1302,23 @@ public class FileUtils {
}
}
}

public static String getJson(String fileName, Context context) {
//将json数据变成字符串
StringBuilder stringBuilder = new StringBuilder();
try {
//获取assets资源管理器
AssetManager assetManager = context.getAssets();
//通过管理器打开文件并读取
BufferedReader bf = new BufferedReader(new InputStreamReader(
assetManager.open(fileName)));
String line;
while ((line = bf.readLine()) != null) {
stringBuilder.append(line);
}
} catch (IOException e) {
e.printStackTrace();
}
return stringBuilder.toString();
}
}

+ 13
- 3
app/src/main/res/layout/activity_bottom_navigation_new.xml View File

@@ -39,7 +39,18 @@
app:water_mark_textSize="14px" />


<com.bonait.bnframework.ViewModel.ActivityViewModel.CookingActivity
<!-- <com.bonait.bnframework.ViewModel.ActivityViewModel.CookingActivity-->
<!-- android:id="@+id/cooking"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:fitsSystemWindows="false"-->
<!-- android:background="@color/topbj1"-->
<!-- android:visibility="gone"-->
<!-- android:focusable="true"-->
<!-- android:clickable="true">-->
<!-- </com.bonait.bnframework.ViewModel.ActivityViewModel.CookingActivity>-->

<com.bonait.bnframework.ViewModel.ActivityViewModel.CookingNewActivity
android:id="@+id/cooking"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -48,8 +59,7 @@
android:visibility="gone"
android:focusable="true"
android:clickable="true">
</com.bonait.bnframework.ViewModel.ActivityViewModel.CookingActivity>

</com.bonait.bnframework.ViewModel.ActivityViewModel.CookingNewActivity>

<LinearLayout
android:id="@+id/penrenzhong"


+ 145
- 0
app/src/main/res/layout/activity_cooking_new.xml View File

@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/red_primary"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context=".ViewModel.ActivityViewModel.CookingNewActivity">

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

<!-- 其他 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="20dp"
android:layout_weight="0.95">

<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="vertical">

<TextView
android:id="@+id/goodname"
android:layout_width="340dp"
android:layout_height="wrap_content"
android:fontFamily="@font/fz2"
android:shadowColor="#65000000"
android:shadowDx="0.0"
android:shadowDy="10.0"
android:shadowRadius="6.0"
android:text="爆炒鱼香肉丝"
android:textColor="@color/black"
android:textSize="45dp" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10">

<TextView
android:id="@+id/runtime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/ziti0"
android:text="00 : 00"
android:textColor="@color/black"
android:textSize="50dp"
android:textStyle="bold" />

<com.bonait.bnframework.ViewModel.CustomView.imagebuttom
android:id="@+id/zanting_goodmake"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:contentDescription="111"
app:imagesrc_ks="@mipmap/zhizuo_zt"
app:imagesrc_tz="@mipmap/zhizuo_jx" />
</RelativeLayout>
</LinearLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">

<com.bonait.bnframework.ViewModel.CustomView.jingdutiao
android:id="@+id/t_jindu"
android:layout_width="match_parent"
android:layout_height="45dp" />
</RelativeLayout>


</LinearLayout>

<TextView
android:id="@+id/gongxumiaoshu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="步骤1 加油50g"
android:textColor="#797373"
android:layout_alignParentBottom="true"
android:textSize="32sp" />

<com.bonait.bnframework.ViewModel.CustomView.imagebuttom
android:id="@+id/start_goodmake"
android:layout_width="wrap_content"
android:layout_height="110dp"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
app:imagesrc_ks="@mipmap/zhizuo_ks"
app:imagesrc_tz="@mipmap/zhizuo_js" />

<ImageView
android:id="@+id/kancaipu"
android:layout_width="190dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="-80dp"
android:src="@mipmap/yy_h1" />

</RelativeLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2">

<ImageView
android:id="@+id/device_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:src="@mipmap/device_small_cook1" />
</RelativeLayout>
</LinearLayout>

</RelativeLayout>

<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>

+ 27
- 1
app/src/main/res/layout/activity_dishtest.xml View File

@@ -156,7 +156,14 @@
android:layout_marginLeft="25dp"
android:layout_marginTop="155dp"
android:orientation="horizontal">

<TextView
android:layout_width="90dp"
android:layout_height="wrap_content"
android:text="⑤"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:layout_width="90dp"
android:layout_height="wrap_content"
@@ -204,6 +211,16 @@
android:layout_marginTop="190dp"
android:orientation="horizontal">

<com.bonait.bnframework.ViewModel.CustomView.imagebuttom3
android:id="@+id/touliao5"
android:layout_width="90dp"
android:layout_height="110dp"
android:contentDescription=""
android:tag="投料-按钮"
app:imagesrc_ks="@mipmap/sb1"
app:imagesrc_qt="@mipmap/sb2"
app:imagesrc_tz="@mipmap/sb3" />

<com.bonait.bnframework.ViewModel.CustomView.imagebuttom3
android:id="@+id/touliao4"
android:layout_width="90dp"
@@ -644,6 +661,15 @@
android:layout_marginRight="40dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/liaohe5"
android:layout_width="87dp"
android:layout_height="75dp"
android:text=""
android:textColor="@color/white"
android:background="#567722"
android:maxLines="4"
android:ellipsize="end"/>
<TextView
android:id="@+id/liaohe4"
android:layout_marginLeft="30dp"


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

@@ -385,7 +385,7 @@
android:layout_alignParentLeft="true">
<Button
android:id="@+id/ydw"
android:layout_width="60dp"
android:layout_width="@dimen/dp_60"
android:layout_height="match_parent"
android:layout_marginRight="5dp"
android:background="@drawable/bg_btn_login_selected"


+ 1
- 0
app/src/main/res/layout/activity_diy_update1.xml View File

@@ -74,6 +74,7 @@
android:inputType="text"
android:lines="1"
android:padding="3dp"
android:maxLength="100"
android:textSize="19dp" />
</LinearLayout>



+ 119
- 0
app/src/main/res/layout/datatab/layout/silos_calibrate_item.xml View File

@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.android.com/apk/res/android ">

<TableLayout
android:background="@color/activity_background1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:stretchColumns="0">

<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">

<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:id="@+id/tv_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_alignParentLeft="true"
android:text="仓号"
android:textSize="12dp"/>
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:id="@+id/tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_alignParentLeft="true"
android:text="描述"
android:textSize="12dp"/>
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:id="@+id/tv_output_max"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_alignParentLeft="true"
android:text="0"
android:textSize="12dp"/>
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:id="@+id/tv_output_min"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_alignParentLeft="true"
android:text="0"
android:textSize="12dp"/>
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:id="@+id/tv_intput_max"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_alignParentLeft="true"
android:text="0"
android:textSize="12dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:id="@+id/tv_intput_min"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_alignParentLeft="true"
android:text="0"
android:textSize="12dp"/>
</RelativeLayout>
</TableRow>
</TableLayout>
</RelativeLayout>

+ 76
- 0
app/src/main/res/layout/dialog_with_cancel_confirm.xml View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
tools:background="#88000000">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:layout_gravity="center"
android:padding="20dp"
android:layout_margin="20dp"
>

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@string/tip_save_menu_title"
android:textStyle="bold"
android:textSize="42sp"
android:textColor="@color/black"
/>

<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@string/tip_save_menu_content"
android:textSize="38sp"
android:textColor="@color/gray_light"
android:layout_marginTop="40dp"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:maxLength="200"
android:ellipsize="middle"
/>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="50dp"
>

<TextView
android:id="@+id/tv_cancel"
android:layout_width="100dp"
android:layout_height="100dp"
android:textSize="38sp"
android:textColor="@color/blue_primary"
android:text="@string/tip_save_cancel"
android:layout_alignParentRight="true"
android:layout_marginRight="130dp"
android:gravity="center"
/>
<TextView
android:id="@+id/tv_confirm"
android:layout_width="100dp"
android:layout_height="100dp"
android:textSize="38sp"
android:textColor="@color/blue_primary"
android:text="@string/tip_save_confirm"
android:gravity="center"
android:layout_alignParentRight="true"
/>


</RelativeLayout>


</LinearLayout>

</LinearLayout>

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

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<TextView
android:id="@+id/device_error_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:textSize="32sp"
android:textColor="@color/red_primary"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
tools:text="错误码"
/>

<ImageView
android:id="@+id/device_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:src="@mipmap/device_small_cook1"
android:antialias="true"
android:layout_marginTop="50dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

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

@@ -48,13 +48,13 @@
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_margin="@dimen/dp_10"
android:antialias="true"
android:scaleType="fitXY"
android:src="@mipmap/device1"
android:antialias="true"/>
android:src="@mipmap/device1" />

<!-- 温度 -->
<LinearLayout


+ 151
- 0
app/src/main/res/layout/fragment_system_seasoningset.xml View File

@@ -4,6 +4,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context=".ViewModel.FragmentViewModel.SystemSeasoningsetFragment">
<LinearLayout
android:layout_width="match_parent"
@@ -324,6 +326,155 @@
</RelativeLayout>
</LinearLayout>

<!--料仓校准管理-->
<LinearLayout
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/qmui_config_color_white"
android:orientation="vertical"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_10">

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:id="@+id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="调料仓校准"
android:textSize="19dp" />
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_toRightOf="@id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:textColor="@color/amber_primary_dark"
android:text="(温馨提示:点击行可修改内容.)"
android:textSize="12dp" />
</RelativeLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- 表头 -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/activity_background">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:gravity="center"
android:stretchColumns="0">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:text="仓号" />
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:text="描述" />
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:text="输出时间最大值(s)" />
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">

<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:text="输出时间最小值(s)" />
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">

<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:text="输入重量最大值(g)" />
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">

<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:text="输入重量最小值(g)" />
</RelativeLayout>
</TableRow>
</TableLayout>
</RelativeLayout>
<!-- 数据 -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<ListView
android:id="@+id/datatab_silos_calibrate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="3dp"
android:divider="#00000000"
android:dividerHeight="3dp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>

<!-- 工序模型管理 -->
<LinearLayout
android:layout_marginTop="5dp"


+ 148
- 0
app/src/main/res/layout/season_jiaozhun_layout.xml View File

@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/qmui_config_color_white"
android:orientation="vertical"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_10">

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="调料仓校准"
android:textSize="19dp" />
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="80dp"
android:layout_centerVertical="true"
android:textColor="@color/amber_primary_dark"
android:text="(温馨提示:点击行可修改内容.)"
android:textSize="12dp" />
</RelativeLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_marginTop="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- 表头 -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@color/activity_background">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:gravity="center"
android:stretchColumns="0">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:text="仓号" />
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:text="描述" />
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:text="输出时间最大值(s)" />
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">

<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:text="输出时间最小值(s)" />
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">

<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:text="输入重量最大值(g)" />
</RelativeLayout>

<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">

<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:text="输入重量最小值(g)" />
</RelativeLayout>
</TableRow>
</TableLayout>
</RelativeLayout>
<!-- 数据 -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<ListView
android:id="@+id/datatab_lc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="3dp"
android:divider="#00000000"
android:dividerHeight="3dp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>

BIN
View File


BIN
View File


BIN
View File


BIN
View File


+ 1418
- 4
app/src/main/res/values/dimens.xml
File diff suppressed because it is too large
View File


+ 7
- 0
app/src/main/res/values/strings.xml View File

@@ -33,5 +33,12 @@
<string name="str_name">名称</string>
<string name="str_age">年龄</string>

<!--TODO: 提示文案-->
<string name="tip_save_menu_title">保存菜谱操作提示!</string>
<string name="tip_create_menu_title">生成菜谱操作提示!</string>
<string name="tip_save_menu_content">请问客官确定要保存[%s]菜谱吗?</string>
<string name="tip_create_menu_content">请问客官确定要生成[%s]菜谱吗?</string>
<string name="tip_save_cancel">取消</string>
<string name="tip_save_confirm">确定</string>

</resources>

+ 7
- 1
app/src/main/res/values/styles.xml View File

@@ -270,5 +270,11 @@
<!-- 屏幕背景是否变暗 -->
<item name="android:backgroundDimAmount">0.3</item>
</style>

<!--=======通用弹框主题============-->
<style name="dialogCommonTheme" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimAmount">0.4</item><!--弹框背景灰度-->
</style>
</resources>

Loading…
Cancel
Save