Files
JY1.0/src/views/ManufacturingCenter/PartAssignment/index.vue
2020-04-09 10:54:30 +08:00

1656 lines
69 KiB
Vue

<template>
<div class="app-container">
<el-card style="padding-top: 5px;">
<el-row>
<el-select v-model="machineNumberValue" filterable placeholder="机床图号" size="small" style="margin:0px;width: 180px" clearable @change="machineChange">
<el-option
v-for="item in machineNumber"
: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.name }}</div>
</el-option>
</el-select>
<el-select v-model="groupNumberValue" filterable placeholder="组号" style="margin-left: 10px;width: 90px" size="small" clearable>
<el-option
v-for="item in groupNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span style="margin-left: 20px;font-size: 14px;">任务下达时间:&nbsp;&nbsp;{{ DeliveryTime }}</span>
<!-- <el-button type="success" size="small" icon="el-icon-search" style="margin-left: 15px" @click="searchTable()">查询</el-button>-->
<!-- <el-button type="success" size="small" icon="el-icon-search" style="margin-left: 15px" @click="searchPart()">查询1</el-button>-->
<el-badge :value="value1" :max="99" class="item">
<el-button size="small" type="text" @click="PartCallbackInformation1">外购件和标准件打回信息</el-button>
</el-badge>
<el-badge :value="value" :max="99" class="item">
<el-button size="small" type="text" @click="PartCallbackInformation">基本件打回信息</el-button>
</el-badge>
</el-row>
</el-card>
<el-tabs type="border-card" @tab-click="selectPart">
<el-tab-pane label="基本件">
<el-table :data="tableData1" :row-class-name="tableRowClassName1" stripe border size="mini" style="width: 1160px" height="300px" @selection-change="handleSelectionChange">
<el-table-column align="center" width="50" type="selection"/>
<el-table-column label="零件名称" align="center" width="140px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="零件图号" align="center" width="120px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="前零件图号" align="center" width="120px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.前零件图号 }}
</template>
</el-table-column>
<el-table-column label="材料" align="center" width="120px">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="零件数量" align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
<el-table-column label="机床数量" align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.机床数量 }}
</template>
</el-table-column>
<el-table-column label="零件总数量" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.总数量 }}
</template>
</el-table-column>
<el-table-column label="投产总数量" align="center" width="120px">
<template slot-scope="scope">
<el-input-number v-model="scope.row.投产总数量" :min="0" size="mini" style="width: 95px"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.零件备注 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100px">
<template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-right" plain @click="OutParts(scope.row)">移出</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="外购件">
<el-table :data="tableData2" border size="mini" style="width: 100%" height="300px" @selection-change="handleSelectionChange">
<el-table-column align="center" width="50" type="selection"/>
<el-table-column label="物料代码" align="center" width="120">
<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="物料规格" align="center" width="120">
<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="零件数量" align="center" width="90">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
<el-table-column label="机床数量" align="center" width="90">
<template slot-scope="scope">
{{ scope.row.机床数量 }}
</template>
</el-table-column>
<el-table-column label="零件总数量" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.总数量 }}
</template>
</el-table-column>
<el-table-column label="采购总数量" align="center" width="135px">
<template slot-scope="scope">
<el-input-number v-model="scope.row.采购总数量" :min="0" size="mini" style="width: 100%"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" width="120">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="标准件">
<el-table :data="tableData3" border size="mini" style="width: 100%" height="300px" @selection-change="handleSelectionChange">
<el-table-column align="center" width="50" type="selection"/>
<el-table-column label="物料代码" align="center" width="120">
<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="物料规格" align="center" width="120">
<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="零件数量" align="center" width="90">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
<el-table-column label="机床数量" align="center" width="90">
<template slot-scope="scope">
{{ scope.row.机床数量 }}
</template>
</el-table-column>
<el-table-column label="零件总数量" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.总数量 }}
</template>
</el-table-column>
<el-table-column label="采购总数量" align="center" width="115px">
<template slot-scope="scope">
<el-input-number v-model="scope.row.采购总数量" :min="0" size="mini" style="width: 90px"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" width="120">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<el-card style="padding: 3px">
<el-date-picker
v-model="time"
size="small"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 160px"
placeholder="选择交货期"/>
<span style="font-weight: bold">制造:</span>
<el-tooltip :open-delay="1200" effect="dark" content="将零件选择到采购单" placement="top">
<el-button type="primary" size="small" icon="el-icon-s-shop" plain style="margin-top: 3px; margin-left: 5px" @click="purchaseRequisition()">制造部采购</el-button>
</el-tooltip>
<span style="margin-left: 40px;font-weight: bold">金工:</span>
<el-tooltip :open-delay="1200" effect="dark" content="所选零件分配为自家生产" placement="top">
<el-button type="danger" size="small" icon="el-icon-star-off" plain style="margin-top: 3px; margin-left: 5px" @click="Production()">车间生产</el-button>
</el-tooltip>
<span style="margin-left: 40px;font-weight: bold">采购:</span>
<el-tooltip :open-delay="1200" effect="dark" content="所选零件分配到采购部" placement="top">
<el-button type="success" size="small" icon="el-icon-shopping-cart-full" plain style="margin-top: 3px; margin-left: 5px" @click="PurchasingDepartment()">采购部门采购</el-button>
</el-tooltip>
</el-card>
<el-card style="padding: 3px;">
<el-row>
<el-input v-model="PurchaseOrder" size="small" style="width: 155px" placeholder="请购单号" clearable @change="searchTable1"/>
<el-button icon="el-icon-search" type="primary" size="mini" style="margin-left: 10px" plain @click="searchTable1()">查询</el-button>
<el-button icon="el-icon-circle-plus-outline" type="warning" size="mini" style="margin-left: 10px" plain @click="handleAdd()">请购单</el-button>
<el-button icon="el-icon-delete" type="info" size="mini" style="margin-left: 50px" plain @click="handleDelete()">删除</el-button>
<el-button icon="el-icon-bottom" type="success" plain size="mini" @click="exportExcel()">导出</el-button>
</el-row>
</el-card>
<el-row>
<el-card>
<el-col style="width: 400px;">
<el-table :data="tableData4" stripe border size="mini" style="width: 100%" height="300px" highlight-current-row @row-click="searchDetailed">
<el-table-column label="请购单号" show-overflow-tooltip align="center" width="120px">
<template slot-scope="scope">
{{ scope.row.请购单编号 }}
</template>
</el-table-column>
<el-table-column label="请购人" align="center" show-overflow-tooltip width="80px">
<template slot-scope="scope">
{{ scope.row.请购人 }}
</template>
</el-table-column>
<el-table-column label="请购时间" align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.请购时间 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
</el-table>
</el-col>
<el-col style="width: 950px;margin-left: 0px">
<el-table :data="tableData6" border size="mini" height="300px">
<el-table-column label="序号" type="index" align="center" width="50px"/>
<el-table-column label="零件名称" show-overflow-tooltip align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column label="图号或型号" show-overflow-tooltip align="center" min-width="120px">
<template slot-scope="scope">
{{ scope.row.图号或型号 }}
</template>
</el-table-column>
<el-table-column label="材料或规格" show-overflow-tooltip align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.规格或材料 }}
</template>
</el-table-column>
<el-table-column label="数量" show-overflow-tooltip align="center" width="50px">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
<el-table-column label="零件类型" show-overflow-tooltip align="center" width="80px">
<template slot-scope="scope">
{{ scope.row.零件类型 }}
</template>
</el-table-column>
<el-table-column label="交货期" show-overflow-tooltip align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.物料计划到货时间 }}
</template>
</el-table-column>
<el-table-column label="机床图号" show-overflow-tooltip align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="组号" show-overflow-tooltip align="center" width="50px">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column label="备注" show-overflow-tooltip align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="80px">
<template slot-scope="scope">
<el-tooltip :open-delay="1200" effect="dark" content="编辑" placement="top">
<div style="display: inline-block;margin-right: 10px">
<el-button type="text" size="mini" icon="el-icon-edit" @click="handleEdit1(scope.row)"/>
</div>
</el-tooltip>
<el-tooltip :open-delay="1200" effect="dark" content="移出" placement="top">
<div style="display: inline-block">
<el-button type="text" size="mini" icon="el-icon-delete" @click="MoveOut(scope.row)"/>
</div>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</el-col>
</el-card>
</el-row>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible" title="新增请购单" center style="min-height: 300px" width="350px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="请款单号" prop="请款单号">
<el-input :disabled="true" v-model="form.请款单号" size="small" style="width:160px"/>
</el-form-item>
<el-form-item v-show="false" label="请购车间" prop="请购车间">
<el-input v-model="form.请购车间" size="small" style="width:160px"/>
</el-form-item>
<el-form-item label="请购人员">
<el-input v-model="name" size="small" readonly style="width:160px;"/>
</el-form-item>
<el-form-item label="请购时间" prop="请购时间">
<el-date-picker
v-model="form.请购时间"
size="small"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 160px"
placeholder="选择日期"/>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.Remarks" size="small" style="width:160px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel('form')">取消</el-button>
<el-button v-show="title==='增加'" :disabled="handleAdd_disable" type="primary" @click="submitAdd('form')">确定</el-button>
<el-button v-show="title==='编辑'" type="primary" @click="submitEdit('form')">确定</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-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:150px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitEdit1('form3')">确定</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-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
v-el-drag-dialog
:visible.sync="dialogFormVisible1"
title="基本件打回信息"
center
width="60%"
style="min-height: 400px">
<el-input v-model="partNumber" size="small" placeholder="零件图号及名称" style="width: 200px" clearable @change="PartCallbackInformation"/>
<el-date-picker
v-model="dateRange"
type="daterange"
size="small"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
range-separator="~"
style="width:240px;margin-left: 10px"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="PartCallbackInformation"/>
<el-button
size="small"
type="success"
plain
@click="submit()">采购部采购</el-button>
<!-- :row-class-name="tableRowClassName"-->
<el-table
:data="tableData9"
size="mini"
style="width: 100%;max-height: 300px"
height="400"
highlight-current-row
border
@selection-change="handleSelectionChange10">
<el-table-column align="center" type="selection" width="42px"/>
<el-table-column align="center" label="零件图号">
<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="材料">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件数量" width="150">
<template slot-scope="scope">
<el-input-number v-model="scope.row.零件数量" :min="0" size="mini" style="width: 120px"/>
</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="机床编号">
<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="退回时间">
<template slot-scope="scope">
{{ scope.row.退回时间 }}
</template>
</el-table-column>
<!--<el-table-column property="date" label="操作" width="200" align="center">-->
<!--<template slot-scope="scope">-->
<!--&lt;!&ndash;<el-button&ndash;&gt;-->
<!--&lt;!&ndash;size="mini"&ndash;&gt;-->
<!--&lt;!&ndash;type="success"&ndash;&gt;-->
<!--&lt;!&ndash;plain&ndash;&gt;-->
<!--&lt;!&ndash;@click="submit(scope.row)">确认</el-button>&ndash;&gt;-->
<!--&lt;!&ndash;<el-button&ndash;&gt;-->
<!--&lt;!&ndash;size="mini"&ndash;&gt;-->
<!--&lt;!&ndash;type="danger"&ndash;&gt;-->
<!--&lt;!&ndash;plain&ndash;&gt;-->
<!--&lt;!&ndash;@click="Delete(scope.row)">删除</el-button>&ndash;&gt;-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
</el-dialog>
<el-dialog
v-el-drag-dialog
:visible.sync="dialogFormVisible2"
title="外购件和标准件打回信息"
center
width="60%"
style="min-height: 400px">
<el-input v-model="partNumber1" size="small" placeholder="零件图号及名称" style="width: 200px" clearable @change="PartCallbackInformation1"/>
<el-date-picker
v-model="dateRange1"
type="daterange"
size="small"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
range-separator="~"
style="width:240px;margin-left: 10px"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="PartCallbackInformation1"/>
<el-button
size="small"
type="success"
plain
@click="submit1()">采购部采购</el-button>
<!-- :row-class-name="tableRowClassName"-->
<el-table
:data="tableData10"
size="mini"
style="width: 100%;max-height: 300px"
height="400"
highlight-current-row
border
@selection-change="handleSelectionChange11">
<el-table-column align="center" type="selection" width="42px"/>
<el-table-column align="center" label="物料名称">
<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="物料型号">
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件数量" width="150">
<template slot-scope="scope">
<el-input-number v-model="scope.row.零件数量" :min="0" size="mini" style="width: 120px"/>
</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="机床编号">
<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="退回时间">
<template slot-scope="scope">
{{ scope.row.退回时间 }}
</template>
</el-table-column>
<!--<el-table-column property="date" label="操作" width="200" align="center">-->
<!--<template slot-scope="scope">-->
<!--<el-button-->
<!--size="mini"-->
<!--type="success"-->
<!--plain-->
<!--@click="submit1(scope.row)">确认</el-button>-->
<!--<el-button-->
<!--size="mini"-->
<!--type="danger"-->
<!--plain-->
<!--@click="Delete1(scope.row)">删除</el-button>-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
</el-dialog>
</div>
</template>
<script>
import { searchBillNumber, DeliveryTimeSelect, initProject, searchgroup, searchTable, searchPart, searchPart1, searchTable1, addData, editData, deleteData, searchDetailed1, purchaseRequisition, purchaseRequisition1, purchaseRequisition2, MoveOut, MoveOut1, PurchasingDepartment, Production, PartCallbackInformation, PartCallbackInformation1, Delete, Delete1, editStock, editNum, OutPart, PurchasingDepartmentBack, purchaseRequisition2Back } from '@/api/ManufacturingCenter/PartAssignment'
import { mapGetters } from 'vuex'
import { getNowShotTime } from '@/utils/tool'
import Cookie from 'js-cookie'
export default {
inject: ['reload'],
data() {
return {
handleAdd_disable: false,
dateRange: '',
partNumber: '',
dateRange1: '',
partNumber1: '',
DeliveryTime: '', // 三表下达时间
projectFloatValue: '',
machineNumberValue: '',
machineFloatValue: '',
machineNumber: [],
machineName: '',
groupNumberValue: '',
groupFloatValue: '',
groupNumber: [],
StandardAndOutsourcing: '',
PartNum: '',
DetailedNum: '',
stockNum: '',
MaterialNumber: '',
PurchaseOrder: '',
project: [],
machine: [],
group: [],
PartType: '基本件',
tableData: [],
tableData1: [],
tableData2: [],
tableData3: [],
tableData4: [],
tableData6: [],
loading: false,
title: '',
dialogFormVisible: false,
RequisitionList: '',
form: {
请款单号: '',
请购单编号: '',
请购车间: '制造部',
请购时间: '',
Remarks: ''
},
rules: {
请购单编号: [{ required: true, message: '请输入请购单编号', trigger: 'blur' }],
请购车间: [{ 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: [],
MaterialModel: [],
NumberOfParts: [],
multipleSelection: [],
multipleSelection10: [],
multipleSelection11: [],
ReMarks: [],
projectName: '',
MachineToolNumber: '',
groupName: '',
time: '',
result: 0,
pageSize: '',
pageCurrent: '',
total: '',
check: '',
value: 0,
value1: 0,
tableData9: [],
tableData10: [],
dialogFormVisible1: false,
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible4: false
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id'
])
},
watch: {
// 如果路由有变化,会再次执行该方法
'$route': {
handler(route) {
const _this = this
if (route.name === 'PartAssignment') {
_this.fetchData()
_this.DeliveryTime = ''
}
}
},
groupNumberValue() {
this.searchTable()
}
},
created() {
this.DeliveryTime = ''
this.fetchData()
},
methods: {
// EXCEL 导出
// 姜福壮
exportExcel() {
if (this.RequisitionList !== '') {
var param = []
param[0] = ['请购单流水号', this.RequisitionList]
var Data = this.CreateData('2001', '报表_制造中心制造_零件分配_查询', param)
this.exportExcel_NPOI(Data)
}
},
fetchData() {
if (Cookie.get('machineValue') !== undefined) {
this.machineNumber = []
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].机床流水号
})
}
}).then(() => {
this.machineNumberValue = parseInt(Cookie.get('machineValue'))
this.machineChange()
this.groupNumberValue = parseInt(Cookie.get('group'))
this.searchTable()
Cookie.remove('machineValue')
Cookie.remove('group')
})
} else {
this.machineNumberValue = ''
this.groupNumberValue = ''
this.tableData = []
this.machineNumber = []
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() {
let check, check1
this.dialogFormVisible1 = true
this.tableData9 = []
this.partNumber ? check = 1 : check = 0
this.dateRange ? check1 = 1 : (check1 = 0, this.dateRange = '')
PartCallbackInformation(check, this.partNumber, check1, this.dateRange[0], this.dateRange[1]).then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].退回时间 !== '') {
response.data[i].退回时间 = (response.data[i].退回时间).split(' ')[0]
}
if (response.data[i].是否确认 === 0) {
this.value += 1
}
}
this.tableData9 = response.data
})
},
PartCallbackInformation1() {
this.dialogFormVisible2 = true
let check, check1
this.tableData10 = []
this.partNumber1 ? check = 1 : check = 0
this.dateRange1 ? check1 = 1 : (check1 = 0, this.dateRange1 = '')
PartCallbackInformation1(check, this.partNumber1, check1, this.dateRange1[0], this.dateRange1[1]).then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].退回时间 !== '') {
response.data[i].退回时间 = (response.data[i].退回时间).split(' ')[0]
}
if (response.data[i].是否确认 === 0) {
this.value1 += 1
}
}
this.tableData10 = response.data
})
},
submit() {
if (this.multipleSelection10.length > 0) {
this.MaterialNum = []
this.BasicPartsNumber = []
this.MaterialName = []
this.PartToolNumber = []
this.Material = []
this.NumberOfParts = []
this.project = []
this.machine = []
this.group = []
for (let i = 0; i < this.multipleSelection10.length; i++) {
this.MaterialNum[i] = this.multipleSelection10[i].物料流水号
this.BasicPartsNumber[i] = this.multipleSelection10[i].基本件流水号
this.MaterialName[i] = this.multipleSelection10[i].零件名称
this.PartToolNumber[i] = this.multipleSelection10[i].零件图号
this.Material[i] = this.multipleSelection10[i].材料
this.NumberOfParts[i] = this.multipleSelection10[i].零件数量
this.ReMarks[i] = this.multipleSelection10[i].零件备注
this.project[i] = this.multipleSelection10[i].项目流水号
this.machine[i] = this.multipleSelection10[i].机床流水号
this.group[i] = this.multipleSelection10[i].组件流水号
}
purchaseRequisition2Back(this.project, this.machine, this.group, this.BasicPartsNumber, this.NumberOfParts, this.time).then(response => {
if (response.data[0].result !== '0') {
console.log(response.data[0].result)
this.$message.success('请购成功')
PartCallbackInformation().then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].退回时间 !== '') {
response.data[i].退回时间 = (response.data[i].退回时间).split(' ')[0]
}
if (response.data[i].是否确认 === 0) {
this.value += 1
}
}
this.tableData9 = response.data
})
} else {
this.$message.error('请购失败')
}
})
} else {
this.$message.warning('请勾选')
}
},
submit1() {
if (this.multipleSelection11.length > 0) {
this.MaterialNum = []
this.MaterialCode = []
this.StandardPartsAndOutsourcing = []
this.MaterialName = []
this.MaterialSpecification = []
this.MaterialModel = []
this.NumberOfParts = []
this.project = []
this.machine = []
this.group = []
for (let i = 0; i < this.multipleSelection11.length; i++) {
this.StandardPartsAndOutsourcing[i] = this.multipleSelection11[i].标准件和外购件流水号
this.MaterialNum[i] = this.multipleSelection11[i].物料流水号
this.MaterialCode[i] = this.multipleSelection11[i].物料代码
this.MaterialName[i] = this.multipleSelection11[i].物料名称
this.MaterialSpecification[i] = this.multipleSelection11[i].物料规格
this.MaterialModel[i] = this.multipleSelection11[i].物料型号
this.NumberOfParts[i] = this.multipleSelection11[i].零件数量
this.ReMarks[i] = this.multipleSelection11[i].备注
this.project[i] = this.multipleSelection11[i].项目流水号
this.machine[i] = this.multipleSelection11[i].机床流水号
this.group[i] = this.multipleSelection11[i].组件流水号
}
PurchasingDepartmentBack(this.group, this.StandardPartsAndOutsourcing, this.MaterialNum, this.NumberOfParts, this.project, this.machine).then(response => {
if (response.data[0].result !== '0') {
this.$message.success('请购成功')
PartCallbackInformation1().then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].退回时间 !== '') {
response.data[i].退回时间 = (response.data[i].退回时间).split(' ')[0]
}
if (response.data[i].是否确认 === 0) {
this.value1 += 1
}
}
this.tableData10 = response.data
})
} else {
this.$message.error('请购失败')
}
})
} else {
this.$message.warning('请勾选')
}
},
Delete(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
Delete(row.基本件流水号).then(response => {
this.value = 0
if (response.data[0].result === '1') {
this.$message.success('删除成功')
PartCallbackInformation().then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].退回时间 !== '') {
response.data[i].退回时间 = (response.data[i].退回时间).split(' ')[0]
}
if (response.data[i].是否确认 === 0) {
this.value += 1
}
}
this.tableData9 = response.data
})
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
Delete1(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
Delete1(row.标准件和外购件流水号).then(response => {
this.value1 = 0
if (response.data[0].result === '1') {
this.$message.success('删除成功')
PartCallbackInformation1().then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].退回时间 !== '') {
response.data[i].退回时间 = (response.data[i].退回时间).split(' ')[0]
}
if (response.data[i].是否确认 === 0) {
this.value1 += 1
}
}
this.tableData10 = response.data
})
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
tableRowClassName({ row }) {
console.log(row.是否确认)
if (row.是否确认 === 0) {
return 'NotThrough'
} else {
return 'adopt'
}
},
tableRowClassName1({ row }) {
if (row.是否加急件 === 1) {
return 'isUrgentItem'
}
},
machineChange() {
this.groupNumberValue = ''
this.groupNumber = []
searchgroup(this.machineNumberValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNumber.push({
label: response.data[i].组号 + ' ' + response.data[i].组件名称,
value: response.data[i].组件流水号
})
}
if (response.data.length > 0) {
this.groupNumberValue = this.groupNumber[0].value
}
})
},
// 三表下达时间查询
DeliveryTimeSelect() {
this.DeliveryTime = ''
DeliveryTimeSelect(this.groupNumberValue).then(response => {
console.log(response.data)
this.DeliveryTime = response.data[0].操作日期.substring(0, 10)
})
},
searchTable() {
this.loading = true
if (this.machineNumberValue !== '') {
this.check2 = 1
} else { this.check2 = 0 }
if (this.groupNumberValue !== '') {
this.DeliveryTimeSelect() // 三表下达时间查询
this.check3 = 1
} else { this.check3 = 0 }
searchTable(this.machineNumberValue, this.check2, this.groupNumberValue, this.check3).then(response => {
// this.tableData = response.data
this.projectName = response.data[0].项目名称
this.projectFloatValue = response.data[0].项目流水号
this.MachineToolNumber = response.data[0].机床图号
this.machineFloatValue = response.data[0].机床流水号
this.groupName = response.data[0].组号
this.groupFloatValue = response.data[0].组件流水号
this.tableData1 = []
this.tableData2 = []
this.tableData3 = []
this.loading = false
this.searchPart()
})
},
selectPart(val) {
this.PartType = val.label
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
})
}
},
searchPart() {
this.tableData1 = []
this.tableData2 = []
this.tableData3 = []
// this.projectName = row.项目名称
// this.projectFloatValue = row.项目流水号
// this.MachineToolNumber = row.机床图号
// this.machineFloatValue = row.机床流水号
// this.groupName = row.组号
// this.groupFloatValue = row.组件流水号
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
})
}
},
searchTable1() {
if (this.PurchaseOrder !== '') {
this.check4 = 1
} else {
this.check4 = 0
}
searchTable1(this.PurchaseOrder, this.check4).then(response => {
for (let i = 0; i < response.data.length; i++) {
console.log(response.data[i].请购时间)
if (response.data[i].请购时间 !== '') {
response.data[i].请购时间 = (response.data[i].请购时间).split(' ')[0]
}
}
this.tableData4 = response.data
})
},
handleAdd() {
this.handleAdd_disable = false
this.addForm('form', [this.dialogFormVisible = true, this.title = '增加'])
searchBillNumber().then(response => {
this.form.请款单号 = response.data[0].单号
})
this.form.请购时间 = getNowShotTime()
},
submitAdd(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.handleAdd_disable = true
addData(this.form.请购车间, this.name, this.id, this.form.请购时间, this.form.Remarks).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.dialogFormVisible = false
this.tableData6 = []
this.searchTable1()
} else {
this.$message.error('增加失败')
this.handleAdd_disable = false
}
})
} else {
console.log('error submit!!')
return false
}
})
},
handleEdit(row) { // 弹出单据编辑
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.title = '编辑'
this.dialogFormVisible = true
this.RequisitionList = row.请购单流水号
this.form.请购车间 = row.请购车间
this.form.请购时间 = row.请购时间
},
submitEdit(formName) { // 提交单据编辑
this.$refs[formName].validate((valid) => {
if (valid) {
editData(this.RequisitionList, this.form.请购车间, this.form.请购时间).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.dialogFormVisible = false
this.tableData6 = []
this.searchTable1()
} else { this.$message.error('编辑失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
handleDelete() { // 删除单据
console.log(this.RequisitionList)
if (this.RequisitionList === '') {
this.$message.error('请先选择请购单')
} else {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteData(this.RequisitionList).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.tableData6 = []
this.searchTable1()
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
},
OutParts(row) { // 移出数据
this.$confirm('移出后,该零件将不再参与考核', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
OutPart(row.基本件流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('移出成功')
searchPart(this.groupFloatValue).then(response => {
this.tableData1 = response.data
})
} else { this.$message.error('移出失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
cancel(formName) {
this.form = {}
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
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]
}
}
const res = response.data
this.tableData6 = res.map(item => {
if (item.零件类型 === '2') {
item.零件类型 = '外购件'
} else if (item.零件类型 === '1') {
item.零件类型 = '标准件'
} else if (item.零件类型 === '3') {
item.零件类型 = '基本件'
}
return item
})
})
} 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.MaterialNumber = row.物料流水号
this.PartNum = row.零件数量
this.stockNum = row.安全库存量
},
submitEdit2(formName) { // 提交使用库存数量
this.$refs[formName].validate((valid) => {
if (valid) {
editStock(this.StandardAndOutsourcing, this.form4.数量, this.PartNum, this.MaterialNumber, this.stockNum).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.请购单流水号
searchDetailed1(row.请购单流水号).then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].物料计划到货时间 !== '') {
response.data[i].物料计划到货时间 = (response.data[i].物料计划到货时间).split(' ')[0]
}
}
const res = response.data
this.tableData6 = res.map(item => {
if (item.零件类型 === '2') {
item.零件类型 = '外购件'
} else if (item.零件类型 === '1') {
item.零件类型 = '标准件'
} else if (item.零件类型 === '3') {
item.零件类型 = '基本件'
}
return item
})
})
},
handleSelectionChange(val) {
this.multipleSelection = val
},
handleSelectionChange10(val) {
this.multipleSelection10 = val
},
handleSelectionChange11(val) {
this.multipleSelection11 = val
},
purchaseRequisition() {
if (this.RequisitionList !== '') {
if (this.time !== '' && this.time !== null) {
if (this.multipleSelection.length !== 0) {
this.result = 0
if (this.PartType === '基本件') {
this.MaterialNum = []
this.BasicPartsNumber = []
this.MaterialName = []
this.PartToolNumber = []
this.Material = []
this.NumberOfParts = []
for (let i = 0; i < this.multipleSelection.length; i++) {
this.MaterialNum[i] = this.multipleSelection[i].物料流水号
this.BasicPartsNumber[i] = this.multipleSelection[i].基本件流水号
this.MaterialName[i] = this.multipleSelection[i].零件名称
this.PartToolNumber[i] = this.multipleSelection[i].零件图号
this.Material[i] = this.multipleSelection[i].材料
this.NumberOfParts[i] = this.multipleSelection[i].投产总数量
this.ReMarks[i] = this.multipleSelection[i].零件备注
}
for (let i = 0; i < this.BasicPartsNumber.length; i++) {
purchaseRequisition(this.RequisitionList, this.projectName, this.projectFloatValue, this.MachineToolNumber, this.machineFloatValue, this.groupName, this.groupFloatValue, this.BasicPartsNumber[i], this.MaterialName[i], this.PartToolNumber[i], this.Material[i], this.NumberOfParts[i], 3, this.time, this.MaterialNum[i], this.ReMarks[i]).then(response => {
this.result += parseInt(response.data[0].result)
if (this.result === this.BasicPartsNumber.length) {
this.$message.success('请购成功')
searchPart(this.groupFloatValue).then(response => {
this.tableData1 = 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]
}
}
const res = response.data
this.tableData6 = res.map(item => {
if (item.零件类型 === '2') {
item.零件类型 = '外购件'
} else if (item.零件类型 === '1') {
item.零件类型 = '标准件'
} else if (item.零件类型 === '3') {
item.零件类型 = '基本件'
}
return item
})
})
}
})
}
} else if (this.PartType === '外购件') {
this.MaterialNum = []
this.MaterialCode = []
this.StandardPartsAndOutsourcing = []
this.MaterialName = []
this.MaterialSpecification = []
this.MaterialModel = []
this.NumberOfParts = []
for (let i = 0; i < this.multipleSelection.length; i++) {
this.StandardPartsAndOutsourcing[i] = this.multipleSelection[i].标准件和外购件流水号
this.MaterialNum[i] = this.multipleSelection[i].物料流水号
this.MaterialCode[i] = this.multipleSelection[i].物料代码
this.MaterialName[i] = this.multipleSelection[i].物料名称
this.MaterialSpecification[i] = this.multipleSelection[i].物料规格
this.MaterialModel[i] = this.multipleSelection[i].物料型号
this.NumberOfParts[i] = this.multipleSelection[i].采购总数量
this.ReMarks[i] = this.multipleSelection[i].备注
}
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.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('请购成功')
searchPart1(this.groupFloatValue, 2).then(response => {
this.tableData2 = 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]
}
}
const res = response.data
this.tableData6 = res.map(item => {
if (item.零件类型 === '2') {
item.零件类型 = '外购件'
} else if (item.零件类型 === '1') {
item.零件类型 = '标准件'
} else if (item.零件类型 === '3') {
item.零件类型 = '基本件'
}
return item
})
})
}
})
}
} else if (this.PartType === '标准件') {
this.MaterialNum = []
this.MaterialCode = []
this.StandardPartsAndOutsourcing = []
this.MaterialName = []
this.MaterialSpecification = []
this.MaterialModel = []
this.NumberOfParts = []
for (let i = 0; i < this.multipleSelection.length; i++) {
this.StandardPartsAndOutsourcing[i] = this.multipleSelection[i].标准件和外购件流水号
this.MaterialNum[i] = this.multipleSelection[i].物料流水号
this.MaterialCode[i] = this.multipleSelection[i].物料代码
this.MaterialName[i] = this.multipleSelection[i].物料名称
this.MaterialSpecification[i] = this.multipleSelection[i].物料规格
this.MaterialModel[i] = this.multipleSelection[i].物料型号
this.NumberOfParts[i] = this.multipleSelection[i].采购总数量
this.ReMarks[i] = this.multipleSelection[i].备注
}
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.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('请购成功')
searchPart1(this.groupFloatValue, 1).then(response => {
this.tableData3 = 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]
}
}
const res = response.data
this.tableData6 = res.map(item => {
if (item.零件类型 === '2') {
item.零件类型 = '外购件'
} else if (item.零件类型 === '1') {
item.零件类型 = '标准件'
} else if (item.零件类型 === '3') {
item.零件类型 = '基本件'
}
return item
})
})
}
})
}
}
} else {
this.$message.warning('请选择零件或物料')
}
} else {
this.$message.warning('请选择交货期')
}
} else {
this.$message.warning('请先选择请购单')
}
},
PurchasingDepartment() {
if (this.time !== '' && this.time !== null) {
if (this.multipleSelection.length !== 0) {
if (this.PartType === '基本件') {
this.MaterialNum = []
this.BasicPartsNumber = []
this.MaterialName = []
this.PartToolNumber = []
this.Material = []
this.NumberOfParts = []
for (let i = 0; i < this.multipleSelection.length; i++) {
this.MaterialNum[i] = this.multipleSelection[i].物料流水号
this.BasicPartsNumber[i] = this.multipleSelection[i].基本件流水号
this.MaterialName[i] = this.multipleSelection[i].零件名称
this.PartToolNumber[i] = this.multipleSelection[i].零件图号
this.Material[i] = this.multipleSelection[i].材料
this.NumberOfParts[i] = this.multipleSelection[i].投产总数量
this.ReMarks[i] = this.multipleSelection[i].零件备注
}
purchaseRequisition2(this.projectFloatValue, this.machineFloatValue, this.groupFloatValue, this.BasicPartsNumber, this.NumberOfParts, this.time).then(response => {
if (response.data[0].result !== '0') {
console.log(response.data[0].result)
this.$message.success('请购成功')
searchPart(this.groupFloatValue).then(response => {
this.tableData1 = response.data
})
} else {
this.$message.error('请购失败')
}
})
} else {
this.MaterialNum = []
this.MaterialCode = []
this.StandardPartsAndOutsourcing = []
this.MaterialName = []
this.MaterialSpecification = []
this.MaterialModel = []
this.NumberOfParts = []
for (let i = 0; i < this.multipleSelection.length; i++) {
this.StandardPartsAndOutsourcing[i] = this.multipleSelection[i].标准件和外购件流水号
this.MaterialNum[i] = this.multipleSelection[i].物料流水号
this.MaterialCode[i] = this.multipleSelection[i].物料代码
this.MaterialName[i] = this.multipleSelection[i].物料名称
this.MaterialSpecification[i] = this.multipleSelection[i].物料规格
this.MaterialModel[i] = this.multipleSelection[i].物料型号
this.NumberOfParts[i] = this.multipleSelection[i].采购总数量
this.ReMarks[i] = this.multipleSelection[i].备注
}
PurchasingDepartment(this.groupFloatValue, this.StandardPartsAndOutsourcing, this.time, this.MaterialNum, this.NumberOfParts, this.projectFloatValue, this.machineFloatValue).then(response => {
if (response.data[0].result !== '0') {
this.$message.success('请购成功')
if (this.PartType === '外购件') {
searchPart1(this.groupFloatValue, 2).then(response => {
this.tableData2 = response.data
})
} else {
searchPart1(this.groupFloatValue, 1).then(response => {
this.tableData3 = response.data
})
}
} else {
this.$message.error('请购失败')
}
})
}
} else {
this.$message.warning('请选择零件或物料')
}
} else {
this.$message.warning('请选择交货期')
}
},
Production() {
if (this.PartType === '基本件' && this.multipleSelection.length !== 0) {
this.MaterialNum = []
this.BasicPartsNumber = []
this.MaterialName = []
this.PartToolNumber = []
this.Material = []
this.NumberOfParts = []
for (let i = 0; i < this.multipleSelection.length; i++) {
this.MaterialNum[i] = this.multipleSelection[i].物料流水号
this.BasicPartsNumber[i] = this.multipleSelection[i].基本件流水号
this.MaterialName[i] = this.multipleSelection[i].零件名称
this.PartToolNumber[i] = this.multipleSelection[i].零件图号
this.Material[i] = this.multipleSelection[i].材料
this.NumberOfParts[i] = this.multipleSelection[i].投产总数量
this.ReMarks[i] = this.multipleSelection[i].零件备注
}
Production(this.groupFloatValue, this.BasicPartsNumber, this.NumberOfParts, this.projectFloatValue, this.machineFloatValue).then(response => {
if (response.data[0].result !== '0') {
this.$message.success('投产成功')
searchPart(this.groupFloatValue).then(response => {
this.tableData1 = response.data
})
} else {
this.$message.error('投产失败')
}
})
} else {
this.$message.warning('请选择基本件')
}
},
MoveOut(row) {
this.$confirm('此操作将该物料移出, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (row.零件类型 === '基本件') {
MoveOut(row.请购单明细流水号, row.基本件流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('移出成功')
searchPart(this.groupFloatValue).then(response => {
this.tableData1 = 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]
}
}
const res = response.data
this.tableData6 = res.map(item => {
if (item.零件类型 === '2') {
item.零件类型 = '外购件'
} else if (item.零件类型 === '1') {
item.零件类型 = '标准件'
} else if (item.零件类型 === '3') {
item.零件类型 = '基本件'
}
return item
})
})
} else { this.$message.error('移出失败') }
})
} else if (row.零件类型 === '外购件') {
MoveOut1(row.请购单明细流水号, row.标准件和外购件流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('移出成功')
searchPart1(this.groupFloatValue, 2).then(response => {
this.tableData2 = 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
const res = response.data
this.tableData6 = res.map(item => {
if (item.零件类型 === '2') {
item.零件类型 = '外购件'
} else if (item.零件类型 === '1') {
item.零件类型 = '标准件'
} else if (item.零件类型 === '3') {
item.零件类型 = '基本件'
}
return item
})
})
} else { this.$message.error('移出失败') }
})
} else if (row.零件类型 === '标准件') {
MoveOut1(row.请购单明细流水号, row.标准件和外购件流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('移出成功')
searchPart1(this.groupFloatValue, 1).then(response => {
this.tableData3 = 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
const res = response.data
this.tableData6 = res.map(item => {
if (item.零件类型 === '2') {
item.零件类型 = '外购件'
} else if (item.零件类型 === '1') {
item.零件类型 = '标准件'
} else if (item.零件类型 === '3') {
item.零件类型 = '基本件'
}
return item
})
})
} else { this.$message.error('移出失败') }
})
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消移出'
})
})
},
handleSizeChange(val) {},
handleCurrentChange(val) {}
}
}
</script>
<style scoped>
.el-tag{
margin: 0
}
span{
margin: 10px 0px 10px 10px;
}
.item {
float: right;
margin-top: 5px;
margin-right: 40px;
}
.el-form--label-left >>> .el-form-item__label {
text-align: right;
}
>>>.el-dialog--center .el-dialog__body {
text-align: initial;
padding: 10px 20px 0px
}
>>>.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>
<style>
.el-table .NotThrough{
background: palevioletred;
}
.el-table .adopt{
background: limegreen;
}
.el-table .isUrgentItem{
background: #ff7575;
}
</style>