Browse Source

燃气炒锅完善优化

燃气自翻炒锅
pry 9 months ago
parent
commit
2dd763efd1
33 changed files with 970 additions and 423 deletions
  1. +2
    -2
      app/build.gradle
  2. +36
    -13
      app/src/main/java/com/bonait/bnframework/business/DeviceData.java
  3. +13
    -6
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  4. +14
    -0
      app/src/main/java/com/bonait/bnframework/common/helper/DataUtil/BitLib.java
  5. +10
    -0
      app/src/main/java/com/bonait/bnframework/common/helper/GifStatus.java
  6. +2
    -6
      app/src/main/java/com/bonait/bnframework/common/modbus/s7/CommHelper.java
  7. +41
    -84
      app/src/main/java/com/bonait/bnframework/common/modbus/s7/SiemensHelper.java
  8. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/utils/UpdateAppUtils.java
  9. +213
    -0
      app/src/main/java/com/bonait/bnframework/custom_view/ShadowContainer.java
  10. +6
    -6
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/DingDanfragment.java
  11. +15
    -14
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/GongnengFragment.java
  12. +4
    -4
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/HandControlFragment.java
  13. +130
    -50
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java
  14. BIN
     
  15. BIN
     
  16. BIN
     
  17. BIN
     
  18. BIN
     
  19. BIN
     
  20. BIN
     
  21. BIN
     
  22. BIN
     
  23. +10
    -0
      app/src/main/res/drawable/shadow_container_bg.xml
  24. +5
    -6
      app/src/main/res/layout/fragment_ding_dan.xml
  25. +385
    -200
      app/src/main/res/layout/fragment_gongneng.xml
  26. +65
    -30
      app/src/main/res/layout/fragment_make_main.xml
  27. BIN
     
  28. BIN
     
  29. BIN
     
  30. BIN
     
  31. +3
    -0
      app/src/main/res/values/attr.xml
  32. +12
    -0
      app/src/main/res/values/attrs.xml
  33. +3
    -1
      app/src/main/res/values/dimens.xml

+ 2
- 2
app/build.gradle View File

@@ -168,8 +168,8 @@ dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'

//gif加载包
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'

//曲线
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'


+ 36
- 13
app/src/main/java/com/bonait/bnframework/business/DeviceData.java View File

@@ -3,20 +3,7 @@ package com.bonait.bnframework.business;
import com.bonait.bnframework.common.helper.NotifyPropVar;

