2022-06-27 09:50:26 +08:00
|
|
|
|
<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="仓库">
|
|
|
|
|
|
<label slot="label">仓 库:</label>
|
|
|
|
|
|
<el-select
|
|
|
|
|
|
v-model="query.stor_id"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
style="width: 220px;"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
|
class="filter-item"
|
|
|
|
|
|
@change="hand"
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
v-for="item in this.storList"
|
|
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:value="item.value"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="日期">
|
|
|
|
|
|
<label slot="label">日 期:</label>
|
|
|
|
|
|
<el-date-picker
|
|
|
|
|
|
v-model="query.createTime"
|
|
|
|
|
|
type="daterange"
|
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
|
end-placeholder="结束日期"
|
|
|
|
|
|
@change="crud.toQuery"
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="物料编码">
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
style="width: 220px"
|
|
|
|
|
|
v-model="query.material_code"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
placeholder="物料编码、名称"
|
|
|
|
|
|
@keyup.enter.native="crud.toQuery"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="批次">
|
|
|
|
|
|
<label slot="label">批 次:</label>
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
style="width: 220px"
|
|
|
|
|
|
v-model="query.pcsn"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
placeholder="请输入批次"
|
|
|
|
|
|
@keyup.enter.native="crud.toQuery"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="物料类别">
|
|
|
|
|
|
<treeselect
|
|
|
|
|
|
v-model="query.material_type_id"
|
|
|
|
|
|
:load-options="loadClass"
|
|
|
|
|
|
:options="classes"
|
|
|
|
|
|
style="width: 220px;"
|
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<rrOperation/>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
|
|
|
|
|
<crudOperation :permission="permission"/>
|
|
|
|
|
|
<!--表格渲染-->
|
2022-08-25 11:26:42 +08:00
|
|
|
|
<el-table ref="table" show-summary :summary-method="getSum" :max-height="550" v-loading="crud.loading" :data="crud.data" size="mini"
|
2022-06-27 09:50:26 +08:00
|
|
|
|
style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
|
|
|
|
|
<el-table-column prop="class_name" label="物料分类"/>
|
|
|
|
|
|
<el-table-column prop="material_code" label="物料编码" min-width="150" show-overflow-tooltip/>
|
|
|
|
|
|
<el-table-column prop="material_name" label="物料名称" min-width="150" show-overflow-tooltip/>
|
|
|
|
|
|
<el-table-column prop="pcsn" label="批次" min-width="120" show-overflow-tooltip/>
|
|
|
|
|
|
<el-table-column prop="quality_scode" label="品质类型" :formatter="formatQualityName" />
|
|
|
|
|
|
<el-table-column prop="ivt_level" label="库存等级" :formatter="formatIvtName" />
|
|
|
|
|
|
<el-table-column prop="is_active" label="是否可用" :formatter="formatIsName" />
|
|
|
|
|
|
<el-table-column prop="unit_name" label="单位"/>
|
|
|
|
|
|
<el-table-column prop="start_num" label="期初数" :formatter="crud.formatNum3"/>
|
|
|
|
|
|
<el-table-column prop="in_num" label="入库数" :formatter="crud.formatNum3"/>
|
|
|
|
|
|
<el-table-column prop="out_num" label="出库数" :formatter="crud.formatNum3"/>
|
|
|
|
|
|
<el-table-column prop="less_num" label="其他出" :formatter="crud.formatNum3"/>
|
|
|
|
|
|
<el-table-column prop="more_num" label="其他入" :formatter="crud.formatNum3"/>
|
|
|
|
|
|
<el-table-column prop="end_num" label="结存" :formatter="crud.formatNum3"/>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
<!--分页组件-->
|
|
|
|
|
|
<pagination/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import crudIostordaily from '@/api/wms/statistics/iostordaily'
|
|
|
|
|
|
import CRUD, {crud, form, header, presenter} 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 DateRangePicker from '@/components/DateRangePicker'
|
|
|
|
|
|
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 crudBucketrecord from "@/api/wms/basedata/master/bucketrecord";
|
|
|
|
|
|
|
|
|
|
|
|
const defaultForm = {
|
|
|
|
|
|
stordaily_id: null,
|
|
|
|
|
|
stor_id: null,
|
|
|
|
|
|
stor_code: null,
|
|
|
|
|
|
stor_name: null,
|
|
|
|
|
|
sect_date: null,
|
|
|
|
|
|
material_id: null,
|
|
|
|
|
|
quality_scode: null,
|
|
|
|
|
|
pcsn: null,
|
|
|
|
|
|
ivt_level: null,
|
|
|
|
|
|
is_active: null,
|
|
|
|
|
|
start_num: null,
|
|
|
|
|
|
in_num: null,
|
|
|
|
|
|
out_num: null,
|
|
|
|
|
|
more_num: null,
|
|
|
|
|
|
less_num: null,
|
|
|
|
|
|
end_num: null,
|
|
|
|
|
|
qty_unit_id: null,
|
|
|
|
|
|
qty_unit_name: null
|
|
|
|
|
|
}
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'SendReceiveQuery',
|
|
|
|
|
|
components: {pagination, crudOperation, rrOperation, udOperation, DateRangePicker, Treeselect},
|
|
|
|
|
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
|
|
|
|
|
cruds() {
|
|
|
|
|
|
return CRUD({
|
|
|
|
|
|
title: '收发存查询',
|
|
|
|
|
|
url: 'api/iostordaily',
|
|
|
|
|
|
idField: 'stordaily_id',
|
|
|
|
|
|
sort: '',
|
|
|
|
|
|
crudMethod: {...crudIostordaily},
|
2022-08-25 11:26:42 +08:00
|
|
|
|
props: {
|
|
|
|
|
|
// 每页数据条数
|
|
|
|
|
|
size: 20
|
|
|
|
|
|
},
|
2022-06-27 09:50:26 +08:00
|
|
|
|
optShow: {
|
|
|
|
|
|
add: false,
|
|
|
|
|
|
edit: false,
|
|
|
|
|
|
del: false,
|
|
|
|
|
|
download: false,
|
|
|
|
|
|
reset: true
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
permission: {},
|
|
|
|
|
|
classes: [],
|
|
|
|
|
|
QualityList: [],
|
|
|
|
|
|
IvtList: [],
|
|
|
|
|
|
class_idStr: null,
|
|
|
|
|
|
storList: []
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
|
|
|
crudIostordaily.getStor().then(res => {
|
|
|
|
|
|
this.storList = res
|
|
|
|
|
|
})
|
|
|
|
|
|
const param = {
|
|
|
|
|
|
'materOpt_code': '00'
|
|
|
|
|
|
}
|
|
|
|
|
|
crudMaterialbase.getMaterOptType(param).then(res => {
|
|
|
|
|
|
this.class_idStr = res.class_idStr
|
|
|
|
|
|
this.crud.query.class_idStr = res.class_idStr
|
|
|
|
|
|
this.queryClassId()
|
|
|
|
|
|
})
|
|
|
|
|
|
crudBucketrecord.getQualityList().then(res => {
|
|
|
|
|
|
this.QualityList = res
|
|
|
|
|
|
})
|
|
|
|
|
|
crudBucketrecord.getIvtList().then(res => {
|
|
|
|
|
|
this.IvtList = res
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
|
|
|
|
|
[CRUD.HOOK.beforeRefresh]() {
|
|
|
|
|
|
return true
|
|
|
|
|
|
},
|
|
|
|
|
|
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
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
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)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
hand(value) {
|
|
|
|
|
|
this.crud.toQuery()
|
|
|
|
|
|
},
|
|
|
|
|
|
formatIvtName(row, column) {
|
|
|
|
|
|
for (const item of this.IvtList) {
|
|
|
|
|
|
if (item.code === row.ivt_level) {
|
|
|
|
|
|
return item.name
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
formatQualityName(row, column) {
|
|
|
|
|
|
for (const item of this.QualityList) {
|
|
|
|
|
|
if (item.code === row.quality_scode) {
|
|
|
|
|
|
return item.name
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
formatIsName(row, column) {
|
|
|
|
|
|
if (row.is_active === '1') {
|
|
|
|
|
|
return '是'
|
|
|
|
|
|
} else if (row.is_active === '0') {
|
|
|
|
|
|
return '否'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
getSum(param) {
|
|
|
|
|
|
// 将所有number的字段合计
|
|
|
|
|
|
const {columns, data} = param
|
|
|
|
|
|
const sums = []
|
|
|
|
|
|
let values = []
|
|
|
|
|
|
columns.forEach((column, index) => {
|
|
|
|
|
|
if (index === 1) {
|
|
|
|
|
|
sums[index] = '合计'
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
values = data.map(item => Number(item[column.property]))
|
|
|
|
|
|
if (column.property === 'start_num') {
|
|
|
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
|
|
|
|
const value = Number(curr)
|
|
|
|
|
|
if (!isNaN(value)) {
|
|
|
|
|
|
return prev + curr
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return prev
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 0)
|
|
|
|
|
|
sums[index] = sums[index].toFixed(3) + 'kg' // 保留三位小数
|
|
|
|
|
|
} else if (column.property === 'in_num') {
|
|
|
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
|
|
|
|
const value = Number(curr)
|
|
|
|
|
|
if (!isNaN(value)) {
|
|
|
|
|
|
return prev + curr
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return prev
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 0)
|
|
|
|
|
|
sums[index] = sums[index].toFixed(3) + 'kg' // 保留三位小数
|
|
|
|
|
|
} else if (column.property === 'out_num') {
|
|
|
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
|
|
|
|
const value = Number(curr)
|
|
|
|
|
|
if (!isNaN(value)) {
|
|
|
|
|
|
return prev + curr
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return prev
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 0)
|
|
|
|
|
|
sums[index] = sums[index].toFixed(3) + 'kg' // 保留三位小数
|
|
|
|
|
|
} else if (column.property === 'end_num') {
|
|
|
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
|
|
|
|
const value = Number(curr)
|
|
|
|
|
|
if (!isNaN(value)) {
|
|
|
|
|
|
return prev + curr
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return prev
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 0)
|
|
|
|
|
|
sums[index] = sums[index].toFixed(3) + 'kg' // 保留三位小数
|
|
|
|
|
|
} else if (column.property === 'more_num') {
|
|
|
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
|
|
|
|
const value = Number(curr)
|
|
|
|
|
|
if (!isNaN(value)) {
|
|
|
|
|
|
return prev + curr
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return prev
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 0)
|
|
|
|
|
|
sums[index] = sums[index].toFixed(3) + 'kg' // 保留三位小数
|
|
|
|
|
|
} else if (column.property === 'less_num') {
|
|
|
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
|
|
|
|
const value = Number(curr)
|
|
|
|
|
|
if (!isNaN(value)) {
|
|
|
|
|
|
return prev + curr
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return prev
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 0)
|
|
|
|
|
|
sums[index] = sums[index].toFixed(3) + 'kg' // 保留三位小数
|
|
|
|
|
|
} else {
|
|
|
|
|
|
sums[index] = '--'
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
return sums
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|