设备运行记录
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
|
||||
package org.nl.wms.sb.run.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.sb.run.service.DevicerunrecordService;
|
||||
import org.nl.wms.sb.run.service.dto.DevicerunrecordDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2022-06-27
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "运行记录填报管理")
|
||||
@RequestMapping("/api/devicerunrecord")
|
||||
@Slf4j
|
||||
public class DevicerunrecordController {
|
||||
|
||||
private final DevicerunrecordService devicerunrecordService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询运行记录填报")
|
||||
@ApiOperation("查询运行记录填报")
|
||||
//@PreAuthorize("@el.check('devicerunrecord:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(devicerunrecordService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增运行记录填报")
|
||||
@ApiOperation("新增运行记录填报")
|
||||
//@PreAuthorize("@el.check('devicerunrecord:add')")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
|
||||
devicerunrecordService.create(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改运行记录填报")
|
||||
@ApiOperation("修改运行记录填报")
|
||||
//@PreAuthorize("@el.check('devicerunrecord:edit')")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
|
||||
devicerunrecordService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除运行记录填报")
|
||||
@ApiOperation("删除运行记录填报")
|
||||
//@PreAuthorize("@el.check('devicerunrecord:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
devicerunrecordService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
|
||||
package org.nl.wms.sb.run.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.sb.run.service.dto.DevicerunrecordDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-06-27
|
||||
**/
|
||||
public interface DevicerunrecordService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<DevicerunrecordDto>
|
||||
*/
|
||||
List<DevicerunrecordDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param runrecord_id ID
|
||||
* @return Devicerunrecord
|
||||
*/
|
||||
DevicerunrecordDto findById(Long runrecord_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Devicerunrecord
|
||||
*/
|
||||
DevicerunrecordDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void create(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void update(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package org.nl.wms.sb.run.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description /
|
||||
* @date 2022-06-27
|
||||
**/
|
||||
@Data
|
||||
public class DevicerunrecordDto implements Serializable {
|
||||
|
||||
/** 记录标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long runrecord_id;
|
||||
|
||||
/**
|
||||
* 设备档案标识
|
||||
*/
|
||||
private Long devicerecord_id;
|
||||
|
||||
/**
|
||||
* 填报日期
|
||||
*/
|
||||
private String run_date;
|
||||
|
||||
/**
|
||||
* 工作时间(分钟)
|
||||
*/
|
||||
private BigDecimal run_times;
|
||||
|
||||
/**
|
||||
* 准备时间(分钟)
|
||||
*/
|
||||
private BigDecimal prepare_times;
|
||||
|
||||
/**
|
||||
* 故障时间(分钟)
|
||||
*/
|
||||
private BigDecimal error_times;
|
||||
|
||||
/**
|
||||
* 工装调整时间(分钟)
|
||||
*/
|
||||
private BigDecimal adjust_times;
|
||||
|
||||
/**
|
||||
* 生产总量
|
||||
*/
|
||||
private BigDecimal product_qty;
|
||||
|
||||
/**
|
||||
* 不合格数
|
||||
*/
|
||||
private BigDecimal nok_qty;
|
||||
|
||||
/**
|
||||
* OEE指标
|
||||
*/
|
||||
private BigDecimal oee_value;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
|
||||
package org.nl.wms.sb.run.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.sb.run.service.DevicerunrecordService;
|
||||
import org.nl.wms.sb.run.service.dto.DevicerunrecordDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-06-27
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DevicerunrecordServiceImpl implements DevicerunrecordService {
|
||||
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 = MapUtil.getStr(whereJson, "class_idStr");
|
||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
|
||||
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 (!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);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_DEVICERUNRECORD001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "run.create_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevicerunrecordDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicerunrecord");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DevicerunrecordDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevicerunrecordDto findById(Long runrecord_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicerunrecord");
|
||||
JSONObject json = wo.query("runrecord_id = '" + runrecord_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(DevicerunrecordDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevicerunrecordDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicerunrecord");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(DevicerunrecordDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(JSONObject whereJson) {
|
||||
WQLObject tab = WQLObject.getWQLObject("EM_BI_DeviceRunRecord");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
String devicerecord_id = whereJson.getString("devicerecord_id");
|
||||
String run_date = whereJson.getString("run_date");
|
||||
|
||||
JSONObject jsonMst = tab.query("devicerecord_id = '" + devicerecord_id + "' and run_date = '" + run_date + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonMst)) throw new BadRequestException("填报信息已存在");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("runrecord_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("devicerecord_id", whereJson.get("devicerecord_id"));
|
||||
json.put("run_date", whereJson.getString("run_date"));
|
||||
json.put("run_times", whereJson.get("run_times"));
|
||||
json.put("prepare_times", whereJson.get("prepare_times"));
|
||||
json.put("error_times", whereJson.get("error_times"));
|
||||
json.put("adjust_times", whereJson.get("adjust_times"));
|
||||
json.put("product_qty", whereJson.get("product_qty"));
|
||||
json.put("nok_qty", whereJson.get("nok_qty"));
|
||||
json.put("oee_value", 0.0);
|
||||
json.put("remark", whereJson.getString("remark"));
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("create_name", nickName);
|
||||
json.put("create_time", now);
|
||||
tab.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(JSONObject whereJson) {
|
||||
WQLObject tab = WQLObject.getWQLObject("EM_BI_DeviceRunRecord");
|
||||
|
||||
JSONObject json = tab.query("runrecord_id = '" + whereJson.getString("runrecord_id") + "'").uniqueResult(0);
|
||||
json.put("run_date", whereJson.getString("run_date"));
|
||||
json.put("run_times", whereJson.get("run_times"));
|
||||
json.put("prepare_times", whereJson.get("prepare_times"));
|
||||
json.put("error_times", whereJson.get("error_times"));
|
||||
json.put("adjust_times", whereJson.get("adjust_times"));
|
||||
json.put("product_qty", whereJson.get("product_qty"));
|
||||
json.put("nok_qty", whereJson.get("nok_qty"));
|
||||
json.put("oee_value", 0);
|
||||
json.put("remark", whereJson.getString("remark"));
|
||||
tab.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicerunrecord");
|
||||
for (Long runrecord_id : ids) {
|
||||
wo.delete("runrecord_id = '"+runrecord_id+"'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
[交易说明]
|
||||
交易名: 运行记录填报分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.classIds TYPEAS f_string
|
||||
输入.device_code TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
run.*,
|
||||
class.class_name,
|
||||
file.device_code,
|
||||
file.device_name
|
||||
FROM
|
||||
EM_BI_DeviceRunRecord run
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = run.devicerecord_id
|
||||
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||
WHERE
|
||||
file.is_delete = '0'
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
(file.device_code like 输入.device_code or
|
||||
file.device_name like 输入.device_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.classIds <> ""
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
run.run_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
run.run_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
27
mes/qd/src/api/wms/sb/devicerunrecord.js
Normal file
27
mes/qd/src/api/wms/sb/devicerunrecord.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/devicerunrecord',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/devicerunrecord/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/devicerunrecord',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
@@ -302,7 +302,7 @@ export default {
|
||||
// 新增一行物料时,给行进行赋值
|
||||
this.form.material_id = data.material_id
|
||||
this.form.material_code = data.material_code
|
||||
this.form.material_name = data.material_name + ' ' + data.material_code
|
||||
this.form.material_name = data.material_name + '##' + data.material_code
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:visiable1', false)
|
||||
|
||||
249
mes/qd/src/views/wms/sb/run/devicerunrecord/index.vue
Normal file
249
mes/qd/src/views/wms/sb/run/devicerunrecord/index.vue
Normal file
@@ -0,0 +1,249 @@
|
||||
<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="110px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="填报日期">
|
||||
<date-range-picker v-model="query.createTime" class="date-item" />
|
||||
</el-form-item>
|
||||
<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="设备编码">
|
||||
<el-input
|
||||
v-model="query.device_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请输入设备编码、名称"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="820px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="160px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备:" prop="devicerecord_id">
|
||||
<el-input v-model="form.devicerecord_id" :disabled="true" style="width: 200px;">
|
||||
<el-button slot="append" icon="el-icon-plus" :disabled="crud.status.edit" @click="putDevice" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="业务日期:" prop="run_date">
|
||||
<el-date-picker v-model="form.run_date" type="date" placeholder="选择日期" style="width: 200px" value-format="yyyy-MM-dd" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工作时间(分钟):">
|
||||
<el-input v-model="form.run_times" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="准备时间(分钟):">
|
||||
<el-input v-model="form.prepare_times" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="故障时间(分钟):">
|
||||
<el-input v-model="form.error_times" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工装调整时间(分钟):">
|
||||
<el-input v-model="form.adjust_times" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="生产总量:">
|
||||
<el-input v-model="form.product_qty" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="不合格数:">
|
||||
<el-input v-model="form.nok_qty" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注:" prop="remark">
|
||||
<el-input v-model="form.remark" style="width: 588px;" rows="2" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<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 v-if="false" prop="runrecord_id" label="记录标识" />
|
||||
<el-table-column prop="device_code" label="设备代码" />
|
||||
<el-table-column prop="device_name" label="设备名称" />
|
||||
<el-table-column prop="class_name" label="设备类类别" />
|
||||
<el-table-column prop="run_date" label="填报日期" />
|
||||
<el-table-column prop="oee_value" label="OEE指标" />
|
||||
<el-table-column prop="create_name" label="创建人" />
|
||||
<el-table-column prop="create_time" label="创建时间" />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<DeviceDialog :dialog-show.sync="deviceDialog" :is-single="true" @tableChanged2="tableChanged2"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudDevicerunrecord from '@/api/wms/sb/devicerunrecord'
|
||||
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 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 DeviceDialog from '@/views/wms/sb/upkeep/devicemaintenanceplan/DeviceDialog'
|
||||
|
||||
const defaultForm = { runrecord_id: null, devicerecord_id: null, run_date: null, run_times: null, prepare_times: null, error_times: null, adjust_times: null, product_qty: null, nok_qty: null, oee_value: null, remark: null, create_id: null, create_name: null, create_time: null }
|
||||
export default {
|
||||
name: 'Devicerunrecord',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker, DeviceDialog },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '运行记录填报',
|
||||
url: 'api/devicerunrecord',
|
||||
idField: 'runrecord_id',
|
||||
sort: 'runrecord_id,desc',
|
||||
crudMethod: { ...crudDevicerunrecord },
|
||||
optShow: {
|
||||
add: true,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
classes: [],
|
||||
class_idStr: null,
|
||||
materOpt_code: '23',
|
||||
deviceDialog: false,
|
||||
permission: {
|
||||
},
|
||||
rules: {
|
||||
devicerecord_id: [
|
||||
{ required: true, message: '设备档案标识不能为空', trigger: 'blur' }
|
||||
],
|
||||
run_date: [
|
||||
{ required: true, message: '填报日期不能为空', trigger: 'blur' }
|
||||
]
|
||||
}}
|
||||
},
|
||||
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()
|
||||
})
|
||||
},
|
||||
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
|
||||
})
|
||||
})
|
||||
},
|
||||
putDevice() {
|
||||
this.deviceDialog = true
|
||||
},
|
||||
tableChanged2(row) {
|
||||
this.form.devicerecord_id = row.devicerecord_id
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user