@@ -47,10 +47,10 @@ | |||||
android:name=".modules.home.fragment.from.fragment.SystemCsFltlFragment" | android:name=".modules.home.fragment.from.fragment.SystemCsFltlFragment" | ||||
android:exported="false" /> | android:exported="false" /> | ||||
<activity | <activity | ||||
android:name=".modules.home.fragment.from.fragment.SystemCsTlFragment" | |||||
android:name=".modules.home.fragment.from.fragment.SystemCsMonitorFragment" | |||||
android:exported="false" /> | android:exported="false" /> | ||||
<activity | <activity | ||||
android:name=".modules.home.fragment.from.fragment.SystemCsJrFragment" | |||||
android:name=".modules.home.fragment.from.fragment.SystemCsControlFragment" | |||||
android:exported="false" /> | android:exported="false" /> | ||||
<activity | <activity | ||||
android:name=".modules.home.fragment.from.fragment.SystemSeasoningsetFragment" | android:name=".modules.home.fragment.from.fragment.SystemSeasoningsetFragment" | ||||
@@ -1,894 +0,0 @@ | |||||
package com.bonait.bnframework.business; | |||||
import com.bonait.bnframework.common.helper.ByteHelper; | |||||
import com.bonait.bnframework.common.helper.I.IRun; | |||||
import com.bonait.bnframework.common.helper.I.IRunT; | |||||
import com.bonait.bnframework.common.helper.I.IThread; | |||||
import com.bonait.bnframework.common.helper.I.IWriteCallBack; | |||||
import com.bonait.bnframework.common.helper.MessageLog; | |||||
import com.bonait.bnframework.common.helper.RTrig; | |||||
import com.bonait.bnframework.common.helper.ThreadManager; | |||||
import com.bonait.bnframework.common.modbus.ModbusTcpServer; | |||||
import com.bonait.bnframework.common.helper.ByteHelper; | |||||
import com.bonait.bnframework.common.helper.MessageLog; | |||||
import com.bonait.bnframework.common.helper.RTrig; | |||||
import com.bonait.bnframework.common.helper.ThreadManager; | |||||
import java.util.concurrent.ConcurrentHashMap; | |||||
import java.util.concurrent.ConcurrentLinkedQueue; | |||||
public class DeviceData { | |||||
private static volatile DeviceData _instance; | |||||
public static DeviceData Get() { | |||||
if (_instance == null) | |||||
_instance = new DeviceData(); | |||||
return _instance; | |||||
} | |||||
//----------------------------------------------------------------Start 模拟测试 ---------------------------------------------------------------- | |||||
ConcurrentLinkedQueue<Integer> testComms = new ConcurrentLinkedQueue<>(); | |||||
public void testAddComm(int value) { | |||||
testComms.offer(value); | |||||
} | |||||
public void TestInit() { | |||||
ThreadManager.Get().StartLong("TestInit", true, new IThread() { | |||||
@Override | |||||
public void Run() throws InterruptedException { | |||||
while (testComms.size() > 0) { | |||||
Thread.sleep(5000); | |||||
if (OnChargeMixtureComNotPar != null) { | |||||
OnChargeMixtureComNotPar.Run(testComms.poll()); | |||||
} | |||||
} | |||||
Thread.sleep(100); | |||||
} | |||||
@Override | |||||
public void RunComplete() throws InterruptedException { | |||||
} | |||||
}); | |||||
; | |||||
} | |||||
//----------------------------------------------------------------End 模拟测试 ---------------------------------------------------------------- | |||||
//region 初始化 | |||||
public void Init() { | |||||
ThreadManager.Get().StartLong("Plc设备数据监听", true, new IThread() { | |||||
@Override | |||||
public void Run() throws InterruptedException { | |||||
// //获取校准值-增加两个果糖通道 | |||||
// ModbusTcpServer.get().ReadShort("VW100", 12, (shorts) -> { | |||||
// for (int i = 0; i < shorts.length; i++) { | |||||
// CalibrationValue.put(i + 1, shorts[i]); | |||||
// } | |||||
// }); | |||||
// | |||||
// //获取称当前重量 | |||||
// ModbusTcpServer.get().ReadInt("VD260", 9, ints -> { | |||||
// for (int i = 0; i < ints.length; i++) { | |||||
// CallCurrentWeight.put(i + 1, ints[i]); | |||||
// } | |||||
// }); | |||||
// | |||||
// //获取温度参数 | |||||
// ModbusTcpServer.get().ReadInt("VD310", 3, ints -> { | |||||
// FructoseTemperature1=ints[0]; | |||||
// FructoseTemperature2=ints[1]; | |||||
// WashTheTankTemperature=ints[2]; | |||||
// }); | |||||
// | |||||
// | |||||
// //获取清洗参数 | |||||
// ModbusTcpServer.get().ReadShort("VW140", 5, shorts -> { | |||||
// DrainageTime = shorts[0]; | |||||
// AddCleaningAgentTime = shorts[1]; | |||||
// InletTime = shorts[2]; | |||||
// CyclicCleaningTime = shorts[3]; | |||||
// CleaningAndHeatingTime = shorts[4]; | |||||
// }); | |||||
// | |||||
// //获取清洗参数 | |||||
// ModbusTcpServer.get().ReadBool("M6.5", 1, booleans -> { | |||||
// WeightCalibrationMode = booleans[0]; | |||||
// }); | |||||
// | |||||
// ModbusTcpServer.get().ReadBool("M6.5", 1, booleans -> { | |||||
// WeightCalibrationMode = booleans[0]; | |||||
// }); | |||||
// //IoStatus | |||||
// | |||||
// | |||||
// //读取当前扫码信息 | |||||
// ModbusTcpServer.get().ReadString("VW342", 20, (data) -> { | |||||
// | |||||
// if(!Code.equals(data)) | |||||
// { | |||||
// if(!data.isEmpty() && OnScanTheCodeInformationT!=null) | |||||
// { | |||||
// MessageLog.ShowInfo("当前扫码信息:"+data); | |||||
// OnScanTheCodeInformationT.Run(data); | |||||
// } | |||||
// Code=data; | |||||
// } | |||||
// //1.查询订单信息 | |||||
// //2.展示订单界面 | |||||
// //3.制作订单信息 | |||||
// //4.回馈订单信息 | |||||
// }); | |||||
// | |||||
// //读取实时状态 | |||||
// ModbusTcpServer.get().ReadStatus("VW382", 3, data -> { | |||||
// for (int i = 0; i < data.length; i++) { | |||||
// byte status=data[i];//0x92 | |||||
// IoStatus.put(i*8+0, ByteHelper.getBit(status,0)==1); | |||||
// IoStatus.put(i*8+1, ByteHelper.getBit(status,1)==1); | |||||
// IoStatus.put(i*8+2, ByteHelper.getBit(status,2)==1); | |||||
// IoStatus.put(i*8+3, ByteHelper.getBit(status,3)==1); | |||||
// IoStatus.put(i*8+4, ByteHelper.getBit(status,4)==1); | |||||
// IoStatus.put(i*8+5, ByteHelper.getBit(status,5)==1); | |||||
// IoStatus.put(i*8+6, ByteHelper.getBit(status,6)==1); | |||||
// IoStatus.put(i*8+7, ByteHelper.getBit(status,7)==1); | |||||
// } | |||||
// }); | |||||
// | |||||
// //配料完成 M0.3 | |||||
// CompleteListen("M0.3", "配料完成", OnChargeMixtureCompleteNotify); | |||||
// | |||||
// //清洗完成 M0.6 | |||||
// CompleteListen("M0.6", "清洗完成", OnCleaningCompleteNotify); | |||||
// | |||||
// //去皮完成 M1.3 | |||||
// CompleteListen("M1.3", "去皮完成", OnPeelingCompleteNotify); | |||||
Thread.sleep(10); | |||||
} | |||||
@Override | |||||
public void RunComplete() throws InterruptedException { | |||||
} | |||||
}); | |||||
} | |||||
//endregion | |||||
/** | |||||
* 扫码信息 | |||||
*/ | |||||
public String Code=""; | |||||
//region 完成信号监听 | |||||
/** | |||||
* 完成信号监听 | |||||
* | |||||
* @param add 监听地址 | |||||
* @param name 监听 KEY | |||||
* @param callback 执行委托 | |||||
*/ | |||||
private void CompleteListen(String add, String name, IRun callback) { | |||||
ModbusTcpServer.get().ReadBool(add, 1, booleans -> { | |||||
RTrig.get(name).Start(booleans[0], () -> { | |||||
if (callback != null) | |||||
callback.Run(); | |||||
}); | |||||
}); | |||||
} | |||||
//endregion | |||||
// region 通知接口 | |||||
/** | |||||
* 配料完成通知 | |||||
*/ | |||||
public IRun OnChargeMixtureCompleteNotify; | |||||
/** | |||||
* 通道配料完成通知 | |||||
*/ | |||||
public IRunT OnChargeMixtureComNotPar; | |||||
/** | |||||
* 清洗完成通知 | |||||
*/ | |||||
public IRun OnCleaningCompleteNotify; | |||||
/** | |||||
* 去皮完成 | |||||
*/ | |||||
public IRun OnPeelingCompleteNotify; | |||||
/** | |||||
* 接收到扫码信息 | |||||
*/ | |||||
public IRun OnScanTheCodeInformation; | |||||
/** | |||||
* 接收到扫码信息,返回 | |||||
*/ | |||||
public IRunT<String> OnScanTheCodeInformationT; | |||||
//endregion | |||||
/** | |||||
* 校准值写入 | |||||
* PLC 地址VW100--VW118 | |||||
* | |||||
* @param value 需要写入的值 | |||||
* @param ch 需要写入的通道编号,1--10 | |||||
*/ | |||||
public void setCalibrationValue(short value, int ch, IWriteCallBack callback) { | |||||
if (ch >= 1 && ch <= 12) { | |||||
String add = "VW" + (98 + ch * 2); | |||||
ModbusTcpServer.get().WriteShort(add, value, callback); | |||||
} | |||||
} | |||||
/** | |||||
* 校准值 | |||||
*/ | |||||
ConcurrentHashMap<Integer, Short> CalibrationValue = new ConcurrentHashMap<>(); | |||||
/** | |||||
* 获取校准值 | |||||
* | |||||
* @param ch 要获取的通道号 | |||||
* @return | |||||
*/ | |||||
public short getCalibrationValue(int ch) { | |||||
if (!CalibrationValue.containsKey(ch)) | |||||
return 0; | |||||
return CalibrationValue.get(ch); | |||||
} | |||||
/** | |||||
* 需求值写入 | |||||
* ,PLC 地址 VW200--VW218 | |||||
* | |||||
* @param value 需要写入的值 | |||||
* @param ch 需要写入的通道编号,1--10 | |||||
*/ | |||||
public void setDemandValue(short value, int ch, IWriteCallBack callback) { | |||||
if (ch >= 1 && ch <= 10) { | |||||
String add = "VW" + (198 + ch * 2); | |||||
ModbusTcpServer.get().WriteShort(add, value, callback); | |||||
}else if(ch>=11 && ch<=12)//果糖需求 | |||||
{ | |||||
String add = "VW" + (198 +20+ ch * 2); | |||||
ModbusTcpServer.get().WriteShort(add, value, callback); | |||||
} | |||||
} | |||||
/** | |||||
* 设置通道校准开关 | |||||
* ,PLC 地址 M2.0--M3.1 | |||||
* | |||||
* @param value 需要写入的值 | |||||
* @param ch 需要写入的通道编号,1--10 | |||||
*/ | |||||
public void setChCalibrationSwitch(boolean value, int ch, IWriteCallBack callback) { | |||||
if (ch >= 1 && ch <= 12) { | |||||
String add=""; | |||||
if(ch==9) | |||||
{ | |||||
add="M03.0"; | |||||
}else if(ch==10) | |||||
{ | |||||
add="M03.1"; | |||||
}else if(ch==11)//果糖1 | |||||
{ | |||||
add="M03.2"; | |||||
}else if(ch==12)//果糖2 | |||||
{ | |||||
add="M03.3"; | |||||
}else | |||||
{ | |||||
add = ModbusTcpServer.get().getBitSingleAdd("M", 2, ch); | |||||
} | |||||
if (add.length() > 0) | |||||
ModbusTcpServer.get().WriteBool(add, value, callback); | |||||
} | |||||
} | |||||
//region 手动控制 | |||||
/** | |||||
* 手动控制设备 | |||||
* @param value | |||||
* @param ch | |||||
* @param callback | |||||
*/ | |||||
public void setSwitch(boolean value, String ch, IWriteCallBack callback) { | |||||
if(ch.isEmpty()) | |||||
{ | |||||
return; | |||||
} | |||||
String add=ch; | |||||
if (add.length() > 0) | |||||
ModbusTcpServer.get().WriteBool(add, value, callback); | |||||
} | |||||
//endregion | |||||
/** | |||||
* 称去皮校准 | |||||
* | |||||
* @param value | |||||
* @param ch 设置称的通道号,ch1-ch8 | |||||
*/ | |||||
public void setRemovePeelCalibration(boolean value, int ch, IWriteCallBack callback) { | |||||
if (ch >= 1 && ch <= 8) { | |||||
String add = ModbusTcpServer.get().getBitSingleAdd("M", 5, ch); | |||||
if (add.length() > 0) | |||||
ModbusTcpServer.get().WriteBool(add, value, callback); | |||||
} | |||||
} | |||||
/** | |||||
* 砝码值写入 | |||||
* | |||||
* @param value | |||||
* @param ch 设置称的砝码通道号,ch1-ch8 | |||||
*/ | |||||
public void setWeightValue(boolean value, int ch, IWriteCallBack callback) { | |||||
if (ch >= 1 && ch <= 8) { | |||||
String add = ModbusTcpServer.get().getBitSingleAdd("M", 15, ch); | |||||
if (add.length() > 0) | |||||
ModbusTcpServer.get().WriteBool(add, value, callback); | |||||
} | |||||
} | |||||
/** | |||||
* 重量清零 | |||||
*/ | |||||
public void setWeightClear(IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M6.0", true, callback); | |||||
} | |||||
/** | |||||
* 关闭写保护 | |||||
*/ | |||||
public void setCloseWriteProtect(IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M6.1", true, callback); | |||||
} | |||||
/** | |||||
* 打开写保护 | |||||
*/ | |||||
public void setOpenWriteProtect(IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M6.4", true, callback); | |||||
} | |||||
/** | |||||
* 零点校准 | |||||
*/ | |||||
public void setZeroPointCalibration(IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M6.2", true, callback); | |||||
} | |||||
/** | |||||
* 砝码值写入 | |||||
*/ | |||||
public void setWeightValueWrite(IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M6.3", true, callback); | |||||
} | |||||
/** | |||||
* 砝码校准模式 | |||||
*/ | |||||
boolean WeightCalibrationMode; | |||||
/** | |||||
* 砝码校准模式 | |||||
*/ | |||||
public void setWeightCalibrationMode(Boolean value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M6.5", value, callback); | |||||
} | |||||
/** | |||||
* 获取砝码校准模式 | |||||
* | |||||
* @return | |||||
*/ | |||||
public boolean getWeightCalibrationMode() { | |||||
return WeightCalibrationMode; | |||||
} | |||||
/** | |||||
* 启动通道校准 | |||||
*/ | |||||
public void setChStartCalibration(IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M0.0", true, callback); | |||||
} | |||||
/** | |||||
* 启动配料 | |||||
*/ | |||||
public void setChargeMixtureStart(IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M0.1", true, callback); | |||||
} | |||||
/** | |||||
* 手自动切换 | |||||
* | |||||
* @param value true:自动模式,flase:手动模式 | |||||
*/ | |||||
public void setHandOrAutoSwitch(boolean value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M0.2", value, callback); | |||||
} | |||||
/** | |||||
* 手自动模式 | |||||
*/ | |||||
boolean HandOrAutoMode; | |||||
/** | |||||
* 获取手自动模式的状态 | |||||
* | |||||
* @return true:自动模式,flase:手动模式 | |||||
*/ | |||||
public boolean getHandOrAutoSwitch() { | |||||
return HandOrAutoMode; | |||||
} | |||||
/** | |||||
* 设置清洗模式 | |||||
* | |||||
* @param value true:清洗模式,false:配料模式 | |||||
*/ | |||||
public void setCleaningMode(boolean value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M0.4", value, callback); | |||||
} | |||||
/** | |||||
* 清洗模式 | |||||
*/ | |||||
boolean CleaningMode; | |||||
/** | |||||
* 获取清洗模式 | |||||
* | |||||
* @return true:清洗模式,false:配料模式 | |||||
*/ | |||||
public boolean getCleaningMode() { | |||||
return CleaningMode; | |||||
} | |||||
/** | |||||
* 设置开始清洗 | |||||
*/ | |||||
public void setStartCleaning(IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M0.5", true, callback); | |||||
} | |||||
/** | |||||
* 设置一键去皮 | |||||
*/ | |||||
public void setOneClickPeeling(IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M1.2", true, callback); | |||||
} | |||||
/** | |||||
* 一键去皮完成状态 | |||||
*/ | |||||
boolean OneClickPeelingComplete; | |||||
/** | |||||
* 设置一键去皮完成状态 | |||||
* | |||||
* @param value | |||||
*/ | |||||
public void setOneClickPeelingComplete(boolean value) { | |||||
OneClickPeelingComplete = value; | |||||
} | |||||
/** | |||||
* 清洗完成 | |||||
*/ | |||||
boolean CleaningComplete; | |||||
/** | |||||
* 获取清洗完成的状态 | |||||
* | |||||
* @return | |||||
*/ | |||||
public boolean getCleaningComplete() { | |||||
return CleaningComplete; | |||||
} | |||||
//region 获取或设置-校准模式 | |||||
/** | |||||
* 设置校准模式 | |||||
* | |||||
* @param value true:零点校准模式,false:清零去皮模式 | |||||
*/ | |||||
public void setCalibrationMode(boolean value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M1.4", value, callback); | |||||
} | |||||
/** | |||||
* 校准模式 | |||||
*/ | |||||
boolean CalibrationMode; | |||||
/** | |||||
* 获取校准模式 | |||||
* | |||||
* @return true:零点校准模式,false:清零去皮模式 | |||||
*/ | |||||
public boolean getCalibrationMode() { | |||||
return CalibrationMode; | |||||
} | |||||
//endregion | |||||
/** | |||||
* 称当前重量 | |||||
*/ | |||||
ConcurrentHashMap<Integer, Integer> CallCurrentWeight = new ConcurrentHashMap<Integer, Integer>(); | |||||
/** | |||||
* 获取指定称的当前重量 | |||||
* | |||||
* @param ch 需要获取的通道号,称1--称9 | |||||
* @return | |||||
*/ | |||||
public int getCallCurrentWeight(int ch) { | |||||
if (!CallCurrentWeight.containsKey(ch)) { | |||||
return 0; | |||||
} | |||||
return CallCurrentWeight.get(ch); | |||||
} | |||||
//region 获取或设置-校准基准时间 | |||||
/** | |||||
* 设置校准基准时间 | |||||
* | |||||
* @param value 需要写入的值 | |||||
*/ | |||||
public void setCalibrationReferenceTime(int value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteInt("VD124", value, callback); | |||||
} | |||||
/** | |||||
* 校准基准时间 | |||||
*/ | |||||
int CalibrationReferenceTime=0; | |||||
/** | |||||
* 获取校准基准时间 | |||||
* | |||||
* @return | |||||
*/ | |||||
public int getCalibrationReferenceTime() { | |||||
return CalibrationReferenceTime; | |||||
} | |||||
//endregion | |||||
//region 获取或设置-排水时间 | |||||
/** | |||||
* 设置排水时间 | |||||
* | |||||
* @param value | |||||
*/ | |||||
public void setDrainageTime(short value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteShort("VW140", value, callback); | |||||
} | |||||
/** | |||||
* 排水时间 | |||||
*/ | |||||
short DrainageTime; | |||||
/** | |||||
* 获取排水时间 | |||||
* | |||||
* @return | |||||
*/ | |||||
public short getDrainageTime() { | |||||
return DrainageTime; | |||||
} | |||||
//endregion | |||||
//region 获取或设置-清洗剂添加时间 | |||||
/** | |||||
* 设置清洗剂添加时间 | |||||
* | |||||
* @param value | |||||
*/ | |||||
public void setAddCleaningAgentTime(short value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteShort("VW142", value, callback); | |||||
} | |||||
/** | |||||
* 清洗剂添加时间 | |||||
*/ | |||||
short AddCleaningAgentTime; | |||||
/** | |||||
* 获取清洗剂添加时间 | |||||
* | |||||
* @return | |||||
*/ | |||||
public short getAddCleaningAgentTime() { | |||||
return AddCleaningAgentTime; | |||||
} | |||||
//endregion | |||||
//region 获取或设置-进水时间 | |||||
/** | |||||
* 设置进水时间 | |||||
* | |||||
* @param value | |||||
*/ | |||||
public void setInletTime(short value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteShort("VW144", value, callback); | |||||
} | |||||
/** | |||||
* 进水时间 | |||||
*/ | |||||
short InletTime; | |||||
/** | |||||
* 获取进水时间 | |||||
* | |||||
* @return | |||||
*/ | |||||
public short getInletTime() { | |||||
return InletTime; | |||||
} | |||||
//endregion | |||||
//region 获取或设置-循环清洗时间 | |||||
/** | |||||
* 设置循环清洗时间 | |||||
* | |||||
* @param value | |||||
*/ | |||||
public void setCyclicCleaningTime(short value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteShort("VW146", value, callback); | |||||
} | |||||
/** | |||||
* 循环清洗时间 | |||||
*/ | |||||
short CyclicCleaningTime; | |||||
/** | |||||
* 获取循环清洗时间 | |||||
* | |||||
* @return | |||||
*/ | |||||
public short getCyclicCleaningTime() { | |||||
return CyclicCleaningTime; | |||||
} | |||||
//endregion | |||||
//region 获取或设置-清洗加热时间 | |||||
/** | |||||
* 设置清洗加热时间 | |||||
* | |||||
* @param value | |||||
*/ | |||||
public void setCleaningAndHeatingTime(short value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteShort("VW148", value, callback); | |||||
} | |||||
/** | |||||
* 清洗加热时间 | |||||
*/ | |||||
short CleaningAndHeatingTime; | |||||
/** | |||||
* 获取清洗加热时间 | |||||
* | |||||
* @return | |||||
*/ | |||||
public short getCleaningAndHeatingTime() { | |||||
return CleaningAndHeatingTime; | |||||
} | |||||
//endregion | |||||
//region 获取温度信息 | |||||
/** | |||||
* 果糖1实际温度 | |||||
*/ | |||||
Boolean ReheatSwitch1=false; | |||||
int FructoseTemperature1=0; | |||||
int FructoseTemperature1_up=0; | |||||
int FructoseTemperature1_down=0; | |||||
/** | |||||
* 设置果糖1号加热启动停止 | |||||
* | |||||
* @param value true:启动,flase:停止 | |||||
*/ | |||||
public void setReheatSwitch1(boolean value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M51.7", value, callback); | |||||
} | |||||
public boolean getReheatSwitch1() { | |||||
return ReheatSwitch1; | |||||
} | |||||
/** | |||||
* 设置获取果糖1上下线 | |||||
* @param value_up 上限 | |||||
* @param value_down 下限 | |||||
* @param callback | |||||
*/ | |||||
public void setFructoseTemperature1(int value_up,int value_down, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteInt("VD388", value_up, callback); | |||||
ModbusTcpServer.get().WriteInt("VD392", value_down, callback); | |||||
} | |||||
/** | |||||
* 获取果糖1实际温度 | |||||
* | |||||
* @return | |||||
*/ | |||||
public int getFructoseTemperature1() { | |||||
return FructoseTemperature1; | |||||
} | |||||
/** | |||||
* 获取果糖1上限 | |||||
* | |||||
* @return | |||||
*/ | |||||
public int getFructoseTemperature1_up() { | |||||
return FructoseTemperature1_up; | |||||
} | |||||
/** | |||||
* 获取果糖1下限 | |||||
* | |||||
* @return | |||||
*/ | |||||
public int getFructoseTemperature1_down() { | |||||
return FructoseTemperature1_down; | |||||
} | |||||
/** | |||||
* 果糖2实际温度 | |||||
*/ | |||||
Boolean ReheatSwitch2=false; | |||||
int FructoseTemperature2=0; | |||||
int FructoseTemperature2_up=0; | |||||
int FructoseTemperature2_down=0; | |||||
/** | |||||
* 设置果糖2号加热启动停止 | |||||
* | |||||
* @param value true:启动,flase:停止 | |||||
*/ | |||||
public void setReheatSwitch2(boolean value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteBool("M52.0", value, callback); | |||||
} | |||||
public boolean getReheatSwitch2() { | |||||
return ReheatSwitch2; | |||||
} | |||||
/** | |||||
* 设置获取果糖2上下线 | |||||
* @param value_up 上限 | |||||
* @param value_down 下限 | |||||
* @param callback | |||||
*/ | |||||
public void setFructoseTemperature2(int value_up,int value_down, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteInt("VD396", value_up, callback); | |||||
ModbusTcpServer.get().WriteInt("VD400", value_down, callback); | |||||
} | |||||
/** | |||||
* 获取果糖2实际温度 | |||||
* | |||||
* @return | |||||
*/ | |||||
public int getFructoseTemperature2() { | |||||
return FructoseTemperature2; | |||||
} | |||||
/** | |||||
* 获取果糖2上限 | |||||
* | |||||
* @return | |||||
*/ | |||||
public int getFructoseTemperature2_up() { | |||||
return FructoseTemperature2_up; | |||||
} | |||||
/** | |||||
* 获取果糖2下限 | |||||
* | |||||
* @return | |||||
*/ | |||||
public int getFructoseTemperature2_down() { | |||||
return FructoseTemperature2_down; | |||||
} | |||||
/** | |||||
* 清洗池实际温度 | |||||
*/ | |||||
int WashTheTankTemperature=0; | |||||
int WashTheTankTemperature_up=0; | |||||
int WashTheTankTemperature_down=0; | |||||
/** | |||||
* 设置清洗池实际温度上下线 | |||||
* @param value_up 上限 | |||||
* @param value_down 下限 | |||||
* @param callback | |||||
*/ | |||||
public void setWashTheTankTemperature(int value_up,int value_down, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteInt("VD404", value_up, callback); | |||||
ModbusTcpServer.get().WriteInt("VD408", value_down, callback); | |||||
} | |||||
/** | |||||
* 清洗池实际温度 | |||||
* | |||||
* @return | |||||
*/ | |||||
public int getWashTheTankTemperature() { | |||||
return WashTheTankTemperature; | |||||
} | |||||
/** | |||||
* 获取清洗池实际温度上限 | |||||
* | |||||
* @return | |||||
*/ | |||||
public int getWashTheTankTemperature_up() { | |||||
return WashTheTankTemperature_up; | |||||
} | |||||
/** | |||||
* 获取清洗池实际温度下限 | |||||
* | |||||
* @return | |||||
*/ | |||||
public int getWashTheTankTemperature_down() { | |||||
return WashTheTankTemperature_down; | |||||
} | |||||
//endregion | |||||
//region 实时状态 | |||||
/** | |||||
* 实时状态 | |||||
*/ | |||||
public ConcurrentHashMap<Integer, Boolean> IoStatus = new ConcurrentHashMap<Integer, Boolean>(); | |||||
/** | |||||
* 获取实时状态 | |||||
* @param ch | |||||
* @return | |||||
*/ | |||||
public boolean getConcurrentHash(int ch) { | |||||
if (!IoStatus.containsKey(ch)) { | |||||
return false; | |||||
} | |||||
return IoStatus.get(ch); | |||||
} | |||||
//endregion | |||||
/** | |||||
* 设置8路称校准砝码重量 | |||||
* | |||||
* @param value | |||||
*/ | |||||
public void setCalibrationWeight(short value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteShort("VW250", value, callback); | |||||
} | |||||
/** | |||||
* 设置称重9校准砝码重量 | |||||
* | |||||
* @param value | |||||
*/ | |||||
public void setCalibrationWeight9(short value, IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteShort("VW254", value, callback); | |||||
} | |||||
/** | |||||
* 扫码清零 | |||||
*/ | |||||
public void setCodeClear(IWriteCallBack callback) { | |||||
ModbusTcpServer.get().WriteString("VW342", 20, callback); | |||||
} | |||||
} |
@@ -12,6 +12,7 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; | |||||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | ||||
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | 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_SILOS; | ||||
import com.bonait.bnframework.common.helper.ByteHelper; | |||||
import com.bonait.bnframework.common.helper.I.IThread; | import com.bonait.bnframework.common.helper.I.IThread; | ||||
import com.bonait.bnframework.common.helper.I.IWriteCallBack; | import com.bonait.bnframework.common.helper.I.IWriteCallBack; | ||||
import com.bonait.bnframework.common.helper.ThreadManager; | import com.bonait.bnframework.common.helper.ThreadManager; | ||||
@@ -556,10 +557,12 @@ public class ExecuteTheRecipe { | |||||
ListeningValue.put(key, val); | ListeningValue.put(key, val); | ||||
} | } | ||||
} | } | ||||
ReadPLCStatus(); | |||||
} catch (Exception ex) { | } catch (Exception ex) { | ||||
ToastUtils.error("异常信息:" + ex.getMessage()); | ToastUtils.error("异常信息:" + ex.getMessage()); | ||||
} | } | ||||
Thread.sleep(10); | |||||
Thread.sleep(100); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -638,6 +641,68 @@ public class ExecuteTheRecipe { | |||||
return ReturnsVariable[0]; | return ReturnsVariable[0]; | ||||
} | } | ||||
} | } | ||||
/** | |||||
* 实时状态 | |||||
*/ | |||||
public static ConcurrentHashMap<Integer, Boolean> IoStatus = new ConcurrentHashMap<Integer, Boolean>(); | |||||
/** | |||||
* 获取实时状态 | |||||
* @param ch | |||||
* @return | |||||
*/ | |||||
public static boolean getConcurrentHash(int ch) { | |||||
if (!IoStatus.containsKey(ch)) { | |||||
return false; | |||||
} | |||||
return IoStatus.get(ch); | |||||
} | |||||
/** | |||||
* 获取搅拌电机 | |||||
* @param | |||||
* @return | |||||
*/ | |||||
public static int getConcurrentHash_dj(String name) { | |||||
if (!ListeningValue.containsKey(name)) { | |||||
return 0; | |||||
} | |||||
Object obj= ListeningValue.get(name); | |||||
if(obj==null) | |||||
{ | |||||
return 0; | |||||
}else | |||||
{ | |||||
return (int)obj; | |||||
} | |||||
} | |||||
/** | |||||
* 读取状态 | |||||
*/ | |||||
public static void ReadPLCStatus() | |||||
{ | |||||
try { | |||||
if (ConfigName.getInstance().PlcIsConnect) { | |||||
ModbusTcpServer.get().ReadStatus("VW354", 1, data -> { | |||||
for (int i = 0; i < data.length; i++) { | |||||
byte status=data[i];//0x92 | |||||
IoStatus.put(i*8+0, ByteHelper.getBit(status,0)==1); | |||||
IoStatus.put(i*8+1, ByteHelper.getBit(status,1)==1); | |||||
IoStatus.put(i*8+2, ByteHelper.getBit(status,2)==1); | |||||
IoStatus.put(i*8+3, ByteHelper.getBit(status,3)==1); | |||||
IoStatus.put(i*8+4, ByteHelper.getBit(status,4)==1); | |||||
IoStatus.put(i*8+5, ByteHelper.getBit(status,5)==1); | |||||
IoStatus.put(i*8+6, ByteHelper.getBit(status,6)==1); | |||||
IoStatus.put(i*8+7, ByteHelper.getBit(status,7)==1); | |||||
} | |||||
}); | |||||
} | |||||
} catch (Exception ex) { | |||||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||||
} finally { | |||||
} | |||||
} | |||||
//endregion | //endregion | ||||
//region 获取基础挡位变量 | //region 获取基础挡位变量 | ||||
@@ -2,9 +2,11 @@ package com.bonait.bnframework.common.constant; | |||||
import android.content.Context; | import android.content.Context; | ||||
import com.bonait.bnframework.R; | |||||
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | ||||
import com.bonait.bnframework.common.db.mode.BPA_USER; | import com.bonait.bnframework.common.db.mode.BPA_USER; | ||||
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS; | import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS; | ||||
import com.bonait.bnframework.common.db.res.StatusMode; | |||||
import com.bonait.bnframework.common.model.AddrType; | import com.bonait.bnframework.common.model.AddrType; | ||||
import com.bonait.bnframework.common.model.mode.DeviceInformation; | import com.bonait.bnframework.common.model.mode.DeviceInformation; | ||||
import com.bonait.bnframework.common.model.mode.OrganizeMode; | import com.bonait.bnframework.common.model.mode.OrganizeMode; | ||||
@@ -372,6 +374,55 @@ public class ConfigName { | |||||
put("四档",8); | put("四档",8); | ||||
put("五档",10); | put("五档",10); | ||||
}}; | }}; | ||||
/** | |||||
* 状态上报信息 | |||||
*/ | |||||
public List<StatusMode> statusModes=new ArrayList<StatusMode>(){{ | |||||
//硬件设备 初始化 | |||||
add(new StatusMode("急停",false,R.mipmap.jiting,R.mipmap.jiting,0)); | |||||
add(new StatusMode("炒锅正限位报警",false,R.mipmap.cg_sxw,R.mipmap.cg_sxw,2)); | |||||
add(new StatusMode("炒锅负限位报警",false,R.mipmap.cgxxw,R.mipmap.cgxxw,3)); | |||||
add(new StatusMode("编码器通讯异常",false,R.mipmap.bmq,R.mipmap.bmq,4)); | |||||
add(new StatusMode("搅拌电机变频器通讯异常",false,R.mipmap.bpq,R.mipmap.bpq,6)); | |||||
add(new StatusMode("翻转电机变频器通讯异常",false,R.mipmap.bpq,R.mipmap.bpq,7)); | |||||
}}; | |||||
/** | |||||
* 状态上报信息 | |||||
*/ | |||||
public ConcurrentHashMap<Integer,String> statusModes_电机=new ConcurrentHashMap<Integer,String>() | |||||
{{ | |||||
put(0 ,"无故障"); | |||||
put(1 ,"过电流"); | |||||
put(2 ,"过电压"); | |||||
put(3 ,"IGBT过热"); | |||||
put(4 ,""); | |||||
put(5 ,"变频器过负载"); | |||||
put(6 ,"电机过负载"); | |||||
put(7 ,"过转矩"); | |||||
put(8 ,"外部异常"); | |||||
put(9 ,"加速中过电流"); | |||||
put(10,"减速中过电流"); | |||||
put(11,"恒速中过电流"); | |||||
put(12,""); | |||||
put(13,"电压不足"); | |||||
put(14,"输入电压缺相"); | |||||
put(15,""); | |||||
put(16,"不适用自动加减速设定"); | |||||
put(17,"软件参数密码保护"); | |||||
put(18,"CPU写入异常"); | |||||
put(19,"CPU读取异常"); | |||||
put(20,"端子保护线路异常"); | |||||
put(21,"0V保护线路异常"); | |||||
put(22,""); | |||||
put(23,""); | |||||
put(24,"U相硬件异常"); | |||||
put(25,"V相硬件异常"); | |||||
put(26,"W相硬件异常"); | |||||
put(27,"DC,bus 硬件异常"); | |||||
}}; | |||||
//endregion | //endregion | ||||
} | } | ||||
@@ -268,10 +268,6 @@ public class DataBus { | |||||
* 订单操作日志 | * 订单操作日志 | ||||
*/ | */ | ||||
public List<BPA_ALERTLOG> bpa_alertlogs = new ArrayList<BPA_ALERTLOG>(); | public List<BPA_ALERTLOG> bpa_alertlogs = new ArrayList<BPA_ALERTLOG>(); | ||||
/** | |||||
* 设备状态列表 | |||||
*/ | |||||
public List<StatusMode> statusModes = new ArrayList<StatusMode>(); | |||||
/** | /** | ||||
* 扫码订单 | * 扫码订单 | ||||
*/ | */ | ||||
@@ -9,11 +9,15 @@ public class StatusMode { | |||||
public int Url_open; | public int Url_open; | ||||
public int Url_close; | public int Url_close; | ||||
public StatusMode(String name,int Url_open,int Url_close,Boolean Status) | |||||
public int sort; | |||||
public StatusMode(String name,Boolean Status,int Url_open,int | |||||
Url_close,int sort) | |||||
{ | { | ||||
this.Name=name; | this.Name=name; | ||||
this.Status=Status; | this.Status=Status; | ||||
this.Url_open=Url_open; | this.Url_open=Url_open; | ||||
this.Url_close=Url_close; | this.Url_close=Url_close; | ||||
this.sort=sort; | |||||
} | } | ||||
} | } |
@@ -0,0 +1,125 @@ | |||||
package com.bonait.bnframework.modules.home.adapter; | |||||
import android.app.Activity; | |||||
import android.content.Context; | |||||
import android.content.ContextWrapper; | |||||
import android.view.LayoutInflater; | |||||
import android.view.View; | |||||
import android.view.ViewGroup; | |||||
import android.widget.ImageView; | |||||
import android.widget.TextView; | |||||
import androidx.annotation.NonNull; | |||||
import androidx.recyclerview.widget.RecyclerView; | |||||
import com.bonait.bnframework.R; | |||||
import com.bonait.bnframework.common.constant.ConfigName; | |||||
import com.bonait.bnframework.common.constant.DataBus; | |||||
import com.bonait.bnframework.common.db.res.StatusMode; | |||||
import com.bonait.bnframework.common.db.res.lcMode; | |||||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||||
import com.qmuiteam.qmui.widget.textview.QMUILinkTextView; | |||||
import java.util.List; | |||||
public class monitor_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |||||
private final LayoutInflater mLayoutInflater; | |||||
private Context context; | |||||
List<StatusMode> statusModes = ConfigName.getInstance().statusModes; | |||||
public monitor_adapter(Context context) { | |||||
this.context = context; | |||||
mLayoutInflater = LayoutInflater.from(context); | |||||
} | |||||
@NonNull | |||||
@Override | |||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |||||
View inflate = mLayoutInflater.inflate(R.layout.devstatus, parent, false); | |||||
return new MyLCViewHolder(inflate); | |||||
} | |||||
@Override | |||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { | |||||
try { | |||||
if (holder instanceof MyLCViewHolder) { | |||||
MyLCViewHolder myViewHolder = (MyLCViewHolder) holder; | |||||
StatusMode statusMode= statusModes.get(position); | |||||
myViewHolder.title.setText(statusMode.Name); | |||||
if(statusMode.Status) | |||||
{ | |||||
myViewHolder.image.setImageResource(statusMode.Url_open); | |||||
myViewHolder.text.setText("打开"); | |||||
myViewHolder.text.setTextColor(context.getResources().getColor(R.color.black)); | |||||
}else | |||||
{ | |||||
myViewHolder.image.setImageResource(statusMode.Url_close); | |||||
myViewHolder.text.setText("关闭"); | |||||
myViewHolder.text.setTextColor(context.getResources().getColor(R.color.red_primary)); | |||||
} | |||||
} | |||||
} catch (Exception e) { | |||||
e.printStackTrace(); | |||||
} | |||||
} | |||||
private Activity findActivity(@NonNull Context context) { | |||||
if (context instanceof Activity) { | |||||
return (Activity) context; | |||||
} else if (context instanceof ContextWrapper) { | |||||
return findActivity(((ContextWrapper) context).getBaseContext()); | |||||
} else { | |||||
return null; | |||||
} | |||||
} | |||||
/** | |||||
* 刷新 | |||||
* | |||||
* @param | |||||
*/ | |||||
public void refresh() { | |||||
Activity activity = findActivity(context); | |||||
if (activity != null) { | |||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
try { | |||||
notifyDataSetChanged(); | |||||
} catch (Exception e) { | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
@Override | |||||
public int getItemCount() { | |||||
return statusModes.size(); | |||||
} | |||||
public static class MyLCViewHolder extends RecyclerView.ViewHolder { | |||||
/** | |||||
* 标题 | |||||
*/ | |||||
TextView title; | |||||
ImageView image; | |||||
/** | |||||
* 描述 | |||||
*/ | |||||
TextView text; | |||||
public MyLCViewHolder(View view) { | |||||
super(view); | |||||
title = (TextView) view.findViewById(R.id.title); | |||||
text=(TextView) view.findViewById(R.id.text); | |||||
image= view.findViewById(R.id.image); | |||||
} | |||||
} | |||||
} |
@@ -4,9 +4,9 @@ import androidx.annotation.NonNull; | |||||
import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsPLCFragment; | import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsPLCFragment; | ||||
import com.google.android.material.bottomnavigation.BottomNavigationView; | import com.google.android.material.bottomnavigation.BottomNavigationView; | ||||
import androidx.core.content.ContextCompat; | |||||
import androidx.viewpager.widget.ViewPager; | import androidx.viewpager.widget.ViewPager; | ||||
import androidx.appcompat.app.AppCompatActivity; | |||||
import android.os.Bundle; | import android.os.Bundle; | ||||
import android.view.MenuItem; | import android.view.MenuItem; | ||||
import android.view.View; | import android.view.View; | ||||
@@ -15,8 +15,8 @@ import com.bonait.bnframework.R; | |||||
import com.bonait.bnframework.common.base.BaseActivity; | import com.bonait.bnframework.common.base.BaseActivity; | ||||
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter; | import com.bonait.bnframework.modules.home.adapter.FragmentAdapter; | ||||
import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsFltlFragment; | import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsFltlFragment; | ||||
import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsJrFragment; | |||||
import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsTlFragment; | |||||
import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsControlFragment; | |||||
import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsMonitorFragment; | |||||
import com.qmuiteam.qmui.widget.QMUITopBar; | import com.qmuiteam.qmui.widget.QMUITopBar; | ||||
import com.qmuiteam.qmui.widget.QMUIViewPager; | import com.qmuiteam.qmui.widget.QMUIViewPager; | ||||
@@ -67,8 +67,8 @@ public class WhActivity extends BaseActivity { | |||||
fragmentAdapter = new FragmentAdapter(getSupportFragmentManager()); | fragmentAdapter = new FragmentAdapter(getSupportFragmentManager()); | ||||
fragmentAdapter.addFragment(new SystemCsPLCFragment()); | fragmentAdapter.addFragment(new SystemCsPLCFragment()); | ||||
fragmentAdapter.addFragment(new SystemCsJrFragment()); | |||||
fragmentAdapter.addFragment(new SystemCsTlFragment()); | |||||
fragmentAdapter.addFragment(new SystemCsControlFragment()); | |||||
fragmentAdapter.addFragment(new SystemCsMonitorFragment()); | |||||
fragmentAdapter.addFragment(new SystemCsFltlFragment()); | fragmentAdapter.addFragment(new SystemCsFltlFragment()); | ||||
viewPager.setAdapter(fragmentAdapter); | viewPager.setAdapter(fragmentAdapter); | ||||
} | } | ||||
@@ -0,0 +1,110 @@ | |||||
package com.bonait.bnframework.modules.home.fragment.from.fragment; | |||||
import android.app.Activity; | |||||
import android.content.Context; | |||||
import androidx.annotation.NonNull; | |||||
import androidx.annotation.Nullable; | |||||
import android.content.ContextWrapper; | |||||
import android.os.Bundle; | |||||
import android.view.LayoutInflater; | |||||
import android.view.View; | |||||
import android.widget.LinearLayout; | |||||
import com.bonait.bnframework.R; | |||||
import com.bonait.bnframework.common.base.BaseFragment; | |||||
import com.bonait.bnframework.common.db.QueryDB; | |||||
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | |||||
import com.bonait.bnframework.modules.home.fragment.mode.fragment_plc; | |||||
import com.bonait.bnframework.modules.home.fragment.mode.fragment_plc_control; | |||||
import com.orhanobut.logger.Logger; | |||||
import java.util.ArrayList; | |||||
import butterknife.BindView; | |||||
import butterknife.ButterKnife; | |||||
/** | |||||
* PLC控制 | |||||
*/ | |||||
public class SystemCsControlFragment extends BaseFragment { | |||||
private Context context; | |||||
@BindView(R.id.plcview) | |||||
LinearLayout plcview;//工序子集 | |||||
@Override | |||||
protected View onCreateView() { | |||||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_system_cs_control, null); | |||||
ButterKnife.bind(this, root); | |||||
return root; | |||||
} | |||||
@Override | |||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||||
super.onViewCreated(view, savedInstanceState); | |||||
Logger.d("我的fragment创建"); | |||||
context = getContext(); | |||||
Init(); | |||||
} | |||||
/** | |||||
* 初始化 | |||||
*/ | |||||
public void Init() { | |||||
plcview.removeAllViews(); | |||||
ArrayList<BPA_PLCADDRESS> arrayList = QueryDB.GetPlcaddressALL(); | |||||
new Thread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
try { | |||||
Activity activity = findActivity(context); | |||||
if (activity != null) { | |||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
try { | |||||
for (BPA_PLCADDRESS item : arrayList) { | |||||
fragment_plc_control gongxu = new fragment_plc_control(context, null, item); | |||||
plcview.addView(gongxu); | |||||
} | |||||
} catch (Exception e) { | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
} catch (Exception e) { | |||||
} | |||||
} | |||||
}).start(); | |||||
} | |||||
private Activity findActivity(@NonNull Context context) { | |||||
if (context instanceof Activity) { | |||||
return (Activity) context; | |||||
} else if (context instanceof ContextWrapper) { | |||||
return findActivity(((ContextWrapper) context).getBaseContext()); | |||||
} else { | |||||
return null; | |||||
} | |||||
} | |||||
@Override | |||||
public void onDestroy() { | |||||
super.onDestroy(); | |||||
Logger.d("我的fragment销毁"); | |||||
} | |||||
/** | |||||
* 当在activity设置viewPager + BottomNavigation + fragment时, | |||||
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题, | |||||
* 必须加上此方法,禁止fragment左滑返回上一界面。 | |||||
* | |||||
* 切记!切记!切记!否则会闪退! | |||||
* | |||||
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。 | |||||
*/ | |||||
@Override | |||||
protected boolean canDragBack() { | |||||
return false; | |||||
} | |||||
} |
@@ -1,22 +1,35 @@ | |||||
package com.bonait.bnframework.modules.home.fragment.from.fragment; | package com.bonait.bnframework.modules.home.fragment.from.fragment; | ||||
import android.app.Activity; | |||||
import android.content.Context; | import android.content.Context; | ||||
import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
import androidx.annotation.Nullable; | import androidx.annotation.Nullable; | ||||
import androidx.appcompat.app.AppCompatActivity; | import androidx.appcompat.app.AppCompatActivity; | ||||
import android.content.ContextWrapper; | |||||
import android.os.Bundle; | import android.os.Bundle; | ||||
import android.view.LayoutInflater; | import android.view.LayoutInflater; | ||||
import android.view.View; | import android.view.View; | ||||
import android.widget.LinearLayout; | |||||
import com.bonait.bnframework.R; | import com.bonait.bnframework.R; | ||||
import com.bonait.bnframework.common.base.BaseFragment; | import com.bonait.bnframework.common.base.BaseFragment; | ||||
import com.bonait.bnframework.common.db.QueryDB; | |||||
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | |||||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||||
import com.bonait.bnframework.modules.home.fragment.mode.fragment_plc_control; | |||||
import com.bonait.bnframework.modules.home.fragment.mode.fragment_silos_cl; | |||||
import com.orhanobut.logger.Logger; | import com.orhanobut.logger.Logger; | ||||
import java.util.ArrayList; | |||||
import butterknife.BindView; | |||||
import butterknife.ButterKnife; | import butterknife.ButterKnife; | ||||
public class SystemCsFltlFragment extends BaseFragment { | public class SystemCsFltlFragment extends BaseFragment { | ||||
@BindView(R.id.plcview) | |||||
LinearLayout plcview;//工序子集 | |||||
private Context context; | private Context context; | ||||
@Override | @Override | ||||
protected View onCreateView() { | protected View onCreateView() { | ||||
@@ -30,8 +43,51 @@ public class SystemCsFltlFragment extends BaseFragment { | |||||
super.onViewCreated(view, savedInstanceState); | super.onViewCreated(view, savedInstanceState); | ||||
Logger.d("我的fragment创建"); | Logger.d("我的fragment创建"); | ||||
context = getContext(); | context = getContext(); | ||||
Init(); | |||||
} | |||||
/** | |||||
* 初始化 | |||||
*/ | |||||
public void Init() { | |||||
plcview.removeAllViews(); | |||||
ArrayList<BPA_SILOS> arrayList = QueryDB.GetSilosALL(); | |||||
new Thread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
try { | |||||
Activity activity = findActivity(context); | |||||
if (activity != null) { | |||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
try { | |||||
for (BPA_SILOS item : arrayList) { | |||||
fragment_silos_cl gongxu = new fragment_silos_cl(context, null, item); | |||||
plcview.addView(gongxu); | |||||
} | |||||
} catch (Exception e) { | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
} catch (Exception e) { | |||||
} | |||||
} | |||||
}).start(); | |||||
} | } | ||||
private Activity findActivity(@NonNull Context context) { | |||||
if (context instanceof Activity) { | |||||
return (Activity) context; | |||||
} else if (context instanceof ContextWrapper) { | |||||
return findActivity(((ContextWrapper) context).getBaseContext()); | |||||
} else { | |||||
return null; | |||||
} | |||||
} | |||||
@Override | @Override | ||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
@@ -1,54 +0,0 @@ | |||||
package com.bonait.bnframework.modules.home.fragment.from.fragment; | |||||
import android.content.Context; | |||||
import androidx.annotation.NonNull; | |||||
import androidx.annotation.Nullable; | |||||
import androidx.appcompat.app.AppCompatActivity; | |||||
import android.os.Bundle; | |||||
import android.view.LayoutInflater; | |||||
import android.view.View; | |||||
import com.bonait.bnframework.R; | |||||
import com.bonait.bnframework.common.base.BaseFragment; | |||||
import com.orhanobut.logger.Logger; | |||||
import butterknife.ButterKnife; | |||||
public class SystemCsJrFragment extends BaseFragment { | |||||
private Context context; | |||||
@Override | |||||
protected View onCreateView() { | |||||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_system_cs_jr, null); | |||||
ButterKnife.bind(this, root); | |||||
return root; | |||||
} | |||||
@Override | |||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||||
super.onViewCreated(view, savedInstanceState); | |||||
Logger.d("我的fragment创建"); | |||||
context = getContext(); | |||||
} | |||||
@Override | |||||
public void onDestroy() { | |||||
super.onDestroy(); | |||||
Logger.d("我的fragment销毁"); | |||||
} | |||||
/** | |||||
* 当在activity设置viewPager + BottomNavigation + fragment时, | |||||
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题, | |||||
* 必须加上此方法,禁止fragment左滑返回上一界面。 | |||||
* | |||||
* 切记!切记!切记!否则会闪退! | |||||
* | |||||
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。 | |||||
*/ | |||||
@Override | |||||
protected boolean canDragBack() { | |||||
return false; | |||||
} | |||||
} |
@@ -0,0 +1,130 @@ | |||||
package com.bonait.bnframework.modules.home.fragment.from.fragment; | |||||
import android.content.Context; | |||||
import androidx.annotation.NonNull; | |||||
import androidx.annotation.Nullable; | |||||
import androidx.recyclerview.widget.RecyclerView; | |||||
import android.os.Bundle; | |||||
import android.view.LayoutInflater; | |||||
import android.view.View; | |||||
import android.widget.LinearLayout; | |||||
import android.widget.TextView; | |||||
import com.bonait.bnframework.R; | |||||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||||
import com.bonait.bnframework.common.base.BaseFragment; | |||||
import com.bonait.bnframework.common.constant.ConfigName; | |||||
import com.bonait.bnframework.common.constant.DataBus; | |||||
import com.bonait.bnframework.common.db.res.StatusMode; | |||||
import com.bonait.bnframework.common.utils.ToastUtils; | |||||
import com.bonait.bnframework.common.view.MyLayoutManager; | |||||
import com.bonait.bnframework.modules.home.adapter.lc_adapter; | |||||
import com.bonait.bnframework.modules.home.adapter.monitor_adapter; | |||||
import com.orhanobut.logger.Logger; | |||||
import butterknife.BindView; | |||||
import butterknife.ButterKnife; | |||||
/** | |||||
* plc 监控 | |||||
*/ | |||||
public class SystemCsMonitorFragment extends BaseFragment { | |||||
@BindView(R.id.recycler_view) | |||||
RecyclerView recyclerView;//工序子集 | |||||
@BindView(R.id.jiaobandianji) | |||||
TextView jiaobandianji;//工序子集 | |||||
@BindView(R.id.fanzhuandianji) | |||||
TextView fanzhuandianji;//工序子集 | |||||
private Context context; | |||||
monitor_adapter adapter; | |||||
@Override | |||||
protected View onCreateView() { | |||||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_system_cs_monitor, null); | |||||
ButterKnife.bind(this, root); | |||||
return root; | |||||
} | |||||
@Override | |||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||||
super.onViewCreated(view, savedInstanceState); | |||||
Logger.d("我的fragment创建"); | |||||
context = getContext(); | |||||
initData(); | |||||
} | |||||
/** | |||||
* 初始化显示数据 | |||||
*/ | |||||
private void initData() { | |||||
try { | |||||
MyLayoutManager layout = new MyLayoutManager(); | |||||
layout.setAutoMeasureEnabled(true); | |||||
recyclerView.setLayoutManager(layout); | |||||
adapter = new monitor_adapter(getContext()); | |||||
recyclerView.setAdapter(adapter); | |||||
Run(); | |||||
} catch (Exception e) { | |||||
ToastUtils.info("异常信息:" + e.getMessage()); | |||||
} | |||||
} | |||||
/** | |||||
* 实时显示线程 | |||||
*/ | |||||
public void Run() { | |||||
new Thread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
while (true) { | |||||
try { | |||||
getActivity().runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
try { | |||||
for (StatusMode item:ConfigName.getInstance().statusModes) | |||||
{ | |||||
item.Status= ExecuteTheRecipe.getConcurrentHash(item.sort); | |||||
} | |||||
jiaobandianji.setText( ConfigName.getInstance().statusModes_电机.get(ExecuteTheRecipe.getConcurrentHash_dj("搅拌电机"))); | |||||
fanzhuandianji.setText( ConfigName.getInstance().statusModes_电机.get(ExecuteTheRecipe.getConcurrentHash_dj("翻转电机"))); | |||||
adapter.refresh(); | |||||
} catch (Exception e) { | |||||
} | |||||
} | |||||
}); | |||||
Thread.sleep(1000); | |||||
} catch (InterruptedException e) { | |||||
throw new RuntimeException(e); | |||||
} | |||||
} | |||||
} | |||||
}).start(); | |||||
} | |||||
@Override | |||||
public void onDestroy() { | |||||
super.onDestroy(); | |||||
Logger.d("我的fragment销毁"); | |||||
} | |||||
/** | |||||
* 当在activity设置viewPager + BottomNavigation + fragment时, | |||||
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题, | |||||
* 必须加上此方法,禁止fragment左滑返回上一界面。 | |||||
* | |||||
* 切记!切记!切记!否则会闪退! | |||||
* | |||||
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。 | |||||
*/ | |||||
@Override | |||||
protected boolean canDragBack() { | |||||
return false; | |||||
} | |||||
} |
@@ -1,54 +0,0 @@ | |||||
package com.bonait.bnframework.modules.home.fragment.from.fragment; | |||||
import android.content.Context; | |||||
import androidx.annotation.NonNull; | |||||
import androidx.annotation.Nullable; | |||||
import androidx.appcompat.app.AppCompatActivity; | |||||
import android.os.Bundle; | |||||
import android.view.LayoutInflater; | |||||
import android.view.View; | |||||
import com.bonait.bnframework.R; | |||||
import com.bonait.bnframework.common.base.BaseFragment; | |||||
import com.orhanobut.logger.Logger; | |||||
import butterknife.ButterKnife; | |||||
public class SystemCsTlFragment extends BaseFragment { | |||||
private Context context; | |||||
@Override | |||||
protected View onCreateView() { | |||||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_system_cs_tl, null); | |||||
ButterKnife.bind(this, root); | |||||
return root; | |||||
} | |||||
@Override | |||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||||
super.onViewCreated(view, savedInstanceState); | |||||
Logger.d("我的fragment创建"); | |||||
context = getContext(); | |||||
} | |||||
@Override | |||||
public void onDestroy() { | |||||
super.onDestroy(); | |||||
Logger.d("我的fragment销毁"); | |||||
} | |||||
/** | |||||
* 当在activity设置viewPager + BottomNavigation + fragment时, | |||||
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题, | |||||
* 必须加上此方法,禁止fragment左滑返回上一界面。 | |||||
* | |||||
* 切记!切记!切记!否则会闪退! | |||||
* | |||||
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。 | |||||
*/ | |||||
@Override | |||||
protected boolean canDragBack() { | |||||
return false; | |||||
} | |||||
} |
@@ -0,0 +1,176 @@ | |||||
package com.bonait.bnframework.modules.home.fragment.mode; | |||||
import android.content.Context; | |||||
import android.text.InputType; | |||||
import android.util.AttributeSet; | |||||
import android.view.LayoutInflater; | |||||
import android.view.View; | |||||
import android.widget.Button; | |||||
import android.widget.CheckBox; | |||||
import android.widget.EditText; | |||||
import android.widget.LinearLayout; | |||||
import android.widget.RelativeLayout; | |||||
import android.widget.Switch; | |||||
import android.widget.TextView; | |||||
import androidx.annotation.Nullable; | |||||
import com.bonait.bnframework.R; | |||||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||||
import com.bonait.bnframework.common.db.QueryDB; | |||||
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | |||||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||||
import com.bonait.bnframework.common.utils.ToastUtils; | |||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||||
import butterknife.BindView; | |||||
import butterknife.ButterKnife; | |||||
import butterknife.OnClick; | |||||
/** | |||||
* PLC控制 | |||||
*/ | |||||
public class fragment_plc_control extends LinearLayout { | |||||
@BindView(R.id.name) | |||||
TextView name; | |||||
@BindView(R.id.name_PLC) | |||||
TextView name_PLC;//分组 | |||||
@BindView(R.id.edittext_plc) | |||||
EditText edittext_plc;//输入文本 | |||||
@BindView(R.id.wenben) | |||||
LinearLayout wenben; | |||||
@BindView(R.id.kaiguan) | |||||
RelativeLayout kaiguan; | |||||
@BindView(R.id.zhidu) | |||||
RelativeLayout zhidu; | |||||
@BindView(R.id.update_plc) | |||||
Button update_plc;//下发按钮 | |||||
@BindView(R.id.control_switch) | |||||
Switch control_switch;//下发按钮 | |||||
@BindView(R.id.text_wb) | |||||
TextView text_wb;//分组 | |||||
private View root; | |||||
public fragment_plc_control(Context context, @Nullable AttributeSet attrs, BPA_PLCADDRESS _model) { | |||||
super(context, attrs); | |||||
root= LayoutInflater.from(context).inflate(R.layout.fragment_item_plc_control, this); | |||||
ButterKnife.bind(this, root); | |||||
model=_model; | |||||
Init(); | |||||
} | |||||
public void Init() | |||||
{ | |||||
if (model.address.equals("-------------")) | |||||
{ | |||||
name.setText("\n"+model.name+":"); | |||||
wenben.setVisibility(View.GONE); | |||||
kaiguan.setVisibility(View.GONE); | |||||
zhidu.setVisibility(View.GONE); | |||||
}else | |||||
{ | |||||
name_PLC.setText(model.name); | |||||
if(model.iswrite==1) | |||||
{ | |||||
zhidu.setVisibility(View.GONE); | |||||
if(model.address.startsWith("M"))//开关 | |||||
{ | |||||
wenben.setVisibility(View.GONE); | |||||
kaiguan.setVisibility(View.VISIBLE); | |||||
if(model.isread==1) | |||||
{ | |||||
Object val= ExecuteTheRecipe.ListeningValue.get(model.name); | |||||
if(val!=null) | |||||
{ | |||||
control_switch.setChecked((boolean)val); | |||||
if ((boolean)val) | |||||
{ | |||||
control_switch.setText("打开"); | |||||
}else | |||||
{ | |||||
control_switch.setText("关闭"); | |||||
} | |||||
} | |||||
} | |||||
} else //文本 | |||||
{ | |||||
wenben.setVisibility(View.VISIBLE); | |||||
kaiguan.setVisibility(View.GONE); | |||||
if(model.isread==1) | |||||
{ | |||||
Object val= ExecuteTheRecipe.ListeningValue.get(model.name); | |||||
if(val!=null) | |||||
{ | |||||
String str=String.valueOf(val); | |||||
edittext_plc.setText(str.toCharArray(), 0, str.length()); | |||||
} | |||||
} | |||||
} | |||||
}else //只读 | |||||
{ | |||||
zhidu.setVisibility(View.VISIBLE); | |||||
wenben.setVisibility(View.GONE); | |||||
kaiguan.setVisibility(View.GONE); | |||||
Object val= ExecuteTheRecipe.ListeningValue.get(model.name); | |||||
if(val!=null) | |||||
{ | |||||
text_wb.setText(val+""); | |||||
} | |||||
} | |||||
} | |||||
control_switch.setOnClickListener(new OnClickListener() { | |||||
@Override | |||||
public void onClick(View view) { | |||||
boolean ischick= control_switch.isChecked(); | |||||
if (ischick) | |||||
{ | |||||
control_switch.setText("打开"); | |||||
}else | |||||
{ | |||||
control_switch.setText("关闭"); | |||||
} | |||||
ExecuteTheRecipe.WritePLC(model.name,ischick,null); | |||||
ToastUtils.info("写入地址:"+model.address+"成功!状态:"+(ischick?"打开":"关闭")); | |||||
} | |||||
}); | |||||
} | |||||
public BPA_PLCADDRESS model=null; | |||||
@OnClick({R.id.update_plc}) | |||||
public void onViewClicked(View view) { | |||||
switch (view.getId()) { | |||||
case R.id.update_plc: | |||||
String text=edittext_plc.getText().toString(); | |||||
if(text.isEmpty()) | |||||
{ | |||||
ToastUtils.warning("输入信息不能为空!"); | |||||
return; | |||||
} | |||||
if(model.address.startsWith("VW")) | |||||
{ | |||||
Short val=Short.parseShort(text); | |||||
ExecuteTheRecipe.WritePLC(model.name,val,null); | |||||
}else if(model.address.startsWith("VD")) | |||||
{ | |||||
int val=Integer.parseInt(text); | |||||
ExecuteTheRecipe.WritePLC(model.name,val,null); | |||||
}else | |||||
{ | |||||
Short val=Short.parseShort(text); | |||||
ExecuteTheRecipe.WritePLC(model.name,val,null); | |||||
} | |||||
ToastUtils.info("写入地址:"+model.address+"成功!"); | |||||
break; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,72 @@ | |||||
package com.bonait.bnframework.modules.home.fragment.mode; | |||||
import android.content.Context; | |||||
import android.text.InputType; | |||||
import android.util.AttributeSet; | |||||
import android.view.LayoutInflater; | |||||
import android.view.View; | |||||
import android.widget.Button; | |||||
import android.widget.CheckBox; | |||||
import android.widget.EditText; | |||||
import android.widget.LinearLayout; | |||||
import android.widget.TextView; | |||||
import androidx.annotation.Nullable; | |||||
import com.bonait.bnframework.R; | |||||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||||
import com.bonait.bnframework.common.db.QueryDB; | |||||
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | |||||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||||
import com.bonait.bnframework.common.helper.I.IWriteCallBack; | |||||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||||
import com.bonait.bnframework.common.utils.ToastUtils; | |||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||||
import butterknife.BindView; | |||||
import butterknife.ButterKnife; | |||||
import butterknife.OnClick; | |||||
public class fragment_silos_cl extends LinearLayout { | |||||
@BindView(R.id.name) | |||||
TextView name; | |||||
@BindView(R.id.update_lc) | |||||
Button update_lc; | |||||
@BindView(R.id.edittext_lc) | |||||
EditText edittext_lc; | |||||
private View root; | |||||
public fragment_silos_cl(Context context, @Nullable AttributeSet attrs, BPA_SILOS _model) { | |||||
super(context, attrs); | |||||
root= LayoutInflater.from(context).inflate(R.layout.fragment_item_silos_cl, this); | |||||
ButterKnife.bind(this, root); | |||||
model=_model; | |||||
name.setText("料仓" + model.num+"号"); | |||||
} | |||||
public BPA_SILOS model=null; | |||||
@OnClick({R.id.update_lc}) | |||||
public void onViewClicked(View view) { | |||||
switch (view.getId()) { | |||||
case R.id.update_lc: | |||||
String text=edittext_lc.getText().toString(); | |||||
if(text.isEmpty()) | |||||
{ | |||||
ToastUtils.warning("需求值为空!"); | |||||
return; | |||||
} | |||||
Short val=Short.parseShort(text); | |||||
ExecuteTheRecipe.WritePLC("料仓" + model.num + "需求值", val, new IWriteCallBack() { | |||||
@Override | |||||
public void onSuccess() { | |||||
ExecuteTheRecipe.WritePLC("料仓" + model.num + "下料",true,null); | |||||
} | |||||
@Override | |||||
public void onFailure(String ErrorMsg) { | |||||
} | |||||
}); | |||||
ToastUtils.info("料仓" + model.num+"出料:"+text+"g"); | |||||
break; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,19 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||||
<item android:state_checked="true"> | |||||
<shape android:shape="rectangle"> | |||||
<corners android:radius="30dp" /> | |||||
<solid android:color="#2ecc71" /> | |||||
<padding android:left="10dp" /> | |||||
</shape> | |||||
</item> | |||||
<item android:state_checked="false"> | |||||
<shape android:shape="rectangle"> | |||||
<corners android:radius="30dp" /> | |||||
<solid android:color="#d1f2eb" /> | |||||
<padding android:left="10dp" /> | |||||
</shape> | |||||
</item> | |||||
</selector> |
@@ -0,0 +1,5 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||||
<item android:state_checked="true" android:color="@android:color/white" /> | |||||
<item android:state_checked="false" android:color="#8A8A8A" /> | |||||
</selector> |
@@ -4,16 +4,24 @@ | |||||
xmlns:tools="http://schemas.android.com/tools" | xmlns:tools="http://schemas.android.com/tools" | ||||
android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
tools:context=".modules.home.fragment.from.fragment.SystemCsTlFragment"> | |||||
tools:context=".modules.home.fragment.from.fragment.SystemCsControlFragment"> | |||||
<LinearLayout | <LinearLayout | ||||
android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
android:orientation="vertical" | android:orientation="vertical" | ||||
android:background="@color/main_background"> | android:background="@color/main_background"> | ||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:text="这里是参数设置的主投料与电机"/> | |||||
<ScrollView | |||||
android:layout_marginTop="20dp" | |||||
android:layout_weight="1" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent"> | |||||
<LinearLayout | |||||
android:id="@+id/plcview" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content" | |||||
android:orientation="vertical"> | |||||
</LinearLayout> | |||||
</ScrollView> | |||||
</LinearLayout> | </LinearLayout> | ||||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> | </com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -10,10 +10,18 @@ | |||||
android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
android:orientation="vertical" | android:orientation="vertical" | ||||
android:background="@color/main_background"> | android:background="@color/main_background"> | ||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:text="这里是参数设置的辅料投料"/> | |||||
<ScrollView | |||||
android:layout_marginTop="20dp" | |||||
android:layout_weight="1" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent"> | |||||
<LinearLayout | |||||
android:id="@+id/plcview" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content" | |||||
android:orientation="vertical"> | |||||
</LinearLayout> | |||||
</ScrollView> | |||||
</LinearLayout> | </LinearLayout> | ||||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> | </com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -1,19 +0,0 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||||
xmlns:tools="http://schemas.android.com/tools" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
tools:context=".modules.home.fragment.from.fragment.SystemCsJrFragment"> | |||||
<LinearLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
android:orientation="vertical" | |||||
android:background="@color/main_background"> | |||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:text="这里是参数设置的主控与加热"/> | |||||
</LinearLayout> | |||||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,140 @@ | |||||
<?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" | |||||
tools:context=".modules.home.fragment.from.fragment.SystemCsMonitorFragment"> | |||||
<LinearLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
android:orientation="vertical" | |||||
android:background="@color/activity_background"> | |||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginTop="@dimen/dp_10" | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:layout_centerHorizontal="true" | |||||
android:layout_marginBottom="5dp" | |||||
android:text="搅拌电机:" | |||||
android:textSize="16sp"/> | |||||
<RelativeLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content"> | |||||
<LinearLayout | |||||
android:layout_marginTop="@dimen/dp_10" | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:orientation="vertical"> | |||||
<ImageView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:src="@mipmap/jbdj"/> | |||||
</LinearLayout> | |||||
<LinearLayout | |||||
android:layout_marginTop="@dimen/dp_10" | |||||
android:layout_marginLeft="100dp" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:orientation="vertical"> | |||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_centerHorizontal="true" | |||||
android:text="故障信息:"/> | |||||
<RelativeLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content"> | |||||
<TextView | |||||
android:id="@+id/jiaobandianji" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_centerHorizontal="true" | |||||
android:textColor="@color/color4" | |||||
android:text="搅拌电机" | |||||
android:textSize="12dp"/> | |||||
</RelativeLayout> | |||||
</LinearLayout> | |||||
</RelativeLayout> | |||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginTop="@dimen/dp_10" | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:layout_centerHorizontal="true" | |||||
android:layout_marginBottom="5dp" | |||||
android:text="翻转电机:" | |||||
android:textSize="16sp"/> | |||||
<RelativeLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content"> | |||||
<LinearLayout | |||||
android:layout_marginTop="@dimen/dp_10" | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:orientation="vertical"> | |||||
<ImageView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:src="@mipmap/fzdj"/> | |||||
</LinearLayout> | |||||
<LinearLayout | |||||
android:layout_marginTop="@dimen/dp_10" | |||||
android:layout_marginLeft="100dp" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:orientation="vertical"> | |||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_centerHorizontal="true" | |||||
android:text="故障信息:"/> | |||||
<RelativeLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content"> | |||||
<TextView | |||||
android:id="@+id/fanzhuandianji" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_centerHorizontal="true" | |||||
android:textColor="@color/color4" | |||||
android:text="搅拌电机" | |||||
android:textSize="12dp"/> | |||||
</RelativeLayout> | |||||
</LinearLayout> | |||||
</RelativeLayout> | |||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginTop="@dimen/dp_10" | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:layout_centerHorizontal="true" | |||||
android:layout_marginBottom="5dp" | |||||
android:text="炒锅状态:" | |||||
android:textSize="16sp"/> | |||||
<ScrollView | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:layout_marginRight="@dimen/dp_10" | |||||
android:layout_height="match_parent" | |||||
android:layout_width="match_parent" | |||||
android:fadingEdge="vertical" | |||||
tools:ignore="Suspicious0dp"> | |||||
<androidx.recyclerview.widget.RecyclerView | |||||
android:id="@+id/recycler_view" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content"/> | |||||
</ScrollView> | |||||
</LinearLayout> | |||||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,39 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:orientation="vertical" | |||||
android:padding="5dp"> | |||||
<RelativeLayout | |||||
android:layout_height="160dp" | |||||
android:layout_width="130dp" | |||||
android:background="@drawable/shadow_bottom"> | |||||
<TextView | |||||
android:id="@+id/title" | |||||
android:layout_marginTop="10dp" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginLeft="5dp" | |||||
android:gravity="center_horizontal" | |||||
android:layout_centerHorizontal="true" | |||||
android:rotationX="18" | |||||
android:text="杯子检测" | |||||
android:textSize="16dp" /> | |||||
<ImageView | |||||
android:id="@+id/image" | |||||
android:layout_width="60dp" | |||||
android:layout_height="60dp" | |||||
android:layout_alignParentTop="true" | |||||
android:layout_centerInParent="true" | |||||
android:layout_marginTop="45dp"> | |||||
</ImageView> | |||||
<TextView | |||||
android:id="@+id/text" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content" | |||||
android:layout_alignParentBottom="true" | |||||
android:layout_marginBottom="10dp" | |||||
android:gravity="center" | |||||
android:text="未设置" /> | |||||
</RelativeLayout> | |||||
</LinearLayout> |
@@ -0,0 +1,105 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<LinearLayout 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="wrap_content" | |||||
android:minHeight="30dp" | |||||
android:layout_marginBottom="@dimen/dp_10" | |||||
android:orientation="horizontal"> | |||||
<RelativeLayout | |||||
android:layout_width="130dp" | |||||
android:layout_height="match_parent"> | |||||
<TextView | |||||
android:id="@+id/name_PLC" | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_alignParentRight="true" | |||||
android:layout_centerVertical="true" | |||||
android:text=""/> | |||||
<TextView | |||||
android:id="@+id/name" | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_alignParentRight="false" | |||||
android:layout_centerVertical="true" | |||||
android:text="" | |||||
android:textSize="19dp"/> | |||||
</RelativeLayout> | |||||
<LinearLayout | |||||
android:visibility="gone" | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:id="@+id/wenben" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content"> | |||||
<EditText | |||||
android:id="@+id/edittext_plc" | |||||
android:layout_width="120dp" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginLeft="5dp" | |||||
android:background="@drawable/input_bj" | |||||
android:hint="请输入变量" | |||||
android:layout_weight="1" | |||||
android:inputType="number" | |||||
android:maxLines="1" | |||||
android:padding="3dp" | |||||
android:textSize="12dp" | |||||
android:text="0"/> | |||||
<RelativeLayout | |||||
android:layout_marginLeft="10dp" | |||||
android:layout_width="wrap_content" | |||||
android:layout_alignParentRight="true" | |||||
android:layout_height="wrap_content"> | |||||
<LinearLayout | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content"> | |||||
<Button | |||||
android:id="@+id/update_plc" | |||||
android:layout_width="80dp" | |||||
android:layout_height="26dp" | |||||
android:layout_marginRight="@dimen/dp_10" | |||||
android:background="@drawable/button1" | |||||
android:layout_centerInParent="true" | |||||
android:text="写" | |||||
android:textSize="14dp" /> | |||||
</LinearLayout> | |||||
</RelativeLayout> | |||||
</LinearLayout> | |||||
<RelativeLayout | |||||
android:visibility="gone" | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:id="@+id/kaiguan" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content"> | |||||
<Switch | |||||
android:id="@+id/control_switch" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:background="@drawable/qs_switch" | |||||
android:text="关闭" | |||||
android:layout_margin="5dp" | |||||
android:focusable="true" | |||||
/> | |||||
</RelativeLayout> | |||||
<RelativeLayout | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:id="@+id/zhidu" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content"> | |||||
<TextView | |||||
android:id="@+id/text_wb" | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_centerVertical="true" | |||||
android:text="未知"/> | |||||
</RelativeLayout> | |||||
</LinearLayout> |
@@ -0,0 +1,58 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<LinearLayout 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="wrap_content" | |||||
android:minHeight="30dp" | |||||
android:layout_marginBottom="@dimen/dp_10" | |||||
android:orientation="horizontal"> | |||||
<RelativeLayout | |||||
android:layout_width="130dp" | |||||
android:layout_height="match_parent"> | |||||
<TextView | |||||
android:id="@+id/name" | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_alignParentRight="true" | |||||
android:layout_centerVertical="true" | |||||
android:text=""/> | |||||
</RelativeLayout> | |||||
<EditText | |||||
android:id="@+id/edittext_lc" | |||||
android:layout_width="120dp" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginLeft="5dp" | |||||
android:background="@drawable/input_bj" | |||||
android:hint="请写入需求值" | |||||
android:layout_weight="1" | |||||
android:inputType="number" | |||||
android:maxLines="1" | |||||
android:padding="3dp" | |||||
android:textSize="12dp" | |||||
android:text="0"/> | |||||
<RelativeLayout | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:layout_width="wrap_content" | |||||
android:layout_alignParentRight="true" | |||||
android:layout_height="match_parent"> | |||||
<LinearLayout | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="match_parent"> | |||||
<Button | |||||
android:id="@+id/update_lc" | |||||
android:layout_width="80dp" | |||||
android:layout_height="26dp" | |||||
android:layout_marginRight="@dimen/dp_10" | |||||
android:background="@drawable/button1" | |||||
android:layout_centerInParent="true" | |||||
android:text="出料" | |||||
android:textSize="14dp" /> | |||||
</LinearLayout> | |||||
</RelativeLayout> | |||||
</LinearLayout> |
@@ -6,13 +6,13 @@ | |||||
<item | <item | ||||
android:id="@+id/bottom_navigation_1" | android:id="@+id/bottom_navigation_1" | ||||
android:title="主机#加热" /> | |||||
android:title="控制#监控" /> | |||||
<item | <item | ||||
android:id="@+id/bottom_navigation_2" | android:id="@+id/bottom_navigation_2" | ||||
android:title="主投料#电机" /> | |||||
android:title="状态#故障" /> | |||||
<item | <item | ||||
android:id="@+id/bottom_navigation_3" | android:id="@+id/bottom_navigation_3" | ||||
android:title="辅料投料" /> | |||||
android:title="辅料#投料" /> | |||||
</menu> | </menu> |