Files
JY1.0/src/views/ManufacturingCenter/InitialProduction/index.vue
liushuai 0bd9cd0189 更新
2020-04-18 17:41:57 +08:00

1382 lines
57 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">
<el-card>
<el-col style="width: 530px">
<el-form label-width="270px" label-position="right" class="Time">
<el-form-item v-show="false">
<el-radio-group v-model="radio" size="small">
<el-radio :label="0">正常件投产</el-radio>
<el-radio :label="1">整改件投产</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="机床图号" style="margin-top:28px">
<el-select v-model="toolNumValue" filterable size="small" style="margin-bottom:10px;width: 180px" placeholder="机床图号" @change="typeChange1()" @focus="typeChange()">
<el-option
v-for="item in toolNum"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.value2 }}</div>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="分组">
<el-select v-model="NumValue" filterable size="small" style="margin-bottom:10px;width: 180px" placeholder="分组" @change="total = 0;pageSize = 10;pageList = 1;getTable()">
<el-option
v-for="item in Num"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="primary" size="small" icon="el-icon-search" style="margin-left:10px" plain @click="total = 0;pageSize = 10000;pageList = 1;getTable()">查询</el-button>
</el-form-item>
</el-form>
</el-col>
<el-col style="width: 530px;margin-left: 50px">
<el-form label-width="70px" label-position="left" class="Time">
<el-form-item label="计划下达">
<el-col :span="8">
<el-date-picker v-model="time_planStart" size="small" type="date" class="time" readonly/>
</el-col>
<el-col :span="1" class="line"></el-col>
<el-col :span="8">
<el-date-picker v-model="time_planFinish" size="small" type="date" class="time" readonly/>
</el-col>
</el-form-item>
<el-form-item label="工艺">
<el-col :span="8">
<el-date-picker v-model="time_gongyiStart" size="small" type="date" class="time" readonly/>
</el-col>
<el-col :span="1" class="line"></el-col>
<el-col :span="8">
<el-date-picker v-model="time_gongyiFinish" size="small" type="date" class="time" readonly/>
</el-col>
</el-form-item>
<el-form-item label="定额">
<el-col :span="8">
<el-date-picker v-model="time_dingeStart" size="small" type="date" class="time" readonly/>
</el-col>
<el-col :span="1" class="line"></el-col>
<el-col :span="8">
<el-date-picker v-model="time_dingeFinish" size="small" type="date" class="time" readonly/>
</el-col>
</el-form-item>
<el-form-item label="计划平衡">
<el-col :span="8">
<el-date-picker v-model="time_planpinghengStart" size="small" type="date" class="time" readonly/>
</el-col>
<el-col :span="1" class="line"></el-col>
<el-col :span="8">
<el-date-picker v-model="time_planpinghengFinish" size="small" type="date" class="time" readonly/>
</el-col>
</el-form-item>
<el-form-item label="加工">
<el-col :span="8">
<el-date-picker v-model="time_machiningStart" size="small" type="date" class="time" readonly/>
</el-col>
<el-col :span="1" class="line"></el-col>
<el-col :span="8">
<el-date-picker v-model="time_machiningFinish" :picker-options="pickerOptions" default-time="23:59:59" size="small" type="date" value-format="yyyy-MM-dd HH:mm:ss" style="margin-bottom:20px;width:150px"/>
</el-col>
</el-form-item>
</el-form>
</el-col>
</el-card>
<el-card>
<div>
<el-table
v-loading="listLoading"
:data="tableData"
:row-class-name="tableRowClassName"
border
stripe
highlight-current-row
style="width: 100%;max-height: 400px"
height="400"
@selection-change="handleSelectionChange"
@row-click="handleCurrentChange1">
<el-table-column
type="selection"
align="center"
width="45"/>
<el-table-column label="零件号" prop="零件图号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" prop="零件名称" align="center">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="规格" prop="规格" align="center" width="170">
<template slot-scope="scope">
{{ 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.最大投产批次 }}
</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.未投产数量 }}
</template>
</el-table-column>
<el-table-column label="零件备注" align="center" width="120">
<template slot-scope="scope">
{{ scope.row.零件备注 }}
</template>
</el-table-column>
<el-table-column label="零件类型" prop="零件类型名称" align="center" width="120">
<template slot-scope="scope">
{{ scope.row.零件类型名称 }}
</template>
</el-table-column>
<el-table-column label="操作" width="220px" fixed="right" align="center">
<template slot-scope="scope">
<el-button
:disabled="checked_hebing"
size="mini"
type="primary"
icon="el-icon-star-off"
style="padding: 4px 8px"
plain
@click="handleEdit(scope.$index, scope.row, 'form')">分批投产</el-button>
<el-button
size="mini"
type="primary"
icon="el-icon-star-off"
style="padding: 4px 8px"
plain
@click="handleEditNumber(scope.$index, scope.row)">更改数量</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
v-show="false"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 10000]"
:page-size="pageSize"
:total="total"
style="width:50%;display:inline-block;"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
<el-tooltip :open-delay="1200" effect="dark" content="将不同组号中相同图号的零件合并" placement="top">
<el-checkbox v-model="checked_hebing" style="margin-top:10px;margin-right:10px">合并生产</el-checkbox>
</el-tooltip>
<el-tooltip :open-delay="1200" effect="dark" content="将零件加急处理" placement="top">
<el-checkbox v-model="checked_UrgentItem" style="margin-top:10px;margin-right:10px">是否加急</el-checkbox>
</el-tooltip>
<el-tooltip :open-delay="1200" effect="dark" content="选中零件进行备料投产" placement="top">
<el-button :loading="listLoading3" type="primary" size="small" plain @click="production10">备料投产</el-button>
</el-tooltip>
<el-tooltip :open-delay="1200" effect="dark" content="选中零件进行投产" placement="top">
<el-button :loading="listLoading3" type="warning" size="small" plain @click="production">投产</el-button>
</el-tooltip>
<el-tooltip :open-delay="1200" effect="dark" content="打回到零件分配" placement="top">
<el-button :loading="listLoading3" type="danger" size="small" style="margin-left: 10px" plain @click="back">打回</el-button>
</el-tooltip>
<el-button icon="el-icon-circle-plus-outline" type="distribution" size="small" style="float:right;" @click="openUrgentItem()">加急件</el-button>
</div>
</div>
</el-card>
<el-card>
<div>
<el-table
v-loading="listLoading1"
:data="tableData1"
stripe
size="mini"
tooltip-effect="dark"
style="width: 100%">
<el-table-column
label="零件号">
<template slot-scope="scope">{{ scope.row.零件图号 }}</template>
</el-table-column>
<el-table-column
prop="零件名称"
label="零件名称" >
<template slot-scope="scope">{{ scope.row.零件名称 }}</template>
</el-table-column>
<el-table-column
label="投产批次">
<template slot-scope="scope">{{ scope.row.投产批次 }}</template>
</el-table-column>
<el-table-column
label="批次数量">
<template slot-scope="scope">{{ scope.row.批次数量 }}</template>
</el-table-column>
<el-table-column
label="投产时间">
<template slot-scope="scope">{{ scope.row.操作时间 ? scope.row.操作时间.split(' ')[0] : '' }}</template>
</el-table-column>
<!--<el-table-column-->
<!--label="是否外协">-->
<!--<template slot-scope="scope">{{ scope.row.是否外协 }}</template>-->
<!--</el-table-column>-->
<!--<el-table-column-->
<!--label="是否带料">-->
<!--<template slot-scope="scope">{{ scope.row.是否带料 }}</template>-->
<!--</el-table-column>-->
<el-table-column
label="机加工开始时间">
<template slot-scope="scope">{{ scope.row.机加工开始时间 ? scope.row.机加工开始时间.split(' ')[0] : '' }}</template>
</el-table-column>
<el-table-column
label="机加工结束时间">
<template slot-scope="scope">{{ scope.row.机加工结束时间 ? scope.row.机加工结束时间.split(' ')[0] : '' }}</template>
</el-table-column>
<el-table-column label="操作" width="200px">
<template slot-scope="scope">
<el-button
size="mini"
fixed="rihgt"
type="text"
icon="el-icon-edit"
@click="handleEdit1(tableData1, scope.$index, scope.row, 'form')">编辑</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
v-show="false"
:current-page="currentPage3"
:page-sizes="[10, 20, 30, 10000]"
:page-size="pageSize3"
:total="total3"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange3"
@current-change="handleCurrentChange3"/>
</div>
</div>
</el-card>
<el-dialog :visible.sync="dialogFormVisible2" title="打回档案" center width="200px">
<el-form ref="form1" :model="form1" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="打回原因" prop="reason">
<el-input v-model="form1.reason" size="small" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="callOff1('form1')">取消</el-button>
<el-button size="small" type="primary" @click="submit1('form1')"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible3" title="更改投产数量" center width="300px">
<el-form ref="form3" :model="form3" :rules="rules3" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="投产数量" prop="投产数量">
<el-input-number v-model="form3.投产数量" :min="AlreadyCastNumber" :step="1" size="small" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="callOff2('form3')">取消</el-button>
<el-button size="small" type="primary" @click="EditNumber('form3')"> </el-button>
</div>
</el-dialog>
<el-dialog :title="title" :visible.sync="dialogFormVisible1" center width="370px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="零件图号" prop="PDnumber">
<el-input v-model="form.PDnumber" size="small" disabled style="width:160px" />
</el-form-item>
<el-form-item label="投产总数量" prop="quantity">
<el-input v-model="form.quantity" size="small" disabled style="width:160px" />
</el-form-item>
<el-form-item label="未投产数量" prop="unputquantity">
<el-input v-model="form.unputquantity" size="small" disabled style="width:160px"/>
</el-form-item>
<el-form-item label="投产批次" prop="productionBatch">
<el-input v-model="form.productionBatch" size="small" disabled style="width:160px" placeholder="请输入投产批次"/>
</el-form-item>
<el-form-item v-show="temp === 1" label="批次数量1" prop="batchQuantity">
<el-input-number v-model="form.batchQuantity" :min="1" :max="parseInt(form.unputquantity)" size="small" style="width:160px" label="批次数量"/>
</el-form-item>
<el-form-item v-show="temp === 2" label="批次数量2" prop="batchQuantity2">
<el-input-number v-model="form.batchQuantity2" :min="1" :max="parseInt(maxmax)" size="small" style="width:160px" label="批次数量"/>
</el-form-item>
<el-form-item label="加工开始时间">
<el-date-picker
v-model="form.startDate_F"
size="small"
disabled
type="date"
value-format="yyyy-MM-dd"
style="top: 1px;width:160px"
placeholder="选择开始日期"/>
</el-form-item>
<el-form-item label="加工结束时间" prop="endDate_F">
<el-date-picker
:readonly="readonly"
v-model="form.endDate_F"
size="small"
type="date"
value-format="yyyy-MM-dd"
style="top: 1px;width:160px"
placeholder="选择结束日期"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="callOff('form')">取消</el-button>
<el-button size="small" type="primary" @click="submit('form')">确定</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible10" title="添加加急件" center style="min-height: 300px" width="350px">
<el-form ref="form10" :model="form10" :rules="rules10" label-position="left" label-width="100px" class="demo-ruleForm">
<el-form-item label="机床图号" prop="机床图号">
<el-select v-model="form10.机床号" placeholder="选择机床" filterable clearable size="small" style="width:160px" @change="getGroupSelect1">
<el-option
v-for="item in machine"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="组号" prop="组号">
<el-select v-model="form10.组号" placeholder="选择组号" filterable clearable size="small" style="width:160px">
<el-option
v-for="item in group1"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="零件图号" prop="零件图号">
<el-input v-model="form10.零件图号" placeholder="零件图号" size="small" style="width:160px" clearable/>
</el-form-item>
<el-form-item label="零件名称" prop="零件名称">
<el-input v-model="form10.零件名称" placeholder="零件名称" size="small" style="width:160px" clearable/>
</el-form-item>
<el-form-item label="规格">
<el-input v-model="form10.规格" placeholder="规格" size="small" style="width:160px" clearable/>
</el-form-item>
<el-form-item label="零件数量" prop="零件数量">
<el-input-number v-model="form10.零件数量" :step="1" :min="1" size="mini" style="width:160px"/>
</el-form-item>
<el-form-item label="零件备注" prop="零件备注">
<el-input v-model="form10.零件备注" placeholder="零件备注" size="small" style="width:160px" clearable/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form10')">取消</el-button>
<el-button :disabled="openUrgentItem_disable" type="primary" @click="submit10('form10')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { machineSelect, groupSelect, getToolNum, getNum, getTable, production, getTable1, revisionBatch, editList, dele, production2, production20, production10, edit, EditNumber, addUrgentItem } from '@/api/ManufacturingCenter/InitialProduction'
import { mapGetters } from 'vuex'
import Cookie from 'js-cookie'
export default {
data() {
return {
openUrgentItem_disable: false,
checked_hebing: true,
checked_UrgentItem: false,
UrgentItem: 0,
maxmax: '',
clearTable: 0,
readonly: true,
gongyirenwuzhuangtai: '',
machine: [],
group1: [],
NUMBER10: '',
count: 0, // 表单计数器
count2: 0,
count3: 0,
midcode: 0, // 查询表2的中间变量
shijiancuo: 0,
shijiancuo1: 0,
jieguo: 0,
value: '',
title: null,
listLoading3: false,
temp: 0,
ComponentflowNumber: '', // 组件零件基本件流水号
TypeflowNumber: '',
dataType: '', // 数据类型
productionQuantity: '', // 投产总数量
AlreadyCastNumber: 0, // 已投产数量
checked_waixie1: '',
piciNumber: '',
MaterialflowNumber: '', // 材料流水号
checked_zhaoji1: '',
time_planStart: '',
time_planFinish: '',
time_gongyiFinish: '',
time_gongyiStart: '',
time_dingeFinish: '',
time_dingeStart: '',
time_planpinghengFinish: '',
time_planpinghengStart: '',
time_machiningFinish: '',
time_machiningStart: '',
time: '',
form: { // 修改表单
PDnumber: '',
quantity: '',
unputquantity: '',
productionBatch: '',
batchQuantity: '',
batchQuantity2: '',
startDate_F: '',
endDate_F: ''
},
form10: {
机床号: '',
组号: '',
零件图号: '',
零件名称: '',
规格: '',
零件数量: '',
零件备注: ''
},
rules10: {
机床号: [{ required: true, message: '请选择机床', trigger: 'change' }],
组号: [{ required: true, message: '请选择组号', trigger: 'change' }],
零件图号: [{ required: true, message: '请输入零件图号', trigger: 'blur' }],
零件名称: [{ required: true, message: '请输入零件名称', trigger: 'blur' }],
零件数量: [{ required: true, message: '请输入零件数量', trigger: 'blur' }]
},
form1: {
reason: ''
},
form3: {
投产数量: ''
},
rules: { // 表单验证规则
batchQuantity: [{ required: true, message: '请输入批次数量', trigger: 'blur' }],
// startDate_F: [{ required: true, message: '请选择加工开始时间', trigger: 'change' }],
endDate_F: [{ required: true, message: '请选择加工结束时间', trigger: 'change' }],
reason: [{ required: true, message: '请输入打回原因', trigger: 'blur' }]
},
rules3: { // 表单验证规则
投产数量: [{ required: true, message: '请输入投产数量', trigger: 'blur' }]
},
pickerOptions: {
// 限制日期
disabledDate: this.disabledDate
},
// value1: '',
result: 0,
dialogFormVisible1: false,
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible10: false,
NumberValue: '',
date: '',
a: false,
multipleSelection: [],
checked_baitu: false,
checked_gaonandu: false,
tableData: [], // 表1
tableData1: [], // 表2
entryNameValue: '',
entryName: [], // 项目名称
toolNumValue: '',
toolNum: [], // 机床号
NumValue: '',
Num: [], // 分组
liushuihao: '',
gongyijihua: '',
radio: 0, // 第一组
total: 0, // 总条数
pageSize: 10000, // 每页显示条数
pageList: 1, // 后台获取页
currentPage: 1, // 显示当前页
total3: 0, // 总条数
pageSize3: 10000, // 每页显示条数
pageList3: 1, // 后台获取页
currentPage3: 1, // 显示当前页
listLoading: false,
listLoading1: false
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id'
])
},
// watch: {
// // 如果路由有变化,会再次执行该方法
// '$route'(to) {
// const _this = this
// console.log(to, 2222)
// if (to.name === 'InitialProduction') {
// _this.typeChange()
// }
// },
// '$route': {
// handler(route) {
// const _this = this
// console.log(route.name)
// if (route.name === 'InitialProduction') {
// _this.typeChange()
// }
// }
// }
// },
created() {
this.typeChange()
this.getCurrentTime()
this.getNowTime()
this.fetchData()
},
methods: {
disabledDate(time) {
return time.getTime() < Date.now() - 8.64e7 + 3 * 24 * 60 * 60 * 1000
},
gaibianwaixie(index, row) {
if (row.checked_waixie === false) {
row.checked_dailiao = false
}
},
select(rows) {
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row)
})
} else {
this.$refs.multipleTable.clearSelection()
}
},
getCurrentTime() {
this.time_planFinish = this.getTime0(0)
this.time_gongyiFinish = this.getTime0(2)
this.time_gongyiStart = this.getTime0(0)
this.time_dingeFinish = this.getTime0(2)
this.time_dingeStart = this.getTime0(2)
this.time_planpinghengFinish = this.getTime0(3)
this.time_planpinghengStart = this.getTime0(2)
this.time_machiningStart = this.getTime0(3)
this.time = this.getTime0(5)
const _this = this
setTimeout(() => {
_this.getCurrentTime()
}, 1000)
},
getTime0(num) {
var date0 = new Date()
var date = new Date(date0.getTime() + num * 24 * 60 * 60 * 1000)
var month = this.zeroFill(date.getMonth() + 1)
var day = this.zeroFill(date.getDate())
var hour = this.zeroFill(date.getHours())
var minute = this.zeroFill(date.getMinutes())
var second = this.zeroFill(date.getSeconds())
return date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
},
getNowTime() {
var date = new Date()
var month = this.zeroFill(date.getMonth() + 1)
var day = this.zeroFill(date.getDate())
var hour = this.zeroFill(date.getHours())
var minute = this.zeroFill(date.getMinutes())
var second = this.zeroFill(date.getSeconds())
this.time_planStart = date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
},
zeroFill(i) {
if (i >= 0 && i <= 9) {
return '0' + i
} else {
return i
}
},
// 初始化获取项目名称
fetchData() {
this.getSelect(machineSelect, ['机床图号', '机床流水号'], 'machine')
},
getGroupSelect1() {
this.form10.组号 = ''
this.getSelect(groupSelect, ['组号', '组件流水号'], 'group1', this.form10.机床号)
},
openUrgentItem() {
if (this.$refs['form10'] !== undefined) {
this.$refs['form10'].resetFields()
}
this.openUrgentItem_disable = false
this.form10.规格 = ''
this.form10.机床号 = ''
this.dialogFormVisible10 = true
},
typeChange() {
this.toolNumValue = ''
this.toolNum = []
this.NumValue = ''
this.Num = []
if (Cookie.get('machineValue') !== undefined) {
getToolNum().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.toolNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号,
value2: response.data[i].项目名称
})
}
}).then(() => {
this.toolNumValue = parseInt(Cookie.get('machineValue'))
this.typeChange1()
this.NumValue = parseInt(Cookie.get('group'))
this.getTable()
Cookie.remove('machineValue')
Cookie.remove('group')
})
} else {
getToolNum().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.toolNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号,
value2: response.data[i].项目名称
})
}
})
}
},
typeChange1() {
this.NumValue = ''
this.Num = []
getNum(this.toolNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Num.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
getTable() {
if (this.NumValue === '') {
this.$message.error('请选择机床组号')
} else {
this.listLoading = true
this.tableData1 = []
getTable(this.NumValue, this.pageList, this.pageSize).then(response => {
this.total = parseInt(response.data.total)
this.tableData = []
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].已投产数量,
未投产数量: response.data.rows[i].未投产数量,
零件类型名称: response.data.rows[i].零件类型名称,
组件零件基本件流水号: response.data.rows[i].组件零件基本件流水号,
投产类型流水号: response.data.rows[i].投产类型流水号,
数据类型: response.data.rows[i].数据类型,
零件备注: response.data.rows[i].零件备注,
规格: response.data.rows[i].规格,
是否加急件: response.data.rows[i].是否加急件,
材料流水号: response.data.rows[i].材料流水号,
checked_dailiao: false,
checked_waixie: false,
checked_zhaoji: false
})
}
}).then(() => {
this.listLoading = false
})
}
},
submit10(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.openUrgentItem_disable = true
addUrgentItem(this.form10.机床号, this.form10.组号, this.form10.零件图号, this.form10.零件名称, this.form10.规格, this.form10.零件数量, this.form10.零件备注, this.id, this.time_planStart, this.time_planFinish, this.time_gongyiStart, this.time_gongyiFinish, this.time_dingeStart, this.time_dingeFinish, this.time_planpinghengStart, this.time_planpinghengFinish, this.time_machiningStart, this.time).then(response => {
if (response.data[0].result === '1') {
this.$message.success('添加成功')
this.dialogFormVisible10 = false
} else {
this.openUrgentItem_disable = false
this.$message.error('添加失败')
}
})
}
})
},
// 点击Table查询设备信息
handleCurrentChange1(row) {
this.tableData1 = []
this.listLoading1 = true
getTable1(row.组件零件基本件流水号, this.pageList3, this.pageSize3).then(response => {
if (response.data.total !== 0) {
this.gongyirenwuzhuangtai = response.data.rows[0].工艺任务分配状态
this.midcode = row.组件零件基本件流水号
this.total3 = parseInt(response.data.total)
this.tableData1 = response.data.rows
}
this.listLoading1 = false
})
},
handleSelectionChange(val) {
this.multipleSelection = val
},
handleEditNumber(index, row) {
this.dialogFormVisible3 = true
this.NumberValue = row.组件零件基本件流水号
this.form3.投产数量 = row.投产总数量
this.AlreadyCastNumber = row.已投产数量 ? parseInt(row.已投产数量) : 0
},
EditNumber() {
EditNumber(this.NumberValue, this.form3.投产数量, this.AlreadyCastNumber).then(response => {
if (response.data[0].result === '1') {
this.getTable()
this.dialogFormVisible3 = false
this.$message.success('更改成功')
} else {
this.$message.error('更改失败')
}
})
},
// 打开分批投产
handleEdit(index, row, formName) {
this.temp = 1
this.title = '分批投产'
this.readonly = true
this.midcode = row.组件零件基本件流水号
if (this.time_machiningFinish === '') {
this.$message.error('请选择加工结束时间')
} else {
this.count = this.count + 1
if (this.count !== 1) {
this.$refs[formName].resetFields()
}
this.form.endDate_F = this.time_machiningFinish
this.form.PDnumber = row.零件图号
this.form.quantity = row.投产总数量
if (row.未投产数量 !== '' && row.未投产数量 !== null) {
this.form.unputquantity = row.未投产数量
} else {
this.form.unputquantity = row.投产总数量
}
if (row.最大投产批次 !== '' && row.最大投产批次 !== null) {
this.form.productionBatch = parseInt(row.最大投产批次) + 1
} else {
this.form.productionBatch = 1
}
this.form.startDate_F = this.time_machiningStart
this.ComponentflowNumber = row.组件零件基本件流水号
this.TypeflowNumber = row.投产类型流水号
this.dataType = row.数据类型
this.productionQuantity = row.投产总数量
this.checked_waixie1 = row.checked_waixie
this.MaterialflowNumber = row.材料流水号
this.checked_zhaoji1 = row.checked_zhaoji
this.dialogFormVisible1 = true
}
},
// 打开编辑
handleEdit1(tableData, index, row, formName) {
let Sum = null
this.temp = 2
this.title = '编辑'
this.readonly = false
this.count3 = this.count3 + 1
if (this.count3 !== 1) {
this.$refs[formName].resetFields()
}
this.form.endDate_F = row.机加工结束时间
this.dialogFormVisible1 = true
this.form.PDnumber = row.零件图号
this.form.quantity = row.投产总数量
if (row.最大投产批次 !== '' && row.最大投产批次 !== null) {
this.form.productionBatch = row.最大投产批次
} else {
this.form.productionBatch = 1
}
this.form.startDate_F = row.机加工开始时间
this.ComponentflowNumber = row.组件零件基本件流水号
this.TypeflowNumber = row.投产类型流水号
this.dataType = row.数据类型
this.productionQuantity = row.投产总数量
this.checked_waixie1 = row.checked_waixie
this.MaterialflowNumber = row.材料流水号
this.checked_zhaoji1 = row.checked_zhaoji
this.form.batchQuantity2 = parseInt(row.批次数量)
this.form.batchQuantity = parseInt(row.批次数量)
this.piciNumber = parseInt(row.批次数量)
this.gongyijihua = row.工艺计划流水号
this.form.unputquantity = row.投产总数量 - row.已投产数量
for (let i = 0; i < tableData.length; i++) {
Sum += parseInt(tableData[i].批次数量)
if (i === tableData.length - 1) {
Sum -= parseInt(row.批次数量)
this.maxmax = row.投产总数量 - Sum
}
}
},
// 提交编辑
submitEdit() {
this.shijiancuo1 = Date.parse(this.form.startDate_F)
this.shijiancuo = Date.parse(this.form.endDate_F)
this.jieguo = this.shijiancuo1 - this.shijiancuo
if (this.jieguo >= 0) {
this.$message.error('加工结束时间应大于开始时间')
} else {
this.temp = null
if (this.gongyirenwuzhuangtai === '1') {
editList(this.gongyijihua, this.form.batchQuantity2, this.form.startDate_F, this.form.endDate_F, this.piciNumber).then(response => {
if (response.data.hasOwnProperty('result') === false) {
this.dialogFormVisible1 = false
this.NUMBER10 = response.data[0].已投产数量
this.$message({
type: 'success',
message: '信息更新成功!'
})
if (parseInt(this.productionQuantity) === this.NUMBER10) {
this.tableData1 = []
this.total3 = 0
this.listLoading1 = false
} else {
getTable1(this.midcode, this.pageList3, this.pageSize3).then(response => {
this.total3 = parseInt(response.data.total)
this.tableData1 = response.data.rows
this.listLoading1 = false
})
}
this.total = 0
this.pageSize = 10000
this.pageList = 1
this.getTable()
} else {
if (response.data[0].result === '0') {
this.dialogFormVisible1 = false
this.$message.error('信息更新失败')
}
}
})
} else {
this.dialogFormVisible1 = false
this.$message.error('零件任务已经分配,无法更改')
}
this.shijiancuo1 = 0
this.shijiancuo = 0
this.jieguo = 0
}
},
// 分批投产确定
revisionBatch() {
if (this.checked_waixie1 === false) {
this.checked_waixie1 = 1
} else {
this.checked_waixie1 = 2
}
if (this.checked_zhaoji1 === false) {
this.checked_zhaoji1 = 0
} else {
this.checked_zhaoji1 = 1
}
if (this.checked_gaonandu === false) {
this.checked_gaonandu = 0
} else {
this.checked_gaonandu = 1
}
if (this.checked_baitu === false) {
this.checked_baitu = 0
} else {
this.checked_baitu = 1
}
if (this.checked_dailiao === true) {
this.checked_dailiao = 2
} else {
this.checked_dailiao = 1
}
this.shijiancuo1 = Date.parse(this.time_machiningStart)
this.shijiancuo = Date.parse(this.form.endDate_F)
this.jieguo = this.shijiancuo1 - this.shijiancuo
if (this.jieguo >= 0) {
this.$message.error('加工结束时间应大于开始时间')
} else {
this.temp = null
this.listLoading = true
revisionBatch(this.ComponentflowNumber, this.TypeflowNumber, this.dataType, this.form.productionBatch, this.form.batchQuantity, this.time_planStart, this.time_planFinish, this.time_gongyiStart, this.time_gongyiFinish, this.time_dingeStart, this.time_dingeFinish, this.time_planpinghengStart, this.time_planpinghengFinish, this.time_machiningStart, this.time_machiningFinish, this.time_planStart, this.checked_waixie1, this.checked_dailiao, this.id, this.MaterialflowNumber, this.radio, this.checked_gaonandu, this.checked_zhaoji1, this.checked_baitu).then(response => {
if (response.data[0].result === '1') {
this.dialogFormVisible1 = false
this.$message({
type: 'success',
message: '分批投产成功!'
})
this.clearTable = this.total
this.checked_baitu = false
this.checked_gaonandu = false
this.total = 0
this.pageSize = 10000
this.pageList = 1
this.shijiancuo1 = 0
this.shijiancuo = 0
this.checked_dailiao = 0
this.jieguo = 0
this.tableData = []
getTable(this.NumValue, this.pageList, this.pageSize).then(response => {
this.total = parseInt(response.data.total)
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].已投产数量,
未投产数量: response.data.rows[i].未投产数量,
零件类型名称: response.data.rows[i].零件类型名称,
组件零件基本件流水号: response.data.rows[i].组件零件基本件流水号,
投产类型流水号: response.data.rows[i].投产类型流水号,
数据类型: response.data.rows[i].数据类型,
零件备注: response.data.rows[i].零件备注,
是否加急件: response.data.rows[i].是否加急件,
规格: response.data.rows[i].规格,
材料流水号: response.data.rows[i].材料流水号,
checked_dailiao: false,
checked_waixie: false,
checked_zhaoji: false
})
}
return this.total
}).then((total) => {
this.listLoading = false
getTable1(this.midcode, this.pageList3, this.pageSize3).then(response => {
const data = response.data.rows
for (let i = 0; i < data.length; i++) {
data[i].批次数量 = parseInt(data[i].批次数量)
}
this.total3 = parseInt(response.data.total)
if (this.clearTable === total) {
this.tableData1 = data
} else {
this.tableData1 = []
}
this.listLoading1 = false
})
})
} else {
this.dialogFormVisible1 = false
this.$message.error('分批投产失败')
}
})
}
},
// 投产
production() {
this.result = 0
this.UrgentItem = 0
if (this.time_machiningFinish === '' || this.time_machiningFinish === null) {
this.$message.error('请输入加工结束时间')
} else {
this.shijiancuo1 = Date.parse(this.time_machiningStart)
this.shijiancuo = Date.parse(this.time_machiningFinish)
this.jieguo = this.shijiancuo1 - this.shijiancuo
if (this.jieguo >= 0) {
this.$message.error('加工结束时间应大于开始时间')
} else {
if (this.multipleSelection.length === 0) {
this.$message.error('请至少选择一个零件')
} else {
if (this.checked_UrgentItem === true) {
this.UrgentItem = 1
}
if (this.checked_hebing === true) {
this.listLoading3 = true
for (let i = 0; i < this.multipleSelection.length; i++) {
if (this.multipleSelection[i].checked_waixie === false) {
this.multipleSelection[i].checked_waixie = 1
} else {
this.multipleSelection[i].checked_waixie = 2
}
if (this.multipleSelection[i].checked_zhaoji === false) {
this.multipleSelection[i].checked_zhaoji = 0
} else {
this.multipleSelection[i].checked_zhaoji = 1
}
if (this.multipleSelection[i].checked_dailiao === true) {
this.multipleSelection[i].checked_dailiao = 2
} else {
this.multipleSelection[i].checked_dailiao = 1
}
if (this.checked_gaonandu === false) {
this.checked_gaonandu = 0
} else {
this.checked_gaonandu = 1
}
if (this.checked_baitu === false) {
this.checked_baitu = 0
} else {
this.checked_baitu = 1
}
production2(this.multipleSelection[i].零件图号, this.multipleSelection[i].规格, this.toolNumValue, this.multipleSelection[i].数据类型, this.multipleSelection[i].投产总数量, this.time_planStart, this.time_planFinish, this.time_gongyiStart, this.time_gongyiFinish, this.time_dingeStart, this.time_dingeFinish, this.time_planpinghengStart, this.time_planpinghengFinish, this.time_machiningStart, this.time_machiningFinish, this.time_planStart, this.multipleSelection[i].checked_waixie, this.multipleSelection[i].checked_dailiao, this.id, this.multipleSelection[i].材料流水号, this.radio, this.checked_gaonandu, this.multipleSelection[i].checked_zhaoji, this.checked_baitu, this.UrgentItem, this.multipleSelection[i].是否加急件).then(response => {
this.result += parseInt(response.data[0].result)
if (this.result === this.multipleSelection.length) {
this.$message.success('投产成功')
this.total = 0
this.pageList = 1
this.getTable()
this.checked_baitu = false
this.checked_gaonandu = false
this.tableData1 = []
this.listLoading3 = false
} else if (response.data[0].result === '0') {
this.listLoading3 = false
this.$message.error('投产失败')
}
})
this.shijiancuo1 = 0
this.shijiancuo = 0
this.jieguo = 0
}
} else {
this.listLoading3 = true
for (let i = 0; i < this.multipleSelection.length; i++) {
if (this.multipleSelection[i].checked_waixie === false) {
this.multipleSelection[i].checked_waixie = 1
} else {
this.multipleSelection[i].checked_waixie = 2
}
if (this.multipleSelection[i].checked_zhaoji === false) {
this.multipleSelection[i].checked_zhaoji = 0
} else {
this.multipleSelection[i].checked_zhaoji = 1
}
if (this.multipleSelection[i].checked_dailiao === true) {
this.multipleSelection[i].checked_dailiao = 2
} else {
this.multipleSelection[i].checked_dailiao = 1
}
if (this.checked_gaonandu === false) {
this.checked_gaonandu = 0
} else {
this.checked_gaonandu = 1
}
if (this.checked_baitu === false) {
this.checked_baitu = 0
} else {
this.checked_baitu = 1
}
production(this.multipleSelection[i].组件零件基本件流水号, this.multipleSelection[i].投产类型流水号, this.multipleSelection[i].数据类型, this.multipleSelection[i].投产总数量, this.time_planStart, this.time_planFinish, this.time_gongyiStart, this.time_gongyiFinish, this.time_dingeStart, this.time_dingeFinish, this.time_planpinghengStart, this.time_planpinghengFinish, this.time_machiningStart, this.time_machiningFinish, this.time_planStart, this.multipleSelection[i].checked_waixie, this.multipleSelection[i].checked_dailiao, this.id, this.multipleSelection[i].材料流水号, this.radio, this.checked_gaonandu, this.multipleSelection[i].checked_zhaoji, this.checked_baitu, this.UrgentItem, this.multipleSelection[i].是否加急件).then(response => {
this.result += parseInt(response.data[0].result)
if (this.result === this.multipleSelection.length) {
this.$message.success('投产成功')
this.total = 0
this.pageList = 1
this.getTable()
this.checked_baitu = false
this.checked_gaonandu = false
this.tableData1 = []
this.listLoading3 = false
} else if (response.data[0].result === '0') {
this.listLoading3 = false
this.$message.error('投产失败')
}
})
this.shijiancuo1 = 0
this.shijiancuo = 0
this.jieguo = 0
}
}
}
}
}
},
// 备料投产
production10() {
this.result = 0
this.UrgentItem = 0
if (this.time_machiningFinish === '' || this.time_machiningFinish === null) {
this.$message.error('请输入加工结束时间')
} else {
this.shijiancuo1 = Date.parse(this.time_machiningStart)
this.shijiancuo = Date.parse(this.time_machiningFinish)
this.jieguo = this.shijiancuo1 - this.shijiancuo
if (this.jieguo >= 0) {
this.$message.error('加工结束时间应大于开始时间')
} else {
if (this.multipleSelection.length === 0) {
this.$message.error('请至少选择一个零件')
} else {
if (this.checked_UrgentItem === true) {
this.UrgentItem = 1
}
if (this.checked_hebing === true) {
this.listLoading3 = true
for (let i = 0; i < this.multipleSelection.length; i++) {
if (this.multipleSelection[i].checked_waixie === false) {
this.multipleSelection[i].checked_waixie = 1
} else {
this.multipleSelection[i].checked_waixie = 2
}
if (this.multipleSelection[i].checked_zhaoji === false) {
this.multipleSelection[i].checked_zhaoji = 0
} else {
this.multipleSelection[i].checked_zhaoji = 1
}
if (this.multipleSelection[i].checked_dailiao === true) {
this.multipleSelection[i].checked_dailiao = 2
} else {
this.multipleSelection[i].checked_dailiao = 1
}
if (this.checked_gaonandu === false) {
this.checked_gaonandu = 0
} else {
this.checked_gaonandu = 1
}
if (this.checked_baitu === false) {
this.checked_baitu = 0
} else {
this.checked_baitu = 1
}
production20(this.multipleSelection[i].零件图号, this.multipleSelection[i].规格, this.toolNumValue, this.multipleSelection[i].数据类型, this.multipleSelection[i].投产总数量, this.time_planStart, this.time_planFinish, this.time_gongyiStart, this.time_gongyiFinish, this.time_dingeStart, this.time_dingeFinish, this.time_planpinghengStart, this.time_planpinghengFinish, this.time_machiningStart, this.time_machiningFinish, this.time_planStart, this.multipleSelection[i].checked_waixie, this.multipleSelection[i].checked_dailiao, this.id, this.multipleSelection[i].材料流水号, this.radio, this.checked_gaonandu, this.multipleSelection[i].checked_zhaoji, this.checked_baitu, this.UrgentItem, this.multipleSelection[i].是否加急件).then(response => {
this.result += parseInt(response.data[0].result)
if (this.result === this.multipleSelection.length) {
this.$message.success('投产成功')
this.total = 0
this.pageList = 1
this.getTable()
this.checked_baitu = false
this.checked_gaonandu = false
this.tableData1 = []
this.listLoading3 = false
} else if (response.data[0].result === '0') {
this.listLoading3 = false
this.$message.error('投产失败')
}
})
this.shijiancuo1 = 0
this.shijiancuo = 0
this.jieguo = 0
}
} else {
this.listLoading3 = true
for (let i = 0; i < this.multipleSelection.length; i++) {
if (this.multipleSelection[i].checked_waixie === false) {
this.multipleSelection[i].checked_waixie = 1
} else {
this.multipleSelection[i].checked_waixie = 2
}
if (this.multipleSelection[i].checked_zhaoji === false) {
this.multipleSelection[i].checked_zhaoji = 0
} else {
this.multipleSelection[i].checked_zhaoji = 1
}
if (this.multipleSelection[i].checked_dailiao === true) {
this.multipleSelection[i].checked_dailiao = 2
} else {
this.multipleSelection[i].checked_dailiao = 1
}
if (this.checked_gaonandu === false) {
this.checked_gaonandu = 0
} else {
this.checked_gaonandu = 1
}
if (this.checked_baitu === false) {
this.checked_baitu = 0
} else {
this.checked_baitu = 1
}
production10(this.multipleSelection[i].组件零件基本件流水号, this.multipleSelection[i].投产类型流水号, this.multipleSelection[i].数据类型, this.multipleSelection[i].投产总数量, this.time_planStart, this.time_planFinish, this.time_gongyiStart, this.time_gongyiFinish, this.time_dingeStart, this.time_dingeFinish, this.time_planpinghengStart, this.time_planpinghengFinish, this.time_machiningStart, this.time_machiningFinish, this.time_planStart, this.multipleSelection[i].checked_waixie, this.multipleSelection[i].checked_dailiao, this.id, this.multipleSelection[i].材料流水号, this.radio, this.checked_gaonandu, this.multipleSelection[i].checked_zhaoji, this.checked_baitu, this.UrgentItem, this.multipleSelection[i].是否加急件).then(response => {
this.result += parseInt(response.data[0].result)
if (this.result === this.multipleSelection.length) {
this.$message.success('投产成功')
this.total = 0
this.pageList = 1
this.getTable()
this.checked_baitu = false
this.checked_gaonandu = false
this.tableData1 = []
this.listLoading3 = false
} else if (response.data[0].result === '0') {
this.listLoading3 = false
this.$message.error('投产失败')
}
})
this.shijiancuo1 = 0
this.shijiancuo = 0
this.jieguo = 0
}
}
}
}
}
},
back() {
if (this.multipleSelection.length === 0) {
this.$message.error('请至少选择一个零件')
} else {
this.a = 0
for (let i = 0; i < this.multipleSelection.length; i++) {
edit(this.multipleSelection[i].组件零件基本件流水号).then(response => {
this.a += parseInt(response.data[0].result)
if (this.a === this.multipleSelection.length) {
this.$message.success('打回成功')
this.total = 0
this.pageList = 1
this.getTable()
this.checked_baitu = false
this.checked_gaonandu = false
this.tableData1 = []
this.listLoading3 = false
} else {
this.$message.error('打回失败')
}
})
}
}
},
tableRowClassName({ row }) {
if (row.是否加急件 === '1') {
return 'IsUrgentItem'
}
},
// 打回档案
handleDele(index, row, formName) {
this.count2 = this.count2 + 1
if (this.count2 !== 1) {
this.$refs[formName].resetFields()
}
this.temp = 3
this.liushuihao = row.组件零件基本件流水号
this.form1.reason = ''
this.dialogFormVisible2 = true
},
Dele() {
dele(this.liushuihao, this.form1.reason, this.time_gongyiStart).then(response => {
if (response.data[0].result === '1') {
this.dialogFormVisible2 = false
this.$message({
type: 'success',
message: '打回档案成功!'
})
this.total = 0
this.pageSize = 10000
this.pageList = 1
this.getTable()
} else {
this.dialogFormVisible2 = false
this.$message.error('打回档案失败')
}
})
},
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.temp === 1) {
this.revisionBatch()
} else if (this.temp === 2) {
this.submitEdit()
// this.temp = null
}
} else {
return false
}
})
},
// 重置表单
callOff(formName) {
this.dialogFormVisible1 = false
this.dialogFormVisible10 = false
this.$refs[formName].resetFields()
},
submit1(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.Dele()
} else {
return false
}
})
},
// 重置表单
callOff1(formName) {
this.dialogFormVisible2 = false
this.$refs[formName].resetFields()
},
callOff2(formName) {
this.dialogFormVisible3 = false
this.$refs[formName].resetFields()
},
// 分页
handleSizeChange(val) {
this.pageSize = val
this.getTable()
},
handleCurrentChange(val) {
this.pageList = val
this.getTable()
},
handleSizeChange3(val) {
this.pageSize3 = val
this.getTable1()
},
handleCurrentChange3(val) {
this.pageList3 = val
this.getTable1()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 0px;
}
.el-date-editor{
width:150px
}
.el-select{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.time{
width: 150px;
}
.Time>.el-form-item{
margin:2px;
/*margin-left: 120px;*/
}
.el-form--label-left >>> .el-form-item__label {
text-align: right;
}
>>>.el-dialog--center .el-dialog__body {
text-align: initial;
padding: 20px 30px 20px
}
>>>.el-dialog__header {
padding: 20px 20px 0px;
}
>>>.el-dialog__footer {
padding: 0px 20px 20px;
/*text-align: right;*/
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
>>>.el-form-item {
margin-bottom: 13px;
}
</style>