|
@@ -98,7 +98,7 @@ public class DeviceCollectionTaskJob {
|
|
|
List<Map> list = JSONUtil.toList(jsonArray, Map.class);
|
|
|
CompletableFuture[] task = list.stream().map(map -> CompletableFuture.runAsync(() -> {
|
|
|
map.put("type","Collect");
|
|
|
- //if("192.168.10.109".equals(map.get("serverUrl").toString())){
|
|
|
+ //if("192.168.10.117".equals(map.get("serverUrl").toString())){
|
|
|
String data = JSONUtil.toJsonStr(map);
|
|
|
String returnInfo = this.httpPost(data);
|
|
|
if(returnInfo !=null){
|
|
@@ -146,6 +146,20 @@ public class DeviceCollectionTaskJob {
|
|
|
deviceInfo.putOnce("actSpindle",returnJson.get("actSpindle"));
|
|
|
deviceInfo.putOnce("powerOnTime",returnJson.get("powerOnTime"));
|
|
|
deviceInfo.putOnce("deviceState",returnJson.get("deviceState"));
|
|
|
+ deviceInfo.putOnce("feedRateOvr",returnJson.get("feedRateOvr"));
|
|
|
+
|
|
|
+ Object actFeed = deviceInfo.get("actFeed");
|
|
|
+ Object actSpindle = deviceInfo.get("actSpindle");
|
|
|
+ if(actFeed!=null || actSpindle !=null) {
|
|
|
+ if(("0".equals(actFeed.toString()) || "NAN".equals(actFeed.toString()) || "null".equals(actFeed.toString()))
|
|
|
+ && ("0".equals(actSpindle.toString()) || "NAN".equals(actSpindle.toString()) || "null".equals(actSpindle.toString()))){
|
|
|
+ deviceInfo.putOnce("deviceWorkState","空闲");
|
|
|
+ }else{
|
|
|
+ deviceInfo.putOnce("deviceWorkState","加工");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ deviceInfo.putOnce("deviceWorkState","空闲");
|
|
|
+ }
|
|
|
|
|
|
Map<String, Object> deviceCollection = jdbcService.findOne("select * from device_collection where ip = ? ", ip);
|
|
|
|
|
@@ -178,6 +192,7 @@ public class DeviceCollectionTaskJob {
|
|
|
map.put("actSpindle",returnJson.get("actSpindle"));
|
|
|
map.put("powerOnTime",returnJson.get("powerOnTime"));
|
|
|
map.put("deviceState",returnJson.get("deviceState"));
|
|
|
+ map.put("feedRateOvr",returnJson.get("feedRateOvr"));
|
|
|
|
|
|
Object powerOnTime = returnJson.get("powerOnTime"); //当前设备开机总时长(分钟)
|
|
|
|
|
@@ -238,14 +253,14 @@ public class DeviceCollectionTaskJob {
|
|
|
|
|
|
if(!Objects.isNull(returnJson.get("deviceState")) && "在线".equals(returnJson.get("deviceState").toString())){
|
|
|
BigDecimal currentPowerOnTime = new BigDecimal(powerOnTime.toString());
|
|
|
- if(hisPowerOnTime.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ if(hisPowerOnTime.compareTo(BigDecimal.ZERO) > 0 && currentPowerOnTime.compareTo(hisPowerOnTime) > 0){
|
|
|
// 间隔时间 = 当前开机总时长 - 最近的上一次采集开机总时长
|
|
|
BigDecimal intervalTime = currentPowerOnTime.subtract(hisPowerOnTime);
|
|
|
//当日设备开机时长 = 当日设备开机时长 + 间隔时间
|
|
|
todayPowerOnTime = todayPowerOnTime.add(intervalTime);
|
|
|
}
|
|
|
|
|
|
- String startDate = nowDate + " " + "08:00:00"; //默认早上八点
|
|
|
+ String startDate = nowDate + " " + "00:00:00"; //默认早上0点
|
|
|
|
|
|
//计算设备利用率
|
|
|
long workhour = DateUtil.between(DateUtil.parse(startDate), date, DateUnit.MINUTE);//当天的实际工作时长(分钟)
|