优化
This commit is contained in:
@@ -34,7 +34,8 @@ public enum MaterOptTypeEnum {
|
|||||||
SBGZ(23, "24", "设备故障", "('1541964046385942528')", ""),
|
SBGZ(23, "24", "设备故障", "('1541964046385942528')", ""),
|
||||||
TJJ_AND_OTHER(24, "25", "添加剂和其他有色金属粉", "('1503644361697660928','1503644362838511616')", ""),
|
TJJ_AND_OTHER(24, "25", "添加剂和其他有色金属粉", "('1503644361697660928','1503644362838511616')", ""),
|
||||||
BJID(25, "26", "备品备件", "1503644361789935616", ""),
|
BJID(25, "26", "备品备件", "1503644361789935616", ""),
|
||||||
THW_AND_GF_AND_TJJ(26, "27", "碳化钨、钴粉、添加剂", "('1503644361664106496','1503644362192588800','1503644361697660928')", "");
|
THW_AND_GF_AND_TJJ(26, "27", "碳化钨、钴粉、添加剂", "('1503644361664106496','1503644362192588800','1503644361697660928')", ""),
|
||||||
|
BCP_AND_YL_AND_FL(27, "28", "半成品、原辅料、合金制品", "('1503644359155912704','1503644353019645952','1503644353116114944','1503644349995552768')", "");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,13 @@ public class DevicesafetyqtyqueryController {
|
|||||||
return new ResponseEntity<>(devicesafetyqtyqueryService.queryAll(whereJson, page), HttpStatus.OK);
|
return new ResponseEntity<>(devicesafetyqtyqueryService.queryAll(whereJson, page), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/query2")
|
||||||
|
@Log("备件安全库存查询")
|
||||||
|
@ApiOperation("备件安全库存查询")
|
||||||
|
public ResponseEntity<Object> query2(@RequestParam Map whereJson, Pageable page) {
|
||||||
|
return new ResponseEntity<>(devicesafetyqtyqueryService.queryAll2(whereJson, page), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增备件安全库存查询")
|
@Log("新增备件安全库存查询")
|
||||||
@ApiOperation("新增备件安全库存查询")
|
@ApiOperation("新增备件安全库存查询")
|
||||||
|
|||||||
@@ -24,6 +24,14 @@ public interface DevicesafetyqtyqueryService {
|
|||||||
* @return Map<String, Object>
|
* @return Map<String, Object>
|
||||||
*/
|
*/
|
||||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
*
|
||||||
|
* @param whereJson 条件
|
||||||
|
* @param page 分页参数
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> queryAll2(Map whereJson, Pageable page);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有数据不分页
|
* 查询所有数据不分页
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.nl.exception.BadRequestException;
|
import org.nl.exception.BadRequestException;
|
||||||
import org.nl.utils.FileUtil;
|
import org.nl.utils.FileUtil;
|
||||||
import org.nl.utils.SecurityUtils;
|
import org.nl.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
|
||||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||||
import org.nl.wms.sb.stat.service.DevicesafetyqtyqueryService;
|
import org.nl.wms.sb.stat.service.DevicesafetyqtyqueryService;
|
||||||
import org.nl.wms.sb.stat.service.DevicesparepartivtService;
|
import org.nl.wms.sb.stat.service.DevicesparepartivtService;
|
||||||
@@ -48,7 +49,9 @@ public class DevicesafetyqtyqueryServiceImpl implements DevicesafetyqtyqueryServ
|
|||||||
String material_code = MapUtil.getStr(whereJson, "material_code");
|
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||||
String type = MapUtil.getStr(whereJson, "type");
|
String type = MapUtil.getStr(whereJson, "type");
|
||||||
String is_all = MapUtil.getStr(whereJson, "is_all");
|
String is_all = MapUtil.getStr(whereJson, "is_all");
|
||||||
|
if(StrUtil.isEmpty(class_idStr)){
|
||||||
|
class_idStr = MaterOptTypeEnum.SPARE.getClass_idStr();
|
||||||
|
}
|
||||||
HashMap<String, String> map = new HashMap<>();
|
HashMap<String, String> map = new HashMap<>();
|
||||||
map.put("flag", "1");
|
map.put("flag", "1");
|
||||||
map.put("type",type);
|
map.put("type",type);
|
||||||
@@ -63,7 +66,35 @@ public class DevicesafetyqtyqueryServiceImpl implements DevicesafetyqtyqueryServ
|
|||||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||||
map.put("classIds", classIds);
|
map.put("classIds", classIds);
|
||||||
}
|
}
|
||||||
JSONObject json = WQL.getWO("EM_DEVICESAFETQTYQUERY001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "a.material_id DESC");
|
JSONObject json = WQL.getWO("EM_DEVICESAFETQTYQUERY001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "a.material_code");
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryAll2(Map whereJson, Pageable page) {
|
||||||
|
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||||
|
String class_idStr = (String) whereJson.get("class_idStr");
|
||||||
|
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||||
|
String type = MapUtil.getStr(whereJson, "type");
|
||||||
|
String is_all = MapUtil.getStr(whereJson, "is_all");
|
||||||
|
if(StrUtil.isEmpty(class_idStr)){
|
||||||
|
class_idStr = MaterOptTypeEnum.BCP_AND_YL_AND_FL.getClass_idStr();
|
||||||
|
}
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
map.put("flag", "2");
|
||||||
|
map.put("type",type);
|
||||||
|
map.put("is_all",is_all);
|
||||||
|
if (ObjectUtil.isNotEmpty(material_code)) map.put("material_code", "%"+material_code+"%");
|
||||||
|
//处理物料当前节点的所有子节点
|
||||||
|
if (StrUtil.isNotEmpty(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_DEVICESAFETQTYQUERY001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "a.material_code");
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,4 +113,71 @@
|
|||||||
|
|
||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDPAGEQUERY
|
ENDPAGEQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "2"
|
||||||
|
PAGEQUERY
|
||||||
|
SELECT
|
||||||
|
a.material_id,
|
||||||
|
a.material_code,
|
||||||
|
a.material_name,
|
||||||
|
a.class_name,
|
||||||
|
a.safe_ivt_down,
|
||||||
|
a.ivt_qty,
|
||||||
|
a.qty_unit_name
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
mater.material_id,
|
||||||
|
mater.material_code,
|
||||||
|
mater.material_name,
|
||||||
|
class.class_name,
|
||||||
|
(
|
||||||
|
CASE
|
||||||
|
WHEN fivt.safe_ivt_down is null THEN 0 ELSE fivt.safe_ivt_down
|
||||||
|
END
|
||||||
|
) AS safe_ivt_down,
|
||||||
|
(
|
||||||
|
CASE
|
||||||
|
WHEN pivt.ivt_qty is null THEN 0 ELSE pivt.ivt_qty
|
||||||
|
END
|
||||||
|
) AS ivt_qty,
|
||||||
|
unit.unit_name AS qty_unit_name
|
||||||
|
FROM
|
||||||
|
md_me_materialbase mater
|
||||||
|
LEFT JOIN md_pb_classstandard class ON mater.material_type_id = class.class_id
|
||||||
|
LEFT JOIN ST_IVT_MaterialSafeIvt fivt ON fivt.material_id = mater.material_id
|
||||||
|
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = mater.base_unit_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
SUM(ivt.ivt_qty) AS ivt_qty,
|
||||||
|
ivt.material_id
|
||||||
|
FROM
|
||||||
|
st_ivt_structivt ivt
|
||||||
|
WHERE
|
||||||
|
1=1
|
||||||
|
group by ivt.material_id
|
||||||
|
) pivt ON pivt.material_id = mater.material_id
|
||||||
|
WHERE
|
||||||
|
1=1
|
||||||
|
|
||||||
|
OPTION 输入.classIds <> ""
|
||||||
|
class.class_id in 输入.classIds
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.material_code <> ""
|
||||||
|
(mater.material_code like 输入.material_code or
|
||||||
|
mater.material_name like 输入.material_code)
|
||||||
|
ENDOPTION
|
||||||
|
) AS a
|
||||||
|
|
||||||
|
WHERE
|
||||||
|
1=1
|
||||||
|
|
||||||
|
OPTION 输入.is_all <> "0"
|
||||||
|
a.safe_ivt_down > a.ivt_qty
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDPAGEQUERY
|
||||||
|
ENDIF
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ export default {
|
|||||||
url: 'api/devicesafetyqtyquery',
|
url: 'api/devicesafetyqtyquery',
|
||||||
idField: 'stockrecord_id',
|
idField: 'stockrecord_id',
|
||||||
sort: 'stockrecord_id,desc',
|
sort: 'stockrecord_id,desc',
|
||||||
|
query: { is_all: '1' },
|
||||||
crudMethod: { ...crudDevicesafetyqtyquery },
|
crudMethod: { ...crudDevicesafetyqtyquery },
|
||||||
optShow: {
|
optShow: {
|
||||||
add: false,
|
add: false,
|
||||||
|
|||||||
290
mes/qd/src/views/wms/sb/stat/safetyqtyquery/index.vue
Normal file
290
mes/qd/src/views/wms/sb/stat/safetyqtyquery/index.vue
Normal file
@@ -0,0 +1,290 @@
|
|||||||
|
<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="模糊查询">
|
||||||
|
<el-input
|
||||||
|
v-model="query.material_code"
|
||||||
|
clearable
|
||||||
|
placeholder="编码、名称"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="仅显示预警" label-width="120px">
|
||||||
|
<el-switch v-model="query.is_all" active-value="1" inactive-value="0" @change="crud.toQuery()"/>
|
||||||
|
</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-check"
|
||||||
|
size="mini"
|
||||||
|
@click="downdtl"
|
||||||
|
>
|
||||||
|
导出Excel
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<el-table ref="table" border :cell-style="cellStyle" 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="material_code" label="物料编码" />
|
||||||
|
<el-table-column prop="material_name" label="物料名称" />
|
||||||
|
<el-table-column prop="class_name" label="物料分类" />
|
||||||
|
<el-table-column prop="safe_ivt_down" label="安全库存下限" :formatter="crud.formatNum2" />
|
||||||
|
<el-table-column prop="ivt_qty" label="库存" :formatter="crud.formatNum2" />
|
||||||
|
<el-table-column prop="qty_unit_name" label="单位" />
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudDevicesafetyqtyquery from '@/api/wms/sb/devicesafetyqtyquery'
|
||||||
|
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
|
import crudOperation from '@crud/CRUD.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'
|
||||||
|
|
||||||
|
const defaultForm = { }
|
||||||
|
export default {
|
||||||
|
name: 'safetyqtyquery',
|
||||||
|
components: { pagination, crudOperation, rrOperation, Treeselect },
|
||||||
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '安全库存预警',
|
||||||
|
url: 'api/devicesafetyqtyquery/query2',
|
||||||
|
idField: 'stockrecord_id',
|
||||||
|
sort: '',
|
||||||
|
query: { is_all: '1' },
|
||||||
|
crudMethod: { ...crudDevicesafetyqtyquery },
|
||||||
|
optShow: {
|
||||||
|
add: false,
|
||||||
|
edit: false,
|
||||||
|
del: false,
|
||||||
|
download: false,
|
||||||
|
reset: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
classes: [],
|
||||||
|
class_idStr: null,
|
||||||
|
materOpt_code: '28',
|
||||||
|
deviceTypeList: [
|
||||||
|
{ 'label': '超上限', 'value': '01' },
|
||||||
|
{ 'label': '超下限', 'value': '02' },
|
||||||
|
{ 'label': '正常', 'value': '03' }
|
||||||
|
],
|
||||||
|
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: {
|
||||||
|
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
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
downdtl() {
|
||||||
|
if (this.currentRow !== null) {
|
||||||
|
crud.downloadLoading = true
|
||||||
|
download('/api/devicesafetyqtyquery/download', this.crud.query).then(result => {
|
||||||
|
downloadFile(result, '备件安全库存量', 'xlsx')
|
||||||
|
crud.downloadLoading = false
|
||||||
|
}).catch(() => {
|
||||||
|
crud.downloadLoading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cellStyle({ row, column, rowIndex, columnIndex }) {
|
||||||
|
const safe_ivt_down = parseInt(row.safe_ivt_down)
|
||||||
|
const ivt_qty = parseInt(row.ivt_qty)
|
||||||
|
|
||||||
|
if (column.property === 'ivt_qty') {
|
||||||
|
if (ivt_qty < safe_ivt_down) {
|
||||||
|
return 'background: red'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (safe_ivt_down <= ivt_qty) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
::v-deep {
|
||||||
|
|
||||||
|
.vue-treeselect__menu {
|
||||||
|
|
||||||
|
overflow-x: auto !important;
|
||||||
|
|
||||||
|
width: 300px;
|
||||||
|
|
||||||
|
max-height: 300px !important;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.vue-treeselect__label {
|
||||||
|
|
||||||
|
overflow: unset;
|
||||||
|
|
||||||
|
text-overflow: unset;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.vue-treeselect__control {
|
||||||
|
|
||||||
|
height: 20px !important;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.vue-treeselect__multi-value-item-container,
|
||||||
|
|
||||||
|
.vue-treeselect--has-value .vue-treeselect__multi-value {
|
||||||
|
|
||||||
|
height: 30px;
|
||||||
|
|
||||||
|
line-height: 24px;
|
||||||
|
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.vue-treeselect__limit-tip,
|
||||||
|
|
||||||
|
.vue-treeselect--searchable.vue-treeselect--multi.vue-treeselect--has-value
|
||||||
|
|
||||||
|
.vue-treeselect__input-container {
|
||||||
|
|
||||||
|
padding-top: 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.vue-treeselect__placeholder,
|
||||||
|
|
||||||
|
.vue-treeselect__single-value {
|
||||||
|
|
||||||
|
height: 28px;
|
||||||
|
|
||||||
|
line-height: 32px;
|
||||||
|
|
||||||
|
font-size: small;
|
||||||
|
|
||||||
|
color: "#CCCFD6";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.vue-treeselect--has-value .vue-treeselect__input {
|
||||||
|
|
||||||
|
height: 18px !important;
|
||||||
|
|
||||||
|
line-height: 18px !important;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.vue-treeselect div,
|
||||||
|
|
||||||
|
.vue-treeselect span {
|
||||||
|
|
||||||
|
box-sizing: content-box;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.vue-treeselect__multi-value-label {
|
||||||
|
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
width: 140px;
|
||||||
|
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.vue-treeselect__value-container {
|
||||||
|
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
height: 32px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user