update:大屏接口修改

This commit is contained in:
songxiaopeng
2024-04-15 17:46:47 +08:00
parent eb6b79b6dc
commit f88d6b4802
11 changed files with 124 additions and 84 deletions

View File

@@ -1,13 +0,0 @@
package org.nl.wms.cockpit.service.dao;
import lombok.Data;
/**
* @author Administrator
* @description 30天故障
*/
@Data
public class DeviceErrorVo {
private String deviceName;
private String errorNum;
}

View File

@@ -4,10 +4,10 @@ import lombok.Data;
/**
* @author Administrator
* 混碾机对接位
* 点位信息对接位货架
*/
@Data
public class MixingRelativeVo {
public class PointInfoVo {
private String pointStatus;
private String pointName;
private String pointCode;

View File

@@ -0,0 +1,13 @@
package org.nl.wms.cockpit.service.dao;
import lombok.Data;
/**
* @author Administrator
* @description 困料货架泥料库(吨)
*/
@Data
public class klInfoVo {
private String materialCode;
private String weight;
}

View File

@@ -7,9 +7,10 @@ import lombok.Getter;
@AllArgsConstructor
public enum ColorEnum {
GREY(0, "灰色"),
YELLOW(1, "黄色"),
GREEN(2, "绿色"),
RED(3, "红色"),
YELLOW(1, "黄色");
RED(3, "红色");
private final Integer index;
private final String colorName;

View File

@@ -8,13 +8,9 @@ import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.nl.wms.cockpit.service.CockpitService;
import org.nl.wms.cockpit.service.dao.*;
import org.nl.wms.cockpit.service.enums.ColorEnum;
import org.nl.wms.cockpit.service.enums.DeviceEnum;
import org.nl.wms.cockpit.service.mapper.CockPitMapper;
import org.nl.wms.das.device.record.service.IDasDeviceErrorRecordService;
import org.nl.wms.das.device.record.service.dao.DasDeviceErrorRecord;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
import org.nl.wms.sch.point.service.ISchBasePointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -37,9 +33,6 @@ public class CockpitServiceImpl implements CockpitService {
@Autowired
private WmsToAcsService wmsToAcsService;
@Autowired
private IDasDeviceErrorRecordService dasDeviceErrorRecordService;
@Override
public ConcurrentHashMap<String, Object> pressedMonitor() {
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll();
@@ -203,8 +196,8 @@ public class CockpitServiceImpl implements CockpitService {
// 遍历判断
for (int i = 0; i < data.size(); i++) {
JSONObject device = data.getJSONObject(i);
int status = ObjectUtil.isNotEmpty(device.getInteger("status"))
? device.getInteger("status")
int status = ObjectUtil.isNotEmpty(device.getString("device_status"))
? Integer.parseInt(device.getString("device_status"))
: 0;
if (status == 0) {
unProducedNum++;
@@ -236,14 +229,14 @@ public class CockpitServiceImpl implements CockpitService {
return null;
});
//30天故障top10
CompletableFuture<List<DeviceErrorVo>> errorCompletableFuture = CompletableFuture.supplyAsync(
() -> dasDeviceErrorRecordService.queryErrorVo(), pool);
errorCompletableFuture.thenAccept(result -> {
resultMap.put("deviceErrorList", result);
//困料货架泥料库(吨)
CompletableFuture<List<klInfoVo>> klInfoCompletableFuture = CompletableFuture.supplyAsync(
() -> cockPitMapper.queryKlInfoList(), pool);
klInfoCompletableFuture.thenAccept(result -> {
resultMap.put("klInfoList", result);
}).exceptionally((e) -> {
log.error("30天故障top10: {}", e.getMessage(), e);
resultMap.put("deviceErrorList", null);
log.error("困料货架泥料库(吨): {}", e.getMessage(), e);
resultMap.put("klInfoList", null);
return null;
});
@@ -263,7 +256,7 @@ public class CockpitServiceImpl implements CockpitService {
productCompletableFuture,
historyCompletableFuture,
deviceRunStatCompletableFuture,
errorCompletableFuture,
klInfoCompletableFuture,
errorRecordCompletableFuture);
CompletableFuture<ConcurrentHashMap<String, Object>> future
= allQuery.thenApply((result) -> resultMap).exceptionally((e) -> {
@@ -279,6 +272,24 @@ public class CockpitServiceImpl implements CockpitService {
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll();
ConcurrentHashMap<String, Object> map = new ConcurrentHashMap<>();
//压制上料位
CompletableFuture<JSONArray> yzslwPositionTask = CompletableFuture.supplyAsync(() -> {
List<String> points = cockPitMapper.selectYzslwPoint();
if (points.isEmpty()) {
return null;
}
JSONArray param = new JSONArray(Collections.singletonList(points));
AcsResponse deviceStatus = wmsToAcsService.getDeviceStatus(param);
return ObjectUtil.isNotEmpty(deviceStatus) ? deviceStatus.getData() : param;
}, pool);
yzslwPositionTask.thenAccept(result -> {
map.put("YzslwPositionList", result);
}).exceptionally((e) -> {
log.error("压制上料位情况显示: {}", e.getMessage(), e);
map.put("YzslwPositionList", e);
return null;
});
//压制码垛位情况显示
CompletableFuture<JSONArray> stackingPositionTask = CompletableFuture.supplyAsync(() -> {
List<String> points = cockPitMapper.selectYzPoint();
@@ -366,20 +377,8 @@ public class CockpitServiceImpl implements CockpitService {
map.put("MixMachineList", null);
return null;
});
// 困料货架的信息显示 TODO
CompletableFuture<JSONArray> trappedMaterialShelfTask = CompletableFuture.supplyAsync(() -> {
// return cockPitMapper.selectKlhwInfo();
return null;
}, pool);
trappedMaterialShelfTask.thenAccept(result -> {
map.put("TrappedMaterialShelfList", result);
}).exceptionally((e) -> {
log.error("困料货架 - 40 货位的信息显示: {}", e.getMessage(), e);
map.put("TrappedMaterialShelfList", null);
return null;
});
// 混碾机对接位
CompletableFuture<List<MixingRelativeVo>> mixBlankingTask = CompletableFuture.supplyAsync(() -> {
CompletableFuture<List<PointInfoVo>> mixBlankingTask = CompletableFuture.supplyAsync(() -> {
return cockPitMapper.selectMixingRelativeInfo();
}, pool);
mixBlankingTask.thenAccept(result -> {
@@ -389,6 +388,18 @@ public class CockpitServiceImpl implements CockpitService {
map.put("MixBlankingList", null);
return null;
});
// 困料货架的信息显示
CompletableFuture<List<PointInfoVo>> trappedMaterialShelfTask = CompletableFuture.supplyAsync(() -> {
return cockPitMapper.selectKlhwInfo();
}, pool);
trappedMaterialShelfTask.thenAccept(result -> {
map.put("TrappedMaterialShelfList", result);
}).exceptionally((e) -> {
log.error("困料货架货位的信息显示: {}", e.getMessage(), e);
map.put("TrappedMaterialShelfList", null);
return null;
});
//压制、分拣机械手
CompletableFuture<JSONArray> manipulatorInfoTask = CompletableFuture.supplyAsync(() -> {
List<String> jxsPoints = cockPitMapper.selectJxsPoints();
@@ -451,7 +462,7 @@ public class CockpitServiceImpl implements CockpitService {
});
// 出窑缓存货架
CompletableFuture<List<MixingRelativeVo>> outKilnHchjTask = CompletableFuture.supplyAsync(() -> {
CompletableFuture<List<PointInfoVo>> outKilnHchjTask = CompletableFuture.supplyAsync(() -> {
return cockPitMapper.selectHchjList();
}, pool);
outKilnHchjTask.thenAccept(result -> {
@@ -462,7 +473,7 @@ public class CockpitServiceImpl implements CockpitService {
return null;
});
// 人工分拣拆垛
CompletableFuture<List<MixingRelativeVo>> manualSortingTask = CompletableFuture.supplyAsync(() -> {
CompletableFuture<List<PointInfoVo>> manualSortingTask = CompletableFuture.supplyAsync(() -> {
return cockPitMapper.selecManualSortingList();
}, pool);
manualSortingTask.thenAccept(result -> {
@@ -473,6 +484,7 @@ public class CockpitServiceImpl implements CockpitService {
return null;
});
CompletableFuture<Void> allQuery = CompletableFuture.allOf(
yzslwPositionTask,
stackingPositionTask,
pressMachineTask,
trappedMaterialShelfTask,

View File

@@ -46,13 +46,19 @@ public interface CockPitMapper {
List<String> selectHnjPoints();
List<MixingRelativeVo> selectMixingRelativeInfo();
List<PointInfoVo> selectMixingRelativeInfo();
List<String> selectJxsPoints();
List<ErrorRecordVo> queryRecord();
List<MixingRelativeVo> selectHchjList();
List<PointInfoVo> selectHchjList();
List<MixingRelativeVo> selecManualSortingList();
List<PointInfoVo> selecManualSortingList();
List<klInfoVo> queryKlInfoList();
List<PointInfoVo> selectKlhwInfo();
List<String> selectYzslwPoint();
}

View File

@@ -122,28 +122,28 @@
</select>
<select id="getMixingList" resultType="org.nl.wms.cockpit.service.dao.MixingVo">
SELECT m.material_name AS materialName,
SUM(w.plan_qty) AS planQty,
SUM(w.real_qty) AS realQty
SELECT m.material_code AS materialName,
SUM(w.plan_weight) AS planQty,
SUM(w.real_weight) AS realQty
FROM pdm_bd_workorder w
LEFT JOIN md_base_material m ON m.material_id = w.material_id
WHERE w.region_code = 'HN'
AND w.workorder_status='3'
GROUP BY m.material_name
order by m.material_name
AND w.workorder_status='3'
GROUP BY m.material_code
order by m.material_code
</select>
<select id="getPressWorkerOrder" resultType="org.nl.wms.cockpit.service.dao.PressProductVo">
SELECT m.material_name as materialName,
SUM(w.plan_qty) as requiredNum,
SUM(w.real_qty) as suppressedNum,
SUM(CASE WHEN w.workorder_status = '5' THEN w.real_qty ELSE 0 END) AS finishedNum
SELECT m.material_code as materialName,
SUM(w.plan_qty) as requiredNum,
SUM(w.real_qty) as suppressedNum,
SUM(w.real_qty) AS finishedNum
FROM pdm_bd_workorder w
LEFT JOIN md_base_material m ON w.material_id = m.material_id
WHERE w.region_code = 'YZ'
AND w.workorder_status='3'
group by m.material_name
order by m.material_name
AND w.workorder_status = '3'
group by m.material_code
order by m.material_code
</select>
<select id="getHistoryList" resultType="org.nl.wms.cockpit.service.dao.HistoryVo">
@@ -236,7 +236,7 @@
WHERE point_type = '1'
and region_code = 'HN'
</select>
<select id="selectMixingRelativeInfo" resultType="org.nl.wms.cockpit.service.dao.MixingRelativeVo">
<select id="selectMixingRelativeInfo" resultType="org.nl.wms.cockpit.service.dao.PointInfoVo">
SELECT p.point_code as pointCode,
p.point_name as pointName,
p.point_status as pointStatus
@@ -264,7 +264,7 @@
LEFT JOIN sch_base_point p ON r.device_code = p.point_code
ORDER BY r.record_time desc limit 100
</select>
<select id="selectHchjList" resultType="org.nl.wms.cockpit.service.dao.MixingRelativeVo">
<select id="selectHchjList" resultType="org.nl.wms.cockpit.service.dao.PointInfoVo">
SELECT p.point_code as pointCode,
p.point_name as pointName,
p.point_status as pointStatus
@@ -272,7 +272,7 @@
WHERE p.region_code ='HCHJ'
ORDER BY p.point_code
</select>
<select id="selecManualSortingList" resultType="org.nl.wms.cockpit.service.dao.MixingRelativeVo">
<select id="selecManualSortingList" resultType="org.nl.wms.cockpit.service.dao.PointInfoVo">
SELECT p.point_code as pointCode,
p.point_name as pointName,
p.point_status as pointStatus
@@ -280,5 +280,35 @@
WHERE p.region_code ='RGFJ'
ORDER BY p.point_code
</select>
<select id="queryKlInfoList" resultType="org.nl.wms.cockpit.service.dao.klInfoVo">
SELECT
p.point_code as materialCode,
sum( v.material_weight ) as weight
FROM
sch_base_point P
LEFT JOIN sch_base_vehiclematerialgroup v ON p.point_code = v.point_code
WHERE
p.region_code IN ( 'KL' )
AND p.point_code NOT LIKE ( 'CBJ%' )
GROUP BY
materialCode
ORDER BY
materialCode
</select>
<select id="selectKlhwInfo" resultType="org.nl.wms.cockpit.service.dao.PointInfoVo">
SELECT p.point_code as pointCode,
p.point_name as pointName,
p.point_status as pointStatus
FROM `sch_base_point` p
WHERE p.region_code ='KL'
and p.point_code not like 'CBJ%'
ORDER BY p.point_code
</select>
<select id="selectYzslwPoint" resultType="java.lang.String">
SELECT point_code AS device_code
FROM `sch_base_point`
WHERE point_type in ('3','4')
and region_code = 'YZ'
</select>
</mapper>

View File

@@ -3,15 +3,10 @@ package org.nl.wms.das.device.record.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.cockpit.service.dao.DeviceErrorVo;
import org.nl.wms.cockpit.service.dao.ErrorRecordVo;
import org.nl.wms.das.device.check.service.dao.DasDeviceCheckRecord;
import org.nl.wms.cockpit.service.dao.klInfoVo;
import org.nl.wms.das.device.record.service.dao.DasDeviceErrorRecord;
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @description 服务接口
@@ -28,6 +23,6 @@ public interface IDasDeviceErrorRecordService extends IService<DasDeviceErrorRec
*/
int create(DasDeviceErrorRecord entity);
List<DeviceErrorVo> queryErrorVo();
List<klInfoVo> queryErrorVo();
}

View File

@@ -1,7 +1,7 @@
package org.nl.wms.das.device.record.service.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.nl.wms.cockpit.service.dao.DeviceErrorVo;
import org.nl.wms.cockpit.service.dao.klInfoVo;
import org.nl.wms.das.device.record.service.dao.DasDeviceErrorRecord;
import java.util.List;
@@ -12,6 +12,6 @@ import java.util.List;
*/
public interface DasDeviceErrorRecordMapper extends BaseMapper<DasDeviceErrorRecord> {
List<DeviceErrorVo> queryErrorVo();
List<klInfoVo> queryErrorVo();
}

View File

@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.das.device.record.service.dao.mapper.DasDeviceErrorRecordMapper">
<select id="queryErrorVo" resultType="org.nl.wms.cockpit.service.dao.DeviceErrorVo">
<select id="queryErrorVo" resultType="org.nl.wms.cockpit.service.dao.klInfoVo">
select if(LENGTH(p.point_name) <![CDATA[ > ]]> 0, p.point_name, r.device_code) as deviceName,
count(*) as errorNum
from das_device_error_record r

View File

@@ -8,18 +8,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.cockpit.service.dao.DeviceErrorVo;
import org.nl.wms.das.device.check.service.dao.DasDeviceCheckRecord;
import org.nl.wms.das.device.check.service.dao.mapper.DasDeviceCheckRecordMapper;
import org.nl.wms.cockpit.service.dao.klInfoVo;
import org.nl.wms.das.device.record.service.IDasDeviceErrorRecordService;
import org.nl.wms.das.device.record.service.dao.DasDeviceErrorRecord;
import org.nl.wms.das.device.record.service.dao.mapper.DasDeviceErrorRecordMapper;
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
@@ -47,7 +43,7 @@ public class IDasDeviceErrorRecordServiceImpl extends ServiceImpl<DasDeviceError
}
@Override
public List<DeviceErrorVo> queryErrorVo() {
public List<klInfoVo> queryErrorVo() {
return dasDeviceCheckRecordMapper.queryErrorVo();
}