add:增加固化室错误代码解析。

This commit is contained in:
2024-09-27 14:34:22 +08:00
parent 9b15f6cb76
commit da421665ea
7 changed files with 150 additions and 71 deletions

View File

@@ -18,8 +18,8 @@ public enum AcsDefineEnum {
//agv状态 1-关机2-运行中3-交通管制4-任务等待5-充电中6-故障中7-低电量
AGV_STATUS(MapOf.of("关机", "1", "运行中", "2", "交通管制", "3", "任务等待", "4", "充电中", "5", "故障中", "6", "低电量", "7")),
//RGV状态 1-空闲 2-任务执行中 3-充电 4-故障 5-未知 6-不可利用
RGV_STATUS(MapOf.of("1","IDLE","2","EXECUTING","3","CHARGING","4","ERROR","5","UNKNOWN","6","UNAVAILABLE")),
//RGV状态 1-空闲 2-工作中 3-手动 4-下线
RGV_STATUS(MapOf.of("1","IDLE","2","WORK","3","UNAVAIL","4","OFFLINE")),
//载具类型
VEHICLE_TYPE(MapOf.of("普涂", "1", "连涂", "2")),

View File

@@ -18,6 +18,8 @@ public class TaskInfo extends ErrorData {
private String material_name;
private String material_spec;
private String qty;
private String type;
private String material_qty;
private String vehicle_type;
private String vehicle_code;
private String task_type;

View File

@@ -1,5 +1,6 @@
package org.nl.wms.cockpit.service.impl;
import cn.hutool.core.date.StopWatch;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -151,6 +152,7 @@ public class CockpitServiceImpl implements CockpitService {
item1.put("plan_qty", "100");
item1.put("real_qty", "0");
item1.put("point_name", "普涂线01");
item1.put("device_code", "LTX01");
item1.put("workorder_status", "生产中");
today_work.add(item1);
}
@@ -187,7 +189,7 @@ public class CockpitServiceImpl implements CockpitService {
CompletableFuture<List<Map<String, Object>>> task10 = CompletableFuture.supplyAsync(() -> cockpitMapper.faultAlarm(), pool);
task10.thenAccept((result) -> {
//测试数据,上线后删除
faultAlarmDefault(result, "TS_GHS02");
faultAlarmDefault(result, "GHS01");
getHomeInfo.put("fault_alarm", result);
}).exceptionally((e) -> {
log.error("实时故障告警: {}", e.getMessage(), e);
@@ -198,7 +200,7 @@ public class CockpitServiceImpl implements CockpitService {
CompletableFuture<JSONArray> task11 = CompletableFuture.supplyAsync(() -> cockpitMapper.monthlyFaultStatistics(), pool);
task11.thenAccept((result) -> {
//测试数据,上线后删除
monthlyFaultStatisticsDefault(result, "TS_GHS02");
monthlyFaultStatisticsDefault(result, "GHS01");
getHomeInfo.put("monthly_fault_statistics", result);
}).exceptionally((e) -> {
log.error("近30日故障统计: {}", e.getMessage(), e);
@@ -286,22 +288,23 @@ public class CockpitServiceImpl implements CockpitService {
JSONArray today_work = cockpitMapper.todayTbTask();
if (ObjectUtil.isEmpty(today_work)) {
JSONObject item1 = new JSONObject();
item1.put("workorder_code", "test_240712002");
item1.put("workorder_code", "TS_240712002");
item1.put("material_name", "13.2正");
item1.put("plan_qty", "100");
item1.put("real_qty", "0");
item1.put("point_name", "连涂线01");
item1.put("device_code", "LTX01");
item1.put("workorder_status", "就绪");
today_work.add(item1);
}
//实时故障告警
List<Map<String, Object>> fault_alarm = cockpitMapper.FaultTime("TBX");
//测试数据,上线后删除
faultAlarmDefault(fault_alarm, "TS_LTX02");
faultAlarmDefault(fault_alarm, "LTX01");
//近30日故障统计
JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("TBX");
//测试数据,上线后删除
monthlyFaultStatisticsDefault(monthly_fault_statistics, "TS_LTX02");
monthlyFaultStatisticsDefault(monthly_fault_statistics, "LTX01");
List<Map<String, Object>> monthly_produce_statistics = cockpitMapper.getTbxMonthlyStatistics();
List<Map<String, Object>> tbxMonthlyStatistics = new ArrayList<>();
for (int i = 0; i < 30; i++) {
@@ -364,35 +367,36 @@ public class CockpitServiceImpl implements CockpitService {
@Override
public JSONObject getGhsInfo() {
JSONObject getGhsInfo = new JSONObject();
StopWatch stopWatch = new StopWatch();
stopWatch.start();
//固化汇总
JSONArray curing_summary = cockpitMapper.curingSummary();
stopWatch.stop();
System.out.println("查询固化汇总花费时间---= totalTime = " + stopWatch.getTotalTimeMillis());
StopWatch stopWatch1 = new StopWatch();
stopWatch1.start();
//30天固化统计
List<Map<String, Object>> monthly_gh_qty = cockpitMapper.getGhsQty("30");
List<Map<String, Object>> monthly_gh_qty_default = new ArrayList<>();
getWeekWorkStatistics(monthly_gh_qty, monthly_gh_qty_default, "GH", 30);
stopWatch1.stop();
System.out.println("查询30天固化统计花费时间---= totalTime = " + stopWatch1.getTotalTimeMillis());
StopWatch stopWatch2 = new StopWatch();
stopWatch2.start();
//今日固化任务
List<Map<String, Object>> gh_material_summary = new ArrayList<>();
CompletableFuture<List<TaskInfo>> task3 = CompletableFuture.supplyAsync(() -> {
List<TaskInfo> tasks = new ArrayList<>();
try {
tasks = getTasks(RegionCodeConstant.CURING_ZONE);
} catch (Exception e) {
TaskInfo taskInfo = new TaskInfo();
taskInfo.setError_info(e.toString());
tasks.add(taskInfo);
}
return tasks;
}, pool);
List<TaskInfo> taskInfos = task3.join();
if (ObjectUtil.isNotEmpty(taskInfos )){
List<TaskInfo> taskInfos = getTasks(RegionCodeConstant.CURING_ZONE);
if (ObjectUtil.isNotEmpty(taskInfos)) {
taskInfos.forEach(r -> {
if (r.getError_info() != null) {
Map<String, Object> item = new HashMap<>();
item.put("material_name", r.getMaterial_name());
item.put("material_spec", r.getMaterial_spec());
item.put("qty", r.getQty());
item.put("type", r.getTask_type());
gh_material_summary.add(item);
}
Map<String, Object> item = new HashMap<>();
item.put("material_name", r.getMaterial_name());
item.put("material_spec", r.getMaterial_spec());
item.put("qty", r.getMaterial_qty());
item.put("type", r.getType());
gh_material_summary.add(item);
});
} else {
//测试数据,上线后删除
@@ -409,19 +413,36 @@ public class CockpitServiceImpl implements CockpitService {
gh_material_summary.add(item1);
gh_material_summary.add(item2);
}
stopWatch2.stop();
System.out.println("今日固化任务统计花费时间---= totalTime = " + stopWatch2.getTotalTimeMillis());
StopWatch stopWatch3 = new StopWatch();
stopWatch3.start();
//实时故障告警
List<Map<String, Object>> fault_alarm = cockpitMapper.FaultTime("GH");
//测试数据,上线后删除
faultAlarmDefault(fault_alarm, "TS_GHS02");
faultAlarmDefault(fault_alarm, "GHS01");
stopWatch3.stop();
System.out.println("查询实时故障告警花费时间---= totalTime = " + stopWatch3.getTotalTimeMillis());
StopWatch stopWatch4 = new StopWatch();
stopWatch4.start();
//近30日故障统计
JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("GH");
//测试数据,上线后删除
monthlyFaultStatisticsDefault(monthly_fault_statistics, "TS_GHS02");
monthlyFaultStatisticsDefault(monthly_fault_statistics, "GHS01");
stopWatch4.stop();
System.out.println("查询近30日故障统计花费时间---= totalTime = " + stopWatch4.getTotalTimeMillis());
getGhsInfo.put("curing_summary", curing_summary);
getGhsInfo.put("monthly_gh_qty", monthly_gh_qty_default);
getGhsInfo.put("gh_material_summary", gh_material_summary);
getGhsInfo.put("fault_alarm", fault_alarm);
getGhsInfo.put("monthly_fault_statistics", monthly_fault_statistics);
return getGhsInfo;
}
@@ -510,7 +531,7 @@ public class CockpitServiceImpl implements CockpitService {
//测试数据,上线后删除
if (ObjectUtil.isEmpty(monthly_fault_statistics)) {
JSONObject item = new JSONObject();
item.put("region_name", "TS_GHS");
item.put("region_name", "GHS");
item.put("alarm_qty", "1");
monthly_fault_statistics.add(item);
}
@@ -525,8 +546,12 @@ public class CockpitServiceImpl implements CockpitService {
* 设备ui
*/
@Override
public JSONObject equipmentInfo(String deviceCode) {
public JSONObject equipmentInfo(String code) {
if (StringUtils.isBlank(code)) {
throw new RuntimeException("设备编号不能为空");
}
JSONObject res = new JSONObject();
String deviceCode = code.toUpperCase();
SchBasePoint point = pointService.getById(deviceCode);
String type = point != null ? point.getRegion_code() : RegionCodeConstant.VEHICLEINFO;
List<SchBasePoint> points;
@@ -600,7 +625,7 @@ public class CockpitServiceImpl implements CockpitService {
List<Map<String, Object>> tb_real_qty = cockpitMapper.getTxQty("30", "TBX");
List<Map<String, Object>> tb_real_qty_default = new ArrayList<>();
getWeekWorkStatistics(tb_real_qty, tb_real_qty_default, "TBX", 30);
res.put("production_month ", tb_real_qty_default);
res.put("production_month", tb_real_qty_default);
break;
case RegionCodeConstant.CURING_ZONE:
//固化室,需要显示整个设备+内部位置明细
@@ -648,8 +673,8 @@ public class CockpitServiceImpl implements CockpitService {
List<Map<String, Object>> gh_real_qty = cockpitMapper.getGhsQty("30");
List<Map<String, Object>> gh_real_qty_default = new ArrayList<>();
getWeekWorkStatistics(gh_real_qty, gh_real_qty_default, "GHS", 30);
res.put("production_month ", gh_real_qty_default);
res.put("current_tasks ", current_tasks);
res.put("production_month", gh_real_qty_default);
res.put("current_tasks", current_tasks);
res.put("details", ghsArray);
break;
case RegionCodeConstant.EMPTY_TEMPORARY_STORAGE_AREA:

View File

@@ -331,7 +331,8 @@
m.material_name AS material_name,
w.plan_qty,
w.real_qty,
w.point_name,
w.point_name ,
w.point_code as device_code,
w.workorder_status
FROM `pdm_bd_workorder` w
LEFT JOIN md_base_material m ON m.material_id = w.material_id
@@ -521,6 +522,7 @@
w.plan_qty,
w.real_qty,
w.point_name,
w.point_code as device_code,
w.workorder_status
FROM
`pdm_bd_workorder` w
@@ -529,22 +531,42 @@
w.workorder_status=3
And DATE(w.create_time)=CURDATE()
</select>
<select id="FaultTime1" resultType="java.util.HashMap">
SELECT
d1.device_code,
d1.failure_info AS fault_cause,
d1.failure_time AS alarm_time
FROM
das_device_fault d1
WHERE
d1.failure_time = (
SELECT MAX(d2.failure_time)
FROM das_device_fault d2
WHERE d2.device_code = d1.device_code
AND d2.region_code = #{region_code}
)
AND d1.region_code = #{region_code}
And d1.current_status=1
</select>
<select id="FaultTime" resultType="java.util.HashMap">
SELECT
d1.device_code,
d1.failure_info AS fault_cause,
d1.failure_time AS alarm_time
FROM
das_device_fault d1
WHERE
d1.failure_time = (
SELECT MAX(d2.failure_time)
FROM das_device_fault d2
WHERE d2.device_code = d1.device_code
AND d2.region_code = #{region_code}
)
AND d1.region_code = #{region_code}
And d1.current_status=1
SELECT
d1.device_code,
d1.failure_info AS fault_cause,
d1.failure_time AS alarm_time
FROM
das_device_fault d1
JOIN
(SELECT
device_code,
MAX(failure_time) AS max_failure_time
FROM
das_device_fault
WHERE
region_code = #{region_code} GROUP BY device_code) d2
ON d1.device_code = d2.device_code AND d1.failure_time = d2.max_failure_time
WHERE
d1.region_code = #{region_code}
AND d1.current_status = 1;
</select>
<select id="FaultTotal" resultType="com.alibaba.fastjson.JSONObject">
SELECT