@@ -28,6 +28,9 @@ | |||||
android:supportsRtl="true" | android:supportsRtl="true" | ||||
android:theme="@style/AppTheme" | android:theme="@style/AppTheme" | ||||
tools:targetApi="31"> | tools:targetApi="31"> | ||||
<activity | |||||
android:name=".view.from.wdgl_new_Activity" | |||||
android:exported="false" /> | |||||
<activity | <activity | ||||
android:name=".view.from.sdkz_new_Activity" | android:name=".view.from.sdkz_new_Activity" | ||||
android:exported="false" /> | android:exported="false" /> | ||||
@@ -218,6 +218,7 @@ public class Main { | |||||
ConfigName.getInstance().user.account = ConfigUtil.read(ConfigName.getInstance().dishesCon, "username", ConfigName.getInstance().user.account); | ConfigName.getInstance().user.account = ConfigUtil.read(ConfigName.getInstance().dishesCon, "username", ConfigName.getInstance().user.account); | ||||
ConfigName.getInstance().user.pass = ConfigUtil.read(ConfigName.getInstance().dishesCon, "password", ConfigName.getInstance().user.pass); | 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().IsUserDownOrder = ConfigUtil.read(ConfigName.getInstance().dishesCon, "IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder); | ||||
ConfigName.getInstance().AutomaticHeating = ConfigUtil.read(ConfigName.getInstance().dishesCon, "AutomaticHeating", ConfigName.getInstance().AutomaticHeating); | |||||
ConfigName.getInstance().Version = ConfigUtil.read(ConfigName.getInstance().dishesCon, "Version", ConfigName.getInstance().Version); | ConfigName.getInstance().Version = ConfigUtil.read(ConfigName.getInstance().dishesCon, "Version", ConfigName.getInstance().Version); | ||||
} | } | ||||
@@ -233,8 +234,9 @@ public class Main { | |||||
ConfigUtil.write(ConfigName.getInstance().dishesCon,"username", ConfigName.getInstance().user.account); | ConfigUtil.write(ConfigName.getInstance().dishesCon,"username", ConfigName.getInstance().user.account); | ||||
ConfigUtil.write(ConfigName.getInstance().dishesCon,"password", ConfigName.getInstance().user.pass); | ConfigUtil.write(ConfigName.getInstance().dishesCon,"password", ConfigName.getInstance().user.pass); | ||||
ConfigUtil.write(ConfigName.getInstance().dishesCon,"IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder); | ConfigUtil.write(ConfigName.getInstance().dishesCon,"IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder); | ||||
ConfigUtil.write(ConfigName.getInstance().dishesCon,"IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder); | |||||
ConfigUtil.write(ConfigName.getInstance().dishesCon,"AutomaticHeating", ConfigName.getInstance().AutomaticHeating); | |||||
ConfigUtil.write(ConfigName.getInstance().dishesCon,"Version", ConfigName.getInstance().Version); | ConfigUtil.write(ConfigName.getInstance().dishesCon,"Version", ConfigName.getInstance().Version); | ||||
} | } | ||||
/** | /** | ||||
@@ -114,7 +114,14 @@ public class ConfigName { | |||||
/** | /** | ||||
* 是否手动下单 | * 是否手动下单 | ||||
*/ | */ | ||||
public Boolean IsUserDownOrder=false; | |||||
public Boolean IsUserDownOrder=true; | |||||
//endregion | |||||
//region 是否自动加热 | |||||
/** | |||||
* 是否自动加热 | |||||
*/ | |||||
public Boolean AutomaticHeating=false; | |||||
//endregion | //endregion | ||||
//region 系统设置表 | //region 系统设置表 | ||||
@@ -233,6 +233,8 @@ public class ModbusTcpServer { | |||||
LogServer.Get().Init(); | LogServer.Get().Init(); | ||||
//6.云订单服务 | //6.云订单服务 | ||||
OrderServer.Get().Init(); | OrderServer.Get().Init(); | ||||
//7.自动加热服务 | |||||
ReheatServer.Get().Init(); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -725,22 +725,34 @@ public class DeviceData { | |||||
//region 获取或设置保温箱温度信息 | //region 获取或设置保温箱温度信息 | ||||
/** | /** | ||||
* 保温箱 | |||||
* 水箱 | |||||
*/ | */ | ||||
int BWX_FructoseTemperature=0; | int BWX_FructoseTemperature=0; | ||||
/** | /** | ||||
* 获取保温箱实际温度 | |||||
* 水箱 | |||||
*/ | |||||
int BWX_FructoseTemperature_sz=0; | |||||
/** | |||||
* 获取水箱实际温度 | |||||
* | * | ||||
* @return | * @return | ||||
*/ | */ | ||||
public int getBWX_FructoseTemperature() { | public int getBWX_FructoseTemperature() { | ||||
return BWX_FructoseTemperature; | return BWX_FructoseTemperature; | ||||
} | } | ||||
/** | |||||
* 获取水箱实际温度保温温度 | |||||
* | |||||
* @return | |||||
*/ | |||||
public int getBWX_FructoseTemperatureSZ() { | |||||
return BWX_FructoseTemperature_sz; | |||||
} | |||||
public void setBWX_FructoseTemperature(int value, IWriteCallBack callback) { | public void setBWX_FructoseTemperature(int value, IWriteCallBack callback) { | ||||
ModbusTcpServer.get().WriteInt("VD372", value, callback); | ModbusTcpServer.get().WriteInt("VD372", value, callback); | ||||
} | } | ||||
/** | /** | ||||
* 设置保温箱加热启动停止 | |||||
* 设置水箱加热启动停止 | |||||
* | * | ||||
* @param value true:启动,flase:停止 | * @param value true:启动,flase:停止 | ||||
*/ | */ | ||||
@@ -751,6 +763,10 @@ public class DeviceData { | |||||
* 加热箱 | * 加热箱 | ||||
*/ | */ | ||||
int JRX_FructoseTemperature=0; | int JRX_FructoseTemperature=0; | ||||
/** | |||||
* 加热箱 | |||||
*/ | |||||
int JRX_FructoseTemperature_sz=0; | |||||
/** | /** | ||||
* 获取加热箱实际温度 | * 获取加热箱实际温度 | ||||
* | * | ||||
@@ -759,6 +775,14 @@ public class DeviceData { | |||||
public int getJRX_FructoseTemperature() { | public int getJRX_FructoseTemperature() { | ||||
return JRX_FructoseTemperature; | return JRX_FructoseTemperature; | ||||
} | } | ||||
/** | |||||
* 获取加热箱实际温度 | |||||
* | |||||
* @return | |||||
*/ | |||||
public int getJRX_FructoseTemperatureSZ() { | |||||
return JRX_FructoseTemperature_sz; | |||||
} | |||||
public void setJRX_FructoseTemperature(int value, IWriteCallBack callback) { | public void setJRX_FructoseTemperature(int value, IWriteCallBack callback) { | ||||
ModbusTcpServer.get().WriteInt("VD380", value, callback); | ModbusTcpServer.get().WriteInt("VD380", value, callback); | ||||
} | } | ||||
@@ -768,7 +792,7 @@ public class DeviceData { | |||||
* @param value true:启动,flase:停止 | * @param value true:启动,flase:停止 | ||||
*/ | */ | ||||
public void setJRXSwitch(boolean value, IWriteCallBack callback) { | public void setJRXSwitch(boolean value, IWriteCallBack callback) { | ||||
ModbusTcpServer.get().WriteBool("M103.4", value, callback); | |||||
ModbusTcpServer.get().WriteBool("M103.1", value, callback); | |||||
} | } | ||||
//endregion | //endregion | ||||
@@ -3,6 +3,7 @@ package com.example.bpa.service; | |||||
import com.example.bpa.Model.IRun; | import com.example.bpa.Model.IRun; | ||||
import com.example.bpa.Model.IThread; | import com.example.bpa.Model.IThread; | ||||
import com.example.bpa.Model.IWriteCallBack; | import com.example.bpa.Model.IWriteCallBack; | ||||
import com.example.bpa.config.ConfigName; | |||||
import com.example.bpa.config.DataBus; | import com.example.bpa.config.DataBus; | ||||
import com.example.bpa.helper.MessageLog; | import com.example.bpa.helper.MessageLog; | ||||
import com.example.bpa.helper.ModbusTcpServer; | import com.example.bpa.helper.ModbusTcpServer; | ||||
@@ -45,79 +46,38 @@ public class ReheatServer { | |||||
ThreadManager.Get().StartLong("加热服务", true, new IThread() { | ThreadManager.Get().StartLong("加热服务", true, new IThread() { | ||||
@Override | @Override | ||||
public void Run() throws InterruptedException { | public void Run() throws InterruptedException { | ||||
if (DataBus.getInstance().PlcIsConnect) | |||||
if (DataBus.getInstance().PlcIsConnect && ConfigName.getInstance().AutomaticHeating) | |||||
{ | { | ||||
if(DeviceData.Get().getFructoseTemperature1_up()>0 && DeviceData.Get().getFructoseTemperature1_down()>0 ) | |||||
//1.温度值低于设置值,加热 | |||||
//2.温度高于设置值,停止加热 | |||||
int sx_temp=DeviceData.Get().getBWX_FructoseTemperature();//水箱温度 | |||||
int sx_temp_sz=DeviceData.Get().getBWX_FructoseTemperatureSZ();//水箱温度设置值 | |||||
int jrx_temp=DeviceData.Get().getJRX_FructoseTemperature();//加热箱温度 | |||||
int jrx_temp_sz=DeviceData.Get().getJRX_FructoseTemperatureSZ();//加热箱温度设置值 | |||||
if(sx_temp_sz>0) | |||||
{ | { | ||||
if(DeviceData.Get().getFructoseTemperature1_up()>DeviceData.Get().getFructoseTemperature1_down()) | |||||
if(sx_temp>=sx_temp_sz) | |||||
{ | |||||
DeviceData.Get().setBWXSwitch(false,null); | |||||
}else | |||||
{ | { | ||||
//温度低于最小值 加热 | |||||
if(DeviceData.Get().getFructoseTemperature1()<DeviceData.Get().getFructoseTemperature1_down()) | |||||
{ | |||||
if(DeviceData.Get().getReheatSwitch1()==false) | |||||
{ | |||||
DeviceData.Get().setReheatSwitch1(true, new IWriteCallBack() { | |||||
@Override | |||||
public void onSuccess() { | |||||
} | |||||
@Override | |||||
public void onFailure(String ErrorMsg) { | |||||
} | |||||
}); | |||||
} | |||||
}else if(DeviceData.Get().getFructoseTemperature1()>=DeviceData.Get().getFructoseTemperature1_up()) | |||||
{ | |||||
if(DeviceData.Get().getReheatSwitch1()==true) | |||||
{ | |||||
DeviceData.Get().setReheatSwitch1(false, new IWriteCallBack() { | |||||
@Override | |||||
public void onSuccess() { | |||||
} | |||||
@Override | |||||
public void onFailure(String ErrorMsg) { | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
DeviceData.Get().setBWXSwitch(true,null); | |||||
} | } | ||||
} | } | ||||
if(DeviceData.Get().getFructoseTemperature2_up()>0 && DeviceData.Get().getFructoseTemperature2_down()>0 ) | |||||
if(jrx_temp_sz>0) | |||||
{ | { | ||||
if(DeviceData.Get().getFructoseTemperature2_up()>DeviceData.Get().getFructoseTemperature2_down()) | |||||
if(jrx_temp>=jrx_temp_sz) | |||||
{ | { | ||||
//温度低于最小值 加热 | |||||
if(DeviceData.Get().getFructoseTemperature2()<DeviceData.Get().getFructoseTemperature2_down()) | |||||
{ | |||||
if(DeviceData.Get().getReheatSwitch2()==false) | |||||
{ | |||||
DeviceData.Get().setReheatSwitch2(true, new IWriteCallBack() { | |||||
@Override | |||||
public void onSuccess() { | |||||
} | |||||
@Override | |||||
public void onFailure(String ErrorMsg) { | |||||
} | |||||
}); | |||||
} | |||||
}else if(DeviceData.Get().getFructoseTemperature2()>=DeviceData.Get().getFructoseTemperature2_up()) | |||||
{ | |||||
if(DeviceData.Get().getReheatSwitch2()==true) | |||||
{ | |||||
DeviceData.Get().setReheatSwitch2(false, new IWriteCallBack() { | |||||
@Override | |||||
public void onSuccess() { | |||||
} | |||||
@Override | |||||
public void onFailure(String ErrorMsg) { | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
DeviceData.Get().setJRXSwitch(false,null); | |||||
}else | |||||
{ | |||||
DeviceData.Get().setJRXSwitch(true,null); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
Thread.sleep(2000); | Thread.sleep(2000); | ||||
} | } | ||||
@@ -34,6 +34,7 @@ import com.example.bpa.helper.T; | |||||
import com.example.bpa.helper.WrapContentLinearLayoutManager; | import com.example.bpa.helper.WrapContentLinearLayoutManager; | ||||
import com.example.bpa.message.MessageLooper; | import com.example.bpa.message.MessageLooper; | ||||
import com.example.bpa.message.MessageManager; | import com.example.bpa.message.MessageManager; | ||||
import com.example.bpa.service.DeviceData; | |||||
import com.example.bpa.view.adapter.maingoods_adapter; | import com.example.bpa.view.adapter.maingoods_adapter; | ||||
import com.example.bpa.view.adapter.makegood_adapter; | import com.example.bpa.view.adapter.makegood_adapter; | ||||
import com.example.bpa.view.adapter.order_adapter; | import com.example.bpa.view.adapter.order_adapter; | ||||
@@ -67,6 +68,10 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl | |||||
* 自动控制按钮 | * 自动控制按钮 | ||||
*/ | */ | ||||
ImageView image_zdkz; | ImageView image_zdkz; | ||||
/** | |||||
* 当前温度 | |||||
*/ | |||||
TextView wendu1, wendu2; | |||||
/** | /** | ||||
* 界面实例 | * 界面实例 | ||||
*/ | */ | ||||
@@ -93,6 +98,9 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl | |||||
makesp=view.findViewById(R.id.makesp); | makesp=view.findViewById(R.id.makesp); | ||||
nohelp=view.findViewById(R.id.nohelp); | nohelp=view.findViewById(R.id.nohelp); | ||||
image_zdkz=view.findViewById(R.id.image_zdkz); | image_zdkz=view.findViewById(R.id.image_zdkz); | ||||
wendu1 = view.findViewById(R.id.wendu1); | |||||
wendu2 = view.findViewById(R.id.wendu2); | |||||
if( ConfigName.getInstance().IsUserDownOrder) | if( ConfigName.getInstance().IsUserDownOrder) | ||||
{ | { | ||||
makesp.setVisibility(View.VISIBLE); | makesp.setVisibility(View.VISIBLE); | ||||
@@ -107,6 +115,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl | |||||
Initdata();//初始化数据 | Initdata();//初始化数据 | ||||
RegisterMessage();//消息中心事件接收 | RegisterMessage();//消息中心事件接收 | ||||
initEvents(); | initEvents(); | ||||
startListening(); | |||||
} | } | ||||
/** | /** | ||||
* 初始化按钮事件 | * 初始化按钮事件 | ||||
@@ -278,18 +287,33 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl | |||||
Activity activity=null; | Activity activity=null; | ||||
public void RegisterMessage() | public void RegisterMessage() | ||||
{ | { | ||||
// MessageManager.getInstance().registerMessageReceiver(this, MessageName.Common.name(), new MessageLooper.OnMessageListener() { | |||||
// @Override | |||||
// public void onMessage(Object msg) { | |||||
// activity.runOnUiThread(new Runnable() { | |||||
// @Override | |||||
// public void run() { | |||||
// DataBus.getInstance().UpdateMainGoods();//更新商品 | |||||
// goodadapter.notifyDataSetChanged(); | |||||
// } | |||||
// }); | |||||
// } | |||||
// }); | |||||
} | |||||
/** | |||||
* 监听外部数据变化 | |||||
*/ | |||||
private void startListening() { | |||||
new Thread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
while (true) { | |||||
try { | |||||
activity.runOnUiThread(new Runnable() { | |||||
@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); | |||||
} catch (Exception e) { | |||||
} | |||||
} | |||||
} | |||||
}).start(); | |||||
} | } | ||||
//endregion | //endregion | ||||
} | } |
@@ -27,6 +27,7 @@ import com.example.bpa.view.from.lcsz_activity; | |||||
import com.example.bpa.view.from.lsjy_activity; | import com.example.bpa.view.from.lsjy_activity; | ||||
import com.example.bpa.view.from.sdkz_new_Activity; | import com.example.bpa.view.from.sdkz_new_Activity; | ||||
import com.example.bpa.view.from.wdgl_activity; | import com.example.bpa.view.from.wdgl_activity; | ||||
import com.example.bpa.view.from.wdgl_new_Activity; | |||||
import com.example.bpa.view.from.wlgl_activity; | import com.example.bpa.view.from.wlgl_activity; | ||||
import com.example.bpa.view.from.yfcl_activity; | import com.example.bpa.view.from.yfcl_activity; | ||||
import com.example.bpa.view.from.yfpf_activity; | import com.example.bpa.view.from.yfpf_activity; | ||||
@@ -72,7 +73,7 @@ public class SystemCapabilitiesFragment extends Fragment { | |||||
menuModes.add(new MenuMode("料仓管理", R.mipmap.lcsz)); | menuModes.add(new MenuMode("料仓管理", R.mipmap.lcsz)); | ||||
menuModes.add(new MenuMode("订单管理", R.mipmap.ddgl)); | menuModes.add(new MenuMode("订单管理", R.mipmap.ddgl)); | ||||
menuModes.add(new MenuMode("手动控制", R.mipmap.sdkz)); | menuModes.add(new MenuMode("手动控制", R.mipmap.sdkz)); | ||||
// menuModes.add(new MenuMode("温度管理", R.mipmap.wdkz)); | |||||
menuModes.add(new MenuMode("温度管理", R.mipmap.wdkz)); | |||||
menuModes.add(new MenuMode("电子秤校验", R.mipmap.dzcjy)); | menuModes.add(new MenuMode("电子秤校验", R.mipmap.dzcjy)); | ||||
menuModes.add(new MenuMode("流速校验", R.mipmap.lsjy)); | menuModes.add(new MenuMode("流速校验", R.mipmap.lsjy)); | ||||
@@ -131,7 +132,7 @@ public class SystemCapabilitiesFragment extends Fragment { | |||||
intent = new Intent(view.getContext(), sdkz_new_Activity.class); | intent = new Intent(view.getContext(), sdkz_new_Activity.class); | ||||
break; | break; | ||||
case "温度管理": | case "温度管理": | ||||
intent = new Intent(view.getContext(), wdgl_activity.class); | |||||
intent = new Intent(view.getContext(), wdgl_new_Activity.class); | |||||
break; | break; | ||||
case "饮料配方管理": | case "饮料配方管理": | ||||
default: | default: | ||||
@@ -24,7 +24,7 @@ import java.util.Arrays; | |||||
public class ovarparameter extends Fragment { | public class ovarparameter extends Fragment { | ||||
Switch Switch_1; | |||||
Switch Switch_1,Switch_2; | |||||
/** | /** | ||||
* 界面实例 | * 界面实例 | ||||
*/ | */ | ||||
@@ -49,7 +49,9 @@ public class ovarparameter extends Fragment { | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
Switch_1 = view.findViewById(R.id.Switch_1); | Switch_1 = view.findViewById(R.id.Switch_1); | ||||
Switch_2= view.findViewById(R.id.Switch_2); | |||||
Switch_1.setChecked(ConfigName.getInstance().IsUserDownOrder); | Switch_1.setChecked(ConfigName.getInstance().IsUserDownOrder); | ||||
Switch_2.setChecked(ConfigName.getInstance().AutomaticHeating); | |||||
} | } | ||||
/** | /** | ||||
* 初始化按钮事件 | * 初始化按钮事件 | ||||
@@ -66,6 +68,17 @@ public class ovarparameter extends Fragment { | |||||
Main.getInstance().SavePZ(); | Main.getInstance().SavePZ(); | ||||
} | } | ||||
}); | }); | ||||
/** | |||||
* 设置是否是否自动加热 | |||||
*/ | |||||
Switch_2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { | |||||
@Override | |||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) { | |||||
ConfigName.getInstance().AutomaticHeating=b; | |||||
Main.getInstance().SavePZ(); | |||||
} | |||||
}); | |||||
} | } | ||||
//endregion | //endregion | ||||
} | } |
@@ -0,0 +1,198 @@ | |||||
package com.example.bpa.view.from; | |||||
import androidx.appcompat.app.AppCompatActivity; | |||||
import android.os.Bundle; | |||||
import android.view.View; | |||||
import android.view.Window; | |||||
import android.view.WindowManager; | |||||
import android.widget.Button; | |||||
import android.widget.EditText; | |||||
import android.widget.ImageView; | |||||
import android.widget.TextView; | |||||
import com.example.bpa.Model.IWriteCallBack; | |||||
import com.example.bpa.R; | |||||
import com.example.bpa.helper.T; | |||||
import com.example.bpa.service.DeviceData; | |||||
public class wdgl_new_Activity extends AppCompatActivity implements View.OnClickListener { | |||||
//region 变量 | |||||
/** | |||||
* 返回按钮 | |||||
*/ | |||||
ImageView gongneng_fanhui; | |||||
/** | |||||
* 标题设置 | |||||
*/ | |||||
TextView gongneng_title; | |||||
/** | |||||
* 温度上限 | |||||
*/ | |||||
EditText sc_bw, jrx_bw; | |||||
/** | |||||
* 当前温度 | |||||
*/ | |||||
TextView wendu1, wendu2; | |||||
/** | |||||
* 保存按钮 | |||||
*/ | |||||
Button mwSave_button1, mwSave_button2; | |||||
//endregion | |||||
//region 私有函数 | |||||
@Override | |||||
protected void onCreate(Bundle savedInstanceState) { | |||||
this.requestWindowFeature(Window.FEATURE_NO_TITLE); | |||||
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); | |||||
super.onCreate(savedInstanceState); | |||||
setContentView(R.layout.activity_wdgl_new); | |||||
Init(); | |||||
initEvents(); | |||||
startListening(); | |||||
} | |||||
//endregion | |||||
//region 公共函数 | |||||
/** | |||||
* 初始化 | |||||
*/ | |||||
private void Init() { | |||||
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); | |||||
//通过Activity.getIntent()获取当前页面接收到的Intent。 getXxxExtra方法获取Intent传递过来的数据 | |||||
String msg = getIntent().getStringExtra("data"); | |||||
gongneng_title.setText(msg); | |||||
Initdata(); | |||||
} | |||||
/** | |||||
* 初始化按钮事件 | |||||
*/ | |||||
private void initEvents() { | |||||
gongneng_fanhui.setOnClickListener(this); | |||||
mwSave_button1.setOnClickListener(this); | |||||
mwSave_button2.setOnClickListener(this); | |||||
} | |||||
/** | |||||
* 监听外部数据变化 | |||||
*/ | |||||
private void startListening() { | |||||
new Thread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
while (true) { | |||||
try { | |||||
runOnUiThread(new Runnable() { | |||||
@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); | |||||
} catch (Exception e) { | |||||
} | |||||
} | |||||
} | |||||
}).start(); | |||||
} | |||||
/** | |||||
* 初始化数据加载 | |||||
*/ | |||||
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) { | |||||
} | |||||
} | |||||
//endregion | |||||
//region 点击事件 | |||||
/** | |||||
* 本页面点击事件监听 | |||||
* | |||||
* @param v | |||||
*/ | |||||
@Override | |||||
public void onClick(View v) { | |||||
switch (v.getId()) { | |||||
case R.id.gongneng_fanhui://返回按钮 | |||||
this.finish(); | |||||
break; | |||||
case R.id.mwSave_button1://按钮1 | |||||
try { | |||||
int up = Integer.parseInt((sc_bw.getText().toString().isEmpty() ? "0" : sc_bw.getText().toString())); | |||||
if (up <= 0) { | |||||
T.show(this, "温度不能小于0!请调整后重试."); | |||||
return; | |||||
} | |||||
DeviceData.Get().setBWX_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; | |||||
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; | |||||
} | |||||
} | |||||
//endregion | |||||
} |
@@ -81,6 +81,7 @@ | |||||
android:layout_marginRight="10dp" | android:layout_marginRight="10dp" | ||||
android:src="@mipmap/zzz"/> | android:src="@mipmap/zzz"/> | ||||
<ImageView | <ImageView | ||||
android:visibility="gone" | |||||
android:id="@+id/RealTimeMonitoring" | android:id="@+id/RealTimeMonitoring" | ||||
android:layout_width="28dp" | android:layout_width="28dp" | ||||
android:layout_height="24dp" | android:layout_height="24dp" | ||||
@@ -28,17 +28,24 @@ | |||||
android:id="@+id/Switch_1" | android:id="@+id/Switch_1" | ||||
android:layout_width="wrap_content" | android:layout_width="wrap_content" | ||||
android:layout_height="wrap_content" | android:layout_height="wrap_content" | ||||
android:text="允许手动下单 " | |||||
android:layout_marginRight="20dp" | |||||
android:textOff="关" | |||||
android:tag="M10.0" | |||||
android:textOn="开" | |||||
android:showText="true" | |||||
android:switchTextAppearance="@style/myTextAppearance" | |||||
android:textColor="@color/white" | |||||
android:thumb="@drawable/switch_custom_thumb_selector1" | |||||
android:track="@drawable/switch_custom_track_selector1" | |||||
/> | |||||
android:background="@drawable/qs_switch" | |||||
android:text="允许手动下单" | |||||
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_2" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:background="@drawable/qs_switch" | |||||
android:text="启动自动加热" | |||||
android:layout_margin="5dp"/> | |||||
</TableRow> | </TableRow> | ||||
</TableLayout> | </TableLayout> | ||||
</LinearLayout> | </LinearLayout> | ||||
@@ -0,0 +1,264 @@ | |||||
<?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="match_parent" | |||||
android:background="@mipmap/dpbj" | |||||
android:orientation="vertical" | |||||
tools:context=".view.from.wdgl_new_Activity"> | |||||
<RelativeLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="30dp" | |||||
android:background="@color/test"> | |||||
<ImageView | |||||
android:id="@+id/gongneng_fanhui" | |||||
android:layout_width="26dp" | |||||
android:layout_height="wrap_content" | |||||
android:layout_alignParentLeft="true" | |||||
android:layout_centerVertical="true" | |||||
android:layout_marginLeft="20dp" | |||||
android:src="@mipmap/zj" | |||||
android:textColor="@color/titleforeground" | |||||
android:textSize="@dimen/TitleSize" /> | |||||
<RelativeLayout | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_centerInParent="true"> | |||||
<TextView | |||||
android:id="@+id/gongneng_title" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_centerInParent="true" | |||||
android:textColor="@color/white" | |||||
android:textSize="@dimen/textTitleSize" | |||||
android:textStyle="bold" /> | |||||
<ImageView | |||||
android:layout_width="400dp" | |||||
android:layout_height="22dp" | |||||
android:layout_alignParentBottom="true" | |||||
android:layout_marginLeft="5dp" | |||||
android:src="@mipmap/tittle" /> | |||||
</RelativeLayout> | |||||
</RelativeLayout> | |||||
<View | |||||
android:layout_width="match_parent" | |||||
android:layout_height="1dp" | |||||
android:background="#FF03668F" /> | |||||
<RelativeLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
android:layout_margin="5dp"> | |||||
<ImageView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_alignParentLeft="true" | |||||
android:layout_alignParentTop="true" | |||||
android:src="@mipmap/zs" /> | |||||
<ImageView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_alignParentLeft="true" | |||||
android:layout_alignParentBottom="true" | |||||
android:src="@mipmap/zx" /> | |||||
<ImageView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_alignParentTop="true" | |||||
android:layout_alignParentRight="true" | |||||
android:src="@mipmap/ys" /> | |||||
<ImageView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_alignParentRight="true" | |||||
android:layout_alignParentBottom="true" | |||||
android:src="@mipmap/yx" /> | |||||
<RelativeLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
android:layout_margin="10dp"> | |||||
<LinearLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
android:orientation="vertical"> | |||||
<RelativeLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content"> | |||||
<LinearLayout | |||||
android:layout_centerHorizontal="true" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content"> | |||||
<LinearLayout | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:orientation="vertical" | |||||
android:layout_marginTop="10dp" | |||||
android:layout_marginLeft="20dp"> | |||||
<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/sc_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_button1" | |||||
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/wendu1" | |||||
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> | |||||
</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> | |||||
</LinearLayout> | |||||
</LinearLayout> | |||||
</RelativeLayout> | |||||
</LinearLayout> | |||||
</RelativeLayout> | |||||
</RelativeLayout> | |||||
</LinearLayout> |
@@ -164,6 +164,45 @@ | |||||
</RelativeLayout> | </RelativeLayout> | ||||
</LinearLayout> | </LinearLayout> | ||||
<RelativeLayout | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_alignParentLeft="true" | |||||
android:layout_alignParentBottom="true"> | |||||
<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/wendu1" | |||||
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: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"/> | |||||
</LinearLayout> | |||||
</RelativeLayout> | |||||
<ImageView | <ImageView | ||||
android:id="@+id/image_zdkz" | android:id="@+id/image_zdkz" | ||||
android:layout_width="wrap_content" | android:layout_width="wrap_content" | ||||