Files
FLX_MES_Manage_View/src/views/ProcessManagement/MaterialVerificationMaintenance/index.vue
2026-05-29 16:32:43 +08:00

1293 lines
54 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="app-container mes-admin-page">
<el-card class="topCard">
<div class="topDiv materialToolbar">
<span style="margin-left: 10px">{{ $t('materialVerificationMaintenance.stationNumberLabel') }}</span>
<el-select v-model="stationNumberValue" clearable :placeholder="$t('materialVerificationMaintenance.selectStationNumber')" size="small" style="width: 250px" @change="searchOrder">
<el-option
v-for="item in stationNumber"
:key="item.value"
:label="item.label"
:value="item.value"
size="mini"/>
</el-select>
<span style="margin-left: 10px">{{ $t('materialVerificationMaintenance.productModelLabel') }}</span>
<el-select v-model="engineTypeValue" :placeholder="$t('materialVerificationMaintenance.selectProductModel')" size="small" style="width: 150px" @change="searchOrder">
<el-option
v-for="item in engineType"
:key="item.value"
:label="item.label"
:value="item.value"
size="mini"/>
</el-select>
<!-- <span style="margin-left: 10px">版本号</span>-->
<!-- <el-select v-model="version" placeholder="请选择版本号" size="small" style="width: 150px" @change="searchOrder">-->
<!-- <el-option-->
<!-- v-for="item in versionList"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- size="mini"/>-->
<!-- </el-select>-->
<!-- <span style="margin-left: 10px">物料号</span>-->
<!-- <el-input v-model="materialCode" style="width:170px;" clearable placeholder="物料号" size="small"/>-->
<!-- <span style="margin-left: 10px">是否验证</span>-->
<!-- <el-select v-model="isVerification" placeholder="是否验证" size="small" clearable style="width: 140px" @change="searchOrder()">-->
<!-- <el-option-->
<!-- v-for="item in verification"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- size="mini"/>-->
<!-- </el-select>-->
<el-button type="primary" plain size="small" icon="el-icon-search" style="margin-left: 10px" @click="searchOrder()">{{ $t('materialVerificationMaintenance.searchMaterial') }}</el-button>
<el-button type="primary" size="small" icon="el-icon-circle-plus" @click="creatOrder('form')">{{ $t('materialVerificationMaintenance.createMaterial') }}</el-button>
<!-- <el-button type="success" size="small" plain icon="el-icon-document-copy" @click="copyOrder('form4')">复制物料</el-button>-->
<!-- <el-button type="info" plain size="small" icon="el-icon-upload2" @click="importOrder('form')">物料导入</el-button>-->
<el-button type="warning" plain size="small" icon="el-icon-download" @click="exportExcel()">{{ $t('materialVerificationMaintenance.exportMaterial') }}</el-button>
</div>
<div class="tablePanel">
<el-table
v-loading="loading"
ref="multipleTable"
:data="tableData"
:header-cell-style="{background:'#eef1f6',color:'#606266'}"
:cell-class-name="tableRowClassName"
:element-loading-text="$t('materialVerificationMaintenance.loadingData')"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.2)"
class="main"
tooltip-effect="dark"
height="640px"
style="width: 100%"
border
size="mini"
@selection-change="handleSelectionChange">
<el-table-column type="index" width="60" :label="$t('materialVerificationMaintenance.sequence')" align="center"/>
<!-- <el-table-column align="center" label="物料号">-->
<!-- <template slot-scope="scope">-->
<!-- {{ scope.row.物料号 }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" :label="$t('materialVerificationMaintenance.stationNumber')" width="100px">
<template slot-scope="scope">
{{ scope.row.工位号 }}
</template>
</el-table-column>
<!-- <el-table-column align="center" label="版本号" width="100px">-->
<!-- <template slot-scope="scope">-->
<!-- {{ scope.row.版本号 }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" :label="$t('materialVerificationMaintenance.materialNumber')" width="150px">
<template slot-scope="scope">
{{ scope.row.物料号 }}
</template>
</el-table-column>
<!-- <el-table-column align="center" label="零件图号">-->
<!-- <template slot-scope="scope">-->
<!-- {{ scope.row.零件图号 }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" :label="$t('materialVerificationMaintenance.partName')" min-width="120px">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialVerificationMaintenance.materialQuantity')" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialVerificationMaintenance.isVerification')" width="100px">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否验证) === 1" size="mini" type="success">{{ $t('materialVerificationMaintenance.yes') }}</el-tag>
<span v-else>&nbsp;</span>
</template>
</el-table-column>
<!-- <el-table-column align="center" label="是否批次" width="100px">-->
<!-- <template slot-scope="scope">-->
<!-- <el-tag v-if="Number(scope.row.是否批次) === 1" size="mini" type="success"></el-tag>-->
<!-- <span v-else>&nbsp;</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" :label="$t('materialVerificationMaintenance.matchRule')" width="150px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialVerificationMaintenance.matchLength')" width="120px">
<template slot-scope="scope">
<span v-if="Number(scope.row.是否验证) === 1">{{ scope.row.条码长度 }}</span>
<span v-else>&nbsp;</span>
</template>
</el-table-column>
<!-- <el-table-column align="center" label="匹配排序" width="100px">
<template slot-scope="scope">
<span v-if="Number(scope.row.是否验证) === 1">{{ scope.row.零件排序 }}</span>
<span v-else>&nbsp;</span>
</template>
</el-table-column> -->
<!-- <el-table-column align="center" label="是否主物料">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="Number(scope.row.是否主物料) === 1"></span>-->
<!-- <span v-if="Number(scope.row.是否主物料) === 0"></span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" :label="$t('materialVerificationMaintenance.operation')" width="150">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleEdit(scope.row)">{{ $t('materialVerificationMaintenance.edit') }}</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
style="color:#ff0000;"
@click="deleteOrder(scope.row)">{{ $t('materialVerificationMaintenance.delete') }}</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible" :title="$t('materialVerificationMaintenance.createMaterial')" center style="min-height: 200px;" width="800px">
<el-form ref="form" :model="form" :rules="rules" label-position="right" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item :label="$t('materialVerificationMaintenance.stationNumber')" prop="stationNumberValue" style="display: inline-block">
<el-select v-model="form.stationNumberValue" size="small" :placeholder="$t('materialVerificationMaintenance.selectStationNumber')">
<el-option
v-for="item in stationNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('materialVerificationMaintenance.productModel')" prop="engineTypeValue" style="display: inline-block">
<el-select v-model="form.engineTypeValue" size="small" :placeholder="$t('materialVerificationMaintenance.selectProductModel')">
<el-option
v-for="item in engineType1"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item :label="$t('materialVerificationMaintenance.materialNumber')" prop="orderNumber" style="display: inline-block">
<el-input
v-model="form.orderNumber"
clearable
size="small"
:placeholder="$t('materialVerificationMaintenance.enterMaterialNumber')"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('materialVerificationMaintenance.materialName')" prop="partName" style="display: inline-block">
<el-input
v-model="form.partName"
clearable
size="small"
:placeholder="$t('materialVerificationMaintenance.materialName')"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item :label="$t('materialVerificationMaintenance.quantity')" prop="number" style="display: inline-block">
<el-input-number
v-model="form.number"
:min="1"
:step="1"
size="small"
:placeholder="$t('materialVerificationMaintenance.enterQuantity')"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('materialVerificationMaintenance.isVerification')" prop="verificationValue" style="display: inline-block">
<el-select v-model="form.verificationValue" size="small" :placeholder="$t('materialVerificationMaintenance.selectVerification')" @change="changeIsVerification">
<el-option
v-for="item in verification"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="物料版本" prop="version" style="display: inline-block">-->
<!-- <el-select v-model="form.version" size="small" placeholder="请选择物料版本">-->
<!-- <el-option-->
<!-- v-for="item in versionList"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"/>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="是否批次" prop="batchValue" style="display: inline-block">-->
<!-- <el-select v-model="form.batchValue" size="small" placeholder="请选择是否批次">-->
<!-- <el-option-->
<!-- v-for="item in verification"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"/>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row v-if="form.verificationValue === 1" style="margin: 10px 0">
<el-divider>{{ $t('materialVerificationMaintenance.verificationRuleSetting') }}</el-divider>
</el-row>
<el-row v-if="form.verificationValue === 1">
<el-col :span="10">
<el-form-item :label="$t('materialVerificationMaintenance.rule')" prop="verificationCode" style="display: inline-block">
<el-input
v-model="form.verificationCode"
clearable
size="small"
:placeholder="$t('materialVerificationMaintenance.enterMatchRule')"/>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item :label="$t('materialVerificationMaintenance.length')" prop="verificationLength" style="display: inline-block">
<el-input-number
v-model="form.verificationLength"
:min="1"
:step="1"
size="small"
:placeholder="$t('materialVerificationMaintenance.enterMatchLength')"/>
</el-form-item>
</el-col>
<!-- <el-col :span="7">
<el-form-item label="排序" prop="verificationOrder" style="display: inline-block">
<el-input-number
v-model="form.verificationOrder"
:min="0"
:step="1"
size="small"
placeholder="请输入匹配排序"/>
</el-form-item>
</el-col> -->
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="callOff('form')">{{ $t('common.cancel') }}</el-button>
<el-button type="primary" size="small" @click="submitAdd('form')">{{ $t('common.confirm') }}</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible1" :title="$t('materialVerificationMaintenance.editMaterial')" center style="min-height: 200px;" width="800px">
<el-form ref="form" :model="form1" :rules="rules1" label-position="right" label-width="120px">
<!-- <el-row>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="工位号" prop="stationNumberValue" style="display: inline-block">-->
<!-- <el-input-->
<!-- v-model="form1.stationNumberValue"-->
<!-- readonly-->
<!-- size="small"-->
<!-- placeholder="工位号"/>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="产品型号" prop="engineTypeValue" style="display: inline-block">-->
<!-- <el-input-->
<!-- v-model="form1.engineTypeValue"-->
<!-- readonly-->
<!-- size="small"-->
<!-- placeholder="工位号"/>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row>
<el-col :span="12">
<el-form-item :label="$t('materialVerificationMaintenance.materialNumber')" prop="orderNumber" style="display: inline-block">
<el-input
v-model="form1.orderNumber"
readonly
size="small"
:placeholder="$t('materialVerificationMaintenance.enterMaterialNumber')"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('materialVerificationMaintenance.version')" prop="version" style="display: inline-block">
<el-input
v-model="form1.version"
readonly
size="small"
:placeholder="$t('materialVerificationMaintenance.selectVersion')"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item :label="$t('materialVerificationMaintenance.materialName')" prop="partName" style="display: inline-block">
<el-input
v-model="form1.partName"
clearable
size="small"
:placeholder="$t('materialVerificationMaintenance.materialName')"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('materialVerificationMaintenance.quantity')" prop="number" style="display: inline-block">
<el-input-number
v-model="form1.number"
:min="1"
:step="1"
size="small"
:placeholder="$t('materialVerificationMaintenance.enterQuantity')"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item :label="$t('materialVerificationMaintenance.isVerification')" prop="verificationValue" style="display: inline-block">
<el-select v-model="form1.verificationValue" size="small" :placeholder="$t('materialVerificationMaintenance.selectVerification')">
<el-option
v-for="item in verification"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<!-- <el-form-item label="是否批次" prop="batchValue" style="display: inline-block">-->
<!-- <el-select v-model="form1.batchValue" size="small" placeholder="请选择是否批次">-->
<!-- <el-option-->
<!-- v-for="item in verification"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"/>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
</el-col>
</el-row>
<el-row v-if="form1.verificationValue === 1" style="margin: 10px 0">
<el-divider>{{ $t('materialVerificationMaintenance.verificationRuleSetting') }}</el-divider>
</el-row>
<el-row v-if="form1.verificationValue === 1">
<el-col :span="10">
<el-form-item :label="$t('materialVerificationMaintenance.rule')" prop="verificationCode" style="display: inline-block">
<el-input
v-model="form1.verificationCode"
clearable
size="small"
:placeholder="$t('materialVerificationMaintenance.enterMatchRule')"/>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item :label="$t('materialVerificationMaintenance.length')" prop="verificationLength" style="display: inline-block">
<el-input-number
v-model="form1.verificationLength"
:min="1"
:step="1"
size="small"
:placeholder="$t('materialVerificationMaintenance.enterMatchLength')"/>
</el-form-item>
</el-col>
<!-- <el-col :span="7">
<el-form-item label="排序" prop="verificationOrder" style="display: inline-block">
<el-input-number
v-model="form1.verificationOrder"
:min="0"
:step="1"
size="small"
placeholder="请输入匹配排序"/>
</el-form-item>
</el-col> -->
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="callOff1('form')">{{ $t('common.cancel') }}</el-button>
<el-button type="primary" size="small" @click="submitAdd1('form')">{{ $t('common.confirm') }}</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible3" :title="$t('materialVerificationMaintenance.materialImport')" center style="min-height: 200px" width="1000px">
<div class="app-container">
<upload-excel-component :on-success="handleSuccess" :before-upload="beforeUpload" />
<div style="margin-top: 5px">
<el-table
v-loading="loading"
ref="multipleTable"
:data="tableDataListAll"
:header-cell-style="{ background: '#F5F5F5', fontSize: '16px' }"
:element-loading-text="$t('materialVerificationMaintenance.loadingData')"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.2)"
height="300px"
style="width: 100%"
border
>
<el-table-column type="index" width="60" :label="$t('materialVerificationMaintenance.sequence')" align="center"/>
<el-table-column align="center" :label="$t('materialVerificationMaintenance.stationNumber')" width="80px">
<template slot-scope="scope">
{{ scope.row.工位号 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialVerificationMaintenance.productModel')" width="80px">
<template slot-scope="scope">
{{ scope.row.产品型号 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialVerificationMaintenance.materialNumber')" width="120px">
<template slot-scope="scope">
{{ scope.row.物料号 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialVerificationMaintenance.partName')" min-width="120px">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialVerificationMaintenance.materialQuantity')" width="80px">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialVerificationMaintenance.isVerification')" width="80px">
<template slot-scope="scope">
{{ scope.row.是否验证 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialVerificationMaintenance.matchRule')" width="120px">
<template slot-scope="scope">
{{ scope.row.匹配规则 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialVerificationMaintenance.matchLength')" width="80px">
<template slot-scope="scope">
{{ scope.row.条码长度 }}
</template>
</el-table-column>
<!-- <el-table-column align="center" label="匹配排序" width="80px">
<template slot-scope="scope">
{{ scope.row.匹配排序 }}
</template>
</el-table-column> -->
</el-table>
</div>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="materialAddAllCancel()">{{ $t('common.cancel') }}</el-button>
<el-button type="primary" icon="el-icon-upload" size="small" @click="materialAddAllSubmit()">{{ $t('materialVerificationMaintenance.confirmImport') }}</el-button>
</div>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible4" :title="$t('materialVerificationMaintenance.dataCopy')" center style="min-height: 200px" width="400px">
<el-form ref="form1" :model="form4" :rules="rules4" label-position="right" label-width="110px">
<el-form-item :label="$t('materialVerificationMaintenance.productModel')" prop="engineTypeValue" style="display: inline-block">
<el-select v-model="form4.engineTypeValue" :placeholder="$t('materialVerificationMaintenance.selectProductModel')" size="small">
<el-option
v-for="item in engineType"
:key="item.value"
:label="item.label"
:value="item.value"
size="mini"/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="callOff4()">{{ $t('common.cancel') }}</el-button>
<el-button type="primary" size="small" @click="submitAdd4()">{{ $t('common.confirm') }}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import UploadExcelComponent from './UploadExcel.vue'
import { sleep } from '../../../utils/tool'
export default {
name: 'UploadExcel',
components: { UploadExcelComponent },
data() {
return {
stationNumber: [],
stationNumberValue: '',
materialCode: '',
stationName: '',
worksheet: [],
itemFile: [],
unSpecification: [],
method1: '', // 机床1加工方式
method2: '', // 机床2加工方式
method1Explain: '', // 机床1加工方式说明
method2Explain: '', // 机床2加工方式说明
stockQuantity: '', // 库存数量
stockNum: '', // 库位号
dialogFormVisible4: false,
explain: false,
orderNumber: [],
orderNumberValue: '',
engineTypeValue: '',
version: '',
versionList: [],
engineType: [],
engineType1: [],
isVerification: '',
OKWarehouseValue: '',
OKWarehouse: [],
NGWarehouseValue: '',
NGWarehouse: [],
verification: [],
mainMaterial: [],
form: { // 创建订单
partName: '',
stationNumberValue: '',
orderNumber: '',
engineTypeValue: '',
partDrawing: '',
number: '',
manufactor: '',
verificationValue: 1,
version: '',
verificationCode: '',
verificationLength: 0,
verificationOrder: 0,
mainMaterialValue: 0,
batchValue: 0
},
rules: {},
form1: { // 修改订单
partName: '',
stationNumberValue: '',
engineTypeValue: '',
orderNumber: '',
partDrawing: '',
number: '',
manufactor: '',
version: '',
verificationValue: 1,
verificationCode: '',
verificationLength: 0,
verificationOrder: 0,
mainMaterialValue: 0,
batchValue: 0,
ID: ''
},
rules1: {},
form2: { // 订单下发
planQuantity: '',
orderNumber: '',
engineTypeValue: '',
MID: '',
IssuedQuantity: 1
},
form4: {
engineTypeValue: ''
},
rules4: {},
// planTime: [new Date(new Date().getTime() - 3600 * 1000 * 24 * 3000), new Date(new Date().getTime())],
planTime: [],
tableDataListAll: [],
tableData: [],
importData: [],
dialogFormVisible: false, // 创建订单
dialogFormVisible1: false, // 修改订单
dialogFormVisible3: false, // 订单导入
states: '', // 当前库存状态
MIDGroup: [],
total: 0, // 总条数
pageList: 30, // 每页显示条数
pageSize: 30, // 每页显示条数
pageCurrent: 1, // 后台获取页
loading: false
}
},
watch: {
'$i18n.locale'() {
this.initI18nState()
}
},
created() {
this.initI18nState()
this.getStationNumber()
this.getEndStation()
this.getVersion()
setTimeout(() => {
this.searchOrder()
}, 1000)
},
methods: {
initI18nState() {
this.verification = [
{
label: this.$t('materialVerificationMaintenance.no'),
value: 0
}, {
label: this.$t('materialVerificationMaintenance.yes'),
value: 1
}
]
this.mainMaterial = [
{
label: this.$t('materialVerificationMaintenance.no'),
value: 0
}, {
label: this.$t('materialVerificationMaintenance.yes'),
value: 1
}
]
this.rules = {
partName: [{ required: true, message: this.$t('materialVerificationMaintenance.enterMaterialNameRequired'), trigger: 'blur' }],
stationNumberValue: [{ required: true, message: this.$t('materialVerificationMaintenance.selectStationNumberRequired'), trigger: 'change' }],
orderNumber: [{ required: true, message: this.$t('materialVerificationMaintenance.enterMaterialNumberRequired'), trigger: 'blur' }],
engineTypeValue: [{ required: true, message: this.$t('materialVerificationMaintenance.selectEngineTypeRequired'), trigger: 'blur' }],
number: [{ required: true, message: this.$t('materialVerificationMaintenance.enterQuantityRequired'), trigger: 'blur' }],
verificationValue: [{ required: true, message: this.$t('materialVerificationMaintenance.selectVerificationRequired'), trigger: 'change' }],
version: [{ required: true, message: this.$t('materialVerificationMaintenance.selectMaterialVersionRequired'), trigger: 'change' }],
verificationLength: [{ required: true, message: this.$t('materialVerificationMaintenance.enterVerificationLengthRequired'), trigger: 'blur' }],
verificationOrder: [{ required: true, message: this.$t('materialVerificationMaintenance.enterVerificationOrderRequired'), trigger: 'blur' }],
verificationCode: [{ required: true, message: this.$t('materialVerificationMaintenance.enterVerificationRuleRequired'), trigger: 'blur' }]
}
this.rules1 = {
partName: [{ required: true, message: this.$t('materialVerificationMaintenance.enterPartNameRequired'), trigger: 'blur' }],
number: [{ required: true, message: this.$t('materialVerificationMaintenance.enterQuantityRequired'), trigger: 'blur' }],
verificationValue: [{ required: true, message: this.$t('materialVerificationMaintenance.selectVerificationRequired'), trigger: 'change' }],
verificationLength: [{ required: true, message: this.$t('materialVerificationMaintenance.enterVerificationLengthRequired'), trigger: 'blur' }],
verificationOrder: [{ required: true, message: this.$t('materialVerificationMaintenance.enterVerificationOrderRequired'), trigger: 'blur' }],
verificationCode: [{ required: true, message: this.$t('materialVerificationMaintenance.enterVerificationRuleRequired'), trigger: 'blur' }]
}
this.rules4 = {
engineTypeValue: [{ required: true, message: this.$t('materialVerificationMaintenance.selectEngineTypeRequired'), trigger: 'blur' }]
}
},
removeAll() {
this.worksheet = []
this.itemFile = []
},
async selected(data) { // 选择需要导入的文件
this.worksheet = data.worksheet // 获取每个多选文件的表格坐标及值
this.itemFile = data.itemFile
},
handleRemove(file) { // 移除文件
for (let i = 0; i < this.itemFile.length; i++) {
if (this.itemFile[i].name === file.name) {
this.worksheet.splice(i, 1)
this.itemFile.splice(i, 1)
}
}
},
/* 验证内容是否英文数字以及下划线*/
// isPassword(rule, value, callback) {
// const reg = /^[_a-zA-Z0-9]+$/
// if (value === '' || value === undefined || value == null) {
// callback()
// } else {
// if (!reg.test(value) || value.length !== 7) {
// callback(new Error('订单仅由数字和字母组成且只能位7位'))
// } else {
// callback()
// }
// }
// },
// 初始化获取产品型号
getEndStation() {
this.engineType = []
var param = []
var Data = this.CreateData('11', 'MES_基本变量_机型代码_查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length > 0) this.engineTypeValue = response.data[0].发动机机型标志
for (let i = 0; i < response.data.length; i++) {
this.engineType.push({
label: response.data[i].发动机型号,
value: response.data[i].发动机机型标志
})
this.engineType1.push({
label: response.data[i].发动机型号,
value: response.data[i].发动机机型标志
})
}
this.searchOrder()
})
},
// 获取版本号
getVersion() {
this.versionList = []
var param = []
var Data = this.CreateData('11', '电子看板_装配零件_版本_查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length > 0) this.version = response.data[0].版本号
for (let i = 0; i < response.data.length; i++) {
this.versionList.push({
label: response.data[i].是否启用 === 1 ? `${response.data[i].版本号}【启用】` : response.data[i].版本号,
value: response.data[i].版本号
})
}
})
},
// 初始化获取订单号
getStationNumber() {
this.stationNumber = []
var param = []
var Data = this.CreateData('11', 'MES_计划BOM_工位与名称_查询', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.stationNumber.push({
label: `${response.data[i].工位号}${response.data[i].工位名称}`,
value: response.data[i].工位号
})
}
})
},
// 查询订单
searchOrder() {
var param = []
const isVerification = this.isVerification === '' ? 9999 : this.isVerification
param[0] = ['工位号', this.stationNumberValue]
param[1] = ['产品型号代码', this.engineTypeValue]
param[2] = ['是否验证', isVerification]
param[3] = ['物料号', this.materialCode]
param[4] = ['版本号', this.version]
var Data = this.CreateData('11', '电子看板_装配零件_查询', param)
this.ExecDatabase(Data).then(response => {
this.tableData = []
if (response.data.length !== 0) {
this.tableData = response.data
}
})
},
changeIsVerification(value) {
if (value === 1) {
this.form.verificationCode = this.form.orderNumber
} else {
this.form.verificationCode = '****'
}
},
// 创建订单
creatOrder(formName) {
if (this.$refs[formName] !== undefined) {
this.$refs[formName].resetFields()
}
this.form.partName = ''
this.form.stationNumberValue = ''
this.form.orderNumber = ''
this.form.engineTypeValue = ''
this.form.partDrawing = ''
this.form.number = ''
this.form.manufactor = ''
this.form.verificationValue = 0
this.form.verificationCode = '****'
this.form.verificationLength = 1
this.form.verificationOrder = 0
this.form.mainMaterialValue = 0
this.form.batchValue = 0
this.dialogFormVisible = true
},
// 提交新增订单
submitAdd(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
var param = []
param[0] = ['工位号', this.form.stationNumberValue]
param[1] = ['产品型号代码', this.form.engineTypeValue]
param[2] = ['物料号', this.form.orderNumber]
param[3] = ['零件名称', this.form.partName]
param[4] = ['零件图号', this.form.partDrawing]
param[5] = ['生产厂家', this.form.manufactor]
param[6] = ['是否验证', this.form.verificationValue]
param[7] = ['是否主物料', this.form.mainMaterialValue]
param[8] = ['零件数量', this.form.number]
param[9] = ['验证规则', this.form.verificationCode]
param[10] = ['验证长度', this.form.verificationLength]
param[11] = ['验证顺序', this.form.verificationOrder]
param[12] = ['版本号', this.form.version]
param[13] = ['批次追溯', this.form.batchValue]
var Data = this.CreateData('12', '电子看板_装配零件_SPC_增加', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0]['result'] === '1') {
this.$message({
message: this.$t('materialVerificationMaintenance.materialAddSuccess'),
type: 'success'
})
this.searchOrder()
} else {
this.$message.error(this.$t('materialVerificationMaintenance.materialAddFailed'))
}
})
} else {
return false
}
})
},
// 取消新增订单
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
copyOrder(formName) {
if (this.tableData.length) {
if (this.$refs[formName] !== undefined) {
this.$refs[formName].resetFields()
}
this.dialogFormVisible4 = true
} else {
this.$message({
message: this.$t('materialVerificationMaintenance.noDataToCopy'),
type: 'error'
})
}
},
callOff4() {
this.dialogFormVisible4 = false
},
async submitAdd4() {
let stationNumberValue, orderNumber, partName, partDrawing, manufactor, verificationValue, mainMaterialValue, number, batchValue
for (let i = 0; i < this.tableData.length; i++) {
stationNumberValue = this.tableData[i].工位号
orderNumber = this.tableData[i].物料号
partName = this.tableData[i].零件名称
partDrawing = this.tableData[i].零件图号
manufactor = this.tableData[i].生产厂家
verificationValue = this.tableData[i].是否验证
mainMaterialValue = this.tableData[i].是否主物料
number = this.tableData[i].零件数量
batchValue = this.tableData[i].是否批次
await this.submitAdd5(stationNumberValue, orderNumber, partName, partDrawing, manufactor, verificationValue, mainMaterialValue, number, batchValue)
}
this.$message({
message: this.$t('materialVerificationMaintenance.addSuccess'),
type: 'success'
})
this.dialogFormVisible4 = false
this.engineTypeValue = this.form4.engineTypeValue
this.searchOrder()
},
async submitAdd5(stationNumberValue, orderNumber, partName, partDrawing, manufactor, verificationValue, mainMaterialValue, number, batchValue) {
var param = []
param[0] = ['工位号', stationNumberValue]
param[1] = ['发动机型号', this.form4.engineTypeValue]
param[2] = ['物料号', orderNumber]
param[3] = ['零件名称', partName]
param[4] = ['零件图号', partDrawing]
param[5] = ['生产厂家', manufactor]
param[6] = ['是否验证', verificationValue]
param[7] = ['是否主物料', mainMaterialValue]
param[8] = ['零件数量', number]
param[9] = ['批次追溯', batchValue]
var Data = this.CreateData('12', '电子看板_装配零件_SPC_增加', param)
return new Promise((resolve, reject) => {
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
resolve(1)
} else {
reject(2)
}
})
})
},
// 导入订单
importOrder() {
this.dialogFormVisible3 = true
},
// 删除订单
deleteOrder(row) {
this.$confirm(this.$t('materialVerificationMaintenance.confirmDelete'), this.$t('materialVerificationMaintenance.prompt'), {
confirmButtonText: this.$t('common.confirm'),
cancelButtonText: this.$t('common.cancel'),
type: 'warning'
}).then(() => {
var param = []
param[0] = ['ID', row.ID]
var Data = this.CreateData('12', '电子看板_装配零件_SPC_删除', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success(this.$t('materialVerificationMaintenance.deleteSuccess'))
this.searchOrder()
} else {
this.$message.error(this.$t('materialVerificationMaintenance.deleteFailed'))
}
})
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('materialVerificationMaintenance.deleteCanceled')
})
})
},
// 修改订单
handleEdit(row) {
if (this.$refs['form1'] !== undefined) {
this.$refs['form1'].resetFields()
}
console.log(row)
this.form1.partName = row.零件名称
this.form1.stationNumberValue = row.工位号
this.form1.engineTypeValue = row.工位号
this.form1.orderNumber = row.物料号
// this.form1.partDrawing = row.零件图号
this.form1.number = row.零件数量
// this.form1.manufactor = row.生产厂家
this.form1.verificationValue = Number(row.是否验证)
this.form1.verificationCode = row.零件图号
this.form1.verificationLength = row.条码长度
this.form1.verificationOrder = row.零件排序
this.form1.version = row.版本号
// this.form1.mainMaterialValue = Number(row.是否主物料)
this.form1.batchValue = Number(row.是否批次)
this.form1.ID = row.ID
this.dialogFormVisible1 = true
},
// 提交修改订单
submitAdd1(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
var param = []
param[0] = ['ID', this.form1.ID]
param[1] = ['物料号', this.form1.orderNumber]
param[2] = ['零件名称', this.form1.partName]
param[3] = ['零件图号', this.form1.partDrawing]
param[4] = ['生产厂家', this.form1.manufactor]
param[5] = ['是否验证', this.form1.verificationValue]
param[6] = ['是否主物料', this.form1.mainMaterialValue]
param[7] = ['零件数量', this.form1.number]
param[8] = ['工位号', this.form1.stationNumberValue]
param[9] = ['发动机型号', this.engineTypeValue]
param[10] = ['验证规则', this.form1.verificationCode]
param[11] = ['验证长度', this.form1.verificationLength]
param[12] = ['验证顺序', this.form1.verificationOrder]
param[13] = ['批次追溯', this.form1.batchValue]
var Data = this.CreateData('12', '电子看板_装配零件_SPC_修改', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message({
message: this.$t('materialVerificationMaintenance.editSuccess'),
type: 'success'
})
this.searchOrder()
} else {
this.$message.error(this.$t('materialVerificationMaintenance.editFailed'))
}
})
this.dialogFormVisible1 = false
} else {
return false
}
})
},
// 取消修改订单
callOff1(formName) {
this.$refs[formName].resetFields()
this.dialogFormVisible1 = false
},
// 多选
handleSelectionChange(val) {
this.MIDGroup = []
for (let i = 0; i < val.length; i++) {
this.MIDGroup.push(val[i].MID)
}
},
handleAdd() {
if (this.tableData.length === 0) {
this.$message.error(this.$t('materialVerificationMaintenance.contentEmpty'))
} else {
var param = []
var Data = this.CreateData('11', '确认导入物料字典_新增', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length > 0) {
this.notes = ''
for (var i = 0; i < response.data.length; i++) {
this.notes = response.data[i].导入结果 + '、 ' + this.notes
}
this.$message({
message: this.$t('materialVerificationMaintenance.materialDictionaryUpdated'),
type: 'warning'
})
this.isShow = true
this.tableData = []
} else {
this.tableData = []
this.$message({
message: this.$t('materialVerificationMaintenance.materialDictionaryUpdated'),
type: 'success'
})
}
})
}
},
// 查询
searchTable() {
var param = []
var Data = this.CreateData('11', '生产计划导入_确认导入前临时表_查询', param, this.pageSize, this.pageList)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
this.loading = false
})
},
// 表格颜色变化
tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 === 0) {
return 'black'
} else {
return 'red'
}
},
async basicPartsToSQL() {
try {
this.loading = true
this.err = 0
for (let j = this.worksheet.length - 1; j >= 0; j--) {
let partName,
stationNumberValue,
orderNumber,
engineTypeValue,
engineTypeNumber,
partDrawing,
partBatchNumber,
number,
manufactor,
verificationValue,
mainMaterialValue,
isPreservation
// var param = []
// param[0] = ['物料号', this.worksheet[j].L2.v]
// console.log('物料号', this.worksheet[j].L2.v)
// var Data = this.CreateData('11', '电子看板_装配零件_总物料表_导入校验', param)
// const response = await this.ExecDatabase(Data)
// const res = response.data
// if (res[0].Column1 !== 0) {
// this.$notify.error(`${this.worksheet[j].L2.v}已经存在,请确认文件是否正确`)
// this.loading = false
// this.disabled = false
// return
// }
for (let i = 0; i < 999; i++) {
const attr = i + 2
stationNumberValue = this.worksheet[j][`A${attr}`] ? this.worksheet[j][`A${attr}`].v : ''
engineTypeNumber = this.worksheet[j][`B${attr}`] ? this.worksheet[j][`B${attr}`].v : ''
partDrawing = this.worksheet[j][`C${attr}`] ? this.worksheet[j][`C${attr}`].v : ''
partName = this.worksheet[j][`D${attr}`] ? this.worksheet[j][`D${attr}`].v : ''
number = this.worksheet[j][`E${attr}`] ? this.worksheet[j][`E${attr}`].v : ''
partBatchNumber = this.worksheet[j][`F${attr}`] ? this.worksheet[j][`F${attr}`].v : ''
manufactor = this.worksheet[j][`G${attr}`] ? this.worksheet[j][`G${attr}`].v : ''
engineTypeValue = this.worksheet[j][`H${attr}`] ? this.worksheet[j][`H${attr}`].v : ''
verificationValue = this.worksheet[j][`I${attr}`] ? this.worksheet[j][`I${attr}`].v : ''
mainMaterialValue = this.worksheet[j][`J${attr}`] ? this.worksheet[j][`J${attr}`].v : ''
isPreservation = this.worksheet[j][`K${attr}`] ? this.worksheet[j][`K${attr}`].v : ''
orderNumber = this.worksheet[j][`L${attr}`] ? this.worksheet[j][`L${attr}`].v : ''
if (!stationNumberValue && !engineTypeNumber &&
!partDrawing && !partName && !number && !partBatchNumber &&
!manufactor && !engineTypeValue && !verificationValue && !mainMaterialValue && !isPreservation && !orderNumber) {
break
} else if (!orderNumber) { // 名称不能为空
this.$notify.error(this.$t('materialVerificationMaintenance.materialNumberRequired'))
break
} else if (Number(partDrawing) <= 0) { // 数量不能为0
this.$notify.error(this.$t('materialVerificationMaintenance.partDrawingRequired'))
break
} else {
if (orderNumber) {
await sleep(50)
await this.insertToSQL(stationNumberValue,
engineTypeNumber,
partDrawing,
partName,
number,
partBatchNumber,
manufactor,
engineTypeValue,
verificationValue,
mainMaterialValue,
isPreservation,
orderNumber)
} else {
this.loading = false
this.disabled = false
this.$notify.error(this.$t('materialVerificationMaintenance.confirmImportFile'))
return
}
}
}
this.itemFile.splice(j, 1)
this.worksheet.splice(j, 1)
this.err === 0 ? this.$message.success(this.$t('materialVerificationMaintenance.importCompleted')) : this.$message.error(this.$t('materialVerificationMaintenance.importFailedCount', { count: this.err }))
}
this.loading = false
this.searchOrder()
} catch (e) {
this.err++
this.loading = false
this.$notify.error(this.$t('materialVerificationMaintenance.importDataErrorFile'))
console.log(`导入数据错误${e}`)
}
},
async insertToSQL(stationNumberValue,
engineTypeNumber,
partDrawing,
partName,
number,
partBatchNumber,
manufactor,
engineTypeValue,
verificationValue,
mainMaterialValue,
isPreservation,
orderNumber) {
try {
var param = []
param[0] = ['工位号', stationNumberValue]
param[1] = ['产品型号代码', engineTypeNumber]
param[2] = ['零件图号', partDrawing]
param[3] = ['零件名称', partName]
param[4] = ['零件数量', number]
param[5] = ['零件批号', partBatchNumber]
param[6] = ['生产厂家', manufactor]
param[7] = ['发动机型号', engineTypeValue]
param[8] = ['是否验证', verificationValue]
param[9] = ['是否主物料', mainMaterialValue]
param[10] = ['是否保存', isPreservation]
param[11] = ['物料号', orderNumber]
param[12] = ['是否批次', 0] // 导入时默认设置为否
var Data = this.CreateData('12', '物料数据_导入Excel', param)
const response = await this.ExecDatabase(Data)
const res = response.data
if (res[0].result === '0') {
this.$notify.error(this.$t('materialVerificationMaintenance.importFailedSuffix', { value: orderNumber }))
} else {
this.$notify.error(this.$t('materialVerificationMaintenance.importSuccessSuffix', { value: orderNumber }))
}
} catch (e) {
this.err++
this.$message.error(this.$t('materialVerificationMaintenance.importDataError'))
console.log(`导入数据错误${e}`)
}
},
exportExcel() {
if (this.tableData.length !== 0) {
var param = []
param[0] = ['产品型号代码', this.engineTypeValue]
param[1] = ['工位号', this.stationNumberValue]
var Data = this.CreateData('2001', '电子看板_装配零件_总物料表_导出新', param)
this.exportExcel_NPOI(Data)
} else {
this.$message.warning(this.$t('materialVerificationMaintenance.noData'))
}
},
beforeUpload(file) {
return true
},
handleSuccess({ results, header }) {
const tableName = `基础数据_物料bom_导入临时表`
console.log(tableName)
var Data = this.CreateData('7', tableName, results, header)
this.ExecDatabase(Data).then(response => {
this.selectDate2()
})
},
selectDate2() {
this.tableDataListAll = []
var param = []
var Data = this.CreateData('11', '电子看板_装配零件_物料bom_导入临时表_查询', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length !== 0) {
this.tableDataListAll = response.data
}
})
},
materialAddAllSubmit() {
if (this.tableDataListAll.length === 0) {
this.$message.error(this.$t('materialVerificationMaintenance.contentEmpty'))
} else {
var param = []
var Data = this.CreateData('12', '电子看板_装配零件_物料BOM_导入临时表_确认导入', param)
this.ExecDatabase(Data).then(response => {
if (response.data.length > 0) {
if (response.data[0]['result'] === '1') {
this.$message.success(this.$t('materialVerificationMaintenance.importSuccess'))
this.dialogFormVisible3 = false
this.searchOrder()
} else {
this.$message.error(this.$t('materialVerificationMaintenance.importFailed'))
}
} else {
this.$message.error(this.$t('materialVerificationMaintenance.importFailed'))
}
})
}
},
materialAddAllCancel() {
this.dialogFormVisible3 = false
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchOrder()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchOrder()
}
}
}
</script>
<style scoped>
.topCard{
margin: 5px;
}
.topDiv{
margin-bottom: 10px;
}
.materialToolbar {
align-items: flex-end;
}
.tablePanel {
padding-top: 4px;
border-radius: 14px;
background: linear-gradient(180deg, rgba(255,255,255,0.52) 0%, rgba(243,248,252,0.92) 100%);
}
.el-select{
width:200px
}
.el-input{
width:200px
}
.text {
font-size: 14px;
}
.item {
padding: 18px 0;
}
.box-card {
position: absolute;
right: 6px;
top: 80px;
width: 300px;
}
.el-table .warning-row {
background: oldlace;
}
.el-table .success-row {
background: #f0f9eb;
}
::v-deep.el-input.is-disabled .el-input__inner{
color: #606266!important;
}
::v-deep.el-input.is-disabled .el-input__inner{
background-color: white!important;
}
::v-deep .materialToolbar .el-button {
margin-bottom: 2px;
}
</style>