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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery; import org.nl.common.domain.query.PageQuery;
import org.nl.wms.cockpit.service.dao.DeviceErrorVo; 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.check.service.dao.DasDeviceCheckRecord;
import org.nl.wms.das.device.record.service.dao.DasDeviceErrorRecord; import org.nl.wms.das.device.record.service.dao.DasDeviceErrorRecord;
import org.nl.wms.pda.service.dao.vo.PdaResponseVo; import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
@@ -29,5 +30,4 @@ public interface IDasDeviceErrorRecordService extends IService<DasDeviceErrorRec
List<DeviceErrorVo> queryErrorVo(); List<DeviceErrorVo> queryErrorVo();
List<DasDeviceErrorRecord> queryRecord();
} }

View File

@@ -51,11 +51,4 @@ public class IDasDeviceErrorRecordServiceImpl extends ServiceImpl<DasDeviceError
return dasDeviceCheckRecordMapper.queryErrorVo(); 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} # 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 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} username: ${DB_USER:root}
password: ${DB_PWD:12356} password: ${DB_PWD:123456}
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
redis: redis:
#数据库索引 #数据库索引