This commit is contained in:
zhangdingyu
2019-01-22 10:24:20 +08:00
21 changed files with 1245 additions and 819 deletions

View File

@@ -2,21 +2,16 @@
<div class="app-container">
<el-card>
<el-row>
<span>项目名称</span>
<el-select v-model="projectValue" filterable clearable size="small" placeholder="项目名称" @change="projectChange">
<el-option
v-for="item in project"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>机床编号:</span>
<el-select v-model="machineNumberValue" placeholder="机床编号" size="small" clearable @change="machineChange">
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="machineChange">
<el-option
v-for="item in machineNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</div>
</el-option>
</el-select>
<span>组号:</span>
<el-select v-model="groupNumberValue" placeholder="组号" size="small" clearable>
@@ -63,17 +58,6 @@
</template>
</el-table-column>
</el-table>
<!--<div class="block" style="margin-top: 10px;">-->
<!--<el-pagination-->
<!--@size-change="handleSizeChange"-->
<!--@current-change="handleCurrentChange"-->
<!--:current-page="pageCurrent"-->
<!--:page-sizes="[10, 20, 30, 40, 50]"-->
<!--:page-size="pageSize"-->
<!--layout="total, sizes, prev, pager, next, jumper"-->
<!--:total="total">-->
<!--</el-pagination>-->
<!--</div>-->
</el-card>
<el-card>
<el-tabs type="border-card" @tab-click="selectPart">
@@ -90,6 +74,11 @@
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="前零件图号" align="center">
<template slot-scope="scope">
{{ scope.row.前零件图号 }}
</template>
</el-table-column>
<el-table-column label="材料" align="center">
<template slot-scope="scope">
{{ scope.row.材料 }}
@@ -110,6 +99,16 @@
{{ scope.row.库存数量 }}
</template>
</el-table-column>
<el-table-column label="需求数量" align="center">
<template slot-scope="scope">
{{ scope.row.需求数量 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="120px" fixed="right">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit" @click="handleEdit(scope.row)">使用</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="外购件">
@@ -147,12 +146,17 @@
</el-table-column>
<el-table-column label="库存数量" align="center">
<template slot-scope="scope">
{{ scope.row.库存 }}
{{ scope.row.安全库存量 }}
</template>
</el-table-column>
<el-table-column label="需求数量" align="center">
<template slot-scope="scope">
{{ scope.row.需求数量 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="120px" fixed="right">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit" @click="handleEdit(scope.row)">使用</el-button>
<el-button type="primary" size="mini" icon="el-icon-edit" @click="handleEdit2(scope.row)">使用</el-button>
</template>
</el-table-column>
</el-table>
@@ -192,12 +196,17 @@
</el-table-column>
<el-table-column label="库存数量" align="center">
<template slot-scope="scope">
{{ scope.row.库存 }}
{{ scope.row.安全库存量 }}
</template>
</el-table-column>
<el-table-column label="需求数量" align="center">
<template slot-scope="scope">
{{ scope.row.需求数量 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="120px" fixed="right">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit" @click="handleEdit(scope.row)">使用</el-button>
<el-button type="primary" size="mini" icon="el-icon-edit" @click="handleEdit2(scope.row)">使用</el-button>
</template>
</el-table-column>
</el-table>
@@ -307,6 +316,7 @@
</el-table-column>
<el-table-column label="操作" align="center" width="250px" fixed="right">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit" @click="handleEdit1(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click="MoveOut(scope.row)">移出</el-button>
</template>
</el-table-column>
@@ -314,6 +324,11 @@
</el-card>
<el-card>
<el-table :data="tableData5" border size="mini" style="width: 100%" height="300px">
<el-table-column label="物料代码" align="center">
<template slot-scope="scope">
{{ scope.row.物料代码 }}
</template>
</el-table-column>
<el-table-column label="物料名称" align="center">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
@@ -366,6 +381,7 @@
</el-table-column>
<el-table-column label="操作" align="center" width="250px" fixed="right">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit" @click="handleEdit1(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click="MoveOut(scope.row)">移出</el-button>
</template>
</el-table-column>
@@ -373,12 +389,6 @@
</el-card>
<el-dialog :title="title" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="400px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="请购单编号" prop="请购单编号">
<el-input
v-model="form.请购单编号"
size="small"
style="width:200px"/>
</el-form-item>
<el-form-item label="请购车间" prop="请购车间">
<el-input
@@ -411,6 +421,31 @@
<el-button v-show="title==='编辑'" type="primary" @click="submitEdit('form')">确定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible3" title="更改数量" center style="min-height: 300px" width="400px">
<el-form ref="form3" :model="form3" :rules="rules3" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="数量" prop="数量">
<el-input
v-model="form3.数量"
size="small"
style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel('form3')">取消</el-button>
<el-button type="primary" @click="submitEdit1('form3')">确定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible4" title="使用库存" center style="min-height: 300px" width="400px">
<el-form ref="form4" :model="form4" :rules="rules4" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="数量" prop="数量">
<el-input-number v-model="form4.数量" :min="0" :max="100" size="small" style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel('form4')">取消</el-button>
<el-button type="primary" @click="submitEdit2('form4')">确定</el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="dialogFormVisible1"
title="基本件打回信息"
@@ -551,15 +586,13 @@
</template>
<script>
import { initProject, searchmachine, searchgroup, searchTable, searchPart, searchPart1, searchTable1, addData, editData, deleteData, searchDetailed, searchDetailed1, purchaseRequisition, purchaseRequisition1, purchaseRequisition2, MoveOut, MoveOut1, PurchasingDepartment, Production, PartCallbackInformation, PartCallbackInformation1, submit, submit1, Delete, Delete1 } from '@/api/ManufacturingCenter/PartAssignment'
import { initProject, searchgroup, searchTable, searchPart, searchPart1, searchTable1, addData, editData, deleteData, searchDetailed, searchDetailed1, purchaseRequisition, purchaseRequisition1, purchaseRequisition2, MoveOut, MoveOut1, PurchasingDepartment, Production, PartCallbackInformation, PartCallbackInformation1, submit, submit1, Delete, Delete1, editStock, editNum } from '@/api/ManufacturingCenter/PartAssignment'
import { mapGetters } from 'vuex'
export default {
inject: ['reload'],
data() {
return {
projectValue: '',
projectFloatValue: '',
project: [],
machineNumberValue: '',
machineFloatValue: '',
machineNumber: [],
@@ -567,6 +600,9 @@ export default {
groupNumberValue: '',
groupFloatValue: '',
groupNumber: [],
StandardAndOutsourcing: '',
PartNum: '',
DetailedNum: '',
PurchaseOrder: '',
PartType: '基本件',
tableData: [],
@@ -590,9 +626,22 @@ export default {
请购车间: [{ required: true, message: '请输入请购车间', trigger: 'blur' }],
请购时间: [{ required: true, message: '请选择请购时间', trigger: 'change' }]
},
form3: {
数量: ''
},
rules3: {
数量: [{ required: true, message: '请输入数量', trigger: 'blur' }]
},
form4: {
数量: ''
},
rules4: {
数量: [{ required: true, message: '请输入数量', trigger: 'blur' }]
},
BasicPartsNumber: [],
StandardPartsAndOutsourcing: [],
MaterialNum: [],
MaterialCode: [],
MaterialName: [],
PartToolNumber: [],
MaterialSpecification: [],
@@ -613,7 +662,9 @@ export default {
tableData9: [],
tableData10: [],
dialogFormVisible1: false,
dialogFormVisible2: false
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible4: false
}
},
computed: {
@@ -629,7 +680,15 @@ export default {
},
methods: {
fetchData() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'project')
initProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineNumber.push({
label: response.data[i].机床图号,
name: response.data[i].项目名称,
value: response.data[i].机床流水号
})
}
})
PartCallbackInformation().then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].退回时间 !== '') {
@@ -773,25 +832,6 @@ export default {
return 'adopt'
}
},
projectChange() {
this.machineNumberValue = ''
this.machineNumber = []
this.groupNumberValue = ''
this.groupNumber = []
if (this.projectValue !== '') {
this.check = 1
searchmachine(this.projectValue, this.check).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineNumber.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
} else {
this.check = 0
}
},
machineChange() {
this.groupNumberValue = ''
this.groupNumber = []
@@ -806,16 +846,13 @@ export default {
},
searchTable() {
this.loading = true
if (this.projectValue !== '') {
this.check1 = 1
} else { this.check1 = 0 }
if (this.machineNumberValue !== '') {
this.check2 = 1
} else { this.check2 = 0 }
if (this.groupNumberValue !== '') {
this.check3 = 1
} else { this.check3 = 0 }
searchTable(this.projectValue, this.check1, this.machineNumberValue, this.check2, this.groupNumberValue, this.check3).then(response => {
searchTable(this.machineNumberValue, this.check2, this.groupNumberValue, this.check3).then(response => {
this.tableData = response.data
this.tableData1 = []
this.tableData2 = []
@@ -885,7 +922,7 @@ export default {
submitAdd(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
addData(this.form.请购单编号, this.form.请购车间, this.name, this.id, this.form.请购时间).then(response => {
addData(this.form.请购车间, this.name, this.id, this.form.请购时间).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.dialogFormVisible = false
@@ -906,15 +943,13 @@ export default {
this.title = '编辑'
this.dialogFormVisible = true
this.RequisitionList = row.请购单流水号
this.form.请购单编号 = row.请购单编号
this.form.请购车间 = row.请购车间
this.form.请购时间 = row.请购时间
},
submitEdit(formName) { // 提交单据编辑
this.$refs[formName].validate((valid) => {
if (valid) {
console.log(this.form.请购时间)
editData(this.RequisitionList, this.form.请购单编号, this.form.请购车间, this.form.请购时间).then(response => {
editData(this.RequisitionList, this.form.请购车间, this.form.请购时间).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.dialogFormVisible = false
@@ -953,6 +988,81 @@ export default {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
handleEdit1(row) { // 弹出单据编辑
if (this.$refs['form3'] !== undefined) {
this.$refs['form3'].resetFields()
}
this.dialogFormVisible3 = true
this.DetailedNum = row.请购单明细流水号
this.form3.数量 = row.零件数量
},
submitEdit1(formName) { // 提交单据编辑
this.$refs[formName].validate((valid) => {
if (valid) {
editNum(this.DetailedNum, this.form3.数量).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.dialogFormVisible3 = false
searchDetailed(this.RequisitionList).then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].物料计划到货时间 !== '') {
response.data[i].物料计划到货时间 = (response.data[i].物料计划到货时间).split(' ')[0]
}
}
this.tableData5 = response.data
})
searchDetailed1(this.RequisitionList).then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].物料计划到货时间 !== '') {
response.data[i].物料计划到货时间 = (response.data[i].物料计划到货时间).split(' ')[0]
}
}
this.tableData6 = response.data
})
} else { this.$message.error('编辑失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
handleEdit2(row) { // 弹出单据编辑
if (this.$refs['form4'] !== undefined) {
this.$refs['form4'].resetFields()
}
this.dialogFormVisible4 = true
this.StandardAndOutsourcing = row.标准件和外购件流水号
this.PartNum = row.零件数量
},
submitEdit2(formName) { // 提交使用库存数量
this.$refs[formName].validate((valid) => {
if (valid) {
editStock(this.RequisitionList, this.form4.数量, this.PartNum).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.dialogFormVisible4 = false
if (this.PartType === '基本件') {
searchPart(this.groupFloatValue).then(response => {
this.tableData1 = response.data
})
} else if (this.PartType === '外购件') {
searchPart1(this.groupFloatValue, 2).then(response => {
this.tableData2 = response.data
})
} else if (this.PartType === '标准件') {
searchPart1(this.groupFloatValue, 1).then(response => {
this.tableData3 = response.data
})
}
} else { this.$message.error('编辑失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
searchDetailed(row) {
this.RequisitionList = row.请购单流水号
searchDetailed(row.请购单流水号).then(response => {
@@ -987,11 +1097,12 @@ export default {
this.MaterialName[i] = val[i].零件名称
this.PartToolNumber[i] = val[i].零件图号
this.Material[i] = val[i].材料
this.NumberOfParts[i] = val[i].零件数量
this.NumberOfParts[i] = val[i].需求数量
this.ReMarks[i] = val[i].零件备注
}
} else if (this.PartType === '外购件') {
this.MaterialNum = []
this.MaterialCode = []
this.StandardPartsAndOutsourcing = []
this.MaterialName = []
this.MaterialSpecification = []
@@ -1000,14 +1111,16 @@ export default {
for (let i = 0; i < val.length; i++) {
this.StandardPartsAndOutsourcing[i] = val[i].标准件和外购件流水号
this.MaterialNum[i] = val[i].物料流水号
this.MaterialCode[i] = val[i].物料代码
this.MaterialName[i] = val[i].物料名称
this.MaterialSpecification[i] = val[i].物料规格
this.MaterialModel[i] = val[i].物料型号
this.NumberOfParts[i] = val[i].零件数量
this.NumberOfParts[i] = val[i].需求数量
this.ReMarks[i] = val[i].备注
}
} else if (this.PartType === '标准件') {
this.MaterialNum = []
this.MaterialCode = []
this.StandardPartsAndOutsourcing = []
this.MaterialName = []
this.MaterialSpecification = []
@@ -1016,10 +1129,11 @@ export default {
for (let i = 0; i < val.length; i++) {
this.StandardPartsAndOutsourcing[i] = val[i].标准件和外购件流水号
this.MaterialNum[i] = val[i].物料流水号
this.MaterialCode[i] = val[i].物料代码
this.MaterialName[i] = val[i].物料名称
this.MaterialSpecification[i] = val[i].物料规格
this.MaterialModel[i] = val[i].物料型号
this.NumberOfParts[i] = val[i].零件数量
this.NumberOfParts[i] = val[i].需求数量
this.ReMarks[i] = val[i].备注
}
}
@@ -1054,7 +1168,7 @@ export default {
}
} else if (this.PartType === '外购件') {
for (let i = 0; i < this.StandardPartsAndOutsourcing.length; i++) {
purchaseRequisition1(this.RequisitionList, this.projectName, this.projectFloatValue, this.MachineToolNumber, this.machineFloatValue, this.groupName, this.groupFloatValue, this.StandardPartsAndOutsourcing[i], this.MaterialName[i], this.MaterialSpecification[i], this.MaterialModel[i], this.NumberOfParts[i], 2, this.time, this.MaterialNum[i], this.ReMarks[i]).then(response => {
purchaseRequisition1(this.RequisitionList, this.projectName, this.projectFloatValue, this.MachineToolNumber, this.machineFloatValue, this.groupName, this.groupFloatValue, this.StandardPartsAndOutsourcing[i], this.MaterialName[i], this.MaterialCode[i], this.MaterialSpecification[i], this.MaterialModel[i], this.NumberOfParts[i], 2, this.time, this.MaterialNum[i], this.ReMarks[i]).then(response => {
this.result += parseInt(response.data[0].result)
if (this.result === this.StandardPartsAndOutsourcing.length) {
this.$message.success('请购成功')
@@ -1074,7 +1188,7 @@ export default {
}
} else if (this.PartType === '标准件') {
for (let i = 0; i < this.StandardPartsAndOutsourcing.length; i++) {
purchaseRequisition1(this.RequisitionList, this.projectName, this.projectFloatValue, this.MachineToolNumber, this.machineFloatValue, this.groupName, this.groupFloatValue, this.StandardPartsAndOutsourcing[i], this.MaterialName[i], this.MaterialSpecification[i], this.MaterialModel[i], this.NumberOfParts[i], 1, this.time, this.MaterialNum[i], this.ReMarks[i]).then(response => {
purchaseRequisition1(this.RequisitionList, this.projectName, this.projectFloatValue, this.MachineToolNumber, this.machineFloatValue, this.groupName, this.groupFloatValue, this.StandardPartsAndOutsourcing[i], this.MaterialName[i], this.MaterialCode[i], this.MaterialSpecification[i], this.MaterialModel[i], this.NumberOfParts[i], 1, this.time, this.MaterialNum[i], this.ReMarks[i]).then(response => {
this.result += parseInt(response.data[0].result)
if (this.result === this.StandardPartsAndOutsourcing.length) {
this.$message.success('请购成功')