|
@@ -159,7 +159,7 @@ public class RemoteSupportService extends Service implements SendCallback {
|
|
|
}
|
|
|
}, 20000);
|
|
|
|
|
|
- if (Hawk.get(Name.AUTOUPLOADORDER, false)) {
|
|
|
+ if (Hawk.get(Name.AUTOUPLOADORDER, true)) {
|
|
|
upCoinOrder();
|
|
|
}
|
|
|
}
|
|
@@ -290,6 +290,15 @@ public class RemoteSupportService extends Service implements SendCallback {
|
|
|
public void event(ApiMessageEvent messageEvent) {
|
|
|
Log.d(TAG, "Service event: ApiMessageEvent" + messageEvent.getName());
|
|
|
switch (messageEvent.getName()) {
|
|
|
+ case Name.MATERIEL:
|
|
|
+ String isOpen = (String) messageEvent.getData();
|
|
|
+ if (isOpen.equals("1")){
|
|
|
+ stopMateriel();
|
|
|
+ startMateriel();
|
|
|
+ }else {
|
|
|
+ stopMateriel();
|
|
|
+ }
|
|
|
+ break;
|
|
|
case "statusType1":
|
|
|
//同步数据
|
|
|
//showSyncDialog();
|
|
@@ -996,6 +1005,7 @@ public class RemoteSupportService extends Service implements SendCallback {
|
|
|
|
|
|
private IView view;
|
|
|
private HashMap<String, Double> materielMap;
|
|
|
+
|
|
|
/**
|
|
|
* 发送心跳
|
|
|
*/
|
|
@@ -1142,7 +1152,7 @@ public class RemoteSupportService extends Service implements SendCallback {
|
|
|
Log.e(TAG, "checkHeartData: 开始心跳2");
|
|
|
stopHeartbeat();
|
|
|
startHeartbeat();
|
|
|
- if (Hawk.get(Name.MATERIEL,false)){
|
|
|
+ if (Hawk.get(Name.MATERIEL, false)) {
|
|
|
stopMateriel();
|
|
|
startMateriel();
|
|
|
}
|
|
@@ -1151,28 +1161,30 @@ public class RemoteSupportService extends Service implements SendCallback {
|
|
|
Logger.i(TAG + "系统管理id为空");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private Timer timerMateriel;
|
|
|
private TimerTask taskMateriel;
|
|
|
- private boolean C01Type=false;
|
|
|
- private boolean C02Type=false;
|
|
|
- private boolean J01Type=false;
|
|
|
- private boolean J02Type=false;
|
|
|
- private boolean J03Type=false;
|
|
|
-
|
|
|
- private void startMateriel(){
|
|
|
+ private boolean C01Type = false;
|
|
|
+ private boolean C02Type = false;
|
|
|
+ private boolean J01Type = false;
|
|
|
+ private boolean J02Type = false;
|
|
|
+ private boolean J03Type = false;
|
|
|
+
|
|
|
+ private void startMateriel() {
|
|
|
+ Log.d(TAG, "startMateriel: 1");
|
|
|
timerMateriel = new Timer();
|
|
|
taskMateriel = new TimerTask() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
materielMap = Hawk.get(Name.MATERIEL_PARAM, Global.defaultMaterielMap());
|
|
|
- double C01= materielMap.get("C01");
|
|
|
- double C02= materielMap.get("C02");
|
|
|
- double J01= materielMap.get("J01");
|
|
|
- double J02= materielMap.get("J02");
|
|
|
- double J03= materielMap.get("J03");
|
|
|
- if ( C01<= 20) {
|
|
|
+ double C01 = materielMap.get("C01");
|
|
|
+ double C02 = materielMap.get("C02");
|
|
|
+ double J01 = materielMap.get("J01");
|
|
|
+ double J02 = materielMap.get("J02");
|
|
|
+ double J03 = materielMap.get("J03");
|
|
|
+ if (C01 <= 20) {
|
|
|
if (!C01Type) {
|
|
|
- setErrorMateriel(21, App.app.getString(R.string.nutletless1)+C01+"%", "1");
|
|
|
+ setErrorMateriel(21, "No.32" + App.app.getString(R.string.nutletless1) + C01 + "%", "1");
|
|
|
C01Type = true;
|
|
|
}
|
|
|
} else {
|
|
@@ -1181,7 +1193,7 @@ public class RemoteSupportService extends Service implements SendCallback {
|
|
|
|
|
|
if (C02 <= 20) {
|
|
|
if (!C02Type) {
|
|
|
- setErrorMateriel(22, App.app.getString(R.string.nutletless2)+C02+"%", "1");
|
|
|
+ setErrorMateriel(22, "No.33" +App.app.getString(R.string.nutletless2) + C02 + "%", "1");
|
|
|
C02Type = true;
|
|
|
}
|
|
|
} else {
|
|
@@ -1190,16 +1202,16 @@ public class RemoteSupportService extends Service implements SendCallback {
|
|
|
|
|
|
if (J01 <= 20) {
|
|
|
if (!J01Type) {
|
|
|
- setErrorMateriel(23, App.app.getString(R.string.jamless1)+J01+"%", "1");
|
|
|
+ setErrorMateriel(23, "No.34" +App.app.getString(R.string.jamless1) + J01 + "%", "1");
|
|
|
J01Type = true;
|
|
|
}
|
|
|
} else {
|
|
|
J01Type = false;
|
|
|
}
|
|
|
|
|
|
- if (J02<= 20) {
|
|
|
+ if (J02 <= 20) {
|
|
|
if (!J02Type) {
|
|
|
- setErrorMateriel(24, App.app.getString(R.string.jamless2)+J02+"%", "1");
|
|
|
+ setErrorMateriel(24, "No.35" +App.app.getString(R.string.jamless2) + J02 + "%", "1");
|
|
|
J02Type = true;
|
|
|
}
|
|
|
} else {
|
|
@@ -1208,7 +1220,7 @@ public class RemoteSupportService extends Service implements SendCallback {
|
|
|
|
|
|
if (J03 <= 20) {
|
|
|
if (!J03Type) {
|
|
|
- setErrorMateriel(25, App.app.getString(R.string.jamless3)+J03+"%", "1");
|
|
|
+ setErrorMateriel(25, "No.36" +App.app.getString(R.string.jamless3) + J03 + "%", "1");
|
|
|
J03Type = true;
|
|
|
}
|
|
|
} else {
|
|
@@ -1216,20 +1228,21 @@ public class RemoteSupportService extends Service implements SendCallback {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
- timerMateriel.schedule(taskMateriel, 1000, 1000);
|
|
|
+ timerMateriel.schedule(taskMateriel, 1000, 1000 * 60 * 3);
|
|
|
}
|
|
|
+
|
|
|
public void setErrorMateriel(int key, String reason, String level) {
|
|
|
- long date = System.currentTimeMillis();
|
|
|
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- Date curDate = new Date(date);
|
|
|
- String time = formatter.format(curDate);
|
|
|
- AddAlarmRecordBean addAlarmRecordBean = new AddAlarmRecordBean(reason, Heartbeat.deviceId, time, "", level);
|
|
|
- Gson gson = new Gson();
|
|
|
- String json = gson.toJson(addAlarmRecordBean);
|
|
|
- RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json);
|
|
|
- if (!Constant.reasonKey.equals(reason)) {
|
|
|
- upError(body, 0, reason);
|
|
|
- }
|
|
|
+ long date = System.currentTimeMillis();
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date curDate = new Date(date);
|
|
|
+ String time = formatter.format(curDate);
|
|
|
+ AddAlarmRecordBean addAlarmRecordBean = new AddAlarmRecordBean(reason, Heartbeat.deviceId, time, "", level);
|
|
|
+ Gson gson = new Gson();
|
|
|
+ String json = gson.toJson(addAlarmRecordBean);
|
|
|
+ RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json);
|
|
|
+ if (!Constant.reasonKey.equals(reason)) {
|
|
|
+ upError(body, 0, reason);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void stopMateriel() {
|