代码更新
This commit is contained in:
@@ -66,4 +66,13 @@ public class DevicerunrecordController {
|
||||
devicerunrecordService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/submit")
|
||||
@Log("填报")
|
||||
@ApiOperation("填报")
|
||||
public ResponseEntity<Object> submit(@RequestBody JSONObject whereJson) {
|
||||
devicerunrecordService.submit(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,4 +71,12 @@ public interface DevicerunrecordService {
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
|
||||
/**
|
||||
* 填报
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void submit(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,16 @@
|
||||
package org.nl.wms.sb.run.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.service.DeptService;
|
||||
import org.nl.utils.PageUtil;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
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;
|
||||
@@ -18,9 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -46,16 +48,16 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
DeptService deptService = SpringContextHolder.getBean(DeptService.class);
|
||||
|
||||
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 begin_time = MapUtil.getStr(whereJson, "begin_time").substring(0,10);
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time").substring(0,10);
|
||||
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);
|
||||
map.put("flag", "2");
|
||||
if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code","%"+device_code+"%");
|
||||
//处理物料当前节点的所有子节点
|
||||
if (!StrUtil.isEmpty(material_type_id)) {
|
||||
@@ -66,7 +68,40 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService {
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_DEVICERUNRECORD001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "file.device_code ASC,run.run_date ASC");
|
||||
// 归属部门
|
||||
String dept_id = MapUtil.getStr(whereJson, "dept_id");
|
||||
if (!StrUtil.isEmpty(dept_id)) {
|
||||
String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
|
||||
map.put("deptIds", deptIds);
|
||||
}
|
||||
|
||||
ArrayList<Object> objects = new ArrayList<>();
|
||||
|
||||
Date begin_date = DateUtil.parse(begin_time);
|
||||
Date end_date = DateUtil.parse(end_time);
|
||||
long betweenDay = DateUtil.between(begin_date, end_date, DateUnit.DAY);
|
||||
|
||||
if (betweenDay == 0) {
|
||||
// 如果是某天则直接查
|
||||
map.put("run_date", begin_time);
|
||||
JSONArray arr = WQL.getWO("EM_DEVICERUNRECORD001").addParamMap(map).process().getResultJSONArray(0);
|
||||
objects.addAll(arr);
|
||||
} else {
|
||||
// 如果不是则根据日期递增循环查出 然后合并
|
||||
for (int i = 0; i <= betweenDay; i++) {
|
||||
String day_time = DateUtil.offsetDay(begin_date, i).toString().substring(0,10);
|
||||
map.put("run_date",day_time);
|
||||
JSONArray arr = WQL.getWO("EM_DEVICERUNRECORD001").addParamMap(map).process().getResultJSONArray(0);
|
||||
objects.addAll(arr);
|
||||
}
|
||||
}
|
||||
|
||||
// 组织分页查询并返回
|
||||
Map<String, Object> json = PageUtil.toPage(
|
||||
PageUtil.toPage(page.getPageNumber(), page.getPageSize(), objects),
|
||||
objects.size()
|
||||
);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -158,6 +193,12 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService {
|
||||
public void update(JSONObject whereJson) {
|
||||
WQLObject tab = WQLObject.getWQLObject("EM_BI_DeviceRunRecord");
|
||||
String devicerecord_id = whereJson.getString("devicerecord_id");
|
||||
String runrecord_id = whereJson.getString("runrecord_id");
|
||||
|
||||
JSONObject jsonObject = tab.query("runrecord_id = '" + runrecord_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new BadRequestException("请先填报");
|
||||
}
|
||||
|
||||
JSONObject jsonFile = WQLObject.getWQLObject("EM_BI_EquipmentFile").query("devicerecord_id = '" + devicerecord_id + "'").uniqueResult(0);
|
||||
|
||||
@@ -203,4 +244,59 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void submit(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 jsonFile = WQLObject.getWQLObject("EM_BI_EquipmentFile").query("devicerecord_id = '" + devicerecord_id + "'").uniqueResult(0);
|
||||
String status = jsonFile.getString("status");
|
||||
if (!"10,11,20,30,40".contains(status)) {
|
||||
throw new BadRequestException("此设备不能填报");
|
||||
}
|
||||
|
||||
double run_times = whereJson.getDoubleValue("run_times"); //生产时间
|
||||
double prepare_times = whereJson.getDoubleValue("prepare_times");//准备时间
|
||||
double error_times = whereJson.getDoubleValue("error_times"); //故障时间
|
||||
double adjust_times = whereJson.getDoubleValue("adjust_times"); //工装调整时间
|
||||
double product_qty = whereJson.getDoubleValue("product_qty"); //生产总量
|
||||
double nok_qty = whereJson.getDoubleValue("nok_qty"); //不合格数
|
||||
double theory_beat = jsonFile.getDoubleValue("theory_beat"); // 理论节拍
|
||||
|
||||
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("remark", whereJson.getString("remark"));
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("create_name", nickName);
|
||||
json.put("create_time", now);
|
||||
// 计算OEE指标
|
||||
try {
|
||||
BigDecimal div = NumberUtil.div(NumberUtil.sub(run_times, prepare_times, error_times, adjust_times), NumberUtil.sub(run_times, prepare_times, adjust_times));
|
||||
BigDecimal div1 = NumberUtil.div(NumberUtil.mul(div, theory_beat, product_qty), NumberUtil.sub(run_times, prepare_times, error_times, adjust_times));
|
||||
BigDecimal oee_value = NumberUtil.mul(div1, NumberUtil.div(NumberUtil.sub(product_qty, nok_qty), product_qty));
|
||||
json.put("oee_value", oee_value);
|
||||
} catch (Exception e) {
|
||||
json.put("oee_value", 0);
|
||||
}
|
||||
tab.insert(json);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
输入.device_code TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.run_date TYPEAS s_string
|
||||
输入.deptIds TYPEAS f_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -77,5 +79,52 @@
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
file.devicerecord_id,
|
||||
file.device_code,
|
||||
file.device_name,
|
||||
file.extend_code,
|
||||
class.class_name,
|
||||
输入.run_date AS run_date,
|
||||
run.runrecord_id,
|
||||
run.run_times,
|
||||
run.prepare_times,
|
||||
run.error_times,
|
||||
run.adjust_times,
|
||||
run.product_qty,
|
||||
run.nok_qty,
|
||||
run.oee_value,
|
||||
run.remark,
|
||||
run.create_name,
|
||||
run.create_time,
|
||||
d1.name AS dept_name
|
||||
FROM
|
||||
EM_BI_EquipmentFile file
|
||||
LEFT JOIN EM_BI_DeviceRunRecord run ON file.devicerecord_id = run.devicerecord_id AND 输入.run_date = run.run_date
|
||||
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||
LEFT JOIN sys_dept d1 ON file.use_groupid = d1.dept_id
|
||||
WHERE
|
||||
file.is_delete = '0'
|
||||
AND file.status not in ('90','91')
|
||||
|
||||
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 输入.deptIds <> ""
|
||||
d1.dept_id in 输入.deptIds
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -24,4 +24,12 @@ export function edit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
export function submit(data) {
|
||||
return request({
|
||||
url: 'api/devicerunrecord/submit',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, submit }
|
||||
|
||||
141
mes/qd/src/views/wms/sb/run/devicerunrecord/PaDialog.vue
Normal file
141
mes/qd/src/views/wms/sb/run/devicerunrecord/PaDialog.vue
Normal file
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="填报"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
width="850px"
|
||||
:before-close="handleClose"
|
||||
destroy-on-close
|
||||
@close="close"
|
||||
>
|
||||
<el-form ref="form" :model="form1" :rules="rules" size="mini" label-width="160px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备:" prop="devicerecord_id">
|
||||
<el-input v-model="form1.device_code" :disabled="true" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="业务日期:" prop="run_date">
|
||||
<el-date-picker v-model="form1.run_date" type="date" placeholder="选择日期" disabled="true" 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-number :controls="false" :min="0" :precision="0" v-model="form1.run_times" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="准备时间(分钟):">
|
||||
<el-input-number :controls="false" :min="0" :precision="0" v-model="form1.prepare_times" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="故障时间(分钟):">
|
||||
<el-input-number :controls="false" :min="0" :precision="0" v-model="form1.error_times" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工装调整时间(分钟):">
|
||||
<el-input-number :controls="false" :precision="0" :min="0" v-model="form1.adjust_times" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="生产总量:">
|
||||
<el-input-number :controls="false" :min="0" :precision="2" v-model="form1.product_qty" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="不合格数:">
|
||||
<el-input-number :controls="false" :min="0" :precision="2" v-model="form1.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="form1.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="cancel">取消</el-button>
|
||||
<el-button type="primary" @click="sumbit">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import CRUD, { crud } from '@crud/crud'
|
||||
import crudDevicerunrecord from '@/api/wms/sb/devicerunrecord'
|
||||
|
||||
export default {
|
||||
name: 'SunShowDialog',
|
||||
mixins: [crud()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
openParam: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
this.form1 = this.openParam
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form1: {},
|
||||
dialogVisible: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done()
|
||||
})
|
||||
.catch(_ => {
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
cancel() {
|
||||
this.dialogVisible = false
|
||||
this.crud.toQuery()
|
||||
},
|
||||
sumbit() {
|
||||
const data = this.form1
|
||||
crudDevicerunrecord.submit(data).then(res => {
|
||||
this.cancel()
|
||||
this.crud.notify('填报成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -12,7 +12,7 @@
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="填报日期">
|
||||
<date-range-picker v-model="query.createTime" class="date-item" value-format="yyyy-MM-dd" />
|
||||
<date-range-picker v-model="query.createTime" class="date-item" value-format="yyyy-MM-dd" :clearable="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类别">
|
||||
<treeselect
|
||||
@@ -32,25 +32,44 @@
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属部门">
|
||||
<treeselect
|
||||
v-model="query.dept_id"
|
||||
:load-options="loadDepts"
|
||||
:options="depts"
|
||||
style="width: 200px;"
|
||||
placeholder="请选择"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:disabled="crud.selections.length !== 1"
|
||||
@click="addPa"
|
||||
>
|
||||
填报
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<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.device_code" :disabled="true" style="width: 200px;">
|
||||
<el-button slot="append" icon="el-icon-plus" :disabled="crud.status.edit" @click="putDevice" />
|
||||
</el-input>
|
||||
<el-input v-model="form.device_code" :disabled="true" style="width: 200px;"/>
|
||||
</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-date-picker v-model="form.run_date" type="date" placeholder="选择日期" disabled="true" style="width: 200px" value-format="yyyy-MM-dd" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -112,13 +131,22 @@
|
||||
<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="run_date" label="填报日期" width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="device_code" label="设备代码" width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="device_name" label="设备名称" width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="extend_code" label="自编码" />
|
||||
<el-table-column prop="class_name" label="设备类类别" width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="dept_name" label="使用班组" width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="run_times" label="工作时间(分钟)" width="120px" />
|
||||
<el-table-column prop="prepare_times" label="保养时间(分钟)" width="120px" />
|
||||
<el-table-column prop="error_times" label="故障时间(分钟)" width="120px" />
|
||||
<el-table-column prop="adjust_times" label="工装调整时间(分钟)" width="130px" />
|
||||
<el-table-column prop="product_qty" label="生产总量" width="120px" />
|
||||
<el-table-column prop="nok_qty" label="不合格数" width="120px" />
|
||||
<el-table-column prop="oee_value" label="OEE指标" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column prop="create_name" label="创建人" />
|
||||
<el-table-column prop="create_time" label="创建时间" />
|
||||
<el-table-column prop="create_time" label="创建时间" show-overflow-tooltip />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
@@ -132,6 +160,7 @@
|
||||
<pagination />
|
||||
</div>
|
||||
<DeviceDialog :dialog-show.sync="deviceDialog" :is-single="true" @tableChanged2="tableChanged2"/>
|
||||
<PaDialog :dialog-show.sync="addPaDialog" :open-param="openParam" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -148,11 +177,14 @@ 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'
|
||||
import { getDepts } from '@/api/system/dept'
|
||||
import PaDialog from '@/views/wms/sb/run/devicerunrecord/PaDialog'
|
||||
|
||||
const start = new Date()
|
||||
const defaultForm = { runrecord_id: null, device_code: 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 },
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker, DeviceDialog, PaDialog },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
@@ -162,20 +194,27 @@ export default {
|
||||
sort: 'runrecord_id,desc',
|
||||
crudMethod: { ...crudDevicerunrecord },
|
||||
optShow: {
|
||||
add: true,
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
},
|
||||
query: {
|
||||
createTime: [start.daysAgo(0), new Date()]
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
open: true,
|
||||
classes: [],
|
||||
class_idStr: null,
|
||||
materOpt_code: '23',
|
||||
depts: [],
|
||||
deviceDialog: false,
|
||||
openParam: null,
|
||||
addPaDialog: false,
|
||||
permission: {
|
||||
},
|
||||
rules: {
|
||||
@@ -194,14 +233,20 @@ export default {
|
||||
crudMaterialbase.getMaterOptType(param).then(res => {
|
||||
this.class_idStr = res.class_idStr
|
||||
this.crud.query.class_idStr = this.class_idStr
|
||||
this.crud.toQuery()
|
||||
this.queryClassId()
|
||||
})
|
||||
this.getDepts()
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
debugger
|
||||
if (this.open) {
|
||||
this.open = false
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
@@ -240,6 +285,38 @@ export default {
|
||||
tableChanged2(row) {
|
||||
this.form.devicerecord_id = row.devicerecord_id
|
||||
this.form.device_code = row.device_code
|
||||
},
|
||||
// 获取弹窗内部门数据
|
||||
loadDepts({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
setTimeout(() => {
|
||||
callback()
|
||||
}, 200)
|
||||
})
|
||||
}
|
||||
},
|
||||
getDepts() {
|
||||
getDepts({ enabled: true }).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
},
|
||||
addPa() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
const data = _selectData[0]
|
||||
this.openParam = data
|
||||
this.addPaDialog = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user