设备故障分析
This commit is contained in:
@@ -30,7 +30,8 @@ public enum MaterOptTypeEnum {
|
||||
CXJ(19, "20", "成型剂", "('1518780034469466112')", ""),
|
||||
RD_AND_PG(20, "21", "pg粉和软废", "('1503644362108702720','1503644362150645760')", ""),
|
||||
YL_AND_BCP(21, "22", "原料和半成品", "('1503644353019645952','1503644359155912704')", ""),
|
||||
SPARE(22, "23", "备品备件", "('1503644361789935616')", "");
|
||||
SPARE(22, "23", "备品备件", "('1503644361789935616')", ""),
|
||||
SBGZ(23, "24", "设备故障", "('1541964046385942528')", "");
|
||||
|
||||
|
||||
//顺序号
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
package org.nl.wms.sb.stat.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.wms.sb.stat.service.DevicefaultcaeService;
|
||||
import org.nl.wms.sb.stat.service.dto.DevicesparepartivtDto;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2022-06-28
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "设备故障分析")
|
||||
@RequestMapping("/api/devicefaultcae")
|
||||
@Slf4j
|
||||
public class DevicefaultcaeController {
|
||||
|
||||
private final DevicefaultcaeService devicefaultcaeService;
|
||||
|
||||
@GetMapping
|
||||
@Log("设备故障分析查询")
|
||||
@ApiOperation("设备故障分析查询")
|
||||
//@PreAuthorize("@el.check('devicesparepartivt:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(devicefaultcaeService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/dtlQuery")
|
||||
@Log("明细查询")
|
||||
@ApiOperation("明细查询")
|
||||
//@PreAuthorize("@el.check('devicesparepartivt:list')")
|
||||
public ResponseEntity<Object> dtlQuery(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(devicefaultcaeService.dtlQuery(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增设备故障分析")
|
||||
@ApiOperation("新增设备故障分析")
|
||||
//@PreAuthorize("@el.check('devicesparepartivt:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody DevicesparepartivtDto dto) {
|
||||
devicefaultcaeService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改设备故障分析")
|
||||
@ApiOperation("修改设备故障分析")
|
||||
//@PreAuthorize("@el.check('devicesparepartivt:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody DevicesparepartivtDto dto) {
|
||||
devicefaultcaeService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除设备故障分析")
|
||||
@ApiOperation("删除设备故障分析")
|
||||
//@PreAuthorize("@el.check('devicesparepartivt:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
devicefaultcaeService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
devicefaultcaeService.download(whereJson, response);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
|
||||
package org.nl.wms.sb.stat.service;
|
||||
|
||||
import org.nl.wms.sb.stat.service.dto.DevicesparepartivtDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-06-28
|
||||
**/
|
||||
public interface DevicefaultcaeService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<DevicesparepartivtDto>
|
||||
*/
|
||||
List<DevicesparepartivtDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param stockrecord_id ID
|
||||
* @return Devicesparepartivt
|
||||
*/
|
||||
DevicesparepartivtDto findById(Long stockrecord_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Devicesparepartivt
|
||||
*/
|
||||
DevicesparepartivtDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(DevicesparepartivtDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(DevicesparepartivtDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
void download(Map whereJson, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> dtlQuery(Map whereJson, Pageable page);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
|
||||
package org.nl.wms.sb.stat.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.NumberUtil;
|
||||
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.exception.BadRequestException;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.sb.stat.service.DevicefaultcaeService;
|
||||
import org.nl.wms.sb.stat.service.dto.DevicesparepartivtDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-06-28
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DevicefaultcaeServiceImpl implements DevicefaultcaeService {
|
||||
private final ClassstandardService classstandardService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||
String class_idStr = (String) whereJson.get("class_idStr");
|
||||
String device_gz = MapUtil.getStr(whereJson, "device_gz");
|
||||
String class_idStr2 = (String) whereJson.get("class_idStr2");
|
||||
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String dept_id = MapUtil.getStr(whereJson, "dept_id");
|
||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
map.put("begin_time", begin_time);
|
||||
map.put("end_time", end_time);
|
||||
if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code", "%"+device_code+"%");
|
||||
if (ObjectUtil.isNotEmpty(dept_id)) map.put("dept_id", "%"+dept_id+"%");
|
||||
//处理设备当前节点的所有子节点
|
||||
if (!StrUtil.isEmpty(material_type_id)) {
|
||||
map.put("material_type_id", material_type_id);
|
||||
String classIds = classstandardService.getChildIdStr(material_type_id);
|
||||
map.put("classIds", classIds);
|
||||
} else if (ObjectUtil.isNotEmpty(class_idStr)) {
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
//处理故障当前节点的所有子节点
|
||||
if (!StrUtil.isEmpty(device_gz)) {
|
||||
map.put("device_gz", device_gz);
|
||||
String classIds2 = classstandardService.getChildIdStr(device_gz);
|
||||
map.put("classIds2", classIds2);
|
||||
} else if (ObjectUtil.isNotEmpty(class_idStr2)) {
|
||||
String classIds2 = classstandardService.getAllChildIdStr(class_idStr2);
|
||||
map.put("classIds2", classIds2);
|
||||
}
|
||||
|
||||
JSONObject json = WQL.getWO("EM_DEVICEFAULTCAE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "re.devicerecord_id DESC");
|
||||
// 处理平均故障间隔时间 && 平均故障修复时间
|
||||
/* WQLObject tab = WQLObject.getWQLObject("EM_BI_DeviceRepairRequest");
|
||||
JSONArray content = json.getJSONArray("content");
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
JSONObject jsonObject = content.getJSONObject(i);
|
||||
String devicerecord_id = jsonObject.getString("devicerecord_id");
|
||||
JSONArray arr = tab.query("devicerecord_id = '" + devicerecord_id + "' and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
String nunm = jsonObject.getString("nunm");
|
||||
String create_time_all = "0";
|
||||
String finish_time_all = "0";
|
||||
for (int j = 0; j < arr.size(); j++) {
|
||||
JSONObject jsonObject1 = arr.getJSONObject(j);
|
||||
// 去掉时间中的特殊字符
|
||||
String create_time = jsonObject1.getString("create_time").replaceAll("[[\\s-:punct:]]","");
|
||||
String finish_time = "0";
|
||||
if (ObjectUtil.isNotEmpty(jsonObject1.getString("finish_time"))) {
|
||||
finish_time = jsonObject1.getString("finish_time").replaceAll("[[\\s-:punct:]]","");
|
||||
}
|
||||
// 相加
|
||||
create_time_all = String.valueOf(NumberUtil.add(create_time_all,create_time));
|
||||
finish_time_all = String.valueOf(NumberUtil.add(finish_time_all,finish_time));
|
||||
}
|
||||
BigDecimal avgRep_time = NumberUtil.div(String.valueOf(NumberUtil.sub(finish_time_all, create_time_all)), nunm);
|
||||
jsonObject.put("avgRep_time",String.valueOf(avgRep_time));
|
||||
}
|
||||
json.put("content",content);*/
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevicesparepartivtDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesparepartivt");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DevicesparepartivtDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevicesparepartivtDto findById(Long stockrecord_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesparepartivt");
|
||||
JSONObject json = wo.query("stockrecord_id = '" + stockrecord_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(DevicesparepartivtDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevicesparepartivtDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesparepartivt");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(DevicesparepartivtDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(DevicesparepartivtDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setStockrecord_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesparepartivt");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(DevicesparepartivtDto dto) {
|
||||
DevicesparepartivtDto entity = this.findById(dto.getStockrecord_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesparepartivt");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicesparepartivt");
|
||||
for (Long stockrecord_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("stockrecord_id", String.valueOf(stockrecord_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
|
||||
public void download(Map whereJson, HttpServletResponse response) throws IOException {
|
||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||
String devicerecord_id = MapUtil.getStr(whereJson, "devicerecord_id");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "2");
|
||||
map.put("begin_time",begin_time);
|
||||
map.put("end_time",end_time);
|
||||
map.put("devicerecord_id",devicerecord_id);
|
||||
JSONArray rows = WQL.getWO("EM_DEVICEFAULTCAE01").addParamMap(map).process().getResultJSONArray(0);
|
||||
for (int j = 0; j < rows.size(); j++) {
|
||||
JSONObject jsonObject = rows.getJSONObject(j);
|
||||
if (ObjectUtil.isEmpty("outsourceaskfor_optid")) {
|
||||
jsonObject.put("outsourceaskfor_optid","否");
|
||||
} else {
|
||||
jsonObject.put("outsourceaskfor_optid","是");
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
Map<String, Object> dtl_map = new LinkedHashMap<>();
|
||||
dtl_map.put("报修时间", jo.getString("create_time"));
|
||||
dtl_map.put("使用部门", jo.getString("name"));
|
||||
dtl_map.put("故障类型", jo.getString("class_name"));
|
||||
dtl_map.put("受理时间", jo.getString("process_time"));
|
||||
dtl_map.put("开始维修", jo.getString("real_start_date"));
|
||||
dtl_map.put("结束维修", jo.getString("real_end_date"));
|
||||
dtl_map.put("是否委外", jo.getString("outsourceaskfor_optid"));
|
||||
dtl_map.put("生产验收", jo.getString("confirm_time"));
|
||||
dtl_map.put("维修确认", jo.getString("audit_time"));
|
||||
dtl_map.put("生产配合人", jo.getString("product_person_name"));
|
||||
dtl_map.put("维修人", jo.getString("update_optname"));
|
||||
list.add(dtl_map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> dtlQuery(Map whereJson, Pageable page) {
|
||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||
String devicerecord_id = MapUtil.getStr(whereJson, "devicerecord_id");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "2");
|
||||
map.put("begin_time",begin_time);
|
||||
map.put("end_time",end_time);
|
||||
map.put("devicerecord_id",devicerecord_id);
|
||||
JSONObject json = WQL.getWO("EM_DEVICEFAULTCAE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "re.fault_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
[交易说明]
|
||||
交易名: 设备故障分析分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.classIds TYPEAS f_string
|
||||
输入.classIds2 TYPEAS f_string
|
||||
输入.device_code TYPEAS s_string
|
||||
输入.dept_id TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.devicerecord_id TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
count(re.devicerecord_id) AS nunm,
|
||||
MAX(dept.name) AS dept_name,
|
||||
MAX(class.class_name) AS class_name,
|
||||
MAX(file.device_code) AS device_code,
|
||||
MAX(file.device_model) AS device_model,
|
||||
re.devicerecord_id
|
||||
FROM
|
||||
EM_BI_DeviceRepairRequest re
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = re.devicerecord_id
|
||||
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||
LEFT JOIN md_pb_classstandard class2 ON re.device_faultclass_id = class2.class_id
|
||||
LEFT JOIN sys_dept dept ON file.use_deptid = dept.dept_id
|
||||
WHERE
|
||||
re.is_delete = '0'
|
||||
OPTION 输入.classIds <> ""
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.classIds2 <> ""
|
||||
class2.class_id in 输入.classIds2
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
(file.device_code like 输入.device_code or
|
||||
file.device_name like 输入.device_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.dept_id <> ""
|
||||
(dept.code like 输入.dept_id or
|
||||
dept.name like 输入.dept_id)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
re.fault_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
re.fault_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
group by re.devicerecord_id
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
re.*,
|
||||
dept.name,
|
||||
class.class_name,
|
||||
pari.real_start_date,
|
||||
pari.real_end_date,
|
||||
pari.outsourceaskfor_optid,
|
||||
pari.confirm_time,
|
||||
pari.audit_time,
|
||||
pari.product_person_name,
|
||||
pari.update_optname
|
||||
FROM
|
||||
EM_BI_DeviceRepairRequest re
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = re.devicerecord_id
|
||||
LEFT JOIN md_pb_classstandard class ON re.device_faultclass_id = class.class_id
|
||||
LEFT JOIN sys_dept dept ON file.use_deptid = dept.dept_id
|
||||
LEFT JOIN EM_BI_DeviceRepairMst pari ON pari.source_bill_id = re.request_id
|
||||
WHERE
|
||||
re.is_delete = '0'
|
||||
|
||||
OPTION 输入.devicerecord_id <> ""
|
||||
re.devicerecord_id = 输入.devicerecord_id
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
re.fault_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
re.fault_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
27
mes/qd/src/api/wms/sb/devicefaultcae.js
Normal file
27
mes/qd/src/api/wms/sb/devicefaultcae.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/devicefaultcae',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/devicefaultcae/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/devicefaultcae',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
159
mes/qd/src/views/wms/sb/stat/devicefaultcae/DtlDialog.vue
Normal file
159
mes/qd/src/views/wms/sb/stat/devicefaultcae/DtlDialog.vue
Normal file
@@ -0,0 +1,159 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="报修单"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="1000px"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-form
|
||||
size="mini"
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="日期">
|
||||
<date-range-picker v-model="query.createTime" class="date-item" />
|
||||
</el-form-item>
|
||||
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
@click="downdtl"
|
||||
>
|
||||
导出Excel
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="deviceTable"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
style="width: 100%;"
|
||||
size="mini"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column show-overflow-tooltip prop="create_time" label="报修时间" />
|
||||
<el-table-column show-overflow-tooltip prop="name" label="使用部门" />
|
||||
<el-table-column show-overflow-tooltip prop="class_name" label="故障类型" />
|
||||
<el-table-column show-overflow-tooltip prop="process_time" label="受理时间" />
|
||||
<el-table-column show-overflow-tooltip prop="real_start_date" label="开始维修" />
|
||||
<el-table-column show-overflow-tooltip prop="real_end_date" label="结束维修" />
|
||||
<el-table-column show-overflow-tooltip prop="outsourceaskfor_optid" label="是否委外" :formatter="formatName" />
|
||||
<el-table-column show-overflow-tooltip prop="confirm_time" label="生产验收" />
|
||||
<el-table-column show-overflow-tooltip prop="audit_time" label="维修确认" />
|
||||
<el-table-column show-overflow-tooltip prop="product_person_name" label="生产配合人" />
|
||||
<el-table-column show-overflow-tooltip prop="update_optname" label="维修人" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import CRUD, { presenter, header, crud } 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'
|
||||
import crudDevicefaultcae from '@/api/wms/sb/devicefaultcae'
|
||||
import DateRangePicker from '@/components/DateRangePicker'
|
||||
import { download } from '@/api/data'
|
||||
import { downloadFile } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'ReceiveDialog',
|
||||
components: { crudOperation, pagination, rrOperation, udOperation, DateRangePicker },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
url: 'api/devicefaultcae/dtlQuery',
|
||||
idField: 'request_id',
|
||||
sort: 'request_id,desc',
|
||||
crudMethod: { ... crudDevicefaultcae },
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: false
|
||||
}
|
||||
})
|
||||
},
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
openParam: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
this.crud.query.devicerecord_id = this.openParam
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done()
|
||||
})
|
||||
.catch(_ => {
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
open() {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
formatName(row, cloum) {
|
||||
if (row.outsourceaskfor_optid === '') {
|
||||
return '否'
|
||||
} else {
|
||||
return '是'
|
||||
}
|
||||
},
|
||||
downdtl() {
|
||||
if (this.currentRow !== null) {
|
||||
crud.downloadLoading = true
|
||||
download('/api/devicefaultcae/download', this.crud.query).then(result => {
|
||||
downloadFile(result, '报修明细', 'xlsx')
|
||||
crud.downloadLoading = false
|
||||
}).catch(() => {
|
||||
crud.downloadLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
212
mes/qd/src/views/wms/sb/stat/devicefaultcae/index.vue
Normal file
212
mes/qd/src/views/wms/sb/stat/devicefaultcae/index.vue
Normal file
@@ -0,0 +1,212 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-form
|
||||
size="mini"
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="设备类别">
|
||||
<treeselect
|
||||
v-model="query.material_type_id"
|
||||
:load-options="loadClass"
|
||||
:options="classes"
|
||||
style="width: 200px;"
|
||||
placeholder="请选择"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="设备故障">
|
||||
<treeselect
|
||||
v-model="query.device_gz"
|
||||
:load-options="loadClass"
|
||||
:options="classes2"
|
||||
style="width: 200px;"
|
||||
placeholder="请选择"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="日期">
|
||||
<date-range-picker v-model="query.createTime" class="date-item" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="部门">
|
||||
<el-input
|
||||
v-model="query.dept_id"
|
||||
clearable
|
||||
placeholder="编码、名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="设备">
|
||||
<el-input
|
||||
v-model="query.device_code"
|
||||
clearable
|
||||
placeholder="编码、名称"
|
||||
/>
|
||||
</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 type="selection" width="55" />
|
||||
<el-table-column prop="dept_name" label="使用部门" />
|
||||
<el-table-column prop="class_name" label="设备类型" />
|
||||
<el-table-column prop="device_code" label="设备编码">
|
||||
<template slot-scope="scope">
|
||||
<el-link type="warning" @click="openDtl(scope.row)">{{ scope.row.device_code }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="device_model" label="型号规格" />
|
||||
<el-table-column prop="nunm" label="故障次数" />
|
||||
<el-table-column prop="" label="平均故障间隔时间" />
|
||||
<el-table-column prop="" label="平均故障修复时间" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<DtlDialog :dialog-show.sync="dtlDialog" :open-param="openParam" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudDevicefaultcae from '@/api/wms/sb/devicefaultcae'
|
||||
import CRUD, { presenter, header, form, crud } 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'
|
||||
import { download } from '@/api/data'
|
||||
import { downloadFile } from '@/utils'
|
||||
import crudClassstandard from '@/api/wms/basedata/master/classstandard'
|
||||
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
|
||||
import DateRangePicker from '@/components/DateRangePicker'
|
||||
import DtlDialog from '@/views/wms/sb/stat/devicefaultcae/DtlDialog'
|
||||
|
||||
const defaultForm = { }
|
||||
export default {
|
||||
name: 'Devicefaultcae',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker, DtlDialog },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '设备故障分析',
|
||||
url: 'api/devicefaultcae',
|
||||
idField: 'stockrecord_id',
|
||||
sort: 'stockrecord_id,desc',
|
||||
crudMethod: { ...crudDevicefaultcae },
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
classes: [],
|
||||
classes2: [],
|
||||
class_idStr: null,
|
||||
class_idStr2: null,
|
||||
materOpt_code: '23',
|
||||
materOpt_code2: '24',
|
||||
openParam: null,
|
||||
dtlDialog: false,
|
||||
permission: {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const param = {
|
||||
'materOpt_code': this.materOpt_code
|
||||
}
|
||||
crudMaterialbase.getMaterOptType(param).then(res => {
|
||||
this.class_idStr = res.class_idStr
|
||||
this.crud.query.class_idStr = this.class_idStr
|
||||
this.crud.toQuery()
|
||||
this.queryClassId()
|
||||
})
|
||||
const param2 = {
|
||||
'materOpt_code': this.materOpt_code2
|
||||
}
|
||||
crudMaterialbase.getMaterOptType(param2).then(res => {
|
||||
this.class_idStr2 = res.class_idStr
|
||||
this.crud.query.class_idStr2 = this.class_idStr2
|
||||
this.crud.toQuery()
|
||||
this.queryClassId2()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
loadClass({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
setTimeout(() => {
|
||||
callback()
|
||||
}, 100)
|
||||
})
|
||||
}
|
||||
},
|
||||
queryClassId() {
|
||||
const param = {
|
||||
'class_idStr': this.class_idStr
|
||||
}
|
||||
crudClassstandard.queryClassById(param).then(res => {
|
||||
this.classes = res.content.map(obj => {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
},
|
||||
queryClassId2() {
|
||||
const param = {
|
||||
'class_idStr': this.class_idStr2
|
||||
}
|
||||
crudClassstandard.queryClassById(param).then(res => {
|
||||
this.classes2 = res.content.map(obj => {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
},
|
||||
openDtl(row) {
|
||||
this.openParam = row.devicerecord_id
|
||||
this.dtlDialog = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user