工艺任务分配

This commit is contained in:
Vergil
2020-02-17 16:07:23 +08:00
parent 6daff95677
commit f48bdb98a8
2 changed files with 65 additions and 48 deletions

View File

@@ -30,6 +30,20 @@ export function getGroupNum(num) {
}
})
}
// 工艺定额人员查询
export function initPerson() {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号',
param: '考核部门编号=20'
}
})
}
// 获取工艺计划,填充主表
export function getTable(PageCurrent, PageSize, num) {
return request({
@@ -45,20 +59,7 @@ export function getTable(PageCurrent, PageSize, num) {
}
})
}
// 工艺定额人员查询
export function initPerson() {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号',
param: '考核部门编号=20'
}
})
}
// 保存
export function save(num1, num2, num3) {
return request({
@@ -68,8 +69,8 @@ export function save(num1, num2, num3) {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '2',
name: '车间生产管理工艺_工艺任务分配_保存数据',
param: '工艺计划流水号=' + num1 + '&人员编号=' + num2 + '&零件图号=' + num3
name: '车间生产管理工艺_工艺任务分配_保存数据_循环执行',
param: '工艺计划流水号=' + num1 + '&零件图号组=' + num2 + '&工艺员流水号组=' + num3
}
})
}
@@ -87,3 +88,17 @@ export function save2(num1, num2, num3, num4) {
}
})
}
// 查询已完工艺详细内容
export function selectTechnology(num1, num2) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: '1',
name: '车间生产管理工艺_工艺任务分配_查询已完工艺',
param: '零件图号=' + num1 + '&规格=' + num2
}
})
}

View File

@@ -27,7 +27,7 @@
<el-table-column align="center" type="selection"/>
<el-table-column align="center" label="零件号" prop="零件号">
<template slot-scope="scope">
{{ scope.row.零件号 }}
{{ scope.row.零件 }}
</template>
</el-table-column>
<el-table-column align="center" prop="零件名称" label="零件名称" width="150">
@@ -83,7 +83,7 @@
</template>
<script>
import { getGraphNum, getGroupNum, getTable, save, initPerson, save2 } from '@/api/ManufacturingCenter/ProcessTaskAssignment'
import { getGraphNum, getGroupNum, getTable, save, save2, initPerson, selectTechnology } from '@/api/ManufacturingCenter/ProcessTaskAssignment'
export default {
data() {
@@ -174,14 +174,9 @@ export default {
this.tableData = []
getTable(this.PageCurrent, this.PageSize, this.GroupNumValue).then(response => {
this.total = response.data.total
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].工艺计划开始时间 = response.data.rows[i].工艺计划开始时间.split(' ')[0]
response.data.rows[i].工艺计划结束时间 = response.data.rows[i].工艺计划结束时间.split(' ')[0]
response.data.rows[i].操作时间 = response.data.rows[i].操作时间.split(' ')[0]
}
for (let i = 0; i < response.data.rows.length; i++) {
this.tableData.push({
零件号: response.data.rows[i].零件图号,
零件: response.data.rows[i].零件图号,
零件名称: response.data.rows[i].零件名称,
工艺开始时间: response.data.rows[i].工艺计划开始时间,
工艺结束时间: response.data.rows[i].工艺计划结束时间,
@@ -199,7 +194,16 @@ export default {
}
},
rowClick(row) {
console.log(row.工艺计划流水号)
selectTechnology(row.零件图号, row.规格).then(response => {
if (response.data[0].结果 === 1) {
console.log(1)
} else {
console.log(0)
}
})
},
handleSelectionChange(val) {
this.multipleSelection = val
},
// 全选
selectAll(rows) {
@@ -214,26 +218,27 @@ export default {
})
} else { this.$message.error('请在第一行中填写工艺员姓名') }
},
handleSelectionChange(val) {
this.multipleSelection = val
},
save() {
for (let i = 0; i < this.multipleSelection.length; i++) {
if (this.multipleSelection[i].工艺员 === '') {
this.$message.error('请选择工艺员')
} else {
this.result = 0
save(this.multipleSelection[i].工艺计划流水号, this.multipleSelection[i].工艺员, this.multipleSelection[i].零件号).then(response => {
this.result += parseInt(response.data[0].result)
if (this.result === this.multipleSelection.length) {
this.$message.success('保存成功')
this.PageCurrent = 1
this.getTable()
} else if (i === this.multipleSelection.length - 1 && this.result !== this.multipleSelection.length) {
this.$message.error('存在保存失败项')
}
})
this.工艺计划流水号组 = []
this.通用件图号 = []
this.工艺员 = []
var check = 1
this.multipleSelection.map(v => {
if (!v.工艺员) {
check = 0
}
this.工艺计划流水号组.push(v.工艺计划流水号)
this.通用件图号.push(v.零件图号)
this.工艺员.push(v.工艺员)
})
if (check === 1) {
save(this.工艺计划流水号组, this.通用件图号, this.工艺员).then(response => {
this.$message.success('保存成功')
this.PageCurrent = 1
this.getTable()
})
} else {
this.$message.error('请选择工艺员')
}
},
// 直接保存工艺
@@ -251,14 +256,12 @@ export default {
check = 0
}
this.工艺计划流水号组.push(v.工艺计划流水号)
this.通用件图号.push(v.零件号)
this.通用件图号.push(v.零件)
this.通用件规格.push(v.规格)
this.工艺员.push(v.工艺员)
})
if (check === 1) {
console.log(this.工艺计划流水号组, this.通用件图号, this.通用件规格, this.工艺员)
save2(this.工艺计划流水号组, this.通用件图号, this.通用件规格, this.工艺员).then(response => {
console.log(response.data, 231)
if (response.data[0].结果 === 'success') {
this.$message.success('保存成功')
this.PageCurrent = 1
@@ -267,8 +270,7 @@ export default {
var messages = []
messages = response.data[0].结果.split('||||')
messages.shift()
console.log(messages)
this.$message.error(`图号${messages}无已完成`)
this.$message.error(`图号${messages}无已完成工艺`)
}
})
} else {