更新续航

This commit is contained in:
USER-20220102CG\noblelift
2022-09-07 10:27:09 +08:00
parent dc8896d3ad
commit 4c03f3e6be
3 changed files with 27 additions and 1 deletions

View File

@@ -1631,7 +1631,7 @@ public class AgvServiceImpl implements AgvService {
jo.put("operation","JackLoad");
ja.add(jo);
JSONObject jo1 = new JSONObject();
jo1.put("blockId",String.valueOf(ja.size()+1));
jo1.put("blockId",IdUtil.simpleUUID());
jo1.put("location",inst.getNext_point_code());
jo1.put("operation","JackUnload");
ja.add(jo1);

View File

@@ -42,4 +42,9 @@ public interface AcsConfig {
String NDC_RECONNECTION = "NDC_reconnection";
//自动清理日志保留时间
String AutoCleanDays = "AutoCleanDays";
//电池续航时间h
String LIFETIME = "lifeTime";
//保养里程(km)
String MAINTENANCE_MILEAGE = "maintenance_mileage";
}

View File

@@ -6,6 +6,8 @@ import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.nl.acs.agv.server.AgvService;
import org.nl.acs.agv.server.dto.AgvDto;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.modules.mnt.websocket.MsgType;
import org.nl.modules.mnt.websocket.SocketMsg;
@@ -13,6 +15,8 @@ import org.nl.modules.mnt.websocket.WebSocketServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Map;
/**
@@ -26,6 +30,8 @@ public class ToAgvDevice {
AcsToWmsService acsToWmsService;
@Autowired
AgvService agvService;
@Autowired
AcsConfigService acsConfigService;
public void run() throws Exception {
JSONObject json = new JSONObject();
@@ -33,6 +39,11 @@ public class ToAgvDevice {
if(ObjectUtil.isEmpty(agv_map)){
return;
}
String lifeTime = acsConfigService.findConfigFromCache().get(AcsConfig.LIFETIME);
String maintenance_mileage = acsConfigService.findConfigFromCache().get(AcsConfig.MAINTENANCE_MILEAGE);
JSONArray agv_rows = new JSONArray();
JSONObject row = new JSONObject();
@@ -59,10 +70,20 @@ public class ToAgvDevice {
row.put("time", agvDto.getTime());
row.put("state", agvDto.getState());
String onelifeTime = String.valueOf(Double.parseDouble(agvDto.getEnergyLevel()) * Double.parseDouble(lifeTime));
String onemaintenance_mileage = String.valueOf(Double.parseDouble(maintenance_mileage) - (Double.parseDouble(agvDto.getOdo()) % Double.parseDouble(maintenance_mileage)));
row.put("lifeTime", sub(onelifeTime));
row.put("maintenance_mileage", sub(onemaintenance_mileage));
agv_rows.add(row);
}
json.put("agv_rows", agv_rows);
acsToWmsService.feedbackAgv(agv_rows);
}
public String sub(String str){
DecimalFormat format = new DecimalFormat("0.00");
return format.format(new BigDecimal(str));
}
}