opt:设备故障功能wql改成mybatis plus
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
package org.nl.wms.basedata.master.rest;
|
||||
package org.nl.wms.basedata.master.faultdevice.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.basedata.master.service.FaultDeviceService;
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.FaultDeviceService;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dao.FaultDevice;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dto.FaultQuery;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -31,43 +33,26 @@ public class FaultDeviceController {
|
||||
@GetMapping
|
||||
@Log("查询设备故障处理表")
|
||||
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(faultDeviceService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
public ResponseEntity<Object> query(FaultQuery whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(faultDeviceService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/deviceCharge")
|
||||
@Log("查询说有设备故障")
|
||||
|
||||
public ResponseEntity<Object> queryDeviceAll(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(faultDeviceService.queryDeviceAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增设备故障处理表")
|
||||
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody CustomerbaseDto dto) {
|
||||
faultDeviceService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改设备故障处理表")
|
||||
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
|
||||
public ResponseEntity<Object> update(@RequestBody FaultDevice whereJson) {
|
||||
faultDeviceService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除设备故障处理表")
|
||||
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
faultDeviceService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("同步信息")
|
||||
|
||||
@PostMapping("/syncInfo")
|
||||
public ResponseEntity<Object> syncInfo() {
|
||||
faultDeviceService.syncInfo();
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.nl.wms.basedata.master.faultdevice.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.basedata.master.faultdevice.service.dao.FaultDevice;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dto.FaultQuery;
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description 服务接口
|
||||
* @date 2023-04-20
|
||||
**/
|
||||
public interface FaultDeviceService extends IService<FaultDevice> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
IPage<FaultDevice> queryAll(FaultQuery whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryDeviceAll(Map whereJson, Pageable page);
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void update(FaultDevice whereJson);
|
||||
|
||||
/**
|
||||
* 同步信息
|
||||
*/
|
||||
void syncInfo();
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.nl.wms.basedata.master.faultdevice.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-27
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("em_bi_faultdisposedevice")
|
||||
public class FaultDevice implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "fault_id", type = IdType.NONE)
|
||||
private String fault_id;
|
||||
|
||||
private String fault_code;
|
||||
|
||||
private String fault_info;
|
||||
|
||||
private String fault_type;
|
||||
|
||||
private String solve_mode;
|
||||
|
||||
private String create_id;
|
||||
|
||||
private String create_name;
|
||||
|
||||
private String create_time;
|
||||
|
||||
private String update_id;
|
||||
|
||||
private String update_name;
|
||||
|
||||
private String update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package org.nl.wms.basedata.master.faultdevice.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-29
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("em_bi_monitordevice")
|
||||
public class MonitorDevice implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "device_id", type = IdType.NONE)
|
||||
private String device_id;
|
||||
|
||||
private String device_code;
|
||||
|
||||
private String device_name;
|
||||
|
||||
private String product_area;
|
||||
|
||||
private String region_code;
|
||||
|
||||
private String parent_node;
|
||||
|
||||
private String fault_type;
|
||||
|
||||
private String is_crux;
|
||||
|
||||
private String create_id;
|
||||
|
||||
private String create_name;
|
||||
|
||||
private String create_time;
|
||||
|
||||
private String update_id;
|
||||
|
||||
private String update_name;
|
||||
|
||||
private String update_time;
|
||||
|
||||
private String send_szls;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.nl.wms.basedata.master.faultdevice.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dao.FaultDevice;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-27
|
||||
* @description:
|
||||
*/
|
||||
public interface FaultDeviceMapper extends BaseMapper<FaultDevice> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.basedata.master.faultdevice.service.dao.mapper.FaultDeviceMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.nl.wms.basedata.master.faultdevice.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dao.MonitorDevice;
|
||||
|
||||
public interface MonitorDeviceMapper extends BaseMapper<MonitorDevice> {
|
||||
|
||||
String getDeviceStrs();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.basedata.master.faultdevice.service.dao.mapper.MonitorDeviceMapper">
|
||||
|
||||
<select id="getDeviceStrs" resultType="java.lang.String">
|
||||
SELECT
|
||||
GROUP_CONCAT(device_code) AS str
|
||||
FROM
|
||||
EM_BI_MonitorDevice
|
||||
WHERE
|
||||
is_crux = '1'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.nl.wms.basedata.master.faultdevice.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-27
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class FaultQuery implements Serializable {
|
||||
//托盘号
|
||||
private String fault_code;
|
||||
//物料条码号
|
||||
private String fault_type;
|
||||
//物料名称
|
||||
private String device_code;
|
||||
//供应商编码
|
||||
private String is_fault;
|
||||
//供应商编码
|
||||
private String region_code;
|
||||
//供应商名称
|
||||
private String plant_code;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.nl.wms.basedata.master.faultdevice.service.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-29
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class MonitorDeviceDto implements Serializable {
|
||||
|
||||
private String device_id;
|
||||
|
||||
private String device_code;
|
||||
|
||||
private String device_name;
|
||||
|
||||
private String product_area;
|
||||
|
||||
private String region_code;
|
||||
|
||||
private String parent_node;
|
||||
|
||||
private String fault_type;
|
||||
|
||||
private String is_crux;
|
||||
|
||||
private String create_id;
|
||||
|
||||
private String create_name;
|
||||
|
||||
private String create_time;
|
||||
|
||||
private String update_id;
|
||||
|
||||
private String update_name;
|
||||
|
||||
private String update_time;
|
||||
|
||||
private String send_szls;
|
||||
|
||||
private String fault_code;
|
||||
|
||||
private String fault_info;
|
||||
|
||||
private String solve_mode;
|
||||
|
||||
private String is_fault;
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
package org.nl.wms.basedata.master.faultdevice.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.FaultDeviceService;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dao.FaultDevice;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dao.MonitorDevice;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dao.mapper.FaultDeviceMapper;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dao.mapper.MonitorDeviceMapper;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dto.FaultQuery;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dto.MonitorDeviceDto;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description 服务实现
|
||||
* @date 2023-04-20
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class FaultDeviceServiceImpl extends ServiceImpl<FaultDeviceMapper, FaultDevice> implements FaultDeviceService {
|
||||
|
||||
@Autowired
|
||||
private FaultDeviceMapper faultDeviceMapper;
|
||||
@Autowired
|
||||
private MonitorDeviceMapper monitorDeviceMapper;
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
public IPage<FaultDevice> queryAll(FaultQuery whereJson, PageQuery page) {
|
||||
|
||||
IPage<FaultDevice> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
LambdaQueryWrapper<FaultDevice> lam = new LambdaQueryWrapper<FaultDevice>();
|
||||
lam.eq(ObjectUtil.isNotEmpty(whereJson.getFault_code()), FaultDevice::getFault_code, whereJson.getFault_code())
|
||||
.eq(ObjectUtil.isNotEmpty(whereJson.getFault_type()), FaultDevice::getFault_type, whereJson.getFault_type())
|
||||
.orderByAsc(FaultDevice::getCreate_time);
|
||||
faultDeviceMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDeviceAll(Map whereJson, Pageable page) {
|
||||
|
||||
String query_device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String query_is_fault = MapUtil.getStr(whereJson, "is_fault");
|
||||
String query_region_code = MapUtil.getStr(whereJson, "region_code");
|
||||
String query_product_area = MapUtil.getStr(whereJson, "plant_code");
|
||||
if (StrUtil.isEmpty(query_product_area)) {
|
||||
throw new BadRequestException("输入的区域不能为空!");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(query_device_code)) {
|
||||
LambdaQueryWrapper<MonitorDevice> lam = new LambdaQueryWrapper<MonitorDevice>();
|
||||
lam.eq(MonitorDevice::getDevice_code,query_device_code);
|
||||
List<MonitorDevice> monitorDeviceList = monitorDeviceMapper.selectList(lam);
|
||||
if(monitorDeviceList.size()>0){
|
||||
param.put("device_code", query_device_code);
|
||||
param.put("product_area", monitorDeviceList.get(0).getProduct_area());
|
||||
}
|
||||
} else {
|
||||
// 为空则只需要查询专机设备
|
||||
String str = monitorDeviceMapper.getDeviceStrs();
|
||||
param.put("device_code", str);
|
||||
param.put("product_area", query_product_area);
|
||||
}
|
||||
// LMS查看ACS实时报警信息
|
||||
JSONObject result = wmsToAcsService.realTimefaultInfo(param);
|
||||
JSONArray data = result.getJSONArray("data");
|
||||
|
||||
// 查看AVG车辆信息
|
||||
JSONObject result2 = wmsToAcsService.queryDeviceInfo(param);
|
||||
JSONArray rows = result2.getJSONArray("data");
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jsonObject = rows.getJSONObject(i);
|
||||
double electricity = jsonObject.getDoubleValue("electricity");
|
||||
if (electricity <= 30) {
|
||||
// 新增一条agv报警信息
|
||||
JSONObject json = new JSONObject();
|
||||
String car_no = jsonObject.getString("car_no");
|
||||
if (StrUtil.equals(car_no, "1")) {
|
||||
json.put("device_name", "一楼1号AGV");
|
||||
} else if (StrUtil.equals(car_no, "2")) {
|
||||
json.put("device_name", "二楼1号AGV");
|
||||
} else if (StrUtil.equals(car_no, "3")) {
|
||||
json.put("device_name", "二楼2号AGV");
|
||||
}
|
||||
json.put("device_code", jsonObject.getString("car_no"));
|
||||
json.put("fault_code", "99");
|
||||
json.put("fault_info", "电量不足");
|
||||
json.put("fault_type", "agv_error_type");
|
||||
data.add(json);
|
||||
}
|
||||
}
|
||||
// 根据入参处理对应数据
|
||||
JSONArray objects = new JSONArray();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject json = data.getJSONObject(i);
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "2");
|
||||
map.put("region_code", query_region_code);
|
||||
map.put("product_area", query_product_area);
|
||||
map.put("device_code", json.getString("device_code"));
|
||||
|
||||
LambdaQueryWrapper<MonitorDevice> queryWrapper = new LambdaQueryWrapper<MonitorDevice>();
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(json.getString("device_code")),MonitorDevice::getDevice_code,json.getString("device_code"));
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(query_product_area),MonitorDevice::getProduct_area,query_product_area);
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(query_region_code),MonitorDevice::getRegion_code,query_region_code);
|
||||
List<MonitorDevice> monitorDeviceList = monitorDeviceMapper.selectList(queryWrapper);
|
||||
|
||||
if (ObjectUtil.isEmpty(monitorDeviceList)) {
|
||||
continue;
|
||||
}
|
||||
MonitorDevice jsonDeviceOld = monitorDeviceList.get(0);
|
||||
|
||||
MonitorDeviceDto jsonDevice = new MonitorDeviceDto();
|
||||
|
||||
BeanUtils.copyProperties(jsonDeviceOld, jsonDevice);
|
||||
// 单独处理agv报警
|
||||
if (StrUtil.equals(json.getString("fault_type"), "agv_error_type")) {
|
||||
String[] fault_codes = json.getString("fault_code").split(",");
|
||||
if (fault_codes.length > 1) {
|
||||
// 根据每个报警码找找对应解决信息
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int j = 0; j < fault_codes.length; j++) {
|
||||
// 获取报警码
|
||||
LambdaQueryWrapper<FaultDevice> lam = new LambdaQueryWrapper<FaultDevice>();
|
||||
lam.eq(FaultDevice::getFault_code,fault_codes[j]);
|
||||
lam.eq(FaultDevice::getFault_type,json.getString("fault_type"));
|
||||
FaultDevice jsonFault = faultDeviceMapper.selectOne(lam);
|
||||
|
||||
stringBuilder.append(jsonFault.getSolve_mode());
|
||||
if (fault_codes.length - 1 > j) {
|
||||
stringBuilder.append(",");
|
||||
}
|
||||
}
|
||||
jsonDevice.setFault_code("1");
|
||||
jsonDevice.setFault_info(json.getString("fault_info"));
|
||||
jsonDevice.setFault_type(json.getString("fault_type"));
|
||||
jsonDevice.setSolve_mode(stringBuilder.toString());
|
||||
}
|
||||
}
|
||||
// 获取报警码
|
||||
LambdaQueryWrapper<FaultDevice> lam = new LambdaQueryWrapper<FaultDevice>();
|
||||
lam.eq(FaultDevice::getFault_code,json.getString("fault_code"));
|
||||
lam.eq(FaultDevice::getFault_type,json.getString("fault_type"));
|
||||
FaultDevice jsonFault = faultDeviceMapper.selectOne(lam);
|
||||
if (ObjectUtil.isNotEmpty(jsonFault)) {
|
||||
jsonDevice.setFault_code(jsonFault.getFault_code());
|
||||
jsonDevice.setFault_info(jsonFault.getFault_info());
|
||||
jsonDevice.setFault_type(jsonFault.getFault_type());
|
||||
jsonDevice.setSolve_mode(jsonFault.getSolve_mode());
|
||||
}
|
||||
// 判断是否异常
|
||||
if (!StrUtil.equals(json.getString("fault_code"), "0")) {
|
||||
jsonDevice.setIs_fault("1");
|
||||
} else {
|
||||
jsonDevice.setIs_fault("0");
|
||||
}
|
||||
//根据查询条件,筛选设备数据
|
||||
if (StrUtil.equals(query_is_fault, "1")) {
|
||||
if (!StrUtil.equals(json.getString("fault_code"), "0")) {
|
||||
objects.add(jsonDevice);
|
||||
}
|
||||
} else if (StrUtil.equals(query_is_fault, "0")) {
|
||||
if (StrUtil.equals(json.getString("fault_code"), "0")) {
|
||||
objects.add(jsonDevice);
|
||||
}
|
||||
} else {
|
||||
objects.add(jsonDevice);
|
||||
}
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("content", objects);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(FaultDevice whereJson) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
whereJson.setUpdate_time(DateUtil.now());
|
||||
whereJson.setUpdate_id(currentUserId);
|
||||
whereJson.setUpdate_name(nickName);
|
||||
faultDeviceMapper.updateById(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void syncInfo() {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
// 调用acs接口获取信息
|
||||
JSONObject json = wmsToAcsService.syncfaultInfo();
|
||||
JSONArray data = json.getJSONArray("data");
|
||||
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject jsonDtl = data.getJSONObject(i);
|
||||
LambdaQueryWrapper<FaultDevice> lam = new LambdaQueryWrapper<FaultDevice>();
|
||||
lam.eq(FaultDevice::getFault_code,jsonDtl.getString("fault_code"));
|
||||
lam.eq(FaultDevice::getFault_type,jsonDtl.getString("fault_type"));
|
||||
FaultDevice faultDevice = faultDeviceMapper.selectOne(lam);
|
||||
if (ObjectUtil.isNotEmpty(faultDevice)) {
|
||||
faultDevice.setFault_info(jsonDtl.getString("fault_info"));
|
||||
faultDevice.setUpdate_name(nickName);
|
||||
faultDevice.setUpdate_id(currentUserId);
|
||||
faultDevice.setUpdate_time(DateUtil.now());
|
||||
faultDeviceMapper.updateById(faultDevice);
|
||||
} else {
|
||||
jsonDtl.put("fault_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonDtl.put("create_id", currentUserId);
|
||||
jsonDtl.put("create_name", nickName);
|
||||
jsonDtl.put("create_time", DateUtil.now());
|
||||
jsonDtl.put("update_id", currentUserId);
|
||||
jsonDtl.put("update_name", nickName);
|
||||
jsonDtl.put("update_time", DateUtil.now());
|
||||
BeanUtils.copyProperties(jsonDtl, faultDevice);
|
||||
faultDeviceMapper.insert(faultDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package org.nl.wms.basedata.master.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description 服务接口
|
||||
* @date 2023-04-20
|
||||
**/
|
||||
public interface FaultDeviceService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryDeviceAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<CustomerbaseDto>
|
||||
*/
|
||||
List<CustomerbaseDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param cust_id ID
|
||||
* @return Customerbase
|
||||
*/
|
||||
CustomerbaseDto findById(Long cust_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Customerbase
|
||||
*/
|
||||
CustomerbaseDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(CustomerbaseDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void update(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 同步信息
|
||||
*/
|
||||
void syncInfo();
|
||||
}
|
||||
@@ -1,318 +0,0 @@
|
||||
package org.nl.wms.basedata.master.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.service.FaultDeviceService;
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description 服务实现
|
||||
* @date 2023-04-20
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class FaultDeviceServiceImpl implements FaultDeviceService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String fault_code = MapUtil.getStr(whereJson, "fault_code");
|
||||
String fault_type = MapUtil.getStr(whereJson, "fault_type");
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
map.put("fault_code", fault_code);
|
||||
map.put("fault_type", fault_type);
|
||||
|
||||
JSONObject json = WQL.getWO("QMD_BI_FAULT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time DESC");
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDeviceAll(Map whereJson, Pageable page) {
|
||||
WQLObject faultTab = WQLObject.getWQLObject("EM_BI_FaultDisposeDevice");
|
||||
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String is_fault = MapUtil.getStr(whereJson, "is_fault");
|
||||
String region_code = MapUtil.getStr(whereJson, "region_code");
|
||||
String product_area = MapUtil.getStr(whereJson, "plant_code");
|
||||
if (StrUtil.isEmpty(product_area)) {
|
||||
throw new BadRequestException("输入的区域不能为空!");
|
||||
}
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(device_code)) {
|
||||
JSONObject device_jo = WQLObject.getWQLObject("EM_BI_MonitorDevice").query("device_code = '" + device_code + "'").uniqueResult(0);
|
||||
param.put("device_code", device_code);
|
||||
param.put("product_area", device_jo.getString("product_area"));
|
||||
} else {
|
||||
// 不为空则只需要查询专机设备
|
||||
JSONObject jsonStr = WQL.getWO("QMD_BI_FAULT").addParam("flag", "3").process().uniqueResult(0);
|
||||
String str = jsonStr.getString("str");
|
||||
param.put("device_code", str);
|
||||
param.put("product_area", product_area);
|
||||
}
|
||||
|
||||
// 调用acs接口获取设备
|
||||
JSONObject result = SpringContextHolder.getBean(WmsToAcsServiceImpl.class).realTimefaultInfo(param);
|
||||
JSONArray data = result.getJSONArray("data");
|
||||
|
||||
JSONObject result2 = SpringContextHolder.getBean(WmsToAcsServiceImpl.class).queryDeviceInfo(param);
|
||||
JSONArray rows = result2.getJSONArray("data");
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jsonObject = rows.getJSONObject(i);
|
||||
double electricity = jsonObject.getDoubleValue("electricity");
|
||||
|
||||
if (electricity <= 30) {
|
||||
// 新增一条agv报警信息
|
||||
JSONObject json = new JSONObject();
|
||||
String car_no = jsonObject.getString("car_no");
|
||||
|
||||
if (StrUtil.equals(car_no, "1")) {
|
||||
json.put("device_name", "一楼1号AGV");
|
||||
} else if (StrUtil.equals(car_no, "2")) {
|
||||
json.put("device_name", "二楼1号AGV");
|
||||
} else if (StrUtil.equals(car_no, "3")) {
|
||||
json.put("device_name", "二楼2号AGV");
|
||||
}
|
||||
json.put("device_code", jsonObject.getString("car_no"));
|
||||
json.put("fault_code", "99");
|
||||
json.put("fault_info", "电量不足");
|
||||
json.put("fault_type", "agv_error_type");
|
||||
data.add(json);
|
||||
}
|
||||
}
|
||||
|
||||
// 根据入参处理对应数据
|
||||
JSONArray objects = new JSONArray();
|
||||
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject json = data.getJSONObject(i);
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "2");
|
||||
map.put("region_code", region_code);
|
||||
map.put("product_area", product_area);
|
||||
map.put("device_code", json.getString("device_code"));
|
||||
|
||||
JSONObject jsonDevice = WQL.getWO("QMD_BI_FAULT").addParamMap(map).process().uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonDevice)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 单独处理agv报警
|
||||
if (StrUtil.equals(json.getString("fault_type"), "agv_error_type")) {
|
||||
|
||||
String[] fault_codes = json.getString("fault_code").split(",");
|
||||
|
||||
if (fault_codes.length > 1) {
|
||||
// 根据每个报警码找找对应解决信息
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
for (int j = 0; j < fault_codes.length; j++) {
|
||||
JSONObject jsonFault = faultTab.query("fault_type = '" + json.getString("fault_type") + "' and fault_code = '" + fault_codes[j] + "'").uniqueResult(0);
|
||||
|
||||
stringBuilder.append(jsonFault.getString("solve_mode"));
|
||||
|
||||
if (fault_codes.length - 1 > j) {
|
||||
stringBuilder.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
jsonDevice.put("fault_code", "1");
|
||||
jsonDevice.put("fault_info", json.getString("fault_info"));
|
||||
jsonDevice.put("fault_type", json.getString("fault_type"));
|
||||
jsonDevice.put("solve_mode", stringBuilder);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 获取报警码
|
||||
JSONObject jsonFault = faultTab.query("fault_type = '" + json.getString("fault_type") + "' and fault_code = '" + json.getString("fault_code") + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonFault)) {
|
||||
jsonDevice.put("fault_code", jsonFault.getString("fault_code"));
|
||||
jsonDevice.put("fault_info", jsonFault.getString("fault_info"));
|
||||
jsonDevice.put("fault_type", jsonFault.getString("fault_type"));
|
||||
jsonDevice.put("solve_mode", jsonFault.getString("solve_mode"));
|
||||
}
|
||||
|
||||
// 判断是否异常
|
||||
if (!StrUtil.equals(json.getString("fault_code"), "0")) {
|
||||
jsonDevice.put("is_fault", "1");
|
||||
} else {
|
||||
jsonDevice.put("is_fault", "0");
|
||||
}
|
||||
|
||||
if (StrUtil.equals(is_fault, "1")) {
|
||||
if (!StrUtil.equals(json.getString("fault_code"), "0")) {
|
||||
objects.add(jsonDevice);
|
||||
}
|
||||
} else if (StrUtil.equals(is_fault, "0")) {
|
||||
if (StrUtil.equals(json.getString("fault_code"), "0")) {
|
||||
objects.add(jsonDevice);
|
||||
}
|
||||
} else {
|
||||
objects.add(jsonDevice);
|
||||
}
|
||||
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("content", objects);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomerbaseDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<CustomerbaseDto> list = arr.toJavaList(CustomerbaseDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomerbaseDto findById(Long cust_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
JSONObject json = wo.query("cust_id =" + cust_id + "").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) {
|
||||
return null;
|
||||
}
|
||||
final CustomerbaseDto obj = json.toJavaObject(CustomerbaseDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomerbaseDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
JSONObject json = wo.query("cust_code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)) {
|
||||
return null;
|
||||
}
|
||||
final CustomerbaseDto obj = json.toJavaObject(CustomerbaseDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(CustomerbaseDto dto) {
|
||||
String cust_code = dto.getCust_code();
|
||||
CustomerbaseDto customerbaseDto = this.findByCode(cust_code);
|
||||
if (customerbaseDto != null && "0".equals(customerbaseDto.getIs_delete())) {
|
||||
throw new BadRequestException("存在相同的客户编号");
|
||||
}
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setCust_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(JSONObject whereJson) {
|
||||
WQLObject faultTab = WQLObject.getWQLObject("EM_BI_FaultDisposeDevice");
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
whereJson.put("update_id", currentUserId);
|
||||
whereJson.put("update_name", nickName);
|
||||
whereJson.put("update_time", DateUtil.now());
|
||||
faultTab.update(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
for (Long cust_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("cust_id", String.valueOf(cust_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void syncInfo() {
|
||||
WQLObject faultTab = WQLObject.getWQLObject("EM_BI_FaultDisposeDevice");
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
// 调用acs接口获取信息
|
||||
JSONObject json = SpringContextHolder.getBean(WmsToAcsServiceImpl.class).syncfaultInfo();
|
||||
|
||||
JSONArray data = json.getJSONArray("data");
|
||||
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject jsonDtl = data.getJSONObject(i);
|
||||
|
||||
JSONObject jsonFault = faultTab.query("fault_code = '" + jsonDtl.getString("fault_code") + "' and fault_type = '" + jsonDtl.getString("fault_type") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonFault)) {
|
||||
jsonFault.put("fault_info", jsonDtl.getString("fault_info"));
|
||||
jsonFault.put("create_id", currentUserId);
|
||||
jsonFault.put("create_name", nickName);
|
||||
jsonFault.put("create_time", DateUtil.now());
|
||||
jsonFault.put("update_id", currentUserId);
|
||||
jsonFault.put("update_name", nickName);
|
||||
jsonFault.put("update_time", DateUtil.now());
|
||||
faultTab.update(jsonFault);
|
||||
} else {
|
||||
jsonDtl.put("fault_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonDtl.put("create_id", currentUserId);
|
||||
jsonDtl.put("create_name", nickName);
|
||||
jsonDtl.put("create_time", DateUtil.now());
|
||||
jsonDtl.put("update_id", currentUserId);
|
||||
jsonDtl.put("update_name", nickName);
|
||||
jsonDtl.put("update_time", DateUtil.now());
|
||||
faultTab.insert(jsonDtl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 故障分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.fault_code TYPEAS s_string
|
||||
输入.fault_type TYPEAS s_string
|
||||
输入.region_code TYPEAS s_string
|
||||
输入.product_area TYPEAS s_string
|
||||
输入.device_code TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
EM_BI_FaultDisposeDevice
|
||||
WHERE
|
||||
1 = 1
|
||||
|
||||
OPTION 输入.fault_code <> ""
|
||||
fault_code = 输入.fault_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.fault_type <> ""
|
||||
fault_type = 输入.fault_type
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
EM_BI_MonitorDevice
|
||||
WHERE
|
||||
is_crux = '1'
|
||||
|
||||
OPTION 输入.region_code <> ""
|
||||
region_code = 输入.region_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.product_area <> ""
|
||||
product_area = 输入.product_area
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
device_code = 输入.device_code
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
GROUP_CONCAT(device_code) AS str
|
||||
FROM
|
||||
EM_BI_MonitorDevice
|
||||
WHERE
|
||||
is_crux = '1'
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public interface WmsToAcsService {
|
||||
JSONObject unLock(JSONObject jo);
|
||||
|
||||
/**
|
||||
* lms向acs请求设备信息
|
||||
* 查看AVG车辆信息
|
||||
*
|
||||
* @param jo /
|
||||
* @return JSONObject
|
||||
@@ -123,7 +123,7 @@ public interface WmsToAcsService {
|
||||
JSONObject syncfaultInfo();
|
||||
|
||||
/**
|
||||
* LMS查看ACS实时报警信息
|
||||
* LMS查看ACS实时报警信息:ACS查询所有设备报警信息返回
|
||||
*
|
||||
* @param jo /
|
||||
* @return JSONObject
|
||||
|
||||
@@ -23,14 +23,12 @@ public class LmsToMesController {
|
||||
|
||||
@PostMapping("/momRollFoilWeighing")
|
||||
@Log("LMS的PDA操作AGV下卷,AGV称重完成后AGV称重信息发送MES")
|
||||
|
||||
public ResponseEntity<Object> momRollFoilWeighing(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.momRollFoilWeighing(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/momRollBakeInBound")
|
||||
@Log("智能桁架将母卷调进烘箱完成,智能物流发送MES")
|
||||
|
||||
public ResponseEntity<Object> momRollBakeInBound(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.momRollBakeInBound(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -90,40 +90,34 @@
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="device_code" label="设备编码" show-overflow-tooltip width="150px" />
|
||||
<el-table-column prop="device_name" label="设备名称 " show-overflow-tooltip width="300px" />
|
||||
<el-table-column prop="is_fault" label="状态 " show-overflow-tooltip width="100px">
|
||||
<el-table-column prop="device_name" label="设备名称" show-overflow-tooltip width="300px" />
|
||||
<el-table-column prop="plant_code" label="所属车间" show-overflow-tooltip width="100px" :formatter="formatType1" />
|
||||
<el-table-column prop="region_code" label="所属区域" show-overflow-tooltip width="100px" :formatter="formatType2" />
|
||||
<el-table-column prop="is_fault" label="状态" show-overflow-tooltip width="100px">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row.is_fault==='1'" type="danger" circle />
|
||||
<el-button v-if="scope.row.is_fault==='0'" type="success" circle />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="plant_code" label="所属车间 " show-overflow-tooltip width="100px" :formatter="formatType1" />
|
||||
<el-table-column prop="region_code" label="所属区域 " show-overflow-tooltip width="100px" :formatter="formatType2" />
|
||||
<el-table-column prop="fault_type" label="异常类型 " show-overflow-tooltip width="100px" :formatter="formatType3" />
|
||||
<el-table-column prop="fault_type" label="异常类型" show-overflow-tooltip width="100px" :formatter="formatType3" />
|
||||
<el-table-column prop="fault_info" label="故障信息" show-overflow-tooltip width="250px" />
|
||||
<el-table-column prop="solve_mode" label="解决方式" show-overflow-tooltip width="250px" />
|
||||
</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 CRUD, { crud, 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: 'Devicecharge',
|
||||
dicts: ['DEVICE_ERROR_TYPE', 'IS_OR_NOT', 'DEVICE_REGION_TYPE', 'product_area'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
components: { crudOperation, rrOperation },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '设备故障监控',
|
||||
@@ -136,8 +130,7 @@ export default {
|
||||
plant_code: 'A1'
|
||||
},
|
||||
idField: 'device_id',
|
||||
sort: 'device_id,desc',
|
||||
crudMethod: { ...crudFaultdevice }
|
||||
sort: 'device_id,desc'
|
||||
})
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -1,21 +1,5 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/faultdevice',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/faultdevice/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/faultdevice',
|
||||
@@ -39,4 +23,4 @@ export function deviceCharge(params) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, syncInfo, deviceCharge }
|
||||
export default { edit, syncInfo, deviceCharge }
|
||||
|
||||
@@ -77,10 +77,8 @@
|
||||
v-model="form.fault_type"
|
||||
size="mini"
|
||||
:disabled="true"
|
||||
placeholder="请选择"
|
||||
class="filter-item"
|
||||
style="width: 300px"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.DEVICE_ERROR_TYPE"
|
||||
@@ -149,8 +147,8 @@ const defaultForm = {
|
||||
fault_id: null,
|
||||
fault_code: null,
|
||||
fault_info: null,
|
||||
acs_type: null,
|
||||
solve_mode: null,
|
||||
fault_type: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
@@ -171,8 +169,8 @@ export default {
|
||||
add: false,
|
||||
reset: true
|
||||
},
|
||||
idField: 'device_id',
|
||||
sort: 'device_id,desc',
|
||||
idField: 'fault_id',
|
||||
sort: 'create_time',
|
||||
crudMethod: { ...crudFaultdevice }
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user