Преглед изворни кода

更新PLC地址位置

调味吧台第二版
fyf пре 1 година
родитељ
комит
39c60e220a
20 измењених фајлова са 1410 додато и 1136 уклоњено
  1. +1
    -1
      app/build.gradle
  2. +14
    -11
      app/src/main/java/com/example/bpa/app/BootInit.java
  3. +0
    -3
      app/src/main/java/com/example/bpa/app/Main.java
  4. +36
    -36
      app/src/main/java/com/example/bpa/config/ConfigName.java
  5. +1
    -1
      app/src/main/java/com/example/bpa/helper/ModbusTcpServer.java
  6. +1
    -1
      app/src/main/java/com/example/bpa/service/BusinessServer.java
  7. +125
    -115
      app/src/main/java/com/example/bpa/service/DeviceData.java
  8. +0
    -16
      app/src/main/java/com/example/bpa/service/ReheatServer.java
  9. +2
    -2
      app/src/main/java/com/example/bpa/view/control/clsf_control.java
  10. +1
    -3
      app/src/main/java/com/example/bpa/view/fragment/HomeFragment.java
  11. +1
    -19
      app/src/main/java/com/example/bpa/view/fragment/setting/ovarparameter.java
  12. +15
    -2
      app/src/main/java/com/example/bpa/view/from/dzcjy_activity.java
  13. +1
    -1
      app/src/main/java/com/example/bpa/view/from/lcsz_activity.java
  14. +224
    -81
      app/src/main/java/com/example/bpa/view/from/lsjy_activity.java
  15. +6
    -66
      app/src/main/java/com/example/bpa/view/from/wdgl_new_Activity.java
  16. +22
    -0
      app/src/main/res/layout/from/layout/activity_dzcjy.xml
  17. +950
    -644
      app/src/main/res/layout/from/layout/activity_lsjy.xml
  18. +0
    -14
      app/src/main/res/layout/from/layout/activity_ovarparameter.xml
  19. +10
    -106
      app/src/main/res/layout/from/layout/activity_wdgl_new.xml
  20. +0
    -14
      app/src/main/res/layout/from/layout/fragment_home.xml

+ 1
- 1
app/build.gradle Прегледај датотеку

@@ -10,7 +10,7 @@ android {
}

