add:大屏、看板、弹窗接口完善

This commit is contained in:
songxiaopeng
2024-03-07 10:01:55 +08:00
parent 1daf8be83e
commit afeedb200d
11 changed files with 98 additions and 75 deletions

View File

@@ -22,7 +22,7 @@ import java.util.Map;
*/
@Slf4j
@RestController
@Api(tags = "看板接口")
@Api(tags = "大屏接口")
@RequestMapping("/api/cockpit")
@SaIgnore
public class CockPitController {
@@ -30,7 +30,7 @@ public class CockPitController {
@Autowired
private CockpitService cockpitService;
@GetMapping("/press")
@PostMapping("/press")
@Log("压制看板")
@ApiOperation("压制看板")
public ResponseEntity<Object> pressedMonitor(){
@@ -38,21 +38,21 @@ public class CockPitController {
}
@GetMapping("/sorting")
@PostMapping("/sorting")
@Log("分拣看板")
@ApiOperation("分拣看板")
public ResponseEntity<Object> sortingMonitor(){
return new ResponseEntity<>(cockpitService.sortingMonitor(), HttpStatus.OK);
}
@GetMapping("/screenTableData")
@PostMapping("/screenTableData")
@Log("大屏-两侧图表")
@ApiOperation("大屏-两侧图表")
public ResponseEntity<Object> screenLeftData(){
return new ResponseEntity<>(cockpitService.screenTableData(), HttpStatus.OK);
}
@GetMapping("/deviceCondition")
@PostMapping("/deviceCondition")
@Log("大屏-中间设备运行情况")
@ApiOperation("大屏-中间设备运行情况")
public ResponseEntity<Object> deviceCondition(){
@@ -66,13 +66,13 @@ public class CockPitController {
// return new ResponseEntity<>(cockpitService.selectMixingDetail(whereJson), HttpStatus.OK);
// }
@GetMapping("/inOutKilnDetail")
@PostMapping("/inOutKilnDetail")
@Log("出、入窑输送线弹窗")
@ApiOperation("出、入窑输送线弹窗")
public ResponseEntity<Object> selectInOutKilnDetail(){
return new ResponseEntity<>(cockpitService.selectInOutKilnDetail(), HttpStatus.OK);
}
@GetMapping("/kilnDetail")
@PostMapping("/kilnDetail")
@Log("窑弹出框")
@ApiOperation("窑弹出框")
public ResponseEntity<Object> selectKilnDetail(){

View File

@@ -0,0 +1,15 @@
package org.nl.wms.cockpit.service.dao;
import lombok.Data;
/**
* @author Administrator
* 设备报警信息
*/
@Data
public class ErrorRecordVo {
private String deviceCode;
private String deviceName;
private String errorInfo;
private String errorTime;
}

View File

@@ -8,6 +8,6 @@ import lombok.Data;
@Data
public class MixingVo {
private String materialName;
private String planWeight;
private String realWeight;
private String planQty;
private String realQty;
}

View File

@@ -15,7 +15,8 @@ public class PressProductHeaderVo {
private String qualifiedQty;
private String team;
public String getaTeam() {
public String getTeam() {
return "白班";
}
}

View File

@@ -13,6 +13,7 @@ public class ProductTaskVo {
private String workorderCode;
private String team;
private String materialName;
private String customer;
private String planproducestartDate;
private String planQty;
private String realQty;

View File

@@ -48,10 +48,10 @@ public class CockpitServiceImpl implements CockpitService {
CompletableFuture<List<PressProductHeaderVo>> listCompletableFuture = CompletableFuture.supplyAsync(
() -> cockPitMapper.getPressProductHeaderList(), pool);
listCompletableFuture.thenAccept(result -> {
map.put("DayShiftList", result);
map.put("DayShiftInfo", result);
}).exceptionally((e) -> {
log.error("获取当班信息: {}", e.getMessage(), e);
map.put("DayShiftList", null);
map.put("DayShiftInfo", null);
return null;
});
// 2、当班生产
@@ -248,8 +248,8 @@ public class CockpitServiceImpl implements CockpitService {
});
//设备报警信息
CompletableFuture<List<DasDeviceErrorRecord>> errorRecordCompletableFuture = CompletableFuture.supplyAsync(
() -> dasDeviceErrorRecordService.queryRecord(), pool);
CompletableFuture<List<ErrorRecordVo>> errorRecordCompletableFuture = CompletableFuture.supplyAsync(
() -> cockPitMapper.queryRecord(), pool);
errorRecordCompletableFuture.thenAccept(result -> {
resultMap.put("deviceErrorRecordList", result);
}).exceptionally((e) -> {
@@ -283,7 +283,7 @@ public class CockpitServiceImpl implements CockpitService {
CompletableFuture<JSONArray> stackingPositionTask = CompletableFuture.supplyAsync(() -> {
List<String> points = cockPitMapper.selectYzPoint();
if (points.isEmpty()) {
throw new RuntimeException("压制码垛位点位为空");
return null;
}
JSONArray param = new JSONArray(Collections.singletonList(points));
AcsResponse deviceStatus = wmsToAcsService.getDeviceStatus(param);
@@ -321,7 +321,7 @@ public class CockpitServiceImpl implements CockpitService {
CompletableFuture<JSONArray> pressMachineTask = CompletableFuture.supplyAsync(() -> {
List<String> yjPoints = cockPitMapper.selectYjPoint();
if (yjPoints.isEmpty()) {
throw new RuntimeException("压机点位为空");
return null;
}
JSONArray yjPointsParam = new JSONArray(Collections.singletonList(yjPoints));
AcsResponse yjStatus = wmsToAcsService.getDeviceStatus(yjPointsParam);
@@ -347,7 +347,7 @@ public class CockpitServiceImpl implements CockpitService {
CompletableFuture<JSONArray> mixMachineTask = CompletableFuture.supplyAsync(() -> {
List<String> hnjPoints = cockPitMapper.selectHnjPoints();
if (hnjPoints.isEmpty()) {
throw new RuntimeException("设备点位为空");
return null;
}
JSONArray hnjPointsParam = new JSONArray(Collections.singletonList(hnjPoints));
AcsResponse hnjStatus = wmsToAcsService.getDeviceStatus(hnjPointsParam);
@@ -393,7 +393,7 @@ public class CockpitServiceImpl implements CockpitService {
CompletableFuture<JSONArray> manipulatorInfoTask = CompletableFuture.supplyAsync(() -> {
List<String> jxsPoints = cockPitMapper.selectJxsPoints();
if (jxsPoints.isEmpty()) {
throw new RuntimeException("设备点位为空");
return null;
}
JSONArray jxsPointsParam = new JSONArray(Collections.singletonList(jxsPoints));
AcsResponse jxsStatus = wmsToAcsService.getDeviceStatus(jxsPointsParam);
@@ -416,6 +416,8 @@ public class CockpitServiceImpl implements CockpitService {
List<String> fjcmdPoints = new ArrayList<>();
fjcmdPoints.add("FJ01CDW01");
fjcmdPoints.add("FJ01CDW02");
fjcmdPoints.add("FJ01MDW01");
fjcmdPoints.add("FJ01MDW02");
JSONArray fjcmdPointsParam = new JSONArray(Collections.singletonList(fjcmdPoints));
AcsResponse fjcmdStatus = wmsToAcsService.getDeviceStatus(fjcmdPointsParam);
JSONArray fjcmdData = ObjectUtil.isNotEmpty(fjcmdStatus) ? fjcmdStatus.getData() : fjcmdPointsParam;
@@ -483,6 +485,12 @@ public class CockpitServiceImpl implements CockpitService {
@Override
public List<InOutKilnVo> selectInOutKilnDetail() {
// List<String> points = new ArrayList<>();
// points.add("RYHCX01");
// points.add("CYHCX01");
// JSONArray pointsParam = new JSONArray(Collections.singletonList(points));
// AcsResponse response = wmsToAcsService.getDeviceStatus(pointsParam);
// JSONArray data = ObjectUtil.isNotEmpty(response) ? response.getData() : pointsParam;
//todo 确定每托盘数量
List<InOutKilnVo> res = new ArrayList<>();
InOutKilnVo in = cockPitMapper.selectInKilnInfo();

View File

@@ -50,4 +50,5 @@ public interface CockPitMapper {
List<String> selectJxsPoints();
List<ErrorRecordVo> queryRecord();
}

View File

@@ -60,31 +60,29 @@
END AS workorderStatus,
w.operator,
IF(LENGTH(w.realproducestart_date) > 0, w.realproducestart_date, '-') AS realproducestartDate,
IF(LENGTH(w.realproduceend_date) > 0, w.realproduceend_date, '-') AS realproduceendDate
IF(LENGTH(w.realproduceend_date) > 0, w.realproduceend_date, '-') AS realproduceendDate,
c.cust_name as customer
FROM `pdm_bd_workorder` w
LEFT JOIN md_base_material m ON m.material_id = w.material_id
LEFT JOIN md_cs_customerbase c ON w.customer = c.cust_id
WHERE w.region_code = 'YZ'
ORDER BY w.team DESC, w.workorder_status
</select>
<select id="getSortingLine" resultType="org.nl.wms.cockpit.service.dao.SortingLineVo">
SELECT
w.workorder_code AS workorderCode,
w.point_name AS pointName,
w.plan_qty AS planQty,
w.real_qty AS realQty,
c.cust_name AS customer,
m.material_name AS materialName,
m.material_spec AS materialSpec
FROM
pdm_bd_workorder w
LEFT JOIN md_base_material m ON m.material_id = w.material_id
LEFT JOIN md_cs_customerbase c ON w.customer = c.cust_id
WHERE
w.region_code in ('FJ','RGFJ')
SELECT w.workorder_code AS workorderCode,
w.point_name AS pointName,
w.plan_qty AS planQty,
w.real_qty AS realQty,
c.cust_name AS customer,
m.material_name AS materialName,
m.material_spec AS materialSpec
FROM pdm_bd_workorder w
LEFT JOIN md_base_material m ON m.material_id = w.material_id
LEFT JOIN md_cs_customerbase c ON w.customer = c.cust_id
WHERE w.region_code in ('FJ', 'RGFJ')
AND w.workorder_status = '3'
ORDER BY
w.create_time
ORDER BY w.create_time
</select>
<select id="getUnstackingList" resultType="org.nl.wms.cockpit.service.dao.StackVo">
@@ -103,15 +101,18 @@
</select>
<select id="getLastWorkOrderList" resultType="org.nl.wms.cockpit.service.dao.WorkOrderVo">
SELECT w.workorder_code as workorderCode,
m.material_name as materialName,
m.material_spec as materialSpec,
w.plan_qty as planQty,
w.plan_weight as planWeight,
w.produce_order as produceOrder,
c.cust_name as customer,
w.vehicle_type as vehicleType,
w.create_time as createTime
SELECT w.workorder_code as workorderCode,
m.material_name as materialName,
m.material_spec as materialSpec,
w.plan_qty as planQty,
w.plan_weight as planWeight,
m.order_number as produceOrder,
c.cust_name as customer,
(SELECT label
FROM sys_dict s
WHERE CODE = 'vehicle_type'
AND s.`value` = w.vehicle_type) AS vehicleType,
w.create_time as createTime
FROM pdm_bd_workorder w
LEFT JOIN md_base_material m ON m.material_id = w.material_id
LEFT JOIN md_cs_customerbase c ON w.customer = c.cust_id
@@ -122,8 +123,8 @@
<select id="getMixingList" resultType="org.nl.wms.cockpit.service.dao.MixingVo">
SELECT m.material_name AS materialName,
SUM(w.plan_weight) AS planWeight,
SUM(w.real_weight) AS realWeight
SUM(w.plan_qty) AS planQty,
SUM(w.real_qty) 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'
@@ -146,14 +147,11 @@
</select>
<select id="getHistoryList" resultType="org.nl.wms.cockpit.service.dao.HistoryVo">
SELECT
DATE_FORMAT( produce_date, '%m-%d' ) AS produceDate,
SUM( CASE WHEN workorder_status = '5' THEN real_qty ELSE 0 END ) AS finishedNum,
SUM( qualified_qty ) AS suppressedNum
FROM
pdm_bd_workorder
WHERE
region_code = 'YZ'
SELECT DATE_FORMAT(produce_date, '%m-%d') AS produceDate,
SUM(CASE WHEN workorder_status = '5' THEN real_qty ELSE 0 END) AS finishedNum,
SUM(qualified_qty) AS suppressedNum
FROM pdm_bd_workorder
WHERE region_code = 'YZ'
AND produce_date >= CURDATE() - INTERVAL 7 DAY
GROUP BY
produceDate
@@ -198,7 +196,7 @@
</select>
<select id="selectKilnInfo" resultType="org.nl.wms.cockpit.service.dao.KilnVo">
select COUNT(IF(out_kiln_time IS NULL, 1, NULL)) as palletNum,
select COUNT(IF(out_kiln_time IS NULL, 1, NULL)) as palletNum,
count(IF(out_kiln_time IS NOT NULL, 1, NULL)) as produceNum
from sch_base_vehiclematerialgroup
where into_kiln_time IS NOT NULL
@@ -206,16 +204,13 @@
</select>
<select id="selectKilnMaterialInfo" resultType="org.nl.wms.cockpit.service.dao.KilnMaterialInfo">
SELECT
sum(vg.material_qty) as producedNum,
m.material_code as producedNum,
c.cust_name as customer
FROM
`sch_base_vehiclematerialgroup` vg
LEFT JOIN md_base_material m ON m.material_id = vg.material_id
LEFT JOIN md_cs_customerbase c ON vg.customer = c.cust_id
WHERE
vg.into_kiln_time IS NOT NULL
SELECT sum(vg.material_qty) as producedNum,
m.material_code as materialCode,
c.cust_name as customer
FROM `sch_base_vehiclematerialgroup` vg
LEFT JOIN md_base_material m ON m.material_id = vg.material_id
LEFT JOIN md_cs_customerbase c ON vg.customer = c.cust_id
WHERE vg.into_kiln_time IS NOT NULL
AND vg.out_kiln_time IS NULL
and DATE ( vg.create_time ) = CURDATE()
GROUP BY
@@ -256,10 +251,19 @@
p.point_name as pointName,
p.point_status as pointStatus
FROM `sch_base_point` p
WHERE p.region_code in( 'YZ','FJ')
WHERE p.region_code in ('YZ', 'FJ')
AND P.point_type = '1'
and LENGTH(point_code) <![CDATA[ > ]]> 4
ORDER BY p.point_code
</select>
<select id="queryRecord" resultType="org.nl.wms.cockpit.service.dao.ErrorRecordVo">
SELECT r.device_code as deviceCode,
r.error as errorInfo,
r.record_time as errorTime,
p.point_name as deviceName
FROM `das_device_error_record` r
LEFT JOIN sch_base_point p ON r.device_code = p.point_code
ORDER BY r.record_time desc limit 100
</select>
</mapper>

View File

@@ -4,6 +4,7 @@ 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.das.device.record.service.dao.DasDeviceErrorRecord;
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
@@ -29,5 +30,4 @@ public interface IDasDeviceErrorRecordService extends IService<DasDeviceErrorRec
List<DeviceErrorVo> queryErrorVo();
List<DasDeviceErrorRecord> queryRecord();
}

View File

@@ -51,11 +51,4 @@ public class IDasDeviceErrorRecordServiceImpl extends ServiceImpl<DasDeviceError
return dasDeviceCheckRecordMapper.queryErrorVo();
}
@Override
public List<DasDeviceErrorRecord> queryRecord() {
LambdaQueryWrapper<DasDeviceErrorRecord> lam = new LambdaQueryWrapper<>();
lam.orderByDesc(DasDeviceErrorRecord::getRecord_time);
lam.last("LIMIT 100");
return dasDeviceCheckRecordMapper.selectList(lam);
}
}

View File

@@ -15,7 +15,7 @@ spring:
# password: ${DB_PWD:123456}
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:ndhh_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root}
password: ${DB_PWD:12356}
password: ${DB_PWD:123456}
type: com.alibaba.druid.pool.DruidDataSource
redis:
#数据库索引