add:新增异常设备查询页面
This commit is contained in:
@@ -73,4 +73,13 @@ public class FaultDeviceController {
|
||||
faultDeviceService.syncInfo();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getAllerrorDevice")
|
||||
@Log("查询所有设备故障")
|
||||
|
||||
public ResponseEntity<Object> getAllerrorDevice(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(faultDeviceService.getAllerrorDevice(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -82,4 +82,13 @@ public interface FaultDeviceService {
|
||||
* 同步信息
|
||||
*/
|
||||
void syncInfo();
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> getAllerrorDevice(Map whereJson, Pageable page);
|
||||
}
|
||||
|
||||
@@ -326,29 +326,72 @@ public class FaultDeviceServiceImpl implements FaultDeviceService {
|
||||
}
|
||||
|
||||
public Map<String, Object> getAllerrorDevice(Map whereJson, Pageable page) {
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String region_code = MapUtil.getStr(whereJson, "region_code");
|
||||
|
||||
UserDeviceService userDeviceService = SpringContextHolder.getBean(UserDeviceService.class);
|
||||
|
||||
String inArea = userDeviceService.getInArea();
|
||||
|
||||
//查询当前人员对应的设备是多少
|
||||
JSONArray device_rows = WQLObject.getWQLObject("em_bi_monitordevice").query("region_code in " + inArea + "").getResultJSONArray(0);
|
||||
List<String> deviceList = new ArrayList<>();
|
||||
for (int i = 0; i < device_rows.size(); i++) {
|
||||
JSONObject row = device_rows.getJSONObject(i);
|
||||
deviceList.add(row.getString("device_code"));
|
||||
String query_sql = "region_code in " + inArea + "";
|
||||
if (StrUtil.isNotEmpty(region_code)) {
|
||||
query_sql += " and region_code='" + region_code + "'";
|
||||
}
|
||||
|
||||
// 调用acs接口获取设备
|
||||
JSONObject result = SpringContextHolder.getBean(WmsToAcsServiceImpl.class).getDeviceErrorInfo(deviceList);
|
||||
JSONArray data = result.getJSONArray("data");
|
||||
WmsToAcsServiceImpl bean = SpringContextHolder.getBean(WmsToAcsServiceImpl.class);
|
||||
|
||||
|
||||
//查询当前人员对应的设备是多少
|
||||
JSONArray b1_rows = WQLObject.getWQLObject("em_bi_monitordevice").query(query_sql + "AND product_area = 'B1'").getResultJSONArray(0);
|
||||
List<String> b1List = new ArrayList<>();
|
||||
for (int i = 0; i < b1_rows.size(); i++) {
|
||||
JSONObject row = b1_rows.getJSONObject(i);
|
||||
b1List.add(row.getString("device_code"));
|
||||
}
|
||||
|
||||
JSONObject result = bean.getDeviceErrorInfo(b1List,"B1");
|
||||
// 调用acs接口获取设备
|
||||
JSONArray b1_data = result.getJSONArray("data");
|
||||
|
||||
JSONArray blk_rows = WQLObject.getWQLObject("em_bi_monitordevice").query(query_sql + "AND product_area = 'BLK'").getResultJSONArray(0);
|
||||
List<String> blkList = new ArrayList<>();
|
||||
for (int i = 0; i < blk_rows.size(); i++) {
|
||||
JSONObject row = blk_rows.getJSONObject(i);
|
||||
blkList.add(row.getString("device_code"));
|
||||
}
|
||||
|
||||
JSONObject result2 = bean.getDeviceErrorInfo(blkList,"BLK");
|
||||
// 调用acs接口获取设备
|
||||
JSONArray blk_data = result2.getJSONArray("data");
|
||||
|
||||
JSONArray data = new JSONArray();
|
||||
if (ObjectUtil.isNotEmpty(b1_data)) {
|
||||
for (int i = 0; i < b1_rows.size(); i++) {
|
||||
JSONObject row = b1_rows.getJSONObject(i);
|
||||
for (int j = 0; j < b1_data.size(); j++) {
|
||||
JSONObject b1 = b1_data.getJSONObject(j);
|
||||
if (b1.getString("device_code").equals(row.getString("device_code"))) {
|
||||
b1.put("region_code", row.getString("region_code"));
|
||||
}
|
||||
data.add(b1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(blk_data)) {
|
||||
for (int i = 0; i < blk_rows.size(); i++) {
|
||||
JSONObject row = blk_rows.getJSONObject(i);
|
||||
for (int j = 0; j < blk_data.size(); j++) {
|
||||
JSONObject blk = blk_data.getJSONObject(j);
|
||||
if (blk.getString("device_code").equals(row.getString("device_code"))) {
|
||||
blk.put("region_code", row.getString("region_code"));
|
||||
}
|
||||
data.add(blk);
|
||||
}
|
||||
}
|
||||
}
|
||||
//查询内包间套轴对接位的异常
|
||||
if (inArea.contains("NBJ")) {
|
||||
IBstIvtCutpointivtService bean = SpringContextHolder.getBean(IBstIvtCutpointivtService.class);
|
||||
List<BstIvtCutpointivt> list = bean.list(new LambdaQueryWrapper<BstIvtCutpointivt>()
|
||||
IBstIvtCutpointivtService bean2 = SpringContextHolder.getBean(IBstIvtCutpointivtService.class);
|
||||
List<BstIvtCutpointivt> list = bean2.list(new LambdaQueryWrapper<BstIvtCutpointivt>()
|
||||
.eq(BstIvtCutpointivt::getPoint_type, "1")
|
||||
.eq(BstIvtCutpointivt::getIs_used, "1")
|
||||
.ne(BstIvtCutpointivt::getRemark, "")
|
||||
@@ -358,6 +401,7 @@ public class FaultDeviceServiceImpl implements FaultDeviceService {
|
||||
JSONObject row = new JSONObject();
|
||||
row.put("device_code", a.getPoint_code());
|
||||
row.put("device_name", a.getPoint_code());
|
||||
row.put("region_code", "NBJ");
|
||||
row.put("error_code", "");
|
||||
row.put("error_message", a.getRemark());
|
||||
data.add(row);
|
||||
|
||||
@@ -155,5 +155,5 @@ public interface WmsToAcsService {
|
||||
*/
|
||||
JSONObject queryBoxWeigh(JSONObject jo);
|
||||
|
||||
JSONObject getDeviceErrorInfo(List<String> list);
|
||||
JSONObject getDeviceErrorInfo(List<String> list,String product_area);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.ext.acs.service.impl;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -520,7 +521,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceErrorInfo(List<String> list) {
|
||||
public JSONObject getDeviceErrorInfo(List<String> list,String product_area) {
|
||||
String api = "api/wms/getDeviceErrorInfo";
|
||||
//判断是否连接ACS系统
|
||||
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_connect_acs").getValue();
|
||||
@@ -532,8 +533,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
String product_area = "LK";
|
||||
|
||||
String acs_url = URLEnum.find(product_area);
|
||||
if (StrUtil.isEmpty(acs_url)) {
|
||||
log.info(product_area);
|
||||
@@ -543,7 +542,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String url = acs_url + api;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(list))
|
||||
.body(JSON.toJSONString(list))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
|
||||
|
||||
113
lms/nladmin-ui/src/views/wms/agvrush/deviceerror/index.vue
Normal file
113
lms/nladmin-ui/src/views/wms/agvrush/deviceerror/index.vue
Normal file
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="设备区域">
|
||||
<el-select
|
||||
v-model="query.region_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请选择"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.DEVICE_REGION_TYPE"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="mini"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="device_code" label="设备编码" show-overflow-tooltip />
|
||||
<el-table-column prop="device_name" label="设备名称 " show-overflow-tooltip />
|
||||
<el-table-column prop="region_code" label="所属区域 " show-overflow-tooltip />
|
||||
<el-table-column prop="error_code" label="异常编码 " show-overflow-tooltip />
|
||||
<el-table-column prop="error_message" label="故障信息" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<!-- <pagination />-->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudFaultdevice from '@/views/wms/basedata/master/faultdevice/faultdevice'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
const defaultForm = {
|
||||
}
|
||||
export default {
|
||||
name: 'Deviceerror',
|
||||
dicts: ['DEVICE_ERROR_TYPE', 'IS_OR_NOT', 'DEVICE_REGION_TYPE', 'product_area'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '设备故障监控',
|
||||
url: 'api/faultdevice/getAllerrorDevice',
|
||||
optShow: {
|
||||
add: false,
|
||||
reset: true
|
||||
},
|
||||
idField: 'device_code',
|
||||
sort: 'device_code,desc',
|
||||
crudMethod: { ...crudFaultdevice }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {},
|
||||
tableData: [],
|
||||
rules: {
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
formatType1(row) {
|
||||
return this.dict.label.product_area[row.plant_code]
|
||||
},
|
||||
formatType2(row) {
|
||||
return this.dict.label.DEVICE_REGION_TYPE[row.region_code]
|
||||
},
|
||||
formatType3(row) {
|
||||
return this.dict.label.DEVICE_ERROR_TYPE[row.fault_type]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user