defaultConfig {
applicationId "com.example.bpatwbt"
applicationId "com.example.bpa"
minSdk 23
targetSdk 33
versionCode 1


+ 14
- 11
app/src/main/java/com/example/bpa/app/BootInit.java Прегледај датотеку

@@ -47,7 +47,6 @@ public class BootInit {
//2.初始化SD卡,数据库DB
SdCart.getInstance().initSD();


//3.初始化数据
InitDBdata();
//4.初始化Main
@@ -179,15 +178,17 @@ public class BootInit {

if(i<6)
{
silo.name="外置仓";
} else if (i>=6 && i<10) {
silo.name="粉料仓";
}else if (i==10) {
silo.name="外置仓"; //6个
} else if (i>=6 && i<9) {
silo.name="粉料仓"; //3个
}else if (i==9) {
silo.name="酱油仓";
}else if (i==10) {
silo.name="醋仓";
}else if (i==11) {
silo.name="猪油仓";
}else if (i==12) {
silo.name="高汤仓";
silo.name="牛油仓";
}
QueryDB.AddSilos(silo);
QueryDB.AddSilosAndMaterial(sm);
@@ -216,15 +217,17 @@ public class BootInit {

if(i<6)
{
silo.name="外置仓";
} else if (i>=6 && i<10) {
silo.name="粉料仓";
}else if (i==10) {
silo.name="外置仓"; //6个
} else if (i>=6 && i<9) {
silo.name="粉料仓"; //3个
}else if (i==9) {
silo.name="酱油仓";
}else if (i==10) {
silo.name="醋仓";
}else if (i==11) {
silo.name="猪油仓";
}else if (i==12) {
silo.name="高汤仓";
silo.name="牛油仓";
}
QueryDB.AddSilos(silo);
QueryDB.AddSilosAndMaterial(sm);


+ 0
- 3
app/src/main/java/com/example/bpa/app/Main.java Прегледај датотеку

@@ -219,8 +219,6 @@ public class Main {
ConfigName.getInstance().user.pass = ConfigUtil.read(ConfigName.getInstance().dishesCon, "password", ConfigName.getInstance().user.pass);
ConfigName.getInstance().IsUserDownOrder = ConfigUtil.read(ConfigName.getInstance().dishesCon, "IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder);
ConfigName.getInstance().AutomaticHeating = ConfigUtil.read(ConfigName.getInstance().dishesCon, "AutomaticHeating", ConfigName.getInstance().AutomaticHeating);
ConfigName.getInstance().JRX_AutomaticHeating = ConfigUtil.read(ConfigName.getInstance().dishesCon, "JRX_AutomaticHeating", ConfigName.getInstance().JRX_AutomaticHeating);

ConfigName.getInstance().Version = ConfigUtil.read(ConfigName.getInstance().dishesCon, "Version", ConfigName.getInstance().Version);
}

@@ -237,7 +235,6 @@ public class Main {
ConfigUtil.write(ConfigName.getInstance().dishesCon,"password", ConfigName.getInstance().user.pass);
ConfigUtil.write(ConfigName.getInstance().dishesCon,"IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder);
ConfigUtil.write(ConfigName.getInstance().dishesCon,"AutomaticHeating", ConfigName.getInstance().AutomaticHeating);
ConfigUtil.write(ConfigName.getInstance().dishesCon,"JRX_AutomaticHeating", ConfigName.getInstance().JRX_AutomaticHeating);
ConfigUtil.write(ConfigName.getInstance().dishesCon,"Version", ConfigName.getInstance().Version);
}



+ 36
- 36
app/src/main/java/com/example/bpa/config/ConfigName.java Прегледај датотеку

@@ -127,10 +127,6 @@ public class ConfigName {
* 是否自动加热(水池)
*/
public Boolean AutomaticHeating=false;
/**
* 加热箱
*/
public Boolean JRX_AutomaticHeating=false;
//endregion

//region 系统设置表
@@ -207,14 +203,14 @@ public class ConfigName {
public List<Res_PLCADDRESS> PlcAddress_配料吧_手动=new ArrayList<Res_PLCADDRESS>(){{

//硬件设备 初始化
// add(new Res_PLCADDRESS("-------------","","出料口",1,0));
// add(new Res_PLCADDRESS("M41.6","M101.6","出料口振动器",1,1));

add(new Res_PLCADDRESS("-------------","","酱油仓/猪油仓",1,0));
add(new Res_PLCADDRESS("M52.7","M102.7","酱油仓控制",0,1));
add(new Res_PLCADDRESS("M53.0","M103.0","猪油仓控制",0,1));
add(new Res_PLCADDRESS("M51.7","M101.7","猪油仓加热",1,1));
add(new Res_PLCADDRESS("M52.1","M102.1","猪油管道保温",1,1));
add(new Res_PLCADDRESS("M51.7","M101.7","酱油仓控制",0,1));
add(new Res_PLCADDRESS("M52.0","M102.0","醋仓控制",0,1));
add(new Res_PLCADDRESS("M52.1","M102.1","猪油仓控制",0,1));
add(new Res_PLCADDRESS("M52.2","M102.2","牛油仓控制",0,1));

add(new Res_PLCADDRESS("M53.6","M103.6","猪油管道保温",1,1));
add(new Res_PLCADDRESS("M53.7","M103.7","牛油管道保温",1,1));


add(new Res_PLCADDRESS("-------------","","外置仓",1,0));
@@ -225,31 +221,30 @@ public class ConfigName {
add(new Res_PLCADDRESS("M50.4","M100.4","外置仓正转(5)",1,1));
add(new Res_PLCADDRESS("M50.5","M100.5","外置仓正转(6)",1,1));

add(new Res_PLCADDRESS("M41.0","M101.0","外置仓反转(1)",1,1));
add(new Res_PLCADDRESS("M41.1","M101.1","外置仓反转(2)",1,1));
add(new Res_PLCADDRESS("M41.2","M101.2","外置仓反转(3)",1,1));
add(new Res_PLCADDRESS("M41.3","M101.3","外置仓反转(4)",1,1));
add(new Res_PLCADDRESS("M41.4","M101.4","外置仓反转(5)",1,1));
add(new Res_PLCADDRESS("M41.5","M101.5","外置仓反转(6)",1,1));
add(new Res_PLCADDRESS("M50.6","M100.6","外置仓反转(1)",1,1));
add(new Res_PLCADDRESS("M50.7","M100.7","外置仓反转(2)",1,1));
add(new Res_PLCADDRESS("M51.0","M101.0","外置仓反转(3)",1,1));
add(new Res_PLCADDRESS("M51.1","M101.1","外置仓反转(4)",1,1));
add(new Res_PLCADDRESS("M51.2","M101.2","外置仓反转(5)",1,1));
add(new Res_PLCADDRESS("M51.3","M101.3","外置仓反转(6)",1,1));

add(new Res_PLCADDRESS("-------------","","粉料仓",0,0));
add(new Res_PLCADDRESS("M52.2","M102.2","粉料仓控制(1)",0,1));
add(new Res_PLCADDRESS("M52.3","M102.3","粉料仓控制(2)",0,1));
add(new Res_PLCADDRESS("M52.4","M102.4","粉料仓控制(3)",0,1));
//add(new Res_PLCADDRESS("M52.5","M102.5","粉料仓控制(4)",0,1));
add(new Res_PLCADDRESS("M51.4","M101.4","粉料仓控制(1)",0,1));
add(new Res_PLCADDRESS("M51.5","M101.5","粉料仓控制(2)",0,1));
add(new Res_PLCADDRESS("M51.6","M101.6","粉料仓控制(3)",0,1));

add(new Res_PLCADDRESS("-------------","","水池",1,0));
add(new Res_PLCADDRESS("M50.6","M100.6","水池排水阀",1,1));
add(new Res_PLCADDRESS("M52.6","M102.6","水池进水阀",1,1));
add(new Res_PLCADDRESS("M52.0","M102.0","水池加热",1,1));
add(new Res_PLCADDRESS("M53.4","M103.4","水池进水阀",1,1));
add(new Res_PLCADDRESS("M53.5","M103.5","水池排水阀",1,1));
add(new Res_PLCADDRESS("M54.0","M104.0","水池加热",1,1));


add(new Res_PLCADDRESS("-------------","","外部水箱",1,0));
add(new Res_PLCADDRESS("M50.7","M100.7","水箱排水阀",1,1));
add(new Res_PLCADDRESS("M53.1","M103.1","水箱加热",1,1));
add(new Res_PLCADDRESS("M53.2","M103.2","水箱水泵(正)",1,1));
add(new Res_PLCADDRESS("M53.7","M103.7","水箱水泵(反)",1,1));
add(new Res_PLCADDRESS("M53.3","M103.3","外部管道加热",1,1));
// add(new Res_PLCADDRESS("-------------","","外部水箱",1,0));
// add(new Res_PLCADDRESS("M50.7","M100.7","水箱排水阀",1,1));
// add(new Res_PLCADDRESS("M53.1","M103.1","水箱加热",1,1));
// add(new Res_PLCADDRESS("M53.2","M103.2","水箱水泵(正)",1,1));
// add(new Res_PLCADDRESS("M53.7","M103.7","水箱水泵(反)",1,1));
// add(new Res_PLCADDRESS("M53.3","M103.3","外部管道加热",1,1));

// add(new Res_PLCADDRESS("M53.4","M103.4","绿灯",1,1));
// add(new Res_PLCADDRESS("M53.5","M103.5","红灯",1,1));
@@ -262,11 +257,16 @@ public class ConfigName {
*/
public List<Res_ZDSF> zdsfs_出料算法=new ArrayList<Res_ZDSF>(){{
//硬件设备 初始化
add(new Res_ZDSF("外置通道(一)","VW100.0","VW402","VW400","VW450"));
add(new Res_ZDSF("外置通道(二)","VW100.1","VW406","VW404","VW452"));
add(new Res_ZDSF("外置通道(三)","VW100.2","VW410","VW408","VW454"));
add(new Res_ZDSF("外置通道(四)","VW100.3","VW414","VW412","VW456"));
add(new Res_ZDSF("外置通道(五)","VW100.4","VW418","VW416","VW458"));
add(new Res_ZDSF("外置通道(六)","VW100.5","VW422","VW420","VW460"));
add(new Res_ZDSF("外置通道(一)","M5.0","VW144","VW44","VW168"));
add(new Res_ZDSF("外置通道(二)","M5.1","VW146","VW46","VW170"));
add(new Res_ZDSF("外置通道(三)","M5.2","VW148","VW48","VW172"));
add(new Res_ZDSF("外置通道(四)","M5.3","VW150","VW50","VW174"));
add(new Res_ZDSF("外置通道(五)","M5.4","VW152","VW52","VW176"));
add(new Res_ZDSF("外置通道(六)","M5.5","VW154","VW54","VW178"));
// add(new Res_ZDSF("外置通道(七)","M5.6","VW156","VW56","VW180"));
// add(new Res_ZDSF("外置通道(八)","M5.7","VW158","VW58","VW182"));
// add(new Res_ZDSF("外置通道(九)","M6.0","VW160","VW60","VW184"));
// add(new Res_ZDSF("外置通道(十)","M6.1","VW162","VW62","VW186"));

}};
}

+ 1
- 1
app/src/main/java/com/example/bpa/helper/ModbusTcpServer.java Прегледај датотеку

@@ -593,7 +593,7 @@ public class ModbusTcpServer {
for (int m = 0; m < 4; m++) {
tempData[m] = data[i * 4 + m];
}
tempValues[i] = BytesToFloat(tempData, DataFormat.ABCD);
tempValues[i] = BytesToFloat(tempData, DataFormat.BADC);
}
if (tempValues.length == length) {
if (callback != null) callback.onSuccess(tempValues);


+ 1
- 1
app/src/main/java/com/example/bpa/service/BusinessServer.java Прегледај датотеку

@@ -162,7 +162,7 @@ public class BusinessServer {
}

//将其余料仓出料设置为0,重置
for (int k = 1; k <= 13; k++) {
for (int k = 1; k <= 20; k++) {
if (!liaochang.contains(k)) {
DeviceData.Get().setDemandValue((short) 0, k, new IWriteCallBack() {
@Override


+ 125
- 115
app/src/main/java/com/example/bpa/service/DeviceData.java Прегледај датотеку

@@ -45,38 +45,47 @@ public class DeviceData {
public void Run() throws InterruptedException {
if(DataBus.getInstance().PlcIsConnect)
{
//获取校准值-增加两个果糖通道
ModbusTcpServer.get().ReadShort("VW0", 12, (shorts) -> {
//获取校准值-增加两个果糖通道 20个通道
ModbusTcpServer.get().ReadShort("VW0", 20, (shorts) -> {
for (int i = 0; i < shorts.length; i++) {
CalibrationValue.put(i + 1, shorts[i]);
}
});

//出料系数
ModbusTcpServer.get().ReadFloat("VD400", 20, (shorts) -> {
for (int i = 0; i < shorts.length; i++) {
CalibrationValueXS.put(i + 1, shorts[i]);
}
});

//获取称当前重量
ModbusTcpServer.get().ReadInt("VD356", 1, ints -> {
ModbusTcpServer.get().ReadInt("VD344", 1, ints -> {
for (int i = 0; i < ints.length; i++) {
CallCurrentWeight.put(i + 1, ints[i]);
}
});

//获取校准基准时间
ModbusTcpServer.get().ReadShort("VW26", 1, (shorts) -> {
//获取校准基准时间,
ModbusTcpServer.get().ReadShort("VW98", 1, (shorts) -> {
CalibrationReferenceTime = shorts[0];
});

//反转时间
ModbusTcpServer.get().ReadShort("VW94", 1, (shorts) -> {
FZTime = shorts[0];
});

//获取温度参数 保温池温度、加热箱温度
ModbusTcpServer.get().ReadInt("VD364", 2, ints -> {
ModbusTcpServer.get().ReadInt("VD352", 1, ints -> {
BWX_FructoseTemperature=ints[0];
JRX_FructoseTemperature=ints[1];
});

//获取温度设置
ModbusTcpServer.get().ReadInt("VD372", 1, ints -> {
ModbusTcpServer.get().ReadInt("VD360", 1, ints -> {
BWX_FructoseTemperature_sz=ints[0];
});
ModbusTcpServer.get().ReadInt("VD380", 1, ints -> {
JRX_FructoseTemperature_sz=ints[0];
});


//获取校准模式
ModbusTcpServer.get().ReadBool("M1.0", 1, booleans -> {
@@ -84,7 +93,7 @@ public class DeviceData {
});

//读取手动模式状态
ModbusTcpServer.get().ReadBool("M50.0", 32, booleans -> {
ModbusTcpServer.get().ReadBool("M50.0", 38, booleans -> {
for (int i=0;i<booleans.length;i++)
{
ManualValue.put(i,booleans[i]);
@@ -92,7 +101,7 @@ public class DeviceData {
});

//读取自动模式状态
ModbusTcpServer.get().ReadBool("M100.0", 32, booleans -> {
ModbusTcpServer.get().ReadBool("M100.0", 38, booleans -> {
for (int i=0;i<booleans.length;i++)
{
AutomationValue.put(i,booleans[i]);
@@ -100,14 +109,11 @@ public class DeviceData {
});

//读取通道补偿模式
ModbusTcpServer.get().ReadbcStatus("VW100", 1, data -> {
byte status=data[0];//0x92
CompensateValue.put(0, ByteHelper.getBit(status,0)==1);
CompensateValue.put(1, ByteHelper.getBit(status,1)==1);
CompensateValue.put(2, ByteHelper.getBit(status,2)==1);
CompensateValue.put(3, ByteHelper.getBit(status,3)==1);
CompensateValue.put(4, ByteHelper.getBit(status,4)==1);
CompensateValue.put(5, ByteHelper.getBit(status,5)==1);
ModbusTcpServer.get().ReadBool("M5.0", 10, booleans -> {
for (int i=0;i<booleans.length;i++)
{
CompensateValue.put(i,booleans[i]);
}
});

//配料完成 M0.3
@@ -116,6 +122,25 @@ public class DeviceData {
//按钮状态 M0.5
//CompleteListen("M0.5", "按钮状态", OnIngredientButtonPressedNotify);

CompleteListen("M0.7", "校准完成", OnChargeMixtureComNotPar);


//读取当前扫码信息
ModbusTcpServer.get().ReadString("VW300", 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("VW500", 4, data -> {
for (int i = 0; i < data.length; i++) {
@@ -141,6 +166,12 @@ public class DeviceData {
});
}
//endregion

/**
* 扫码信息
*/
public String Code = "";

//region 完成信号监听
/**
* 完成信号监听
@@ -164,6 +195,10 @@ public class DeviceData {
* 配料完成通知
*/
public IRun OnChargeMixtureCompleteNotify;
/**
* 通道配料完成通知
*/
public IRun OnChargeMixtureComNotPar;
/**
* 按钮按下通知
*/
@@ -182,7 +217,7 @@ public class DeviceData {
* @param ch 需要写入的通道编号,1--10
*/
public void setCalibrationValue(short value, int ch, IWriteCallBack callback) {
if (ch >= 1 && ch <= 13) {
if (ch >= 1 && ch <= 20) {
String add = "VW" + (-2 + ch * 2);
ModbusTcpServer.get().WriteShort(add, value, callback);
}
@@ -205,6 +240,37 @@ public class DeviceData {
return CalibrationValue.get(ch);
}

/**
* 校准值系数写入
* PLC 地址VW100--VW118
*
* @param value 需要写入的值
* @param ch 需要写入的通道编号,1--10
*/
public void setCalibrationValueXS(float value, int ch, IWriteCallBack callback) {
if (ch >= 1 && ch <= 20) {
String add = "VD" + (396 + ch * 4);
ModbusTcpServer.get().WriteFloat(add, value, callback);
}
}
/**
* 校准值系数
*/
ConcurrentHashMap<Integer, Float> CalibrationValueXS = new ConcurrentHashMap<>();

/**
* 获取校准值系数
*
* @param ch 要获取的通道号
* @return
*/
public float getCalibrationValueXS(int ch) {
if (!CalibrationValueXS.containsKey(ch))
return 1.0F;
return CalibrationValueXS.get(ch);
}


/**
* 需求值写入
* ,PLC 地址 VW200--VW218
@@ -213,8 +279,8 @@ public class DeviceData {
* @param ch 需要写入的通道编号,1--10
*/
public void setDemandValue(short value, int ch, IWriteCallBack callback) {
if (ch >= 1 && ch <= 13) {
String add = "VW" + (298 + ch * 2);
if (ch >= 1 && ch <= 20) {
String add = "VW" + (98 + ch * 2);
ModbusTcpServer.get().WriteShort(add, value, callback);
}
}
@@ -227,28 +293,8 @@ public class DeviceData {
* @param ch 需要写入的通道编号,1--10
*/
public void setChCalibrationSwitch(boolean value, int ch, IWriteCallBack callback) {
if (ch >= 1 && ch <= 13) {
String add="";
if(ch==9)
{
add="M3.0";
}else if(ch==10)
{
add="M3.1";
}else if(ch==11)
{
add="M3.2";
}else if(ch==12)
{
add="M3.3";
}
else if(ch==13)
{
add="M3.4";
}else
{
add = ModbusTcpServer.get().getBitSingleAdd("M", 2, ch);
}
if (ch >= 1 && ch <= 20) {
String add = ModbusTcpServer.get().getBitSingleAdd("M", 2, ch);
if (add.length() > 0)
ModbusTcpServer.get().WriteBool(add, value, callback);
}
@@ -425,6 +471,31 @@ public class DeviceData {
return CallCurrentWeight.get(ch);
}

//region 反转时间
/**
* 设置反转时间
*
* @param value 需要写入的值
*/
public void setFZTime(short value, IWriteCallBack callback) {
ModbusTcpServer.get().WriteShort("VW94", value, callback);
}

/**
* 反转时间
*/
int FZTime=0;

/**
* 获取反转时间时间
*
* @return
*/
public int getFZTime() {
return FZTime;
}
//endregion

//region 获取或设置-校准基准时间

/**
@@ -433,7 +504,7 @@ public class DeviceData {
* @param value 需要写入的值
*/
public void setCalibrationReferenceTime(short value, IWriteCallBack callback) {
ModbusTcpServer.get().WriteShort("VW26", value, callback);
ModbusTcpServer.get().WriteShort("VW98", value, callback);
}

/**
@@ -757,14 +828,14 @@ public class DeviceData {
* @param value
*/
public void setCalibrationWeight9(short value, IWriteCallBack callback) {
ModbusTcpServer.get().WriteShort("VW30", value, callback);
ModbusTcpServer.get().WriteShort("VW96", value, callback);
}

/**
* 扫码清零
*/
public void setCodeClear(IWriteCallBack callback) {
ModbusTcpServer.get().WriteString("VW342", 20, callback);
ModbusTcpServer.get().WriteString("VW300", 20, callback);
}
//endregion

@@ -794,7 +865,7 @@ public class DeviceData {
return BWX_FructoseTemperature_sz;
}
public void setBWX_FructoseTemperature(int value, IWriteCallBack callback) {
ModbusTcpServer.get().WriteInt("VD372", value, callback);
ModbusTcpServer.get().WriteInt("VD360", value, callback);
}
/**
* 设置水箱加热启动停止
@@ -802,42 +873,7 @@ public class DeviceData {
* @param value true:启动,flase:停止
*/
public void setBWXSwitch(boolean value, IWriteCallBack callback) {
ModbusTcpServer.get().WriteBool("M102.0", value, callback);
}
/**
* 加热箱
*/
int JRX_FructoseTemperature=0;
/**
* 加热箱
*/
int JRX_FructoseTemperature_sz=0;
/**
* 获取加热箱实际温度
*
* @return
*/
public int getJRX_FructoseTemperature() {
return JRX_FructoseTemperature;
}
/**
* 获取加热箱实际温度
*
* @return
*/
public int getJRX_FructoseTemperatureSZ() {
return JRX_FructoseTemperature_sz;
}
public void setJRX_FructoseTemperature(int value, IWriteCallBack callback) {
ModbusTcpServer.get().WriteInt("VD380", value, callback);
}
/**
* 设置加热箱加热启动停止
*
* @param value true:启动,flase:停止
*/
public void setJRXSwitch(boolean value, IWriteCallBack callback) {
ModbusTcpServer.get().WriteBool("M103.1", value, callback);
ModbusTcpServer.get().WriteBool("M104.0", value, callback);
}
//endregion

@@ -879,6 +915,7 @@ public class DeviceData {
*/
private int GetAddressIndex(String address) {
//put("M51.2",10);// 1*8+2 =10
//M50.0 0
if (address == null) return -1;
if (address.length() > 0) {
address = address.trim();
@@ -887,7 +924,7 @@ public class DeviceData {
if (res != null && res.length == 2) {
try {
//int a= intNum%10;//个
int firstAdd = Integer.parseInt(res[0])%10;//51 1
int firstAdd = Integer.parseInt(res[0])%10;//50 51 1
int endAdd = Integer.parseInt(res[1]);//2
return firstAdd*8+endAdd;
} catch (NumberFormatException e) {
@@ -954,35 +991,8 @@ public class DeviceData {
return 0;
}
}
//endregion

/**
* 写开关
* @param Adder
* @param val
* @return
*/
public boolean writeAutomationSwitch(String Adder,boolean valbll)
{
if (DataBus.getInstance().PlcIsConnect)
{
String[] res = Adder.split("[.]");
String firstAdd = res[0]; //VW100
int endAdd = Integer.parseInt(res[1]); //1 //第几位
ModbusTcpServer.get().ReadShort(firstAdd, 1, new IReadCallBack<short[]>() {
@Override
public void onSuccess(short[] shorts) {
Short val=shorts[0];
Short valk= ByteHelper.setBit(val,endAdd,valbll);
ModbusTcpServer.get().WriteShort(firstAdd, valk, null);
}
});

return true;
}else
{
return false;
}
}
//endregion

}

+ 0
- 16
app/src/main/java/com/example/bpa/service/ReheatServer.java Прегледај датотеку

@@ -65,22 +65,6 @@ public class ReheatServer {
}
}
}

if(ConfigName.getInstance().JRX_AutomaticHeating)
{
int jrx_temp=DeviceData.Get().getJRX_FructoseTemperature();//加热箱温度
int jrx_temp_sz=DeviceData.Get().getJRX_FructoseTemperatureSZ();//加热箱温度设置值
if(jrx_temp_sz>0)
{
if(jrx_temp>=jrx_temp_sz)
{
DeviceData.Get().setJRXSwitch(false,null);
}else
{
DeviceData.Get().setJRXSwitch(true,null);
}
}
}
}
Thread.sleep(2000);
}


+ 2
- 2
app/src/main/java/com/example/bpa/view/control/clsf_control.java Прегледај датотеку

@@ -90,7 +90,7 @@ public class clsf_control extends LinearLayout {
boolean isopen= switch1.isChecked();
if (DataBus.getInstance().PlcIsConnect)
{
DeviceData.Get().writeAutomationSwitch(sf.kg_address,isopen);
DeviceData.Get().setSwitch(isopen,sf.kg_address,null);
T.show(view.getContext(), sf.name.toString()+(isopen?"打开":"关闭")+"成功!");

}else
@@ -160,7 +160,7 @@ public class clsf_control extends LinearLayout {

double finalZl = zl;
//将其余料仓出料设置为0,重置
for (int k = 1; k <= 13; k++) {
for (int k = 1; k <= 20; k++) {
if (k!=index) {
DeviceData.Get().setDemandValue((short) 0, k,null);
}


+ 1
- 3
app/src/main/java/com/example/bpa/view/fragment/HomeFragment.java Прегледај датотеку

@@ -79,7 +79,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl
/**
* 当前温度
*/
TextView wendu1, wendu2,pf_ms,plc_status;
TextView wendu1,pf_ms,plc_status;
/**
* 界面实例
*/
@@ -119,7 +119,6 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl
nohelp=view.findViewById(R.id.nohelp);
image_zdkz=view.findViewById(R.id.image_zdkz);
wendu1 = view.findViewById(R.id.wendu1);
wendu2 = view.findViewById(R.id.wendu2);
pf_ms = view.findViewById(R.id.pf_ms);
plc_status = view.findViewById(R.id.plc_status);
if( ConfigName.getInstance().IsUserDownOrder)
@@ -374,7 +373,6 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl
@Override
public void run() {
wendu1.setText(String.valueOf(DeviceData.Get().getBWX_FructoseTemperature()) + "°C");
wendu2.setText(String.valueOf(DeviceData.Get().getJRX_FructoseTemperature()) + "°C");
plc_status.setText(DataBus.getInstance().PlcIsConnect?"正常":"异常");
// plc_status.setTextColor(DataBus.getInstance().PlcIsConnect?getResources().getColor(R.color.foreground):getResources().getColor(R.color.warm_red));
}


+ 1
- 19
app/src/main/java/com/example/bpa/view/fragment/setting/ovarparameter.java Прегледај датотеку

@@ -25,7 +25,7 @@ import java.util.Arrays;

public class ovarparameter extends Fragment {

Switch Switch_1,Switch_2,Switch_3;
Switch Switch_1,Switch_2;
/**
* 界面实例
*/
@@ -51,10 +51,8 @@ public class ovarparameter extends Fragment {
{
Switch_1 = view.findViewById(R.id.Switch_1);
Switch_2 = view.findViewById(R.id.Switch_2);
Switch_3 = view.findViewById(R.id.Switch_3);
Switch_1.setChecked(ConfigName.getInstance().IsUserDownOrder);
Switch_2.setChecked(ConfigName.getInstance().AutomaticHeating);
Switch_3.setChecked(ConfigName.getInstance().JRX_AutomaticHeating);
}
/**
* 初始化按钮事件
@@ -89,22 +87,6 @@ public class ovarparameter extends Fragment {
}
});

/**
* 设置是否是否自动加热
*/
Switch_3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
ConfigName.getInstance().JRX_AutomaticHeating=b;
Main.getInstance().SavePZ();

if(!b)
{
//关闭加热
DeviceData.Get().setJRXSwitch(false,null);
}
}
});
}
//endregion
}

+ 15
- 2
app/src/main/java/com/example/bpa/view/from/dzcjy_activity.java Прегледај датотеку

@@ -52,7 +52,8 @@ public class dzcjy_activity extends AppCompatActivity implements View.OnClickLis
* zerocalibration_button:零点校准
* allcalibration_button:一键去皮
*/
Button owSave_button, zeroweight_button, outWrite_button, zerocalibration_button;
Button owSave_button, zeroweight_button, outWrite_button, zerocalibration_button
,closewrite_bottom,openwrite_bottom;

EditText outweight_edit;

@@ -117,6 +118,9 @@ public class dzcjy_activity extends AppCompatActivity implements View.OnClickLis
zerocalibration_button = this.findViewById(R.id.zerocalibration_button);
//edit
mode_out_realvalue = this.findViewById(R.id.mode_out_realvalue);

closewrite_bottom= this.findViewById(R.id.closewrite_bottom);
openwrite_bottom= this.findViewById(R.id.openwrite_bottom);
}

/**
@@ -134,6 +138,10 @@ public class dzcjy_activity extends AppCompatActivity implements View.OnClickLis
outWrite_button.setOnClickListener(this);
zerocalibration_button.setOnClickListener(this);
out_switch.setOnCheckedChangeListener(this);

closewrite_bottom.setOnClickListener(this);
openwrite_bottom.setOnClickListener(this);

}

/**
@@ -199,7 +207,12 @@ public class dzcjy_activity extends AppCompatActivity implements View.OnClickLis
case R.id.zerocalibration_button://零点校准
DeviceData.Get().setZeroPointCalibration(null);
break;

case R.id.closewrite_bottom://关闭写保护
DeviceData.Get().setCloseWriteProtect(null);
break;
case R.id.openwrite_bottom://打开写保护
DeviceData.Get().setOpenWriteProtect(null);
break;
}
}).start();



+ 1
- 1
app/src/main/java/com/example/bpa/view/from/lcsz_activity.java Прегледај датотеку

@@ -116,7 +116,7 @@ public class lcsz_activity extends AppCompatActivity implements View.OnClickList
//
// }

if(silo.num!=10)
//if(silo.num!=10)
{
List<BPA_MATERIAL> m = QueryDB.GetMaterialBySilosID(silo.id);
if (m.size() > 0) {


+ 224
- 81
app/src/main/java/com/example/bpa/view/from/lsjy_activity.java Прегледај датотеку

@@ -4,6 +4,7 @@ import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
@@ -14,6 +15,7 @@ import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;

import com.example.bpa.Model.IRun;
import com.example.bpa.Model.IWriteCallBack;
import com.example.bpa.R;
import com.example.bpa.config.ConfigName;
@@ -45,6 +47,17 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
TextView gongneng_title;
//通道校准值
EditText passwayText_1, passwayText_2, passwayText_3, passwayText_4, passwayText_5, passwayText_6, passwayText_7, passwayText_8, passwayText_9, passwayText_10, passwayText_11, passwayText_12, passwayText_13;

//通道系数
EditText xsText_1, xsText_2, xsText_3, xsText_4, xsText_5, xsText_6, xsText_7, xsText_8, xsText_9, xsText_10, xsText_11, xsText_12, xsText_13;;

//反转时间
EditText fzText;

//通道系数
List<EditText> editTextListsXS = new ArrayList<EditText>();


//校准基准时间
EditText timeText;
List<EditText> editTextLists = new ArrayList<EditText>();
@@ -58,12 +71,16 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
//清零
Button ClearText;

Button savecanshu;
/**
* 保存值
*/
Button SaveValue;
//重量
TextView zhongliang;

EditText bc_text4;
Button cl_botton;
Button savefztime;

//endregion

@@ -121,6 +138,21 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList

editTextLists = Arrays.asList(passwayText_1, passwayText_2, passwayText_3, passwayText_4, passwayText_5, passwayText_6, passwayText_7, passwayText_8, passwayText_9, passwayText_10, passwayText_11, passwayText_12, passwayText_13);

//校准系数
xsText_1 = findViewById(R.id.xs_1);
xsText_2 = findViewById(R.id.xs_2);
xsText_3 = findViewById(R.id.xs_3);
xsText_4 = findViewById(R.id.xs_4);
xsText_5 = findViewById(R.id.xs_5);
xsText_6 = findViewById(R.id.xs_6);
xsText_7 = findViewById(R.id.xs_7);
xsText_8 = findViewById(R.id.xs_8);
xsText_9 = findViewById(R.id.xs_9);
xsText_10 = findViewById(R.id.xs_10);
xsText_11 = findViewById(R.id.xs_11);
xsText_12 = findViewById(R.id.xs_12);
xsText_13 = findViewById(R.id.xs_13);
editTextListsXS=Arrays.asList(xsText_1, xsText_2, xsText_3, xsText_4, xsText_5, xsText_6, xsText_7, xsText_8, xsText_9, xsText_10, xsText_11, xsText_12, xsText_13);
//校准开关
Switch_1 = findViewById(R.id.Switch_1);
Switch_2 = findViewById(R.id.Switch_2);
@@ -137,17 +169,20 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
Switch_13 = findViewById(R.id.Switch_13);
switchLists = Arrays.asList(Switch_1, Switch_2, Switch_3, Switch_4, Switch_5, Switch_6, Switch_7, Switch_8, Switch_9, Switch_10, Switch_11, Switch_12, Switch_13);

//反转时间
fzText=findViewById(R.id.fz_time);
//校准按钮
StartButton = findViewById(R.id.StartButton);
timeText = findViewById(R.id.edi_time);
SaveButton = findViewById(R.id.savetime);

savecanshu = findViewById(R.id.savecanshu);
savefztime = findViewById(R.id.savefztime);

ClearText = findViewById(R.id.ClearText);
zhongliang = findViewById(R.id.zhongliang);

bc_text4=this.findViewById(R.id.bc_text4);
SaveValue = findViewById(R.id.SaveValue);
bc_text4=this.findViewById(R.id.bc_text4);
cl_botton=this.findViewById(R.id.cl_botton);
}

@@ -159,8 +194,19 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
StartButton.setOnClickListener(this);
SaveButton.setOnClickListener(this);
ClearText.setOnClickListener(this);
savecanshu.setOnClickListener(this);
cl_botton.setOnClickListener(this);
SaveValue.setOnClickListener(this);
cl_botton.setOnClickListener(this);
//switch
// Switch_1.setOnCheckedChangeListener(this);
// Switch_2.setOnCheckedChangeListener(this);
// Switch_3.setOnCheckedChangeListener(this);
// Switch_4.setOnCheckedChangeListener(this);
// Switch_5.setOnCheckedChangeListener(this);
// Switch_6.setOnCheckedChangeListener(this);
// Switch_7.setOnCheckedChangeListener(this);
// Switch_8.setOnCheckedChangeListener(this);
// Switch_9.setOnCheckedChangeListener(this);
// Switch_10.setOnCheckedChangeListener(this);
}

/**
@@ -172,11 +218,15 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
for (int i = 0; i < 13; i++) {
String s = String.valueOf(DeviceData.Get().getCalibrationValue(i + 1));
editTextLists.get(i).setText(String.format("%.1f", (Double.parseDouble(s) / 10)));

editTextListsXS.get(i).setText(DeviceData.Get().getCalibrationValueXS(i + 1)+"");
}
String time = String.valueOf(DeviceData.Get().getCalibrationReferenceTime());
//校准时间
timeText.setText(String.format("%.1f", (Double.parseDouble(time) / 10)));

String fztime = String.valueOf(DeviceData.Get().getFZTime());
fzText.setText(String.format("%.1f", (Double.parseDouble(fztime) / 10)));
//设置手动模式
DeviceData.Get().setHandOrAutoSwitch(false, null);
} catch (Exception e) {
@@ -187,6 +237,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList

//region 点击事件
private boolean isClicked = false;
public int index = -1;

/**
* 本页面点击事件监听
@@ -199,6 +250,79 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
case R.id.gongneng_fanhui://返回按钮
this.finish();
break;
case R.id.SaveValue://保存所有参数
if (!isClicked) {
isClicked = true;
SaveValue.setEnabled(false); // 禁用按钮防止重复点击
// 在2秒后执行按钮操作
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// 执行按钮操作
// TODO: 在这里添加你的代码
try {
for (int i = 0; i < 13; i++) {
if (switchLists.get(i).isChecked() == true)//校准开关打开后,允许校准
{
String value = editTextLists.get(i).getText().toString();
Short val = 0;
try {
val = (short) Math.round((Double.parseDouble(value) * 10));
} catch (Exception e) {
}
if (val <= 0) {
T.show(lsjy_activity.this, "请检查[通道" + (i + 1) + "]数值不能小于0");
return;
}
}
}

//写开关状态 数值
for (int i = 0; i < 13; i++) {
String value = editTextLists.get(i).getText().toString();
String value1=editTextListsXS.get(i).getText().toString();
Short val = 0;
float xs= 1.0F;
try {
val = (short) Math.round((Double.parseDouble(value) * 10));
xs=Float.parseFloat(value1);
} catch (Exception e) {
}

final boolean[] IsComplete = {false};
DeviceData.Get().setCalibrationValueXS(xs, i + 1,null);
DeviceData.Get().setCalibrationValue(val, i + 1, new IWriteCallBack() {
@Override
public void onSuccess() {
IsComplete[0] = true;
}

@Override
public void onFailure(String ErrorMsg) {
IsComplete[0] = true;
}
});

long a = System.currentTimeMillis();
while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * 60) {
break;
}
Thread.sleep(100);//10 *6
}
}
} catch (WindowManager.BadTokenException ex) {
MessageLog.ShowInfo("校准保存配置异常:" + ex.getMessage());
} catch (InterruptedException ex) {
MessageLog.ShowInfo("校准保存配置异常:" + ex.getMessage());
}
T.show(lsjy_activity.this, "参数写入成功");
SaveValue.setEnabled(true); // 恢复按钮状态
isClicked = false; // 重置点击状态
}
}, 500);
}
break;
case R.id.savetime://校准基准时间保存
// 执行操作
if (!isClicked) {
@@ -244,6 +368,51 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
}, 500);
}
break;
case R.id.savefztime://校准基准时间保存
// 执行操作
if (!isClicked) {
isClicked = true;
savefztime.setEnabled(false); // 禁用按钮防止重复点击
// 在2秒后执行按钮操作
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// 执行按钮操作
// TODO: 在这里添加你的代码
try {
String stime = fzText.getText().toString();
if (stime.equals("")) {
T.show(lsjy_activity.this, "校准基准时间不能为空!");
return;
}
int ftime = 0;
try {
ftime = (int) Math.round((Double.parseDouble(stime) * 10));
} catch (Exception e) {
T.show(lsjy_activity.this, "反转时间异常!" + e.getMessage());
return;
}

DeviceData.Get().setFZTime((short) ftime, new IWriteCallBack() {
@Override
public void onSuccess() {
}

@Override
public void onFailure(String ErrorMsg) {
}
});
} catch (WindowManager.BadTokenException ex) {
MessageLog.ShowInfo("校准保存配置异常:" + ex.getMessage());
}
T.show(lsjy_activity.this, "反转时间写入成功");

savefztime.setEnabled(true); // 恢复按钮状态
isClicked = false; // 重置点击状态
}
}, 500);
}
break;
case R.id.StartButton://开始校准
if (!isClicked) {
isClicked = true;
@@ -257,9 +426,17 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
// 执行按钮操作
// TODO: 在这里添加你的代码
try {
index = -1;
//写开关状态 数值
for (int i = 0; i < 13; i++) {
//1.写入开关状态
if (switchLists.get(i).isChecked()) {
if (index < 0) {
index = i;
} else {
index = -2;
}
}
DeviceData.Get().setChCalibrationSwitch(switchLists.get(i).isChecked(), i + 1, new IWriteCallBack() {
@Override
public void onSuccess() {
@@ -306,75 +483,6 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
}
});
break;
case R.id.savecanshu://保存数字
// 执行操作
if (!isClicked) {
isClicked = true;
savecanshu.setEnabled(false); // 禁用按钮防止重复点击
// 在2秒后执行按钮操作
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// 执行按钮操作
// TODO: 在这里添加你的代码
try {
for (int i = 0; i < 13; i++) {
if (switchLists.get(i).isChecked() == true)//校准开关打开后,允许校准
{
String value = editTextLists.get(i).getText().toString();
Short val = 0;
try {
val = (short) Math.round((Double.parseDouble(value) * 10));
} catch (Exception e) {
}
if (val <= 0) {
T.show(lsjy_activity.this, "请检查[通道" + (i + 1) + "]数值不能小于0");
return;
}
}
}
//写开关状态 数值
for (int i = 0; i < 13; i++) {
String value = editTextLists.get(i).getText().toString();
Short val = 0;
try {
val = (short) Math.round((Double.parseDouble(value) * 10));
} catch (Exception e) {
}

final boolean[] IsComplete = {false};
DeviceData.Get().setCalibrationValue(val, i + 1, new IWriteCallBack() {
@Override
public void onSuccess() {
IsComplete[0] = true;
}

@Override
public void onFailure(String ErrorMsg) {
IsComplete[0] = true;
}
});

long a = System.currentTimeMillis();
while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * 6) {
break;
}
Thread.sleep(100);//10 *6
}
}
} catch (WindowManager.BadTokenException ex) {
MessageLog.ShowInfo("校准保存配置异常:" + ex.getMessage());
} catch (InterruptedException ex) {
MessageLog.ShowInfo("校准保存配置异常:" + ex.getMessage());
}
T.show(lsjy_activity.this, "参数值写入成功");
savecanshu.setEnabled(true); // 恢复按钮状态
isClicked = false; // 重置点击状态
}
}, 500);
}
break;
case R.id.cl_botton:
String zltext = bc_text4.getText().toString();
if (zltext.equals("")) {
@@ -395,18 +503,18 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
return;
}

int index=-1;
int indexoo=-1;
for (int i = 0; i < 13; i++) {
if (switchLists.get(i).isChecked() == true)//校准开关打开后,允许校准
{
if(index<=-1)
if(indexoo<=-1)
{
index=i+1;
indexoo=i+1;
}
}
}

if (index<=0)
if (indexoo<=0)
{
T.show(lsjy_activity.this, "请打开通道开关!");
return;
@@ -420,7 +528,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
DeviceData.Get().setDemandValue((short) 0, k,null);
}
}
DeviceData.Get().setDemandValue((short) ((int)(zl*10)), index, new IWriteCallBack() {
DeviceData.Get().setDemandValue((short) ((int)(zl*10)), indexoo, new IWriteCallBack() {
@Override
public void onSuccess() {

@@ -471,13 +579,48 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
}
}
});
Thread.sleep(500);
Thread.sleep(100);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
}).start();

DeviceData.Get().OnChargeMixtureComNotPar = new IRun() {
@Override
public void Run() {
if (index >= 0) {
final int kkk = index;
try {
lsjy_activity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
// 在2秒后执行按钮操作
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
int val = DeviceData.Get().getCallCurrentWeight(9);
DeviceData.Get().setCalibrationValue((short) val, kkk + 1, null);
String s = String.valueOf(val);
editTextLists.get(kkk).setText(String.format("%.1f", (Double.parseDouble(s) / 10)));
}
}, 2000);
} catch (Exception e) {
MessageLog.ShowInfo("重量解析显示异常!" + e.getMessage());
}
}
});
} catch (Exception ex) {
Log.d("dsds", "Run: " + ex.getMessage());
}


index = -1;
}
}
};
}
//endregion
}

+ 6
- 66
app/src/main/java/com/example/bpa/view/from/wdgl_new_Activity.java Прегледај датотеку

@@ -35,17 +35,17 @@ public class wdgl_new_Activity extends AppCompatActivity implements View.OnClick
/**
* 温度上限
*/
EditText sc_bw, jrx_bw;
EditText sc_bw;
/**
* 当前温度
*/
TextView wendu1, wendu2;
TextView wendu1;
/**
* 保存按钮
*/
Button mwSave_button1, mwSave_button2;
Button mwSave_button1;

Switch Switch_2,Switch_3,Switch_zyc,Switch_zygdbw,Switch_wbgdjr;
Switch Switch_2,Switch_zygdbw,Switch_wbgdjr;
//endregion

//region 私有函数
@@ -69,29 +69,22 @@ public class wdgl_new_Activity extends AppCompatActivity implements View.OnClick
gongneng_fanhui = this.findViewById(R.id.gongneng_fanhui);
gongneng_title = this.findViewById(R.id.gongneng_title);
sc_bw = this.findViewById(R.id.sc_bw);
jrx_bw = this.findViewById(R.id.jrx_bw);


wendu1 = this.findViewById(R.id.wendu1);
wendu2 = this.findViewById(R.id.wendu2);

mwSave_button1 = this.findViewById(R.id.mwSave_button1);
mwSave_button2 = this.findViewById(R.id.mwSave_button2);

Switch_2 = this.findViewById(R.id.Switch_2);
Switch_3 = this.findViewById(R.id.Switch_3);

Switch_zyc=this.findViewById(R.id.Switch_zyc);
Switch_zygdbw=this.findViewById(R.id.Switch_zygdbw);
Switch_wbgdjr=this.findViewById(R.id.Switch_wbgdjr);

Switch_zyc.setChecked(DeviceData.Get().getAutomationValue("M101.7"));
Switch_zygdbw.setChecked(DeviceData.Get().getAutomationValue("M102.1"));
Switch_wbgdjr.setChecked(DeviceData.Get().getAutomationValue("M103.3"));
Switch_zygdbw.setChecked(DeviceData.Get().getAutomationValue("M103.6"));
Switch_wbgdjr.setChecked(DeviceData.Get().getAutomationValue("M103.7"));


Switch_2.setChecked(ConfigName.getInstance().AutomaticHeating);
Switch_3.setChecked(ConfigName.getInstance().JRX_AutomaticHeating);
//通过Activity.getIntent()获取当前页面接收到的Intent。 getXxxExtra方法获取Intent传递过来的数据
String msg = getIntent().getStringExtra("data");
gongneng_title.setText(msg);
@@ -105,7 +98,6 @@ public class wdgl_new_Activity extends AppCompatActivity implements View.OnClick
private void initEvents() {
gongneng_fanhui.setOnClickListener(this);
mwSave_button1.setOnClickListener(this);
mwSave_button2.setOnClickListener(this);

/**
* 设置是否是否自动加热
@@ -124,33 +116,6 @@ public class wdgl_new_Activity extends AppCompatActivity implements View.OnClick
}
});

/**
* 设置是否是否自动加热
*/
Switch_3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
ConfigName.getInstance().JRX_AutomaticHeating=b;
Main.getInstance().SavePZ();

if(!b)
{
//关闭加热
DeviceData.Get().setJRXSwitch(false,null);
}
}
});


Switch_zyc.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
String addr= Switch_zyc.getTag().toString();
DeviceData.Get().setSwitch(b,addr,null);
T.show(getBaseContext(), Switch_zyc.getText().toString()+",地址:"+addr+".状态:"+b);
}
});

Switch_zygdbw.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
@@ -183,7 +148,6 @@ public class wdgl_new_Activity extends AppCompatActivity implements View.OnClick
@Override
public void run() {
wendu1.setText(String.valueOf(DeviceData.Get().getBWX_FructoseTemperature()) + "°C");
wendu2.setText(String.valueOf(DeviceData.Get().getJRX_FructoseTemperature()) + "°C");
}
});
Thread.sleep(1000);
@@ -202,10 +166,8 @@ public class wdgl_new_Activity extends AppCompatActivity implements View.OnClick
public void Initdata() {
try {
wendu1.setText(String.valueOf(DeviceData.Get().getBWX_FructoseTemperature()));
wendu2.setText(String.valueOf(DeviceData.Get().getJRX_FructoseTemperature()));

sc_bw.setText(String.valueOf(DeviceData.Get().getBWX_FructoseTemperatureSZ()));
jrx_bw.setText(String.valueOf(DeviceData.Get().getJRX_FructoseTemperatureSZ()));

} catch (Exception e) {

@@ -249,29 +211,7 @@ public class wdgl_new_Activity extends AppCompatActivity implements View.OnClick
T.show(this, "异常信息:" + e.getMessage());
}
break;
case R.id.mwSave_button2://按钮2
try {
int up = Integer.parseInt((jrx_bw.getText().toString().isEmpty() ? "0" : jrx_bw.getText().toString()));
if (up <= 0) {
T.show(this, "温度不能小于0!请调整后重试.");
return;
}

DeviceData.Get().setJRX_FructoseTemperature(up, new IWriteCallBack() {
@Override
public void onSuccess() {
T.show(wdgl_new_Activity.this, "保存成功.");
}

@Override
public void onFailure(String ErrorMsg) {
T.show(wdgl_new_Activity.this, "保存失败.");
}
});
} catch (Exception e) {
T.show(this, "异常信息:" + e.getMessage());
}
break;
}
}



+ 22
- 0
app/src/main/res/layout/from/layout/activity_dzcjy.xml Прегледај датотеку

@@ -190,6 +190,28 @@
android:text="零点校准"
android:layout_margin="5dp"/>
</LinearLayout>

<LinearLayout
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/closewrite_bottom"
android:layout_width="140dp"
android:layout_height="30dp"
android:background="@drawable/btn_greenblue"
android:text="关闭写保护"
android:layout_margin="5dp"/>
<Button
android:id="@+id/openwrite_bottom"
android:layout_width="140dp"
android:layout_height="30dp"
android:background="@drawable/btn_greenblue"
android:text="打开写保护"
android:layout_margin="5dp"/>
</LinearLayout>


</LinearLayout>




+ 950
- 644
app/src/main/res/layout/from/layout/activity_lsjy.xml
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 0
- 14
app/src/main/res/layout/from/layout/activity_ovarparameter.xml Прегледај датотеку

@@ -48,20 +48,6 @@
android:layout_margin="5dp"/>
</TableRow>

<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_marginLeft="5dp">
<Switch
android:id="@+id/Switch_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/qs_switch"
android:text="加热箱自动加热"
android:layout_margin="5dp"/>
</TableRow>
</TableLayout>
</LinearLayout>
</RelativeLayout>

+ 10
- 106
app/src/main/res/layout/from/layout/activity_wdgl_new.xml Прегледај датотеку

@@ -177,109 +177,23 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="60dp">

<Switch
android:id="@+id/Switch_2"
android:layout_centerInParent="true"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="5dp"
android:background="@drawable/qs_switch"
android:text="水池自动加热"
android:layout_margin="5dp"/>
android:text="水池自动加热" />
</RelativeLayout>

</LinearLayout>

<LinearLayout

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_marginLeft="80dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="加热箱温度状态"
android:textStyle="bold"
android:textSize="24dp"
android:textColor="@color/white"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:text="保温温度:"
android:layout_margin="5dp"/>
<EditText
android:id="@+id/jrx_bw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="60dp"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"
android:inputType="number|numberDecimal"
android:theme="@style/MyEditText_num"
android:maxLines="1"
android:singleLine="true"
android:layout_margin="5dp"/>
<Button
android:id="@+id/mwSave_button2"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:background="@drawable/btn_greenblue"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:text="保存"
/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:text="当前温度:"
android:layout_margin="5dp"/>
<TextView
android:id="@+id/wendu2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/lable_color"
android:textSize="24dp"
android:text="89.9°C"
android:layout_margin="5dp"/>
</LinearLayout>

</RelativeLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="60dp">
<Switch
android:id="@+id/Switch_3"
android:layout_centerInParent="true"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="@drawable/qs_switch"
android:text="加热箱自动加热"
android:layout_margin="5dp"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>


@@ -314,16 +228,6 @@
android:layout_width="wrap_content"
android:layout_height="60dp"
android:orientation="horizontal">
<Switch
android:id="@+id/Switch_zyc"
android:layout_centerInParent="true"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="30dp"
android:tag="M101.7"
android:background="@drawable/qs_switch"
android:text="猪油仓加热"
android:layout_margin="5dp"/>
<Switch
android:id="@+id/Switch_zygdbw"
android:layout_centerInParent="true"
@@ -332,7 +236,7 @@
android:layout_height="30dp"
android:background="@drawable/qs_switch"
android:text="猪油管道保温"
android:tag="M102.1"
android:tag="M103.6"
android:layout_margin="5dp"/>
<Switch
android:id="@+id/Switch_wbgdjr"
@@ -341,8 +245,8 @@
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="@drawable/qs_switch"
android:text="外部管道加热"
android:tag="M103.3"
android:text="牛油管道保温"
android:tag="M103.7"
android:layout_margin="5dp"/>
</LinearLayout>



+ 0
- 14
app/src/main/res/layout/from/layout/fragment_home.xml Прегледај датотеку

@@ -221,20 +221,6 @@
android:textSize="@dimen/TitleSize"
android:text="89.9°C"
android:layout_margin="5dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:text="加热箱:"
android:layout_margin="5dp"/>
<TextView
android:id="@+id/wendu2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/lable_color"
android:textSize="@dimen/TitleSize"
android:text="89.9°C"
android:layout_margin="5dp"/>

<TextView
android:id="@+id/pf_ms"


Loading…
Откажи
Сачувај