public class DeviceData {
/**
* 搅拌上限
*/
public boolean MixingUpperLimit;

/**
* 搅拌下限
*/
public boolean MixingLowerLimit;

/**
* 锅后限位
*/
public boolean PostPotLimit;

/**
* 搅拌原点
@@ -61,6 +48,22 @@ public class DeviceData {

//region 通知属性

/**
* 搅拌上限
*/
public NotifyPropVar<Boolean> MixingUpperLimit=new NotifyPropVar<>(false);

/**
* 搅拌下限
*/
public NotifyPropVar<Boolean> MixingLowerLimit=new NotifyPropVar<>(false);

/**
* 锅后限位
*/
public NotifyPropVar<Boolean> PostPotLimit=new NotifyPropVar<>(false);


/**
* 搅拌状态监控
*/
@@ -200,6 +203,26 @@ public class DeviceData {
* 搅拌运行状态
*/
public NotifyPropVar<Boolean> MixingState=new NotifyPropVar<>(false);

/**
* 搅拌上升运行状态
*/
public NotifyPropVar<Boolean> StirringUpState=new NotifyPropVar<>(false);

/**
* 搅拌下降运行状态
*/
public NotifyPropVar<Boolean> StirringDownState=new NotifyPropVar<>(false);

/**
* 炒锅上升运行状态
*/
public NotifyPropVar<Boolean> FryingPanUpState=new NotifyPropVar<>(false);

/**
* 炒锅下降运行状态
*/
public NotifyPropVar<Boolean> FryingPanDownState=new NotifyPropVar<>(false);
//endregion




+ 13
- 6
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -15,6 +15,7 @@ import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.helper.AlertDialogButton;
import com.bonait.bnframework.common.helper.Convert;
import com.bonait.bnframework.common.helper.DataUtil.BitLib;
import com.bonait.bnframework.common.helper.Executor;
import com.bonait.bnframework.common.helper.I.IDialogAction;
import com.bonait.bnframework.common.helper.I.IRunT;
@@ -117,9 +118,9 @@ public class ExecuteTheRecipe {
@Override
public void Run() throws InterruptedException {

Convert.TryToBoolean(ReadPLC("监控_搅拌上限")).OnSource(s->{ getDeviceData.MixingUpperLimit=s.Content;});
Convert.TryToBoolean(ReadPLC("监控_搅拌下限")).OnSource(s->{ getDeviceData.MixingLowerLimit=s.Content;});
Convert.TryToBoolean(ReadPLC("监控_锅后限位")).OnSource(s->{ getDeviceData.PostPotLimit=s.Content;});
Convert.TryToBoolean(ReadPLC("监控_搅拌上限")).OnSource(s->{ getDeviceData.MixingUpperLimit.setValue(s.Content);});
Convert.TryToBoolean(ReadPLC("监控_搅拌下限")).OnSource(s->{ getDeviceData.MixingLowerLimit.setValue(s.Content);});
Convert.TryToBoolean(ReadPLC("监控_锅后限位")).OnSource(s->{ getDeviceData.PostPotLimit.setValue(s.Content);});
Convert.TryToBoolean(ReadPLC("监控_点火正常")).OnSource(s->{ getDeviceData.IgnitionNormal=s.Content;});
Convert.TryToBoolean(ReadPLC("监控_点火异常")).OnSource(s->{ getDeviceData.IgnitionError=s.Content;});
Convert.TryToBoolean(ReadPLC("监控_搅拌原点")).OnSource(s->{ getDeviceData.MixingOrigin=s.Content;});
@@ -128,9 +129,9 @@ public class ExecuteTheRecipe {
Convert.TryToFloat(ReadPLC("炒锅当前重量")).OnSource(s->{ getDeviceData.CurrentWeight=s.Content;});
Convert.TryToFloat(ReadPLC("炒锅当前温度")).OnSource(s->{ getDeviceData.CurrentTemperature=s.Content;});

MonitoringStatus.put("监控_搅拌上限",getDeviceData.MixingUpperLimit);
MonitoringStatus.put("监控_搅拌下限",getDeviceData.MixingLowerLimit);
MonitoringStatus.put("监控_锅后限位",getDeviceData.PostPotLimit);
MonitoringStatus.put("监控_搅拌上限",getDeviceData.MixingUpperLimit.getValue());
MonitoringStatus.put("监控_搅拌下限",getDeviceData.MixingLowerLimit.getValue());
MonitoringStatus.put("监控_锅后限位",getDeviceData.PostPotLimit.getValue());
MonitoringStatus.put("监控_点火正常",getDeviceData.IgnitionNormal);
MonitoringStatus.put("监控_搅拌原点",getDeviceData.MixingOrigin);
MonitoringStatus.put("监控_急停按钮",getDeviceData.EStop);
@@ -166,6 +167,12 @@ public class ExecuteTheRecipe {
Convert.TryToInt(ReadPLC("输入IO")).OnSource(s->{getDeviceData.InputStatus=s.Content;});
Convert.TryToInt(ReadPLC("输出IO")).OnSource(s->{getDeviceData.OutputStatus=s.Content;});


getDeviceData.StirringUpState.setValue( BitLib.getBitFormInt(getDeviceData.OutputStatus,10));
getDeviceData.StirringDownState.setValue( BitLib.getBitFormInt(getDeviceData.OutputStatus,11));
getDeviceData.FryingPanDownState.setValue( BitLib.getBitFormInt(getDeviceData.OutputStatus,12));
getDeviceData.FryingPanUpState.setValue( BitLib.getBitFormInt(getDeviceData.OutputStatus,13));

MonitoringStatus.put("急停按下!",getDeviceData.EstopFaultNotify.getValue());
MonitoringStatus.put("油泵故障!",getDeviceData.OilPumpFault.getValue());
MonitoringStatus.put("搅拌故障!",getDeviceData.MixingFailure.getValue());


+ 14
- 0
app/src/main/java/com/bonait/bnframework/common/helper/DataUtil/BitLib.java View File

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

public class BitLib {
public static boolean getBitFormInt(int data,int offset){
if (offset > 31 || offset < 0) {return false;}
if(offset>=0&&offset<=7){
return (data&(1<<offset+8))!=0;
}
if(offset>7){
return (data&(1<<offset-8))!=0;
}
return false;
}
}

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

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

public enum GifStatus {
None,
MixingState,
StirringUpState,
StirringDownState,
FryingPanUpState,
FryingPanDownState
}

+ 2
- 6
app/src/main/java/com/bonait/bnframework/common/modbus/s7/CommHelper.java View File

@@ -24,7 +24,7 @@ public class CommHelper {
return mInstance;
}
public boolean IsConnected(){
return siemens.IsConnected;
return siemens.IsConnected.getValue();
}
public IRun ConnectOk;

@@ -48,7 +48,7 @@ public class CommHelper {
}
}
if(ConnectOk!=null)ConnectOk.Run();
siemens.IsConnected=true;
siemens.IsConnected.setValue(true);
MessageLog.ShowInfo("PLC连接成功");
}
}).start();
@@ -85,10 +85,6 @@ public class CommHelper {
}

public Object readPLC(String add){
// if(!IsConnected()) {
// MessageLog.ShowInfo(add+":读取数据失败,连接已断开");
// return new Object();
// }
try{
if(add.toUpperCase().contains("VD")){
return siemens.ReadFloat32(add);


+ 41
- 84
app/src/main/java/com/bonait/bnframework/common/modbus/s7/SiemensHelper.java View File

@@ -5,6 +5,7 @@ import static com.github.xingshuangs.iot.common.constant.GeneralConst.S7_PORT;
import android.util.Log;

import com.bonait.bnframework.common.helper.MessageLog;
import com.bonait.bnframework.common.helper.NotifyPropVar;
import com.github.xingshuangs.iot.exceptions.SocketRuntimeException;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.github.xingshuangs.iot.protocol.s7.model.DataItem;
@@ -35,8 +36,9 @@ public class SiemensHelper extends S7PLC {
// return false;
// }
// }
public NotifyPropVar<Boolean> IsConnected=new NotifyPropVar<Boolean>(false);

public Boolean IsConnected=false;
// public Boolean IsConnected.setValue(false);

public boolean CancelWrite=false;

@@ -50,20 +52,16 @@ public class SiemensHelper extends S7PLC {
}

public boolean ReadBoolean(String address){
// if(!IsConnected){
// MessageLog.ShowInfo(address+":读取数据失败,连接已断开");
// return false;
// }
boolean result=false;
while(true){
try {
result=this.readBoolean(address);
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(1000);
}
}
@@ -71,20 +69,16 @@ public class SiemensHelper extends S7PLC {
}

public List<Boolean> ReadBoolean(String... address) {
// if(!IsConnected){
// MessageLog.ShowInfo(address+":读取数据失败,连接已断开");
// return new ArrayList<Boolean>();
// }
List<Boolean> result=new ArrayList<>();
while(true){
try {
result=this.readBoolean(Arrays.asList(address));
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(1000);
}
}
@@ -92,22 +86,17 @@ public class SiemensHelper extends S7PLC {
}

public short ReadInt16(String address) {
// if(!IsConnected){
// MessageLog.ShowInfo(address+":读取数据失败,连接已断开");
// return 0;
// }

short result=0;
while(true){
try {
DataItem dataItem = this.readS7Data(AddressUtil.parseByte(address, 2));
result= ShortUtil.toInt16(dataItem.getData());
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(1000);
}
}
@@ -116,20 +105,16 @@ public class SiemensHelper extends S7PLC {
}

public List<Short> ReadInt16(String... address) {
// if(!IsConnected){
// MessageLog.ShowInfo(address+":读取数据失败,连接已断开");
// return new ArrayList<Short>();
// }
List<Short> result=new ArrayList<>();
while(true){
try {
result=this.readInt16(Arrays.asList(address));
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(1000);
}
}
@@ -138,22 +123,17 @@ public class SiemensHelper extends S7PLC {
}

public int ReadUInt16(String address) {
// if(!IsConnected){
// MessageLog.ShowInfo(address+":读取数据失败,连接已断开");
// return 0;
// }

int result=0;
while(true){
try {
DataItem dataItem = this.readS7Data(AddressUtil.parseByte(address, 2));
result= ShortUtil.toUInt16(dataItem.getData());
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(1000);
}
}
@@ -161,21 +141,16 @@ public class SiemensHelper extends S7PLC {
}

public List<Integer> ReadUInt16(String... address) {
// if(!IsConnected){
// MessageLog.ShowInfo(address+":读取数据失败,连接已断开");
// return new ArrayList<Integer>();
// }

List<Integer> result=new ArrayList<>();
while(true){
try {
result=this.readUInt16(Arrays.asList(address));
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(1000);
}
}
@@ -183,21 +158,17 @@ public class SiemensHelper extends S7PLC {
}

public int ReadInt32(String address) {
// if(!IsConnected){
// MessageLog.ShowInfo(address+":读取数据失败,连接已断开");
// return 0;
// }
int result=0;
while(true){
try {
DataItem dataItem = this.readS7Data(AddressUtil.parseByte(address, 4));
result= IntegerUtil.toInt32(dataItem.getData());
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(1000);
}
}
@@ -205,20 +176,16 @@ public class SiemensHelper extends S7PLC {
}

public List<Integer> ReadInt32(String... address) {
// if(!IsConnected){
// MessageLog.ShowInfo(address+":读取数据失败,连接已断开");
// return new ArrayList<Integer>();
// }
List<Integer> result=new ArrayList<>();
while(true){
try {
result=this.readInt32(Arrays.asList(address));
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(1000);
}
}
@@ -226,23 +193,17 @@ public class SiemensHelper extends S7PLC {
}

public float ReadFloat32(String address) {
// if(!IsConnected){
// MessageLog.ShowInfo(address+":读取数据失败,连接已断开");
// return 0;
// }

float result=0f;
while(true){
try {
DataItem dataItem = this.readS7Data(AddressUtil.parseByte(address, 4));
result= FloatUtil.toFloat32(dataItem.getData());

IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(1000);
}
}
@@ -250,20 +211,16 @@ public class SiemensHelper extends S7PLC {
}

public List<Float> ReadFloat32(String... address) {
// if(!IsConnected){
// MessageLog.ShowInfo(address+":读取数据失败,连接已断开");
// return new ArrayList<Float>();
// }
List<Float> result=new ArrayList<>();
while(true){
try {
result=this.readFloat32(Arrays.asList(address));
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(1000);
}
}
@@ -271,19 +228,19 @@ public class SiemensHelper extends S7PLC {
}

public void WriteBoolean(String address, boolean data) {
if(!IsConnected){
if(!IsConnected.getValue()){
MessageLog.ShowInfo(address+":写入数据失败,连接已断开");
return;
}
while (true) {
try {
this.writeS7Data(AddressUtil.parseBit(address), DataItem.createReqByBoolean(data));
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(100);
if(CancelWrite)break;
}
@@ -295,19 +252,19 @@ public class SiemensHelper extends S7PLC {
}

public void WriteUInt16(String address, int data) {
if(!IsConnected){
if(!IsConnected.getValue()){
MessageLog.ShowInfo(address+":写入数据失败,连接已断开");
return;
}
while (true) {
try {
this.writeByte(address, ShortUtil.toByteArray(data));
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(100);
if(CancelWrite)break;
}
@@ -319,7 +276,7 @@ public class SiemensHelper extends S7PLC {
}

public void WriteInt16(String address, short data) {
if(!IsConnected){
if(!IsConnected.getValue()){
MessageLog.ShowInfo(address+":写入数据失败,连接已断开");
return;
}
@@ -327,13 +284,13 @@ public class SiemensHelper extends S7PLC {
try {
Log.e("info","准备写入数据:"+data);
this.writeByte(address, ShortUtil.toByteArray(data));
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
Log.e("socketException","写入:"+data+"失败");
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(100);
if(CancelWrite)break;
}
@@ -345,19 +302,19 @@ public class SiemensHelper extends S7PLC {
}

public void WriteUInt32(String address, long data) {
if(!IsConnected){
if(!IsConnected.getValue()){
MessageLog.ShowInfo(address+":写入数据失败,连接已断开");
return;
}
while (true) {
try {
this.writeByte(address, IntegerUtil.toByteArray(data));
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(100);
if(CancelWrite)break;
}
@@ -369,19 +326,19 @@ public class SiemensHelper extends S7PLC {
}

public void WriteInt32(String address, int data) {
if(!IsConnected){
if(!IsConnected.getValue()){
MessageLog.ShowInfo(address+":写入数据失败,连接已断开");
return;
}
while (true) {
try {
this.writeByte(address, IntegerUtil.toByteArray(data));
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(100);
if(CancelWrite)break;
}
@@ -393,19 +350,19 @@ public class SiemensHelper extends S7PLC {
}

public void WriteFloat32(String address, float data) {
if(!IsConnected){
if(!IsConnected.getValue()){
MessageLog.ShowInfo(address+":写入数据失败,连接已断开");
return;
}
while (true) {
try {
this.writeByte(address, FloatUtil.toByteArray(data));
IsConnected=true;
IsConnected.setValue(true);
break;
}
catch(SocketRuntimeException ex){
this.close();
IsConnected=false;
IsConnected.setValue(false);
Delay(100);
if(CancelWrite)break;
}


+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/utils/UpdateAppUtils.java View File

@@ -45,7 +45,7 @@ public class UpdateAppUtils {
/**
* 当前版本号
*/
private static String myVersionCode = "1.9";
private static String myVersionCode = "1.12";
/**
* 服务器的版本号
*/


+ 213
- 0
app/src/main/java/com/bonait/bnframework/custom_view/ShadowContainer.java View File

@@ -0,0 +1,213 @@
package com.bonait.bnframework.custom_view;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

import com.bonait.bnframework.R;


/**
* 阴影容器
* 需要在 res->values->attrs.xml中添加以下内容
* <declare-styleable name="ShadowContainer">
* <attr name="containerShadowColor" format="color" /><!--阴影颜色-->
* <attr name="containerShadowRadius" format="dimension" /><!--阴影半径-->
* <attr name="containerDeltaLength" format="dimension" /><!--子View到ShadowContainer的距离-->
* <attr name="containerCornerRadius" format="dimension" /><!--子View背景的圆角大小-->
* <attr name="deltaX" format="dimension" />
* <attr name="deltaY" format="dimension" />
* <attr name="enable" format="boolean" />
* </declare-styleable>
* Reference: https://github.com/cjlemon/Shadow
*/
public class ShadowContainer extends ViewGroup {

private final float deltaLength;
private final float cornerRadius;
private final Paint mShadowPaint;
private boolean drawShadow;

public ShadowContainer(Context context) {
this(context, null);
}

public ShadowContainer(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}

public ShadowContainer(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ShadowContainer);
int shadowColor = a.getColor(R.styleable.ShadowContainer_containerShadowColor, Color.RED);
float shadowRadius = a.getDimension(R.styleable.ShadowContainer_containerShadowRadius, 0);
deltaLength = a.getDimension(R.styleable.ShadowContainer_containerDeltaLength, 0);
cornerRadius = a.getDimension(R.styleable.ShadowContainer_containerCornerRadius, 0);
float dx = a.getDimension(R.styleable.ShadowContainer_deltaX, 0);
float dy = a.getDimension(R.styleable.ShadowContainer_deltaY, 0);
drawShadow = a.getBoolean(R.styleable.ShadowContainer_enable, true);
a.recycle();
mShadowPaint = new Paint();
mShadowPaint.setStyle(Paint.Style.FILL);
mShadowPaint.setAntiAlias(true);
mShadowPaint.setColor(shadowColor);
mShadowPaint.setShadowLayer(shadowRadius, dx, dy, shadowColor);
}

@Override
protected void dispatchDraw(Canvas canvas) {
if (drawShadow) {
/*
setShadowLayer()/setMaskFilter is not support hardware acceleration, so using LAYER_TYPE_SOFTWARE, but software layers isn't always good.
LAYER_TYPE_SOFTWARE: software layers should be avoided when the affected view tree updates often.
*/
if (getLayerType() != LAYER_TYPE_SOFTWARE) {
setLayerType(LAYER_TYPE_SOFTWARE, null);
}
View child = getChildAt(0);
int left = child.getLeft();
int top = child.getTop();
int right = child.getRight();
int bottom = child.getBottom();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
canvas.drawRoundRect(left, top, right, bottom, cornerRadius, cornerRadius, mShadowPaint);
} else {
Path drawablePath = new Path();
drawablePath.moveTo(left + cornerRadius, top);
drawablePath.arcTo(new RectF(left, top, left + 2 * cornerRadius, top + 2 * cornerRadius), -90, -90, false);
drawablePath.lineTo(left, bottom - cornerRadius);
drawablePath.arcTo(new RectF(left, bottom - 2 * cornerRadius, left + 2 * cornerRadius, bottom), 180, -90, false);
drawablePath.lineTo(right - cornerRadius, bottom);
drawablePath.arcTo(new RectF(right - 2 * cornerRadius, bottom - 2 * cornerRadius, right, bottom), 90, -90, false);
drawablePath.lineTo(right, top + cornerRadius);
drawablePath.arcTo(new RectF(right - 2 * cornerRadius, top, right, top + 2 * cornerRadius), 0, -90, false);
drawablePath.close();
canvas.drawPath(drawablePath, mShadowPaint);
}
}
super.dispatchDraw(canvas);
}

/**
* setMeasuredDimension(): store the modified width and modified height.
*
* @param widthMeasureSpec the original width
* @param heightMeasureSpec the original height
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (getChildCount() != 1) {
throw new IllegalStateException("Child View can have only one!!!");
}
int measuredWidth = getMeasuredWidth();
int measuredHeight = getMeasuredHeight();
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
View child = getChildAt(0);
MarginLayoutParams layoutParams = (MarginLayoutParams) child.getLayoutParams();
int childBottomMargin = (int) (Math.max(deltaLength, layoutParams.bottomMargin) + 1);
int childLeftMargin = (int) (Math.max(deltaLength, layoutParams.leftMargin) + 1);
int childRightMargin = (int) (Math.max(deltaLength, layoutParams.rightMargin) + 1);
int childTopMargin = (int) (Math.max(deltaLength, layoutParams.topMargin) + 1);
int widthMeasureSpecMode;
int widthMeasureSpecSize;
int heightMeasureSpecMode;
int heightMeasureSpecSize;
if (widthMode == MeasureSpec.UNSPECIFIED) {
widthMeasureSpecMode = MeasureSpec.UNSPECIFIED;
widthMeasureSpecSize = MeasureSpec.getSize(widthMeasureSpec);
} else {
if (layoutParams.width == MarginLayoutParams.MATCH_PARENT) {
widthMeasureSpecMode = MeasureSpec.EXACTLY;
widthMeasureSpecSize = measuredWidth - childLeftMargin - childRightMargin;
} else if (MarginLayoutParams.WRAP_CONTENT == layoutParams.width) {
widthMeasureSpecMode = MeasureSpec.AT_MOST;
widthMeasureSpecSize = measuredWidth - childLeftMargin - childRightMargin;
} else {
widthMeasureSpecMode = MeasureSpec.EXACTLY;
widthMeasureSpecSize = layoutParams.width;
}
}
if (heightMode == MeasureSpec.UNSPECIFIED) {
heightMeasureSpecMode = MeasureSpec.UNSPECIFIED;
heightMeasureSpecSize = MeasureSpec.getSize(heightMeasureSpec);
} else {
if (layoutParams.height == MarginLayoutParams.MATCH_PARENT) {
heightMeasureSpecMode = MeasureSpec.EXACTLY;
heightMeasureSpecSize = measuredHeight - childBottomMargin - childTopMargin;
} else if (MarginLayoutParams.WRAP_CONTENT == layoutParams.height) {
heightMeasureSpecMode = MeasureSpec.AT_MOST;
heightMeasureSpecSize = measuredHeight - childBottomMargin - childTopMargin;
} else {
heightMeasureSpecMode = MeasureSpec.EXACTLY;
heightMeasureSpecSize = layoutParams.height;
}
}
measureChild(child, MeasureSpec.makeMeasureSpec(widthMeasureSpecSize, widthMeasureSpecMode), MeasureSpec.makeMeasureSpec(heightMeasureSpecSize, heightMeasureSpecMode));
int parentWidthMeasureSpec = MeasureSpec.getMode(widthMeasureSpec);
int parentHeightMeasureSpec = MeasureSpec.getMode(heightMeasureSpec);
int height = measuredHeight;
int width = measuredWidth;
int childHeight = child.getMeasuredHeight();
int childWidth = child.getMeasuredWidth();
if (parentHeightMeasureSpec == MeasureSpec.AT_MOST) {
height = childHeight + childTopMargin + childBottomMargin;
}
if (parentWidthMeasureSpec == MeasureSpec.AT_MOST) {
width = childWidth + childRightMargin + childLeftMargin;
}
if (width < childWidth + 2 * deltaLength) {
width = (int) (childWidth + 2 * deltaLength);
}
if (height < childHeight + 2 * deltaLength) {
height = (int) (childHeight + 2 * deltaLength);
}
if (height != measuredHeight || width != measuredWidth) {
setMeasuredDimension(width, height);
}
}

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
View child = getChildAt(0);
int measuredWidth = getMeasuredWidth();
int measuredHeight = getMeasuredHeight();
int childMeasureWidth = child.getMeasuredWidth();
int childMeasureHeight = child.getMeasuredHeight();
child.layout((measuredWidth - childMeasureWidth) / 2, (measuredHeight - childMeasureHeight) / 2, (measuredWidth + childMeasureWidth) / 2, (measuredHeight + childMeasureHeight) / 2);
}

@Override
protected LayoutParams generateDefaultLayoutParams() {
return new MarginLayoutParams(MarginLayoutParams.WRAP_CONTENT, MarginLayoutParams.WRAP_CONTENT);
}

@Override
protected LayoutParams generateLayoutParams(LayoutParams p) {
return new MarginLayoutParams(p);
}

@Override
public LayoutParams generateLayoutParams(AttributeSet attrs) {
return new MarginLayoutParams(getContext(), attrs);
}

public void setDrawShadow(boolean drawShadow) {
if (this.drawShadow == drawShadow) {
return;
}
this.drawShadow = drawShadow;
postInvalidate();
}

}


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

@@ -43,8 +43,8 @@ import butterknife.OnClick;

public class DingDanfragment extends BaseFragment {

@BindView(R.id.topbar)
QMUITopBarLayout mTopBar;//顶部标题
// @BindView(R.id.topbar)
// QMUITopBarLayout mTopBar;//顶部标题

/**
* 输入框
@@ -111,15 +111,15 @@ public class DingDanfragment extends BaseFragment {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
context = getContext();
initTopBar();
// initTopBar();
}

/**
* 初始化TopBar
*/
private void initTopBar() {
mTopBar.setTitle("过程数据");
}
// private void initTopBar() {
// mTopBar.setTitle("过程数据");
// }

/**
* 初始化


+ 15
- 14
app/src/main/java/com/bonait/bnframework/modules/home/fragment/GongnengFragment.java View File

@@ -26,8 +26,8 @@ import butterknife.OnClick;

public class GongnengFragment extends BaseFragment {

@BindView(R.id.topbar)
QMUITopBarLayout mTopBar;//顶部标题
// @BindView(R.id.topbar)
// QMUITopBarLayout mTopBar;//顶部标题

private Context context;

@@ -45,33 +45,34 @@ public class GongnengFragment extends BaseFragment {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
context = getContext();
initTopBar();
// initTopBar();
}

/**
* 初始化TopBar
*/
private void initTopBar() {
mTopBar.setTitle("功能菜单");
}
@OnClick({R.id.jcsjgl,R.id.lcgl,R.id.yfpf,R.id.log,R.id.ssjk})
// private void initTopBar() {
// mTopBar.setTitle("功能菜单");
// }
// @OnClick({R.id.jcsjgl,R.id.lcgl,R.id.yfpf,R.id.log,R.id.ssjk})
@OnClick({R.id.material_management,R.id.recipe_managerment,R.id.warehouse_management,R.id.log_info})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.jcsjgl://
case R.id.material_management://
skipToActivity(JcsjglActivity.class);
break;
case R.id.lcgl://
case R.id.warehouse_management://
skipToActivity(SilosNewActivity.class);
break;
case R.id.yfpf://
case R.id.recipe_managerment://
skipToActivity(CpActivity.class);
break;
case R.id.log://
case R.id.log_info://
skipToActivity(LogActivity.class);
break;
case R.id.ssjk://
skipToActivity(RealTimeActivity.class);
break;
// case R.id.ssjk://
// skipToActivity(RealTimeActivity.class);
// break;
}
}



+ 4
- 4
app/src/main/java/com/bonait/bnframework/modules/home/fragment/HandControlFragment.java View File

@@ -493,10 +493,10 @@ public class HandControlFragment extends BaseFragment {
CurrentTemp.setText(String.format("%.2f",ExecuteTheRecipe.getDeviceData.CurrentTemperature) + " ℃");//锅体温度
});

SetImageViewUrl(image_搅拌上升, ExecuteTheRecipe.getDeviceData.MixingUpperLimit, 1);
SetImageViewUrl(image_搅拌下降, ExecuteTheRecipe.getDeviceData.MixingLowerLimit, 1);
SetImageViewUrl(image_锅后仰, ExecuteTheRecipe.getDeviceData.PostPotLimit, 1);
SetImageViewUrl(image_锅前倾,ExecuteTheRecipe.getDeviceData.PostPotLimit, 0);
SetImageViewUrl(image_搅拌上升, ExecuteTheRecipe.getDeviceData.MixingUpperLimit.getValue(), 1);
SetImageViewUrl(image_搅拌下降, ExecuteTheRecipe.getDeviceData.MixingLowerLimit.getValue(), 1);
SetImageViewUrl(image_锅后仰, ExecuteTheRecipe.getDeviceData.PostPotLimit.getValue(), 1);
SetImageViewUrl(image_锅前倾,ExecuteTheRecipe.getDeviceData.PostPotLimit.getValue(), 0);

Thread.sleep(1000);
}


+ 130
- 50
app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java View File

@@ -46,6 +46,8 @@ import com.bonait.bnframework.common.db.res.StatusMode;
import com.bonait.bnframework.common.helper.AlertDialogButton;
import com.bonait.bnframework.common.helper.CountDownTimerExt;
import com.bonait.bnframework.common.helper.Convert;
import com.bonait.bnframework.common.helper.Executor;
import com.bonait.bnframework.common.helper.GifStatus;
import com.bonait.bnframework.common.helper.I.IDialogAction;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.helper.I.IRunT;
@@ -64,6 +66,13 @@ import com.bonait.bnframework.custom_view.DashboardView4;
import com.bonait.bnframework.modules.home.adapter.devicestatus_adapter;
import com.bonait.bnframework.modules.home.fragment.from.CpxzActivity;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.request.RequestFutureTarget;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.capton.colorfulprogressbar.ColorfulProgressbar;
import com.google.gson.Gson;
import com.litao.slider.NiftySlider;
@@ -85,8 +94,8 @@ import butterknife.OnClick;

public class MakeGoodFragment extends BaseFragment {
//region 变量
@BindView(R.id.topbar)
QMUITopBarLayout mTopBar;//顶部标题
// @BindView(R.id.topbar)
// QMUITopBarLayout mTopBar;//顶部标题

@BindView(R.id.recycler_view_sbzt)
RecyclerView recycler_view_sbzt;
@@ -112,21 +121,12 @@ public class MakeGoodFragment extends BaseFragment {
@BindView(R.id.gongxumiaoshu)
TextView gongxumiaoshu;//工序描述

// @BindView(R.id.main_weight)
// TextView main_weight;

// @BindView(R.id.main_temp)
// TextView main_temp;

@BindView(R.id.image_frying)
ImageView img_gif;

/**
* 炒锅搅拌动画
*/
@BindView(R.id.gif_fire)
ImageView gif_fire;

@BindView(R.id.image_firypan_png)
ImageView img_png;

//搅拌报警
@BindView(R.id.alarm_Stir)
RelativeLayout alarm_Stir;
@@ -153,10 +153,23 @@ public class MakeGoodFragment extends BaseFragment {
@BindView(R.id.DB_Weight)
DashboardView4 DB_Weight;

//region 测试按钮
@BindView(R.id.btn_jb_test)
Button btn_jb_test;

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

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


/**
* 当前制作商品信息
*/
BPA_GOODS good = null;
private GifStatus gifStatus= GifStatus.None;
private Context context;
//endregion

@@ -181,21 +194,18 @@ public class MakeGoodFragment extends BaseFragment {
ExecuteTheRecipe.mainContext=context;
ExecuteTheRecipe.mainActivity=activity;
AlertDialogUtils.getContext=context;
NotifyProp();
initTopBar();
Initdata();
DialogManager.Init(context,activity);
CommHelper.get().ConnectOk = new IRun() {
@Override
public void Run() {
ConfigData.getInstance().PLC_Init();
StatusOrMakeGoodThread();
ExecuteTheRecipe.DeviceMonitor();
}
CommHelper.get().ConnectOk =()->{
ConfigData.getInstance().PLC_Init();
StatusOrMakeGoodThread();
ExecuteTheRecipe.DeviceMonitor();
};
CommHelper.get().Connect();

DashboardInit();

NotifyProp();
}

/**
@@ -267,34 +277,107 @@ public class MakeGoodFragment extends BaseFragment {
});};

//搅拌运行状态
ExecuteTheRecipe.getDeviceData.MixingState.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{
if(s){
img_gif.setVisibility(View.VISIBLE);
img_png.setVisibility(View.GONE);
}else{
img_gif.setVisibility(View.GONE);
img_png.setVisibility(View.VISIBLE);
ExecuteTheRecipe.getDeviceData.MixingState.Register("主界面搅拌状态",(s)->{getActivity().runOnUiThread(()->{
if(s) Glide.with(getActivity()).asGif().load(R.drawable.stir_rotate).into(gif_fire);
else Glide.with(getActivity()).asBitmap().load(R.drawable.stir_rotate).into(gif_fire);
});});

//搅拌上升状态通知
ExecuteTheRecipe.getDeviceData.StirringUpState.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{
if(s&&gifStatus!= GifStatus.StirringUpState) {
playGif(R.drawable.mixing_arm_up);
gifStatus=GifStatus.StirringUpState;
}
});};

//搅拌下降状态通知
ExecuteTheRecipe.getDeviceData.StirringDownState.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{
if(s&&gifStatus!= GifStatus.StirringDownState) {
playGif(R.drawable.mixing_arm_down);
gifStatus=GifStatus.StirringDownState;
}
});};

Glide.with(this).load(R.drawable.frying_pan).into(img_gif);//动图加载
// Glide.with(this).load(R.drawable.fire).into(gif_fire);
img_gif.setVisibility(View.GONE);
img_png.setVisibility(View.VISIBLE);
//炒锅上升状态
ExecuteTheRecipe.getDeviceData.FryingPanUpState.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{
if(s&&gifStatus!= GifStatus.FryingPanUpState) {
playGif(R.drawable.frying_pan_down);
gifStatus=GifStatus.FryingPanUpState;
}
});};

//炒锅下降状态
ExecuteTheRecipe.getDeviceData.FryingPanDownState.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{
if(s&&gifStatus!= GifStatus.FryingPanDownState) {
playGif(R.drawable.frying_pan_up);
gifStatus=GifStatus.FryingPanDownState;
}
});};

LoadGif();

alarm_EStop.setVisibility(View.GONE);
alarm_OilPump.setVisibility(View.GONE);
alarm_Stir.setVisibility(View.GONE);
alarm_StirUpTrouble.setVisibility(View.GONE);
alarm_HeigTemperature.setVisibility(View.GONE);
// Test();
}

private void LoadGif(){
Glide.with(this).asBitmap().load(R.drawable.stir_rotate).into(gif_fire);//动图gif第一帧
}

private void playGif(int id){
Glide.get(getActivity()).clearMemory();
RequestOptions options=new RequestOptions().skipMemoryCache(true);
// Glide.with(getActivity()).asBitmap().apply(options).load(id).placeholder(gif_fire.getDrawable()).dontAnimate().into(gif_fire);
Glide.with(getActivity()).asGif().apply(options).load(id).listener(new RequestListener<GifDrawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) {
if(resource instanceof GifDrawable) {
resource.setLoopCount(1);
}
return false;
}
}).into(gif_fire);
}

private void Test(){
btn_jb_test.setOnClickListener((view)->{
ExecuteTheRecipe.getDeviceData.MixingState.setValue(!ExecuteTheRecipe.getDeviceData.MixingState.getValue());
});
btn_jbb_test.setOnClickListener((view)->
{
if( ExecuteTheRecipe.getDeviceData.StirringUpState.getValue()){
ExecuteTheRecipe.getDeviceData.StirringUpState.setValue(false);
ExecuteTheRecipe.getDeviceData.StirringDownState.setValue(true);
}else{
ExecuteTheRecipe.getDeviceData.StirringDownState.setValue(false);
ExecuteTheRecipe.getDeviceData.StirringUpState.setValue(true);
}
});
btn_cg_test.setOnClickListener((view)->{
if( ExecuteTheRecipe.getDeviceData.FryingPanUpState.getValue()){
ExecuteTheRecipe.getDeviceData.FryingPanUpState.setValue(false);
ExecuteTheRecipe.getDeviceData.FryingPanDownState.setValue(true);
}else{
ExecuteTheRecipe.getDeviceData.FryingPanDownState.setValue(false);
ExecuteTheRecipe.getDeviceData.FryingPanUpState.setValue(true);
}
});
}

/**
* 初始化TopBar
*/
private void initTopBar() {
mTopBar.setTitle("菠萝燃气炒菜系统" + ConfigName.getInstance().Version);
}
// private void initTopBar() {
// mTopBar.setTitle("菠萝燃气炒菜系统" + ConfigName.getInstance().Version);
// }

//endregion

@@ -455,12 +538,12 @@ public class MakeGoodFragment extends BaseFragment {
return false;
}

if (!ExecuteTheRecipe.getDeviceData.PostPotLimit && k) {
if (!ExecuteTheRecipe.getDeviceData.PostPotLimit.getValue() && k) {
DialogManager.showWarn("请先将炒锅回到原位!", AlertDialogButton.OK,null);
return false;
}

if (!ExecuteTheRecipe.getDeviceData.MixingLowerLimit && k) {
if (!ExecuteTheRecipe.getDeviceData.MixingLowerLimit.getValue() && k) {
DialogManager.showWarn("请先将摆臂回到原位!", AlertDialogButton.OK,null);
return false;
}
@@ -691,18 +774,15 @@ public class MakeGoodFragment extends BaseFragment {
ThreadManager.Get().StartLong("主界面UI刷新任务", true, new IThread() {
@Override
public void Run() throws InterruptedException {
// activity.runOnUiThread(()->{
// if(CommHelper.get().IsConnected()){
// tv_Connect.setTextColor(Color.argb(0,0,136,255));
// tv_Connect.setText("连接状态:已连接");
// }else{
// tv_Connect.setTextColor(0xF44336);
// tv_Connect.setText("连接状态:未连接");
// }
// });

//仪表盘更新
activity.runOnUiThread(()->{
if(CommHelper.get().IsConnected()){

tv_Connect.setTextColor(getResources().getColor(R.color.light_blue_A200));
tv_Connect.setText("连接状态:已连接");
}else{
tv_Connect.setTextColor(getResources().getColor(R.color.pink_primary));
tv_Connect.setText("连接状态:未连接");
}
DB_Weight.setValue(ExecuteTheRecipe.getDeviceData.CurrentWeight);//锅体重量更新
DB_Temperature.setValue(ExecuteTheRecipe.getDeviceData.CurrentTemperature);//锅体温度更新
});


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


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

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

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

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

</shape>

+ 5
- 6
app/src/main/res/layout/fragment_ding_dan.xml View File

@@ -10,7 +10,6 @@

<RelativeLayout
android:id="@+id/tabs"
android:layout_marginTop="54dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
@@ -255,9 +254,9 @@
</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.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>

+ 385
- 200
app/src/main/res/layout/fragment_gongneng.xml View File

@@ -4,212 +4,397 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/app_color_blue">
android:background="@color/main_background">

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

<LinearLayout
android:layout_margin="20dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="30dp">

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

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

<RelativeLayout
android:id="@+id/lcgl"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/silos_bj">

<LinearLayout
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:focusable="false">
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@mipmap/new1"
android:focusable="false"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed-medium"
android:text="料仓管理(绑定物料)"
android:textColor="@color/white"
android:textSize="26dp"
android:focusable="false"/>
</LinearLayout>
</RelativeLayout>

<RelativeLayout
android:id="@+id/jcsjgl"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="5dp"
android:layout_weight="1.4"
android:background="@drawable/jcsjgl_bj">
<LinearLayout
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:focusable="false">
<ImageView
android:layout_width="match_parent"
android:layout_height="120dp"
android:src="@mipmap/new4"
android:focusable="false"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed-medium"
android:text="物料管理"
android:textColor="@color/white"
android:textSize="26dp"
android:focusable="false"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

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

<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_margin="5dp"
android:layout_weight="1.3">

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

<RelativeLayout
android:id="@+id/yfpf"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@drawable/goodpf_bj">
<LinearLayout
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:focusable="false">
<ImageView
android:layout_width="match_parent"
android:layout_height="120dp"
android:src="@mipmap/new2"
android:focusable="false"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed-medium"
android:text="配方管理"
android:textColor="@color/white"
android:textSize="26dp"
android:focusable="false"/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/log"
android:layout_marginLeft="5dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/log_bj">
<LinearLayout
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:focusable="false">
<ImageView
android:layout_width="match_parent"
android:layout_height="120dp"
android:src="@mipmap/new3"
android:focusable="false"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed-medium"
android:text="日志管理"
android:textColor="@color/white"
android:textSize="26dp"
android:focusable="false"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

<RelativeLayout
android:id="@+id/ssjk"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/ssjk_bj">
<LinearLayout
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:focusable="false">
<ImageView
android:layout_width="match_parent"
android:layout_height="120dp"
android:src="@mipmap/new5"
android:focusable="false"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:fontFamily="sans-serif-condensed-medium"
android:text="实时监控管理"
android:textColor="@color/white"
android:textSize="26dp"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

</LinearLayout>
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:columnCount="2"
android:rowCount="2">

<com.bonait.bnframework.custom_view.ShadowContainer
android:id="@+id/material_management"
android:layout_margin="10dp"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_column="0"
android:layout_row="0"
app:containerCornerRadius="10dp"
app:containerDeltaLength="20px"
app:containerShadowColor="#9149fc"
app:containerShadowRadius="20px"
tools:ignore="Pxusage,RtlHardcoded">
<RelativeLayout
android:layout_width="@dimen/groupWidth"
android:layout_height="@dimen/groupHeight"
android:background="@drawable/shadow_container_bg">
<ImageView
android:layout_width="150dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:scaleType="centerInside"
android:layout_centerHorizontal="true"
android:background="@drawable/wlgl"
tools:ignore="Pxusage,RtlHardcoded"
tools:targetApi="lollipop"/>
<TextView
android:layout_width="wrap_content"
android:layout_marginLeft="10dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:gravity="center"
android:textStyle="bold"
android:ems="1"
android:textSize="@dimen/groupTextSize"
android:textColor="#21a3e8"
android:text="物料管理"/>
</RelativeLayout>
</com.bonait.bnframework.custom_view.ShadowContainer>

<com.bonait.bnframework.custom_view.ShadowContainer
android:id="@+id/warehouse_management"
android:layout_width="0dp"
android:layout_margin="10dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_column="1"
android:layout_row="0"
app:containerCornerRadius="10dp"
app:containerDeltaLength="20px"
app:containerShadowColor="#9149fc"
app:containerShadowRadius="20px"
tools:ignore="Pxusage,RtlHardcoded">
<RelativeLayout
android:layout_width="@dimen/groupWidth"
android:layout_height="@dimen/groupHeight"
android:background="@drawable/shadow_container_bg">
<ImageView
android:layout_width="150dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:scaleType="centerInside"
android:layout_centerHorizontal="true"
android:background="@drawable/lcgl"
tools:ignore="Pxusage,RtlHardcoded"
tools:targetApi="lollipop"/>
<TextView
android:layout_width="wrap_content"
android:layout_marginLeft="10dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:gravity="center"
android:textStyle="bold"
android:ems="1"
android:textSize="@dimen/groupTextSize"
android:textColor="#21a3e8"
android:text="料仓管理"/>
</RelativeLayout>
</com.bonait.bnframework.custom_view.ShadowContainer>

<com.bonait.bnframework.custom_view.ShadowContainer
android:id="@+id/recipe_managerment"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_column="0"
android:layout_row="1"
app:containerCornerRadius="10dp"
app:containerDeltaLength="20px"
app:containerShadowColor="#9149fc"
app:containerShadowRadius="20px"
tools:ignore="Pxusage,RtlHardcoded">
<RelativeLayout
android:layout_width="@dimen/groupWidth"
android:layout_height="@dimen/groupHeight"
android:background="@drawable/shadow_container_bg">
<ImageView
android:layout_width="150dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:scaleType="centerInside"
android:layout_centerHorizontal="true"
android:background="@drawable/pxgl"
tools:ignore="Pxusage,RtlHardcoded"
tools:targetApi="lollipop"/>
<TextView
android:layout_width="wrap_content"
android:layout_marginLeft="10dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:gravity="center"
android:textStyle="bold"
android:ems="1"
android:textSize="@dimen/groupTextSize"
android:textColor="#21a3e8"
android:text="配方管理"/>
</RelativeLayout>
</com.bonait.bnframework.custom_view.ShadowContainer>

<com.bonait.bnframework.custom_view.ShadowContainer
android:id="@+id/log_info"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_column="1"
android:layout_row="1"
app:containerCornerRadius="10dp"
app:containerDeltaLength="20px"
app:containerShadowColor="#9149fc"
app:containerShadowRadius="20px"
tools:ignore="Pxusage,RtlHardcoded">
<RelativeLayout
android:layout_width="@dimen/groupWidth"
android:layout_height="@dimen/groupHeight"
android:background="@drawable/shadow_container_bg">
<ImageView
android:layout_width="150dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:scaleType="centerInside"
android:layout_centerHorizontal="true"
android:background="@drawable/log"
tools:ignore="Pxusage,RtlHardcoded"
tools:targetApi="lollipop"/>
<TextView
android:layout_width="wrap_content"
android:layout_marginLeft="10dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:gravity="center"
android:textStyle="bold"
android:ems="1"
android:textSize="@dimen/groupTextSize"
android:textColor="#21a3e8"
android:text="日志信息"/>
</RelativeLayout>
</com.bonait.bnframework.custom_view.ShadowContainer>

</GridLayout>










<!-- <LinearLayout-->
<!-- android:layout_margin="20dp"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_marginBottom="30dp">-->

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

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

<!-- <RelativeLayout-->
<!-- android:id="@+id/lcgl"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="0dp"-->
<!-- android:layout_margin="5dp"-->
<!-- android:layout_weight="1"-->
<!-- android:background="@drawable/silos_bj">-->

<!-- <LinearLayout-->
<!-- android:layout_centerInParent="true"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="vertical"-->
<!-- android:focusable="false">-->
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="100dp"-->
<!-- android:src="@mipmap/new1"-->
<!-- android:focusable="false"/>-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:fontFamily="sans-serif-condensed-medium"-->
<!-- android:text="料仓管理(绑定物料)"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="26dp"-->
<!-- android:focusable="false"/>-->
<!-- </LinearLayout>-->
<!-- </RelativeLayout>-->

<!-- <RelativeLayout-->
<!-- android:id="@+id/jcsjgl"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="0dp"-->
<!-- android:layout_margin="5dp"-->
<!-- android:layout_weight="1.4"-->
<!-- android:background="@drawable/jcsjgl_bj">-->
<!-- <LinearLayout-->
<!-- android:layout_centerInParent="true"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="vertical"-->
<!-- android:focusable="false">-->
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="120dp"-->
<!-- android:src="@mipmap/new4"-->
<!-- android:focusable="false"/>-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:fontFamily="sans-serif-condensed-medium"-->
<!-- android:text="物料管理"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="26dp"-->
<!-- android:focusable="false"/>-->
<!-- </LinearLayout>-->
<!-- </RelativeLayout>-->
<!-- </LinearLayout>-->
<!-- </RelativeLayout>-->

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

<!-- <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_margin="5dp"-->
<!-- android:layout_weight="1.3">-->

<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent">-->

<!-- <RelativeLayout-->
<!-- android:id="@+id/yfpf"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="2"-->
<!-- android:background="@drawable/goodpf_bj">-->
<!-- <LinearLayout-->
<!-- android:layout_centerInParent="true"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="vertical"-->
<!-- android:focusable="false">-->
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="120dp"-->
<!-- android:src="@mipmap/new2"-->
<!-- android:focusable="false"/>-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:fontFamily="sans-serif-condensed-medium"-->
<!-- android:text="配方管理"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="26dp"-->
<!-- android:focusable="false"/>-->
<!-- </LinearLayout>-->
<!-- </RelativeLayout>-->
<!-- <RelativeLayout-->
<!-- android:id="@+id/log"-->
<!-- android:layout_marginLeft="5dp"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="1"-->
<!-- android:background="@drawable/log_bj">-->
<!-- <LinearLayout-->
<!-- android:layout_centerInParent="true"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="vertical"-->
<!-- android:focusable="false">-->
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="120dp"-->
<!-- android:src="@mipmap/new3"-->
<!-- android:focusable="false"/>-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:fontFamily="sans-serif-condensed-medium"-->
<!-- android:text="日志管理"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="26dp"-->
<!-- android:focusable="false"/>-->
<!-- </LinearLayout>-->
<!-- </RelativeLayout>-->
<!-- </LinearLayout>-->
<!-- </RelativeLayout>-->

<!-- <RelativeLayout-->
<!-- android:id="@+id/ssjk"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="0dp"-->
<!-- android:layout_margin="5dp"-->
<!-- android:layout_weight="1"-->
<!-- android:background="@drawable/ssjk_bj">-->
<!-- <LinearLayout-->
<!-- android:layout_centerInParent="true"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="vertical"-->
<!-- android:focusable="false">-->
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="120dp"-->
<!-- android:src="@mipmap/new5"-->
<!-- android:focusable="false"/>-->

<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:focusable="false"-->
<!-- android:fontFamily="sans-serif-condensed-medium"-->
<!-- android:text="实时监控管理"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="26dp"-->
<!-- android:textStyle="bold" />-->
<!-- </LinearLayout>-->
<!-- </RelativeLayout>-->
<!-- </LinearLayout>-->
<!-- </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.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>

+ 65
- 30
app/src/main/res/layout/fragment_make_main.xml View File

@@ -4,12 +4,11 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/app_color_blue">
android:background="@color/main_background">

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

<LinearLayout
@@ -32,32 +31,38 @@
<!-- android:layout_centerVertical="true"-->
<!-- android:src="@mipmap/firypan" />-->

<ImageView
android:id="@+id/image_firypan_png"
android:layout_width="800dp"
android:layout_height="800dp"
android:paddingLeft="50dp"
android:scaleType="centerCrop"
android:layout_centerVertical="true"
android:src="@mipmap/p1" />
<!-- <ImageView-->
<!-- android:id="@+id/image_firypan_png"-->
<!-- android:layout_width="800dp"-->
<!-- android:visibility="gone"-->
<!-- android:layout_height="800dp"-->
<!-- android:scaleType="fitCenter"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:src="@mipmap/chaoguoup" />-->

<ImageView
android:layout_width="800dp"
android:layout_height="800dp"
android:layout_centerVertical="true"
android:paddingLeft="50dp"
android:id="@+id/image_frying"
android:scaleType="centerCrop" />
<!-- <ImageView-->
<!-- android:layout_width="800dp"-->
<!-- android:layout_height="800dp"-->
<!-- android:visibility="gone"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:id="@+id/image_frying"-->
<!-- android:src="@mipmap/jiaobanup"-->
<!-- android:scaleType="fitCenter" />-->

<!-- <ImageView-->
<!-- android:layout_width="800dp"-->
<!-- android:layout_height="800dp"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:id="@+id/image_frying_init"-->
<!-- android:scaleType="fitCenter" />-->

<ImageView
android:id="@+id/gif_fire"
android:layout_width="500dp"
android:layout_height="500dp"
android:scaleType="centerCrop"
android:visibility="gone"
android:layout_centerVertical="true"
android:layout_marginLeft="100dp"
android:layout_marginTop="50dp" />
android:layout_width="800dp"
android:layout_height="800dp"
android:scaleType="fitCenter"
android:src="@drawable/stir_rotate"
android:layout_centerVertical="true" />

<!--搅拌故障报警信息提示-->
<RelativeLayout
@@ -504,8 +509,38 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="连接状态:未连接"
android:textColor="@color/red_primary"
android:textColor="@color/pink_primary"
android:textSize="25dp" />
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:visibility="gone"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn_jb_test"
android:layout_width="100dp"
android:layout_height="40dp"
android:background="@color/gray"
android:text="搅拌测试"/>

<Button
android:id="@+id/btn_jbb_test"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@color/gray"
android:text="搅拌臂测试"/>

<Button
android:id="@+id/btn_cg_test"
android:layout_width="100dp"
android:layout_height="40dp"
android:background="@color/gray"
android:text="炒锅测试"/>

</LinearLayout>
</RelativeLayout>

</LinearLayout>
@@ -513,9 +548,9 @@

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

BIN
View File


BIN
View File


BIN
View File


BIN
View File


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

@@ -3,4 +3,7 @@
<resources>
<attr name="app_primary_color" format="color"/> <!-- topbar -->
<attr name="app_content_bg_color" format="color"/> <!-- content-->



</resources>

+ 12
- 0
app/src/main/res/values/attrs.xml View File

@@ -53,4 +53,16 @@
</attr>
<attr name="water_mark_sync" format="boolean" />
</declare-styleable>


<declare-styleable name="ShadowContainer">
<attr name="containerShadowColor" format="color" /><!--阴影颜色-->
<attr name="containerShadowRadius" format="dimension" /><!--阴影半径-->
<attr name="containerDeltaLength" format="dimension" /><!--子View到ShadowContainer的距离-->
<attr name="containerCornerRadius" format="dimension" /><!--子View背景的圆角大小-->
<attr name="deltaX" format="dimension" />
<attr name="deltaY" format="dimension" />
<attr name="enable" format="boolean" />
</declare-styleable>

</resources>

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

@@ -57,6 +57,8 @@
<dimen name="textSize">25sp</dimen>
<dimen name="handButWidth">100dp</dimen>
<dimen name="handButHeight">40dp</dimen>

<dimen name="groupHeight">200dp</dimen>
<dimen name="groupWidth">500dp</dimen>
<dimen name="groupTextSize">30sp</dimen>

</resources>

Loading…
Cancel
Save