设备报废
This commit is contained in:
@@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.sb.run.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
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.run.service.DeviceScrapService;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @date 2022-06-27
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "设备报废")
|
||||||
|
@RequestMapping("/api/devicescrap")
|
||||||
|
@Slf4j
|
||||||
|
public class DeviceScrapController {
|
||||||
|
|
||||||
|
private final DeviceScrapService deviceScrapService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询设备报废")
|
||||||
|
@ApiOperation("查询设备报废")
|
||||||
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||||
|
return new ResponseEntity<>(deviceScrapService.queryAll(whereJson, page), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/scrap")
|
||||||
|
@Log("报废")
|
||||||
|
@ApiOperation("报废")
|
||||||
|
public ResponseEntity<Object> scrap(@RequestBody JSONObject whereJson) {
|
||||||
|
deviceScrapService.scrap(whereJson);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.sb.run.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @description 服务接口
|
||||||
|
* @date 2022-06-27
|
||||||
|
**/
|
||||||
|
public interface DeviceScrapService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
*
|
||||||
|
* @param whereJson 条件
|
||||||
|
* @param page 分页参数
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报废
|
||||||
|
* @param whereJson 参数
|
||||||
|
*/
|
||||||
|
void scrap(JSONObject whereJson);
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.sb.run.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.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||||
|
import org.nl.wms.sb.run.service.DeviceScrapService;
|
||||||
|
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 java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @description 服务实现
|
||||||
|
* @date 2022-06-27
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class DeviceScrapServiceImpl implements DeviceScrapService {
|
||||||
|
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");
|
||||||
|
String manufacturer = MapUtil.getStr(whereJson, "manufacturer");
|
||||||
|
String supplier_code = MapUtil.getStr(whereJson, "supplier_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("device_type", MapUtil.getStr(whereJson, "device_type"));
|
||||||
|
map.put("status", MapUtil.getStr(whereJson, "status"));
|
||||||
|
map.put("is_produceuse", MapUtil.getStr(whereJson, "is_produceuse"));
|
||||||
|
if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code","%"+device_code+"%");
|
||||||
|
if (ObjectUtil.isNotEmpty(manufacturer)) map.put("manufacturer","%"+manufacturer+"%");
|
||||||
|
if (ObjectUtil.isNotEmpty(supplier_code)) map.put("supplier_code","%"+supplier_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_DEVICESCRAP001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "file.update_time DESC");
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void scrap(JSONObject whereJson) {
|
||||||
|
String devicerecord_id = whereJson.getString("devicerecord_id");
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getNickName();
|
||||||
|
|
||||||
|
WQLObject fileTab = WQLObject.getWQLObject("EM_BI_EquipmentFile");
|
||||||
|
WQLObject lifeTab = WQLObject.getWQLObject("EM_BI_DeviceLifeCycle");
|
||||||
|
|
||||||
|
// 更新设备档案表状态为报废
|
||||||
|
JSONObject json = fileTab.query("devicerecord_id ='" + devicerecord_id + "' and is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(json)) throw new BootstrapMethodError("档案已被删除");
|
||||||
|
|
||||||
|
json.put("status", "90");
|
||||||
|
json.put("update_optid", currentUserId);
|
||||||
|
json.put("update_optname", nickName);
|
||||||
|
json.put("update_time", DateUtil.now());
|
||||||
|
fileTab.update(json);
|
||||||
|
|
||||||
|
// 插入设备生命周期表
|
||||||
|
JSONObject jsonLife = new JSONObject();
|
||||||
|
jsonLife.put("devicechangedtl_id", IdUtil.getSnowflake(1,1).nextId());
|
||||||
|
jsonLife.put("devicerecord_id",json.get("devicerecord_id"));
|
||||||
|
jsonLife.put("changetype","40");
|
||||||
|
jsonLife.put("change_id",currentUserId);
|
||||||
|
jsonLife.put("change_name",nickName);
|
||||||
|
jsonLife.put("change_time",DateUtil.now());
|
||||||
|
jsonLife.put("create_id",currentUserId);
|
||||||
|
jsonLife.put("create_name",nickName);
|
||||||
|
jsonLife.put("create_time",DateUtil.now());
|
||||||
|
lifeTab.insert(jsonLife);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
[交易说明]
|
||||||
|
交易名: 设备报废分页查询
|
||||||
|
所属模块:
|
||||||
|
功能简述:
|
||||||
|
版权所有:
|
||||||
|
表引用:
|
||||||
|
版本经历:
|
||||||
|
|
||||||
|
[数据库]
|
||||||
|
--指定数据库,为空采用默认值,默认为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
|
||||||
|
输入.manufacturer TYPEAS s_string
|
||||||
|
输入.supplier_code TYPEAS s_string
|
||||||
|
输入.device_type TYPEAS s_string
|
||||||
|
输入.status TYPEAS s_string
|
||||||
|
输入.is_produceuse TYPEAS s_string
|
||||||
|
|
||||||
|
|
||||||
|
[临时表]
|
||||||
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
|
|
||||||
|
[临时变量]
|
||||||
|
--所有中间过程变量均可在此处定义
|
||||||
|
|
||||||
|
[业务过程]
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 1、输入输出检查 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 2、主过程前处理 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 3、业务主过程 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
IF 输入.flag = "1"
|
||||||
|
PAGEQUERY
|
||||||
|
SELECT
|
||||||
|
file.*,
|
||||||
|
class.class_name,
|
||||||
|
dept1.name AS use_groupid_name,
|
||||||
|
dept2.name AS use_deptid_name,
|
||||||
|
work.workprocedure_name,
|
||||||
|
info.is_active,
|
||||||
|
info.is_delete AS device_is_delete
|
||||||
|
FROM
|
||||||
|
EM_BI_EquipmentFile file
|
||||||
|
LEFT JOIN em_bi_deviceinfo info ON file.device_code = info.device_code
|
||||||
|
LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id
|
||||||
|
LEFT JOIN sys_dept dept1 ON file.use_groupid = dept1.dept_id
|
||||||
|
LEFT JOIN sys_dept dept2 ON file.use_deptid = dept2.dept_id
|
||||||
|
LEFT JOIN pdm_bi_workprocedure work ON file.workprocedure_id = work.workprocedure_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 <> ""
|
||||||
|
file.beginuse_date >= 输入.begin_time
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.end_time <> ""
|
||||||
|
file.beginuse_date <= 输入.end_time
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.manufacturer <> ""
|
||||||
|
file.manufacturer like 输入.manufacturer
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.device_type <> ""
|
||||||
|
file.device_type = 输入.device_type
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.status <> ""
|
||||||
|
file.status = 输入.status
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.is_produceuse <> ""
|
||||||
|
file.is_produceuse = 输入.is_produceuse
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.supplier_code <> ""
|
||||||
|
(file.supplier_code like 输入.supplier_code or
|
||||||
|
file.supplier_name like 输入.supplier_code)
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDPAGEQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
35
mes/qd/src/api/wms/sb/devicescrap.js
Normal file
35
mes/qd/src/api/wms/sb/devicescrap.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/devicescrap',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: 'api/devicescrap/',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/devicescrap',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function scrap(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/devicescrap/scrap',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del, scrap }
|
||||||
277
mes/qd/src/views/wms/sb/run/devicescrap/index.vue
Normal file
277
mes/qd/src/views/wms/sb/run/devicescrap/index.vue
Normal file
@@ -0,0 +1,277 @@
|
|||||||
|
<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>
|
||||||
|
<el-form-item label="生产厂家">
|
||||||
|
<el-input
|
||||||
|
v-model="query.manufacturer"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="请输入生产厂家"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="供应商">
|
||||||
|
<el-input
|
||||||
|
v-model="query.supplier_code"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="请输入供应商编码、名称"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备属性">
|
||||||
|
<el-select
|
||||||
|
v-model="query.device_type"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="请选择"
|
||||||
|
class="filter-item"
|
||||||
|
@change="hand"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dict.DEVICE_ATTRIBUTE_SCODE"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备状态">
|
||||||
|
<el-select
|
||||||
|
v-model="query.status"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="请选择"
|
||||||
|
class="filter-item"
|
||||||
|
@change="hand"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dict.EM_BI_DEVICESTATUS"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="生产用途">
|
||||||
|
<el-select
|
||||||
|
v-model="query.is_produceuse"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="请选择"
|
||||||
|
class="filter-item"
|
||||||
|
@change="hand"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dict.EM_BI_DEVICEUSE"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<rrOperation />
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
|
<crudOperation :permission="permission">
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="success"
|
||||||
|
icon="el-icon-position"
|
||||||
|
size="mini"
|
||||||
|
:disabled="crud.selections.length !== 1"
|
||||||
|
@click="scrap"
|
||||||
|
>
|
||||||
|
报废
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<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="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="外部编码" width="120px" show-overflow-tooltip/>
|
||||||
|
<el-table-column prop="device_model" label="设备型号" width="120px" show-overflow-tooltip/>
|
||||||
|
<el-table-column prop="device_spec" label="设备规格" />
|
||||||
|
<el-table-column prop="class_name" label="设备类类别" />
|
||||||
|
<el-table-column prop="is_produceuse" label="生产用途" :formatter="formatProduceName" />
|
||||||
|
<el-table-column prop="status" label="设备状态" :formatter="formatStatusName" />
|
||||||
|
<el-table-column prop="beginuse_date" label="启用日期" width="120px" show-overflow-tooltip/>
|
||||||
|
<el-table-column prop="use_deptid_name" label="使用部门" />
|
||||||
|
<el-table-column prop="use_groupid_name" label="使用班组" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="supplier_name" label="供应商" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="manufacturer" label="制造商" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="leavefactory_date" label="出厂日期" width="120px" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="leavefactory_number" label="出厂编号" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="drawing_number" label="图号" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="device_type" label="设备属性" :formatter="formatTypeName" />
|
||||||
|
<el-table-column prop="workprocedure_name" label="工序" />
|
||||||
|
<el-table-column prop="assets_code" label="资产编码" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="assets_name" label="资产名称" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="create_name" label="生成人" />
|
||||||
|
<el-table-column prop="create_time" label="生成时间" width="150px" show-overflow-tooltip/>
|
||||||
|
<el-table-column prop="update_optname" label="修改人" />
|
||||||
|
<el-table-column prop="update_time" label="修改时间" width="150px" show-overflow-tooltip/>
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudDevicescrap from '@/api/wms/sb/devicescrap'
|
||||||
|
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'
|
||||||
|
|
||||||
|
const defaultForm = { status: null }
|
||||||
|
export default {
|
||||||
|
name: 'Devicescrap',
|
||||||
|
dicts: ['EM_BI_DEVICEUSE', 'EM_BI_DEVICESTATUS', 'DEVICE_ATTRIBUTE_SCODE'],
|
||||||
|
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker },
|
||||||
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '设备报废',
|
||||||
|
url: 'api/devicescrap',
|
||||||
|
idField: 'devicerecord_id',
|
||||||
|
sort: 'devicerecord_id,desc',
|
||||||
|
crudMethod: { ...crudDevicescrap },
|
||||||
|
optShow: {
|
||||||
|
add: false,
|
||||||
|
edit: false,
|
||||||
|
del: false,
|
||||||
|
download: false,
|
||||||
|
reset: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
classes: [],
|
||||||
|
class_idStr: null,
|
||||||
|
materOpt_code: '23',
|
||||||
|
deviceDialog: 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()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
formatProduceName(row, cloum) {
|
||||||
|
return this.dict.label.EM_BI_DEVICEUSE[row.is_produceuse]
|
||||||
|
},
|
||||||
|
formatStatusName(row, cloum) {
|
||||||
|
return this.dict.label.EM_BI_DEVICESTATUS[row.status]
|
||||||
|
},
|
||||||
|
formatTypeName(row, cloum) {
|
||||||
|
return this.dict.label.DEVICE_ATTRIBUTE_SCODE[row.device_type]
|
||||||
|
},
|
||||||
|
scrap() {
|
||||||
|
const _selectData = this.$refs.table.selection
|
||||||
|
const data = _selectData[0]
|
||||||
|
if (data.is_active !== '1') {
|
||||||
|
return this.crud.notify('设备未启用或不存在', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
}
|
||||||
|
if (data.device_is_delete === '1') {
|
||||||
|
return this.crud.notify('设备不存在或被删除', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
}
|
||||||
|
if (data.status === '10' || data.status === '11') {
|
||||||
|
crudDevicescrap.scrap(data).then(res => {
|
||||||
|
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
this.crud.toQuery()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return this.crud.notify('设备状态不为正常或者闲置', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user