420 lines
15 KiB
Vue
420 lines
15 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<el-form :model="queryParams" size="small" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
|
|
<el-form-item label="工单号">
|
|
<el-input v-model="queryParams.workorder"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="零件号">
|
|
<el-input v-model="queryParams.partnumber"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="外箱标签">
|
|
<el-input v-model="queryParams.packcode"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="开始日期">
|
|
<el-date-picker
|
|
:style="{ width: inputWidth }"
|
|
v-model="queryParams.starttime"
|
|
type="datetime"
|
|
placeholder="选择日期时间"
|
|
align="right"
|
|
:picker-options="pickerOptions"
|
|
value-format="yyyy-MM-dd hh:mm:ss"
|
|
>
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
<el-form-item label="结束日期">
|
|
<el-date-picker
|
|
:style="{ width: inputWidth }"
|
|
v-model="queryParams.endtime"
|
|
type="datetime"
|
|
placeholder="选择日期时间"
|
|
align="right"
|
|
:picker-options="pickerOptions"
|
|
value-format="yyyy-MM-dd hh:mm:ss"
|
|
>
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
<el-button type="danger" round size="mini" @click="forceGeneration">强制生成</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
<!-- 一级菜单区 -->
|
|
<el-table :data="firstLevel_dataList" v-loading="loading" ref="table" border highlight-current-row>
|
|
<!-- <el-table-column prop="id" label="主键" align="center" /> -->
|
|
<el-table-column prop="workorder" label="工单号" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="partnumber" label="零件号" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="productDescription" label="产品描述" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="specifications" label="规格" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="colour" label="颜色" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="packnum" label="箱子个数" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="previousNumber" label="上件数" align="center" />
|
|
<el-table-column prop="productionNum" label="已打印产品总数" align="center" />
|
|
|
|
<el-table-column label="检验结果" align="center">
|
|
<template slot-scope="scope">
|
|
<el-progress
|
|
:width="100"
|
|
type="circle"
|
|
:percentage="calculate_percentage(scope.row.result_good, scope.row.result_bad, scope.row.result_null)"
|
|
></el-progress>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="检验" align="center" width="140">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
size="mini"
|
|
v-hasPermi="['wmsManagement:wmfgentryinspect:edit']"
|
|
type="success"
|
|
icon="el-icon-edit"
|
|
title="编辑"
|
|
@click="handle_secondLevel(scope.row.workorder)"
|
|
></el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="createdTime" label="创建时间" align="center" :show-overflow-tooltip="true" />
|
|
</el-table>
|
|
<pagination
|
|
class="mt10"
|
|
background
|
|
:total="queryParams.total"
|
|
:page.sync="queryParams.pageNum"
|
|
:limit.sync="queryParams.pageSize"
|
|
@pagination="getList_first"
|
|
/>
|
|
|
|
<!-- 二级菜单区 -->
|
|
<el-dialog :title="first_level.title" :lock-scroll="false" :visible.sync="first_level.open" width="1200px" :show-close="false" :close-on-click-modal="false">
|
|
<!-- 工具区 -->
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
|
<el-button type="success" plain @click="batchQualified">批量合格</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button type="danger" plain @click="batchUnqualified">批量不合格</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button type="success" round @click="allQualified">一键全部合格</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button type="danger" round @click="allUnQualified">一键全部不合格</el-button>
|
|
</el-col>
|
|
|
|
<el-col :span="10">
|
|
本页合格率
|
|
<el-progress :text-inside="true" :stroke-width="24" :percentage="percentage" status="success"></el-progress>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<!-- 数据区域 -->
|
|
<el-table
|
|
:data="secondLevel_dataList"
|
|
ref="table"
|
|
border
|
|
highlight-current-row
|
|
@selection-change="handleSelectionChange"
|
|
v-loading="second_loading"
|
|
>
|
|
<el-table-column type="selection" width="50" align="center" label="合格" />
|
|
<el-table-column prop="workorder" label="工单号" align="center" width="150" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="partnumber" label="零件号" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="packcode" label="外箱标签" align="center" width="190" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="machine" label="工位" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="productionNum" label="箱子里产品个数" align="center" />
|
|
<el-table-column prop="productDescription" label="产品描述" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="specifications" label="规格" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="colour" label="颜色" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="bfilled" label="是否满箱" align="center" />
|
|
<el-table-column label="检验结果" align="center">
|
|
<template slot-scope="scope">
|
|
<el-tag type="success" v-if="scope.row.result == 1">合格</el-tag>
|
|
<el-tag type="danger" v-else-if="scope.row.result == 2">不合格</el-tag>
|
|
<el-tag type="info" v-else>未检</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<pagination
|
|
class="mt10"
|
|
background
|
|
:total="second_queryParams.total"
|
|
:page.sync="second_queryParams.pageNum"
|
|
:limit.sync="second_queryParams.pageSize"
|
|
@pagination="getList_second"
|
|
/>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="text" @click="confirm">取 消</el-button>
|
|
<el-button type="primary" @click="confirm">确 定</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import {
|
|
listWmFgentryInspect,
|
|
listWmFgentryInspect_firstLevel,
|
|
listWmFgentryInspect_secondLevel,
|
|
setTheBoxToBeQualified,
|
|
setAllQualified,
|
|
setAllUnQualified,
|
|
setTheBoxToBeUnQualified,
|
|
addWmFgentryInspect,
|
|
delWmFgentryInspect,
|
|
updateWmFgentryInspect,
|
|
getWmFgentryInspect,
|
|
} from '@/api/wmsManagement/wmFgentryInspect.js'
|
|
|
|
import { convertToIncomingInspectionData } from '@/api/wmsManagement/wmFgentryInspect.js'
|
|
export default {
|
|
name: 'wmfgentryinspect',
|
|
data() {
|
|
return {
|
|
pickerOptions: {
|
|
shortcuts: [
|
|
{
|
|
text: '今天',
|
|
onClick(picker) {
|
|
picker.$emit('pick', new Date())
|
|
},
|
|
},
|
|
{
|
|
text: '昨天',
|
|
onClick(picker) {
|
|
const date = new Date()
|
|
date.setTime(date.getTime() - 3600 * 1000 * 24)
|
|
picker.$emit('pick', date)
|
|
},
|
|
},
|
|
{
|
|
text: '一周前',
|
|
onClick(picker) {
|
|
const date = new Date()
|
|
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
|
|
picker.$emit('pick', date)
|
|
},
|
|
},
|
|
],
|
|
},
|
|
inputWidth: '180',
|
|
labelWidth: '100',
|
|
formLabelWidth: '100',
|
|
// 选中id数组
|
|
packcode_select: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
// 遮罩层
|
|
loading: false,
|
|
second_loading: false,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 查询参数
|
|
queryParams: {
|
|
starttime: null,
|
|
endtime: null,
|
|
workorder: '',
|
|
partnumber: '',
|
|
packcode: '',
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
sort: undefined,
|
|
sortType: undefined,
|
|
// 总记录数
|
|
total: 0,
|
|
},
|
|
second_queryParams: {
|
|
workorder: '',
|
|
partnumber: '',
|
|
packcode: '',
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
// 总记录数
|
|
total: 0,
|
|
},
|
|
// 弹出层标题
|
|
title: '',
|
|
// 操作类型 1、add 2、edit
|
|
opertype: 0,
|
|
// 是否显示弹出层
|
|
open: false,
|
|
// 表单参数
|
|
form: {},
|
|
columns: [
|
|
{ index: 0, key: 'id', label: `主键`, checked: true },
|
|
{ index: 1, key: 'workorder', label: `工单号`, checked: true },
|
|
{ index: 2, key: 'packcode', label: `箱子号`, checked: true },
|
|
{ index: 3, key: 'machine', label: `工位`, checked: true },
|
|
{ index: 4, key: 'productionNum', label: `箱子里产品个数`, checked: true },
|
|
{ index: 5, key: 'partnumber', label: `零件号`, checked: true },
|
|
{ index: 6, key: 'bfilled', label: `是否满箱`, checked: true },
|
|
{ index: 7, key: 'result', label: `检验结果`, checked: true },
|
|
{ index: 8, key: 'createdBy', label: `创建人`, checked: true },
|
|
{ index: 9, key: 'createdTime', label: `创建时间`, checked: false },
|
|
{ index: 10, key: 'updatedBy', label: `更新人`, checked: false },
|
|
{ index: 11, key: 'updatedTime', label: `更新时间`, checked: false },
|
|
],
|
|
// 一级 数据列表
|
|
firstLevel_dataList: [],
|
|
secondLevel_dataList: [],
|
|
|
|
// 提交按钮是否显示
|
|
btnSubmitVisible: true,
|
|
// 表单校验
|
|
rules: {
|
|
packcode: [{ required: true, message: '箱子号不能为空', trigger: 'blur' }],
|
|
},
|
|
first_level: {
|
|
title: '检验',
|
|
open: false,
|
|
},
|
|
full_loading: null,
|
|
workorder_selected: '',
|
|
percentage: 0,
|
|
}
|
|
},
|
|
created() {
|
|
const now = new Date()
|
|
this.queryParams.starttime = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0)
|
|
this.queryParams.endtime = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999)
|
|
|
|
// 列表数据查询
|
|
this.getList_first()
|
|
},
|
|
computed: {},
|
|
methods: {
|
|
calculate_percentage(result_good, result_bad, result_null) {
|
|
if (result_good + result_bad == 0) {
|
|
return 0
|
|
}
|
|
return Math.floor((result_good / (result_good + result_bad + result_null)) * 100)
|
|
},
|
|
//todo 一级菜单调 二级
|
|
handle_secondLevel(workorder) {
|
|
this.first_level.open = true
|
|
this.first_level.title = '检验:' + workorder
|
|
this.full_loading = this.$loading({
|
|
lock: true,
|
|
text: 'Loading',
|
|
spinner: 'el-icon-loading',
|
|
background: 'rgba(0, 0, 0, 0.7)',
|
|
})
|
|
this.workorder_selected = workorder
|
|
// 获取二级菜单目录
|
|
this.getList_second(workorder)
|
|
},
|
|
|
|
//todo 获取一级菜单目录
|
|
getList_first() {
|
|
this.loading = true
|
|
listWmFgentryInspect_firstLevel(this.queryParams).then((res) => {
|
|
if (res.code == 200) {
|
|
this.firstLevel_dataList = res.data.result
|
|
this.queryParams.total = res.data.totalNum
|
|
this.loading = false
|
|
}
|
|
})
|
|
},
|
|
|
|
// 获取二级菜单目录
|
|
getList_second() {
|
|
this.full_loading.close()
|
|
this.second_loading = true
|
|
this.second_queryParams.workorder = this.workorder_selected
|
|
listWmFgentryInspect_secondLevel(this.second_queryParams).then((res) => {
|
|
if (res.code == 200) {
|
|
this.secondLevel_dataList = res.data.result
|
|
this.second_queryParams.total = res.data.totalNum
|
|
this.second_loading = false
|
|
this.calculateQualificationRate()
|
|
}
|
|
})
|
|
},
|
|
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
this.packcode_select = selection.map((item) => item.packcode)
|
|
this.single = selection.length != 1
|
|
this.multiple = !selection.length
|
|
},
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
this.queryParams.pageNum = 1
|
|
this.getList_first()
|
|
},
|
|
// 重置查询操作
|
|
resetQuery() {
|
|
this.resetForm('queryForm')
|
|
this.handleQuery()
|
|
},
|
|
//todo 批量合格
|
|
batchQualified() {
|
|
if (this.packcode_select.length > 0) {
|
|
const query = this.packcode_select
|
|
setTheBoxToBeQualified(query).then((res) => {
|
|
if (res.code == 200) {
|
|
this.getList_second(this.workorder_selected)
|
|
}
|
|
})
|
|
}
|
|
},
|
|
//todo 一键全部合格
|
|
allQualified() {
|
|
const query = { workorder_selected: this.workorder_selected }
|
|
setAllQualified(query).then((res) => {
|
|
if (res.code == 200) {
|
|
this.getList_second(this.workorder_selected)
|
|
}
|
|
})
|
|
},
|
|
//todo 批量不合格
|
|
batchUnqualified() {
|
|
if (this.packcode_select.length > 0) {
|
|
const query = this.packcode_select
|
|
setTheBoxToBeUnQualified(query).then((res) => {
|
|
if (res.code == 200) {
|
|
this.getList_second(this.workorder_selected)
|
|
}
|
|
})
|
|
}
|
|
},
|
|
|
|
//todo 一键全部合格
|
|
allUnQualified() {
|
|
const query = { workorder_selected: this.workorder_selected }
|
|
setAllUnQualified(query).then((res) => {
|
|
if (res.code == 200) {
|
|
this.getList_second(this.workorder_selected)
|
|
}
|
|
})
|
|
},
|
|
//todo 计算合格率
|
|
calculateQualificationRate() {
|
|
let qualifiedQuantity = this.secondLevel_dataList.filter((it) => it.result == 1).length
|
|
let qualifiedUnQuantity = this.secondLevel_dataList.filter((it) => it.result == 2).length
|
|
if (qualifiedQuantity + qualifiedUnQuantity != 0) {
|
|
this.percentage = Math.floor((qualifiedQuantity / (qualifiedQuantity + qualifiedUnQuantity)) * 100)
|
|
}
|
|
},
|
|
confirm() {
|
|
this.first_level.open = false
|
|
this.getList_first()
|
|
},
|
|
// 强制生成报表
|
|
forceGeneration() {
|
|
if (this.queryParams.workorder == '' || this.queryParams.workorder == undefined) {
|
|
this.$notify.warning('工单号为空 ,不能生成报表')
|
|
return
|
|
}
|
|
// 入库检验数据转换
|
|
const quest = { workorder: this.queryParams.workorder }
|
|
convertToIncomingInspectionData(quest).then((res) => {
|
|
if (res.code == 200) {
|
|
this.$alert('生成报表' + res.data + '数据')
|
|
}
|
|
})
|
|
},
|
|
},
|
|
}
|
|
</script>
|