|
|
|
|
@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.nl.modules.wql.WQL;
|
|
|
|
|
import org.nl.modules.wql.core.bean.WQLObject;
|
|
|
|
|
import org.nl.modules.wql.util.WqlUtil;
|
|
|
|
|
import org.nl.wms.basedata.eum.StandStatus;
|
|
|
|
|
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
|
|
|
|
import org.nl.wms.sch.manage.PointStatus;
|
|
|
|
|
@@ -16,6 +17,7 @@ import org.nl.wms.sch.manage.Region;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.annotation.WebFilter;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@@ -36,72 +38,114 @@ public class DashboardService {
|
|
|
|
|
public JSONObject homepageData() {
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
|
|
|
|
// 当前设备情况---------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONObject currentEquipmentCondition = new JSONObject();
|
|
|
|
|
result.put("currentEquipmentCondition", currentEquipmentCondition);
|
|
|
|
|
// 初始化 0
|
|
|
|
|
currentEquipmentCondition.put("running", 0);
|
|
|
|
|
currentEquipmentCondition.put("pausing", 0);
|
|
|
|
|
currentEquipmentCondition.put("shutdown", 0);
|
|
|
|
|
currentEquipmentCondition.put("inTrouble", 0);
|
|
|
|
|
// 真实获取
|
|
|
|
|
JSONObject acsResult = wmsToAcsService.getDeviceStatus(WQLObject.getWQLObject("pdm_bi_device").query().getResultJSONArray(0));
|
|
|
|
|
if (acsResult.getIntValue("status") == HttpStatus.OK.value()) {
|
|
|
|
|
JSONArray data = acsResult.getJSONArray("data");
|
|
|
|
|
|
|
|
|
|
currentEquipmentCondition.put("running", data.stream().filter(o -> ((JSONObject) o).getIntValue("status") == 2).count());
|
|
|
|
|
currentEquipmentCondition.put("pausing", data.stream().filter(o -> ((JSONObject) o).getIntValue("status") == 1).count());
|
|
|
|
|
currentEquipmentCondition.put("shutdown", data.stream().filter(o -> ((JSONObject) o).getIntValue("status") == 0).count());
|
|
|
|
|
currentEquipmentCondition.put("inTrouble", data.stream().filter(o -> ((JSONObject) o).getIntValue("status") == 3).count());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 每月故障统计---------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONObject monthlyFailureStatistics = new JSONObject();
|
|
|
|
|
result.put("monthlyFailureStatistics", monthlyFailureStatistics);
|
|
|
|
|
|
|
|
|
|
// 故障次数
|
|
|
|
|
JSONObject currentMonth = new JSONObject();
|
|
|
|
|
monthlyFailureStatistics.put("currentMonth", currentMonth);
|
|
|
|
|
// 初始化 0
|
|
|
|
|
currentMonth.put("mix", 0);
|
|
|
|
|
currentMonth.put("press", 0);
|
|
|
|
|
currentMonth.put("dry", 0);
|
|
|
|
|
currentMonth.put("sort", 0);
|
|
|
|
|
// // 当前设备情况---------------------------------------------------------------------------------------------------
|
|
|
|
|
// JSONObject currentEquipmentCondition = new JSONObject();
|
|
|
|
|
// result.put("currentEquipmentCondition", currentEquipmentCondition);
|
|
|
|
|
// // 初始化 0
|
|
|
|
|
// currentEquipmentCondition.put("running", 0);
|
|
|
|
|
// currentEquipmentCondition.put("pausing", 0);
|
|
|
|
|
// currentEquipmentCondition.put("shutdown", 0);
|
|
|
|
|
// currentEquipmentCondition.put("inTrouble", 0);
|
|
|
|
|
// // 真实获取
|
|
|
|
|
// JSONObject acsResult = wmsToAcsService.getDeviceStatus(WQLObject.getWQLObject("pdm_bi_device").query().getResultJSONArray(0));
|
|
|
|
|
// if (acsResult.getIntValue("status") == HttpStatus.OK.value()) {
|
|
|
|
|
// JSONArray data = acsResult.getJSONArray("data");
|
|
|
|
|
//
|
|
|
|
|
// currentEquipmentCondition.put("running", data.stream().filter(o -> ((JSONObject) o).getIntValue("status") == 2).count());
|
|
|
|
|
// currentEquipmentCondition.put("pausing", data.stream().filter(o -> ((JSONObject) o).getIntValue("status") == 1).count());
|
|
|
|
|
// currentEquipmentCondition.put("shutdown", data.stream().filter(o -> ((JSONObject) o).getIntValue("status") == 0).count());
|
|
|
|
|
// currentEquipmentCondition.put("inTrouble", data.stream().filter(o -> ((JSONObject) o).getIntValue("status") == 3).count());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// // 每月故障统计---------------------------------------------------------------------------------------------------
|
|
|
|
|
// JSONObject monthlyFailureStatistics = new JSONObject();
|
|
|
|
|
// result.put("monthlyFailureStatistics", monthlyFailureStatistics);
|
|
|
|
|
//
|
|
|
|
|
// // 故障次数
|
|
|
|
|
// JSONObject currentMonth = new JSONObject();
|
|
|
|
|
// monthlyFailureStatistics.put("currentMonth", currentMonth);
|
|
|
|
|
// // 初始化 0
|
|
|
|
|
// currentMonth.put("mix", 0);
|
|
|
|
|
// currentMonth.put("press", 0);
|
|
|
|
|
// currentMonth.put("dry", 0);
|
|
|
|
|
// currentMonth.put("sort", 0);
|
|
|
|
|
// 真实获取
|
|
|
|
|
JSONArray data = WQL.getWO("DASHBOARD").addParam("flag", "1").process().getResultJSONArray(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(data)) {
|
|
|
|
|
data = new JSONArray();
|
|
|
|
|
}
|
|
|
|
|
List<Object> mixData = data.stream().filter(o -> "HL".equals(((JSONObject) o).getString("region_code"))).collect(Collectors.toList());
|
|
|
|
|
List<Object> pressData = data.stream().filter(o -> "YZ".equals(((JSONObject) o).getString("region_code"))).collect(Collectors.toList());
|
|
|
|
|
List<Object> dryData = data.stream().filter(o -> "GZ".equals(((JSONObject) o).getString("region_code"))).collect(Collectors.toList());
|
|
|
|
|
List<Object> sortData = data.stream().filter(o -> "FJ".equals(((JSONObject) o).getString("region_code"))).collect(Collectors.toList());
|
|
|
|
|
currentMonth.put("mix", mixData.stream().filter(o -> {
|
|
|
|
|
JSONObject row = (JSONObject) o;
|
|
|
|
|
return DateUtil.thisYear() == row.getIntValue("year") && (DateUtil.thisMonth() + 1) == row.getIntValue("month");
|
|
|
|
|
}).mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum());
|
|
|
|
|
currentMonth.put("press", pressData.stream().filter(o -> {
|
|
|
|
|
JSONObject row = (JSONObject) o;
|
|
|
|
|
return DateUtil.thisYear() == row.getIntValue("year") && (DateUtil.thisMonth() + 1) == row.getIntValue("month");
|
|
|
|
|
}).mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum());
|
|
|
|
|
currentMonth.put("dry", dryData.stream().filter(o -> {
|
|
|
|
|
JSONObject row = (JSONObject) o;
|
|
|
|
|
return DateUtil.thisYear() == row.getIntValue("year") && (DateUtil.thisMonth() + 1) == row.getIntValue("month");
|
|
|
|
|
}).mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum());
|
|
|
|
|
currentMonth.put("sort", sortData.stream().filter(o -> {
|
|
|
|
|
JSONObject row = (JSONObject) o;
|
|
|
|
|
return DateUtil.thisYear() == row.getIntValue("year") && (DateUtil.thisMonth() + 1) == row.getIntValue("month");
|
|
|
|
|
}).mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum());
|
|
|
|
|
// List<Object> mixData = data.stream().filter(o -> "HL".equals(((JSONObject) o).getString("region_code"))).collect(Collectors.toList());
|
|
|
|
|
// List<Object> pressData = data.stream().filter(o -> "YZ".equals(((JSONObject) o).getString("region_code"))).collect(Collectors.toList());
|
|
|
|
|
// List<Object> dryData = data.stream().filter(o -> "GZ".equals(((JSONObject) o).getString("region_code"))).collect(Collectors.toList());
|
|
|
|
|
// List<Object> sortData = data.stream().filter(o -> "FJ".equals(((JSONObject) o).getString("region_code"))).collect(Collectors.toList());
|
|
|
|
|
// currentMonth.put("mix", mixData.stream().filter(o -> {
|
|
|
|
|
// JSONObject row = (JSONObject) o;
|
|
|
|
|
// return DateUtil.thisYear() == row.getIntValue("year") && (DateUtil.thisMonth() + 1) == row.getIntValue("month");
|
|
|
|
|
// }).mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum());
|
|
|
|
|
// currentMonth.put("press", pressData.stream().filter(o -> {
|
|
|
|
|
// JSONObject row = (JSONObject) o;
|
|
|
|
|
// return DateUtil.thisYear() == row.getIntValue("year") && (DateUtil.thisMonth() + 1) == row.getIntValue("month");
|
|
|
|
|
// }).mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum());
|
|
|
|
|
// currentMonth.put("dry", dryData.stream().filter(o -> {
|
|
|
|
|
// JSONObject row = (JSONObject) o;
|
|
|
|
|
// return DateUtil.thisYear() == row.getIntValue("year") && (DateUtil.thisMonth() + 1) == row.getIntValue("month");
|
|
|
|
|
// }).mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum());
|
|
|
|
|
// currentMonth.put("sort", sortData.stream().filter(o -> {
|
|
|
|
|
// JSONObject row = (JSONObject) o;
|
|
|
|
|
// return DateUtil.thisYear() == row.getIntValue("year") && (DateUtil.thisMonth() + 1) == row.getIntValue("month");
|
|
|
|
|
// }).mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum());
|
|
|
|
|
//
|
|
|
|
|
// // 平均次数
|
|
|
|
|
// JSONObject average = new JSONObject();
|
|
|
|
|
// monthlyFailureStatistics.put("average", average);
|
|
|
|
|
// // 真实获取
|
|
|
|
|
// average.put("mix", mixData.isEmpty() ? 0 : mixData.stream().mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum() / mixData.size());
|
|
|
|
|
// average.put("press", pressData.isEmpty() ? 0 : pressData.stream().mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum() / pressData.size());
|
|
|
|
|
// average.put("dry", dryData.isEmpty() ? 0 : dryData.stream().mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum() / dryData.size());
|
|
|
|
|
// average.put("sort", sortData.isEmpty() ? 0 : sortData.stream().mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum() / sortData.size());
|
|
|
|
|
|
|
|
|
|
// 平均次数
|
|
|
|
|
JSONObject average = new JSONObject();
|
|
|
|
|
monthlyFailureStatistics.put("average", average);
|
|
|
|
|
// 真实获取
|
|
|
|
|
average.put("mix", mixData.isEmpty() ? 0 : mixData.stream().mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum() / mixData.size());
|
|
|
|
|
average.put("press", pressData.isEmpty() ? 0 : pressData.stream().mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum() / pressData.size());
|
|
|
|
|
average.put("dry", dryData.isEmpty() ? 0 : dryData.stream().mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum() / dryData.size());
|
|
|
|
|
average.put("sort", sortData.isEmpty() ? 0 : sortData.stream().mapToInt(o -> ((JSONObject) o).getIntValue("count")).sum() / sortData.size());
|
|
|
|
|
//主要设备运行情况
|
|
|
|
|
JSONArray mainEquipmentStatus = new JSONArray();
|
|
|
|
|
JSONArray pointData = wmsToAcsService.getDeviceStatus(WQL.getWO("DASHBOARD").addParam("flag", "3").process().getResultJSONArray(0)).getJSONArray("data");
|
|
|
|
|
if (ObjectUtil.isEmpty(pointData)) {
|
|
|
|
|
pointData = new JSONArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONArray deviceData = wmsToAcsService.getDeviceStatus(WQLObject.getWQLObject("pdm_bi_device").query().getResultJSONArray(0)).getJSONArray("data");
|
|
|
|
|
if (ObjectUtil.isEmpty(deviceData)) {
|
|
|
|
|
deviceData = new JSONArray();
|
|
|
|
|
}
|
|
|
|
|
//混碾机
|
|
|
|
|
List<JSONObject> mixingMachineData = deviceData.stream().map(o -> (JSONObject) o).filter(o -> "1".equals(o.getString("device_model")) || "2".equals(o.getString("device_model"))).sorted(Comparator.comparingInt(o -> o.getIntValue("productivity"))).collect(Collectors.toList());
|
|
|
|
|
for (JSONObject datum : mixingMachineData) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
String device_code=datum.getString("device_code");
|
|
|
|
|
row.put("devicename", datum.getString("device_name"));
|
|
|
|
|
int status=datum.getInteger("status");
|
|
|
|
|
row.put("status", deviceStatusToChinese(status));
|
|
|
|
|
JSONObject gdxx = WQLObject.getWQLObject("pdm_bd_workorder").query("order_status = '3' AND device_code = '" + device_code + "'").uniqueResult(0);
|
|
|
|
|
String material_id=gdxx.getString("material_id");
|
|
|
|
|
JSONObject wlxx = WQLObject.getWQLObject("md_me_materialbase").query("material_id = '" + material_id + "'").uniqueResult(0);
|
|
|
|
|
String material_name=wlxx.getString("material_name");
|
|
|
|
|
row.put("material", material_name);
|
|
|
|
|
mainEquipmentStatus.add(row);
|
|
|
|
|
}
|
|
|
|
|
//压机
|
|
|
|
|
List<JSONObject> pressMachineData = deviceData.stream().map(o -> (JSONObject) o).filter(o -> "3".equals(o.getString("device_model")) || "4".equals(o.getString("device_model"))).sorted(Comparator.comparingInt(o -> o.getIntValue("productivity"))).collect(Collectors.toList());
|
|
|
|
|
for (JSONObject datum : pressMachineData) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
String device_code=datum.getString("device_code");
|
|
|
|
|
row.put("devicename", datum.getString("device_name"));
|
|
|
|
|
int status=datum.getInteger("status");
|
|
|
|
|
row.put("status", deviceStatusToChinese(status));
|
|
|
|
|
JSONObject gdxx = WQLObject.getWQLObject("pdm_bd_workorder").query("order_status = '3' AND device_code = '" + device_code + "'").uniqueResult(0);
|
|
|
|
|
String material_id=gdxx.getString("material_id");
|
|
|
|
|
JSONObject wlxx = WQLObject.getWQLObject("md_me_materialbase").query("material_id = '" + material_id + "'").uniqueResult(0);
|
|
|
|
|
String material_name=wlxx.getString("material_name");
|
|
|
|
|
row.put("material", material_name);
|
|
|
|
|
mainEquipmentStatus.add(row);
|
|
|
|
|
}
|
|
|
|
|
result.put("mainEquipmentStatus",mainEquipmentStatus);
|
|
|
|
|
// 当日工序生产统计------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONObject dailyProductionStatistics = new JSONObject();
|
|
|
|
|
result.put("dailyProductionStatistics", dailyProductionStatistics);
|
|
|
|
|
@@ -124,10 +168,23 @@ public class DashboardService {
|
|
|
|
|
dailyProductionStatistics.put("stand", stand);
|
|
|
|
|
// 当前所有存在的料盅数据
|
|
|
|
|
JSONArray cupData = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("is_delete = '0' AND vehicle_type = '1'").getResultJSONArray(0);
|
|
|
|
|
// 处理
|
|
|
|
|
stand.put("onStanding", String.format("%.2f", cupData.stream().filter(o -> "1".equals(((JSONObject) o).getString("stand_status"))).mapToDouble(o -> ((JSONObject) o).getDoubleValue("weight")).sum() / 1000));
|
|
|
|
|
stand.put("completed", String.format("%.2f", cupData.stream().filter(o -> "23".contains(((JSONObject) o).getString("stand_status"))).mapToDouble(o -> ((JSONObject) o).getDoubleValue("weight")).sum() / 1000));
|
|
|
|
|
|
|
|
|
|
// // 处理
|
|
|
|
|
// stand.put("onStanding", String.format("%.2f", cupData.stream().filter(o -> "1".equals(((JSONObject) o).getString("stand_status"))).mapToDouble(o -> ((JSONObject) o).getDoubleValue("weight")).sum() / 1000));
|
|
|
|
|
// stand.put("completed", String.format("%.2f", cupData.stream().filter(o -> "23".contains(((JSONObject) o).getString("stand_status"))).mapToDouble(o -> ((JSONObject) o).getDoubleValue("weight")).sum() / 1000));
|
|
|
|
|
JSONArray lzjzid= WQLObject.getWQLObject("sch_base_point").query("region_id = '1695713307387891712' AND vd_id !=' '").getResultJSONArray(0);
|
|
|
|
|
JSONArray resultArray = new JSONArray();
|
|
|
|
|
for (int i = 0; i < cupData.size(); i++) {
|
|
|
|
|
JSONObject obj1 = cupData.getJSONObject(i);
|
|
|
|
|
for (int j = 0; j < lzjzid.size(); j++) {
|
|
|
|
|
JSONObject obj2 = lzjzid.getJSONObject(j);
|
|
|
|
|
String value1 = obj1.getString("vd_id");
|
|
|
|
|
String value2 = obj2.getString("vd_id");
|
|
|
|
|
if (value1.equals(value2)) {
|
|
|
|
|
resultArray.add(obj1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
stand.put("completed", String.format("%.2f", resultArray.stream().filter(o -> "2".equals(((JSONObject) o).getString("stand_status"))).mapToDouble(o -> ((JSONObject) o).getDoubleValue("weight")).sum() / 1000));
|
|
|
|
|
// 压制
|
|
|
|
|
JSONObject press = new JSONObject();
|
|
|
|
|
dailyProductionStatistics.put("press", press);
|
|
|
|
|
@@ -138,17 +195,20 @@ public class DashboardService {
|
|
|
|
|
// 干燥
|
|
|
|
|
JSONObject dry = new JSONObject();
|
|
|
|
|
dailyProductionStatistics.put("dry", dry);
|
|
|
|
|
// 入窑时间为今天的数据
|
|
|
|
|
JSONArray inKilnData = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("vehicle_type = '2' AND TO_DAYS (in_kiln_time) = TO_DAYS (NOW())").getResultJSONArray(0);
|
|
|
|
|
// 出窑时间为今天的数据
|
|
|
|
|
JSONArray outKilnData = WQLObject.getWQLObject("st_ivt_vehicle_detail").query("vehicle_type = '2' AND TO_DAYS (out_kiln_time) = TO_DAYS (NOW())").getResultJSONArray(0);
|
|
|
|
|
// 处理
|
|
|
|
|
dry.put("planned", 0);
|
|
|
|
|
dry.put("planned", String.format("%.2f", inKilnData.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qty")).sum() / 10000.00));
|
|
|
|
|
dry.put("completed", String.format("%.2f", outKilnData.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qty")).sum() / 10000.00));
|
|
|
|
|
|
|
|
|
|
// 分拣
|
|
|
|
|
JSONObject sort = new JSONObject();
|
|
|
|
|
dailyProductionStatistics.put("sort", sort);
|
|
|
|
|
// 真实获取
|
|
|
|
|
sort.put("planned", String.format("%.2f", data.stream().filter(o -> "FJ".equals(((JSONObject) o).getString("region_code"))).mapToInt(o -> ((JSONObject) o).getIntValue("plan_qty")).sum() / 10000.00));
|
|
|
|
|
//计划量即为出窑量
|
|
|
|
|
sort.put("planned", String.format("%.2f", outKilnData.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qty")).sum() / 10000.00));
|
|
|
|
|
sort.put("completed", String.format("%.2f", data.stream().filter(o -> "FJ".equals(((JSONObject) o).getString("region_code"))).mapToInt(o -> ((JSONObject) o).getIntValue("qty")).sum() / 10000.00));
|
|
|
|
|
|
|
|
|
|
// 设备生产统计---------------------------------------------------------------------------------------------------
|
|
|
|
|
@@ -165,7 +225,10 @@ public class DashboardService {
|
|
|
|
|
} else {
|
|
|
|
|
row.put("completed", datum.getIntValue("qty") + "块");
|
|
|
|
|
}
|
|
|
|
|
equipmentProductionStatistics.add(row);
|
|
|
|
|
String equipment=row.getString("equipment");
|
|
|
|
|
if(ObjectUtil.isNotEmpty(equipment)) {
|
|
|
|
|
equipmentProductionStatistics.add(row);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@@ -210,13 +273,11 @@ public class DashboardService {
|
|
|
|
|
String deviceCode = datum.getString("device_code");
|
|
|
|
|
int deviceStatus = datum.getIntValue("status");
|
|
|
|
|
List<JSONObject> todayProduction = allDeviceTodayProduction.stream().map(o -> (JSONObject) o).filter(o -> deviceCode.equals(o.getString("device_code"))).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", deviceCode);
|
|
|
|
|
row.put("status", this.deviceStatusToDictStatus(deviceStatus));
|
|
|
|
|
row.put("equipmentName", datum.getString("device_name"));
|
|
|
|
|
row.put("statusChinese", this.deviceStatusToChinese(deviceStatus));
|
|
|
|
|
|
|
|
|
|
JSONArray rowData = new JSONArray();
|
|
|
|
|
row.put("data", rowData);
|
|
|
|
|
|
|
|
|
|
@@ -286,30 +347,32 @@ public class DashboardService {
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "物料号");
|
|
|
|
|
rowDatum.put("value", datum.getString("material_number"));
|
|
|
|
|
rowDatum.put("key", "点位状态");
|
|
|
|
|
int move=datum.getIntValue("move");
|
|
|
|
|
rowDatum.put("value", deviceMoveToChinese(move));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "物料名称");
|
|
|
|
|
rowDatum.put("value", datum.getString("material_name"));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
// rowDatum = new JSONObject();
|
|
|
|
|
// rowDatum.put("key", "物料号");
|
|
|
|
|
// rowDatum.put("value", datum.getString("material_number"));
|
|
|
|
|
// rowData.add(rowDatum);
|
|
|
|
|
//
|
|
|
|
|
// rowDatum = new JSONObject();
|
|
|
|
|
// rowDatum.put("key", "物料名称");
|
|
|
|
|
// rowDatum.put("value", datum.getString("material_name"));
|
|
|
|
|
// rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "重量");
|
|
|
|
|
rowDatum.put("value", String.format("%.0f", datum.getDoubleValue("weight")) + "千克");
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
String createTime = datum.getString("create_time");
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "组盘时间");
|
|
|
|
|
rowDatum.put("value", createTime);
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
// String createTime = datum.getString("create_time");
|
|
|
|
|
// rowDatum = new JSONObject();
|
|
|
|
|
// rowDatum.put("key", "组盘时间");
|
|
|
|
|
// rowDatum.put("value", createTime);
|
|
|
|
|
// rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "已静置时间");
|
|
|
|
|
rowDatum.put("value", StrUtil.isBlank(createTime) ? "" : DateUtil.between(DateUtil.parseDate(createTime), new Date(), DateUnit.HOUR) + "小时");
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
unloadLocation.add(row);
|
|
|
|
|
}
|
|
|
|
|
@@ -372,7 +435,7 @@ public class DashboardService {
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "已静置时间");
|
|
|
|
|
rowDatum.put("value", StrUtil.isBlank(createTime) ? "" : DateUtil.between(DateUtil.parseDate(createTime), new Date(), DateUnit.HOUR) + "小时");
|
|
|
|
|
rowDatum.put("value", StrUtil.isBlank(createTime) ? "" : DateUtil.between(DateUtil.parseDateTime(createTime), new Date(), DateUnit.HOUR) + "小时");
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
storageLocation.add(row);
|
|
|
|
|
@@ -434,7 +497,7 @@ public class DashboardService {
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "已静置时间");
|
|
|
|
|
rowDatum.put("value", StrUtil.isBlank(createTime) ? "" : DateUtil.between(DateUtil.parseDate(createTime), new Date(), DateUnit.HOUR) + "小时");
|
|
|
|
|
rowDatum.put("value", StrUtil.isBlank(createTime) ? "" : DateUtil.between(DateUtil.parseDateTime(createTime), new Date(), DateUnit.HOUR) + "小时");
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
loadLocation.add(row);
|
|
|
|
|
@@ -561,30 +624,23 @@ public class DashboardService {
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "载具号");
|
|
|
|
|
rowDatum.put("value", datum.getString("vehicle_code"));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "物料号");
|
|
|
|
|
rowDatum.put("value", datum.getString("material_number"));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "物料名称");
|
|
|
|
|
rowDatum.put("value", datum.getString("material_name"));
|
|
|
|
|
rowDatum.put("key", "点位状态");
|
|
|
|
|
int move=datum.getIntValue("move");
|
|
|
|
|
rowDatum.put("value", deviceYZXLMoveToChinese(move));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "数量");
|
|
|
|
|
rowDatum.put("value", datum.getIntValue("qty") + "块");
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "组盘时间");
|
|
|
|
|
rowDatum.put("value", datum.getString("create_time"));
|
|
|
|
|
rowDatum.put("key", "单重");
|
|
|
|
|
rowDatum.put("value", datum.getString("AlongSide")+"kg");
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "今日完成托数");
|
|
|
|
|
rowDatum.put("value", datum.getIntValue("BshortSide")+"托");
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
unloadLocation.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -709,7 +765,6 @@ public class DashboardService {
|
|
|
|
|
for (JSONObject datum : gantryRobotData) {
|
|
|
|
|
String deviceCode = datum.getString("device_code");
|
|
|
|
|
int deviceStatus = datum.getIntValue("status");
|
|
|
|
|
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", deviceCode);
|
|
|
|
|
row.put("status", this.deviceStatusToDictStatus(deviceStatus));
|
|
|
|
|
@@ -739,7 +794,13 @@ public class DashboardService {
|
|
|
|
|
rowDatum.put("value", datum.getIntValue("error_time") / 3600 + "小时");
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "条码");
|
|
|
|
|
rowDatum.put("value", datum.getString("vehicle_code"));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
gantryRobot.add(row);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 窑
|
|
|
|
|
@@ -1127,7 +1188,6 @@ public class DashboardService {
|
|
|
|
|
for (JSONObject datum : laminatingMachineData) {
|
|
|
|
|
String deviceCode = datum.getString("device_code");
|
|
|
|
|
int deviceMode = datum.getIntValue("mode");
|
|
|
|
|
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", deviceCode);
|
|
|
|
|
if (datum.getIntValue("error") != 0) {
|
|
|
|
|
@@ -1146,6 +1206,12 @@ public class DashboardService {
|
|
|
|
|
rowDatum.put("value", datum.getIntValue("container_type"));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "点位状态");
|
|
|
|
|
int move=datum.getIntValue("move");
|
|
|
|
|
rowDatum.put("value", deviceYZXLMoveToChinese(move));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
laminatingMachine.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1253,21 +1319,18 @@ public class DashboardService {
|
|
|
|
|
rowDatum.put("value", datum.getIntValue("energyLevel"));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "角度");
|
|
|
|
|
rowDatum.put("value", datum.getIntValue("positionAngle"));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "X坐标");
|
|
|
|
|
rowDatum.put("value", datum.getIntValue("positionX"));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "Y坐标");
|
|
|
|
|
rowDatum.put("value", datum.getIntValue("positionY"));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
if(datum.getString("name").equals("1")){
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "当日完成任务数量");
|
|
|
|
|
rowDatum.put("value", datum.getIntValue("finishnumber1"));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
}
|
|
|
|
|
if(datum.getString("name").equals("2")){
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "当日完成任务数量");
|
|
|
|
|
rowDatum.put("value", datum.getIntValue("finishnumber2"));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
}
|
|
|
|
|
agvArr.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1461,7 +1524,7 @@ public class DashboardService {
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "已静置时间");
|
|
|
|
|
rowDatum.put("value", StrUtil.isBlank(createTime) ? "" : DateUtil.between(DateUtil.parseDate(createTime), new Date(), DateUnit.HOUR) + "小时");
|
|
|
|
|
rowDatum.put("value", StrUtil.isBlank(createTime) ? "" : DateUtil.between(DateUtil.parseDateTime(createTime), new Date(), DateUnit.HOUR) + "小时");
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
standMonitor.add(row);
|
|
|
|
|
@@ -1487,10 +1550,10 @@ public class DashboardService {
|
|
|
|
|
rowDatum.put("value", pointName);
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "载具号");
|
|
|
|
|
rowDatum.put("value", datum.getString("vehicle_code"));
|
|
|
|
|
rowData.add(rowDatum);
|
|
|
|
|
// rowDatum = new JSONObject();
|
|
|
|
|
// rowDatum.put("key", "载具号");
|
|
|
|
|
// rowDatum.put("value", datum.getString("vehicle_code"));
|
|
|
|
|
// rowData.add(rowDatum);
|
|
|
|
|
|
|
|
|
|
rowDatum = new JSONObject();
|
|
|
|
|
rowDatum.put("key", "物料号");
|
|
|
|
|
@@ -1586,7 +1649,7 @@ public class DashboardService {
|
|
|
|
|
row.put("materialCode", datum.getString("material_number"));
|
|
|
|
|
row.put("materialName", datum.getString("material_name"));
|
|
|
|
|
row.put("weight", String.format("%.0f", datum.getDoubleValue("weight")) + "千克");
|
|
|
|
|
row.put("standTime", DateUtil.between(DateUtil.parseDate(datum.getString("create_time")), new Date(), DateUnit.HOUR) + "小时");
|
|
|
|
|
row.put("standTime", DateUtil.between(DateUtil.parseDateTime(datum.getString("create_time")), new Date(), DateUnit.HOUR) + "小时");
|
|
|
|
|
row.put("standStatus", StandStatus.get(datum.getString("stand_status")).value());
|
|
|
|
|
standStock.add(row);
|
|
|
|
|
}
|
|
|
|
|
@@ -1600,8 +1663,7 @@ public class DashboardService {
|
|
|
|
|
row.put("materialCode", datum.getString("material_number"));
|
|
|
|
|
row.put("materialName", datum.getString("material_name"));
|
|
|
|
|
row.put("qty", String.format("%.0f", datum.getDoubleValue("qty")) + "块");
|
|
|
|
|
row.put("vehicleCode", datum.getString("vehicle_code"));
|
|
|
|
|
row.put("warehousingTime", DateUtil.parseDate(datum.getString("update_time")));
|
|
|
|
|
row.put("warehousingTime", datum.getString("update_time"));
|
|
|
|
|
frontWarehouseStock.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1615,7 +1677,7 @@ public class DashboardService {
|
|
|
|
|
row.put("materialName", datum.getString("material_name"));
|
|
|
|
|
row.put("qty", String.format("%.0f", datum.getDoubleValue("qty")) + "块");
|
|
|
|
|
row.put("vehicleCode", datum.getString("vehicle_code"));
|
|
|
|
|
row.put("warehousingTime", DateUtil.parseDate(datum.getString("update_time")));
|
|
|
|
|
row.put("warehousingTime", datum.getString("update_time"));
|
|
|
|
|
backWarehouseStock.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1785,6 +1847,28 @@ public class DashboardService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String deviceMoveToChinese(int move) {
|
|
|
|
|
switch (move) {
|
|
|
|
|
case 0:
|
|
|
|
|
return "无货";
|
|
|
|
|
case 1:
|
|
|
|
|
return "有货";
|
|
|
|
|
default:
|
|
|
|
|
return "未知";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String deviceYZXLMoveToChinese(int move) {
|
|
|
|
|
switch (move) {
|
|
|
|
|
case 0:
|
|
|
|
|
return "无货";
|
|
|
|
|
case 2:
|
|
|
|
|
return "有货";
|
|
|
|
|
default:
|
|
|
|
|
return "未知";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int agvStatusToDictStatus(int status) {
|
|
|
|
|
switch (status) {
|
|
|
|
|
case 2:
|
|
|
|
|
|