This commit is contained in:
liushuai
2019-08-03 11:05:18 +08:00
4 changed files with 902 additions and 34 deletions

View File

@@ -107,7 +107,7 @@ export function submitOutStore(...params) {
}
})
}
// 出库
// 异常出库
export function errorRecord(...params) {
return request({
url: '',
@@ -130,3 +130,27 @@ export function initOutType() {
}
})
}
// 领料确认
export function pickingSubmit(...params) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '库存管理_物料出库_领料确认_修改数据',
param: `人员编号=${params[0]}&密码=${params[1]}`
}
})
}
// 归还
export function sendBack(...params) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: '库存管理_物料出库_归还记录_增加数据',
param: `货位流水号=${params[0]}&物料流水号=${params[1]}&入库数量=${params[2]}&入库人流水号=${params[3]}&基本件流水号=${params[4]}&标准件和外购件流水号=${params[5]}&请购单明细流水号=${params[6]}&仓库流水号=${params[7]}&领料单流水号=${params[8]}`
}
})
}

View File

@@ -224,19 +224,18 @@
<el-table-column label="审批" align="center" min-width="90">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否审批)===1" type="success">已审批</el-tag>
<el-tag v-if="Number(scope.row.是否审批)===0 && Number(token)!==21 && Number(token)!==36" type="warning">未审批</el-tag>
<el-button v-if="Number(scope.row.是否审批)===0 && (Number(token)===21 || Number(token)===36)" size="mini" type="primary" plain icon="el-icon-check" @click="approvalPass(scope.row)">审批</el-button>
</template>
</el-table-column>
<el-table-column label="领回确认" align="center" min-width="80">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否启用)===1" type="warning">未确认</el-tag>
<el-tag v-else type="success">已确认</el-tag>
<el-tag v-else type="warning">未审批</el-tag>
</template>
</el-table-column>
<!--<el-table-column label="领回确认" align="center" min-width="80">-->
<!--<template slot-scope="scope">-->
<!--<el-tag v-if="Number(scope.row.是否启用)===1" type="warning">未确认</el-tag>-->
<!--<el-tag v-else type="success">已确认</el-tag>-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column label="操作" align="center" width="230px">
<template slot-scope="scope" align="center">
<el-button v-if="Number(token)===21 || Number(token)===36" :disabled="Number(scope.row.是否审批)===0 || Number(scope.row.是否启用)===0" size="mini" type="primary" @click="checkList(scope.row)">确认领回</el-button>
<!--<el-button v-if="Number(token)===21 || Number(token)===36" :disabled="Number(scope.row.是否审批)===0 || Number(scope.row.是否启用)===0" size="mini" type="primary" @click="checkList(scope.row)">确认领回</el-button>-->
<el-button :disabled="Number(scope.row.是否启用)===0" size="mini" type="danger" icon="el-icon-delete" @click="dropList(scope.row)">删除</el-button>
</template>
</el-table-column>
@@ -294,9 +293,21 @@
{{ scope.row.出库数量 }}
</template>
</el-table-column>
<el-table-column v-if="true" label="备料确认" align="center" width="100">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否备料确认)===1" type="success" size="mini">已确认</el-tag>
<el-tag v-else type="warning" size="mini">未确认</el-tag>
</template>
</el-table-column>
<el-table-column v-if="true" label="领料确认" align="center" width="100">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否领料确认)===1" type="success" size="mini">已确认</el-tag>
<el-tag v-else type="warning" size="mini">未确认</el-tag>
</template>
</el-table-column>
<el-table-column v-if="true" label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button :disabled="!!scope.row.是否出库" size="mini" type="danger" icon="el-icon-delete" @click="dropListDetail(scope.row)">删除</el-button>
<el-button :disabled="!!scope.row.是否出库 || Number(scope.row.是否领料确认)===1" size="mini" type="danger" icon="el-icon-delete" @click="dropListDetail(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>

View File

@@ -29,13 +29,22 @@
{{ scope.row.领料单备注 }}
</template>
</el-table-column>
<el-table-column label="领回确认" align="center" min-width="80">
<el-table-column label="审批" align="center" min-width="80">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否启用)===1" type="warning" size="small">确认</el-tag>
<el-tag v-else type="success" size="small">确认</el-tag>
<el-tag v-if="Number(scope.row.是否审批)===0" type="warning" size="small">审批</el-tag>
<el-tag v-else type="success" size="small">审批</el-tag>
</template>
</el-table-column>
</el-table>
<el-row style="margin: 0;">
<el-col style="width: 300px">
<h4 style="margin-right: 100px;">领料单明细{{ pickingListNumberShow }}</h4>
</el-col>
<el-col style="width: 300px;margin-top:15px">
<el-button :disabled="multipleSelection.length===0" size="small" type="primary" @click="prepareConfirm()">备料确认</el-button>
<el-button :disabled="multipleSelection.length===0" size="small" type="primary" @click="inputPassword()">领料确认</el-button>
</el-col>
<el-col style="width:calc(100% - 600px)">
<div class="block" style="float:right;margin: 10px 0;">
<el-pagination
:current-page="pageCurrent3"
@@ -46,8 +55,10 @@
@size-change="handleSizeChange3"
@current-change="handleCurrentChange3"/>
</div>
<h4>领料单明细{{ pickingListNumberShow }}</h4>
<el-table :data="pickListTable2" highlight-current-row border style="width: 100%;" size="mini" height="400" @row-click="clickListDetail">
</el-col>
</el-row>
<el-table :data="pickListTable2" highlight-current-row border style="width: 100%;" size="mini" height="400" @row-click="clickListDetail" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="55"/>
<el-table-column label="序号" align="center" type="index" width="50"/>
<el-table-column label="名称" align="center" min-width="100">
<template slot-scope="scope">
@@ -89,17 +100,36 @@
{{ scope.row.出库数量 }}
</template>
</el-table-column>
<el-table-column v-if="true" label="备料确认" align="center" width="100">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否备料确认)===1" size="mini" type="success">已确认</el-tag>
<el-tag v-else type="warning" size="mini">未确认</el-tag>
</template>
</el-table-column>
<el-table-column v-if="true" label="领料确认" align="center" width="100">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否领料确认)===1" size="mini" type="success">已确认</el-tag>
<el-tag v-else type="warning" size="mini">未确认</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button size="mini" icon="el-icon-back" type="primary" disabled>归还</el-button>
<el-button :disabled="Number(scope.row.出库数量)<=0" size="mini" icon="el-icon-back" type="primary" @click="sendBack(scope.row)">归还</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card>
<el-row>
<el-col :span="12">
<h4 style="margin-top:0">物料货位数量信息</h4>
<el-table :data="StockNumberTable" border style="width: 100%;" size="mini" height="300">
</el-col>
<el-col :span="12">
占用数量{{ 占用数量 }}
</el-col>
</el-row>
<el-table :data="StockNumberTable" border style="width: 100%;" size="mini" height="300" show-summary>
<el-table-column label="序号" align="center" type="index" width="50"/>
<el-table-column label="名称" align="center" min-width="100">
<template slot-scope="scope">
@@ -126,7 +156,7 @@
{{ scope.row.货位名称 }}
</template>
</el-table-column>
<el-table-column label="货位存量" align="center" min-width="70">
<el-table-column label="货位存量" align="center" min-width="70" prop="货位存量">
<template slot-scope="scope">
{{ scope.row.货位存量 }}
</template>
@@ -143,8 +173,8 @@
</el-table-column>
<el-table-column label="操作" align="center" width="200px">
<template slot-scope="scope" align="center">
<el-button size="mini" type="primary" @click="outStore(scope.row)">出库</el-button>
<el-button size="mini" type="warning" @click="errorRecord(scope.row)">异常记录</el-button>
<el-button :disabled="审批未通过" size="mini" type="primary" @click="outStore(scope.row)">出库</el-button>
<el-button :disabled="审批未通过" size="mini" type="warning" @click="errorRecord(scope.row)">异常记录</el-button>
</template>
</el-table-column>
</el-table>
@@ -215,16 +245,63 @@
<el-button type="primary" @click="submitErrorRecord()"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible3" title="领料确认" center width="380px">
<el-form ref="form3" :model="form3" :rules="rules3" label-position="left">
<el-form-item label="领料人" prop="personName" label-width="100px" size="small">
<el-input v-model="form3.personName" readonly size="small" placeholder="领料人" style="width: 200px"/>
</el-form-item>
<el-form-item label="密码" prop="password" label-width="100px" size="small">
<el-input v-model="form3.password" size="small" placeholder="密码" style="width: 200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible3=false">取消</el-button>
<el-button type="primary" @click="pickConfirm()"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible4" title="归还" center width="380px">
<el-form ref="form4" :model="form4" :rules="rules4" label-position="left">
<el-form-item label="仓库" prop="仓库流水号" label-width="100px" size="small">
<el-select v-model="form4.仓库流水号" placeholder="仓库名称" @change="getLocate">
<el-option
v-for="item in inventoryName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="货位" prop="货位流水号" label-width="100px" size="small">
<el-select v-model="form4.货位流水号" placeholder="货位名称">
<el-option
v-for="item in locateName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="归还数量" prop="归还数量" label-width="100px" size="small">
<el-input-number :min="0" :max="最大归还量" v-model="form4.归还数量" size="small" placeholder="归还数量" style="width: 200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible4=false">取消</el-button>
<el-button type="primary" @click="submitSendBack()"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { initPickPerson, initMachineProject, searchgroup, searchList, searchListDetail, searchStockNumber1, searchStockNumber2, submitOutStore, errorRecord, searchStockNumber3, initOutType } from '@/api/Inventory/MaterialOut'
import { sendBack, initPickPerson, initMachineProject, searchgroup, searchList, searchListDetail, searchStockNumber1, searchStockNumber2, submitOutStore, errorRecord, searchStockNumber3, initOutType, pickingSubmit } from '@/api/Inventory/MaterialOut'
import { mapGetters } from 'vuex'
import request from '@/utils/request'
export default {
name: 'MaterialOut',
data() {
return {
multipleSelection: [],
pickingListNum: '', // 领料单流水号
pickingPersonNum: '', // 领料人流水号
pickingListNumber: '',
@@ -237,6 +314,8 @@ export default {
StockNumberTable: [],
dialogFormVisible1: false,
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible4: false,
outType: [],
form1: {
machineValue: '',
@@ -253,6 +332,15 @@ export default {
基本件流水号: '',
货位流水号: ''
},
form3: {
personName: '',
password: ''
},
form4: {
仓库流水号: '',
货位流水号: '',
归还数量: ''
},
rules1: {
machineValue: [{ required: true, message: '请选择' }],
groupNumValue: [{ required: true, message: '请选择' }],
@@ -264,6 +352,14 @@ export default {
errorNumber: [{ required: true, message: '请输入' }],
reason: [{ required: true, message: '请输入' }]
},
rules3: {
password: [{ required: true, message: '请输入' }]
},
rules4: {
仓库流水号: [{ required: true, message: '请输入' }],
货位流水号: [{ required: true, message: '请输入' }],
归还数量: [{ required: true, message: '请输入' }]
},
machine: [],
group: [],
person: [],
@@ -275,7 +371,17 @@ export default {
parchasePartNum: '', // 中间变量标准件和外购件流水号
inventoryNum: '', // 中间变量仓库流水号
locationNum: '', // 中间变量货位流水号
outNumber: 0 // 中间变量出库数量
outNumber: 0, // 中间变量出库数量
inventoryName: [],
locateName: [],
物料流水号: '',
基本件流水号: '',
标准件和外购件流水号: '',
领料单流水号: '',
请购单明细流水号: '',
最大归还量: '',
审批未通过: true,
占用数量: 0
}
},
computed: {
@@ -286,8 +392,154 @@ export default {
mounted() {
this.fetchData()
this.searchList()
this.getHouse()
},
methods: {
// 获取仓库
async getHouse() {
const param = {
url: '',
method: 'post',
data: {
type: '1',
name: '库存管理_货位主文件_仓库查询'
}
}
request(param).then(res => {
for (let i = 0; i < res.data.length; i++) {
this.inventoryName.push({
label: res.data[i].仓库名称,
value: res.data[i].仓库流水号
})
}
})
},
// 获取货位
async getLocate() {
this.locateName = []
this.form4.货位流水号 = ''
const param = {
url: '',
method: 'post',
data: {
type: '1',
name: '库存管理_货位主文件_查询数据',
param: `仓库流水号=${this.form4.仓库流水号}`
}
}
request(param).then(res => {
for (let i = 0; i < res.data.length; i++) {
this.locateName.push({
label: res.data[i].货位名称,
value: res.data[i].货位流水号
})
}
})
},
// 归还
sendBack(row) {
this.dialogFormVisible4 = true
this.物料流水号 = row.物料流水号
this.基本件流水号 = row.基本件流水号
this.标准件和外购件流水号 = row.标准件和外购件流水号
this.请购单明细流水号 = row.请购单明细流水号
this.领料单流水号 = row.领料单流水号
this.最大归还量 = row.出库数量
},
// 提交归还
submitSendBack() {
sendBack(this.form4.货位流水号, this.物料流水号, this.form4.归还数量, this.id, this.基本件流水号, this.标准件和外购件流水号, this.请购单明细流水号, this.form4.仓库流水号, this.领料单流水号).then(res => {
console.log(res)
if (res.data[0].result === '1') {
this.$message.success('操作成功')
this.dialogFormVisible4 = false
this.clickListDetail()
this.clickList()
} else {
this.$message.error('操作失败')
}
})
},
// 多选
handleSelectionChange(val) {
this.multipleSelection = []
val.map(v => {
this.multipleSelection.push(v.领料单明细流水号)
})
},
// 备料确认
prepareConfirm() {
this.$confirm('是否备料确认?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const param = {
url: '',
method: 'post',
data: {
type: '4',
name: `update 车间装配管理_领料单明细 set 是否备料确认 = 1 where 领料单明细流水号 in (${this.multipleSelection})`
}
}
request(param).then(res => {
if (res.data[0].result === '1') {
this.$message.success('操作成功')
this.clickList()
} else {
this.$message.error('操作失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
},
// 领料确认
inputPassword() {
this.dialogFormVisible3 = true
},
// 提交领料确认
pickConfirm() {
this.$confirm('是否领料确认?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const param = {
url: '',
method: 'post',
data: {
type: '4',
name: `update 车间装配管理_领料单明细 set 是否领料确认 = 1 where 领料单明细流水号 in (${this.multipleSelection})`
}
}
pickingSubmit(this.pickingPersonNum, this.form3.password).then(res => {
if (res.data[0].result === 'success') {
request(param).then(res => {
if (res.data[0].result === '1') {
this.$message.success('操作成功')
this.dialogFormVisible3 = false
this.clickList()
} else {
this.$message.error('操作失败')
}
})
} else if (res.data[0].result === 'error') {
this.$message.error('密码错误')
} else {
this.$message.error('操作失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
},
// 初始化数据
fetchData() {
this.person = []
@@ -351,9 +603,11 @@ export default {
},
// 查看领料单明细
clickList(row) {
row && Number(row.是否审批) ? this.审批未通过 = false : this.审批未通过 = true
row && row.领料单流水号 ? this.pickingListNum = row.领料单流水号 : this.pickingListNum
row && row.人员编号 ? this.pickingPersonNum = row.人员编号 : this.pickingListNum
row && row.领料单编号 ? this.pickingListNumberShow = row.领料单编号 : this.pickingListNumberShow
row && row.姓名 ? this.form3.personName = row.姓名 : this.form3.personName
searchListDetail(this.pickingListNum).then(res => {
this.pickListTable2 = res.data
})
@@ -371,14 +625,112 @@ export default {
searchStockNumber1(this.materialNum).then(res => {
this.StockNumberTable = res.data
})
const param = {
url: '',
method: 'post',
data: {
type: '3',
name: `select 物料名称
,物料规格
,物料型号
,sum(零件数量 * 机床数量) as 占用数量
,PDM_零件明细表_标准件和外购件.物料流水号
from PDM_零件明细表_标准件和外购件
inner join PDM_组件名称 on PDM_零件明细表_标准件和外购件.组件流水号 = PDM_组件名称.组件流水号
inner join PDM_机床名称 on PDM_组件名称.机床流水号 = PDM_机床名称.机床流水号
inner join 库存管理_物料主文件_基本 on PDM_零件明细表_标准件和外购件.物料流水号 = 库存管理_物料主文件_基本.物料流水号
inner join 车间装配管理_领料单明细 on PDM_零件明细表_标准件和外购件.标准件和外购件流水号 = 车间装配管理_领料单明细.标准件和外购件流水号
where 是否备料确认 = 1 and 是否领料确认 = 0 and PDM_零件明细表_标准件和外购件.物料流水号 = ${this.materialNum}
group by 物料名称
,物料规格
,物料型号
,PDM_零件明细表_标准件和外购件.物料流水号`
}
}
request(param).then(res => {
if (res.data.length > 0) {
this.占用数量 = res.data[0].占用数量
} else {
this.占用数量 = 0
}
})
} else if (this.basePartNum) {
searchStockNumber2(this.basePartNum).then(res => {
this.StockNumberTable = res.data
})
const param = {
url: '',
method: 'post',
data: {
type: '3',
name: `select 零件名称,零件图号,规格,材料,sum(零件数量 * 机床数量) as 占用数量,PDM_零件明细表_基本件.基本件流水号
from PDM_零件明细表_基本件 inner join PDM_组件名称 on PDM_零件明细表_基本件.组件流水号 = PDM_组件名称.组件流水号
inner join PDM_机床名称 on PDM_组件名称.机床流水号 = PDM_机床名称.机床流水号
inner join PDM_零件明细表_材料 on PDM_零件明细表_基本件.材料流水号 = PDM_零件明细表_材料.材料流水号
inner join 车间装配管理_领料单明细 on PDM_零件明细表_基本件.基本件流水号 = 车间装配管理_领料单明细.基本件流水号
where 是否备料确认 = 1 and 是否领料确认 = 0 and 车间装配管理_领料单明细.基本件流水号 = ${this.basePartNum}
group by 零件名称,零件图号,规格,材料,PDM_零件明细表_基本件.基本件流水号`
}
}
request(param).then(res => {
if (res.data.length > 0) {
this.占用数量 = res.data[0].占用数量
} else {
this.占用数量 = 0
}
})
} else if (this.purchaseBillNum) {
searchStockNumber3(this.purchaseBillNum).then(res => {
this.StockNumberTable = res.data
})
const param = {
url: '',
method: 'post',
data: {
type: '3',
name: `select
库存管理_物料出库_车间采购_基本件_查询视图.基本件流水号
,库存管理_物料出库_车间采购_基本件_查询视图.零件图号
,库存管理_物料出库_车间采购_基本件_查询视图.零件名称
,库存管理_物料出库_车间采购_基本件_查询视图.规格
,sum(零件数量 * 机床数量) as 占用数量
from 库存管理_物料出库_车间采购_基本件_查询视图
inner join PDM_零件明细表_基本件 on 库存管理_物料出库_车间采购_基本件_查询视图.基本件流水号 = PDM_零件明细表_基本件.基本件流水号
inner join PDM_组件名称 on PDM_零件明细表_基本件.组件流水号 = PDM_组件名称.组件流水号
inner join PDM_机床名称 on PDM_组件名称.机床流水号 = PDM_机床名称.机床流水号
where 请购单明细流水号 = ${this.purchaseBillNum}
group by 库存管理_物料出库_车间采购_基本件_查询视图.基本件流水号
,库存管理_物料出库_车间采购_基本件_查询视图.零件图号
,库存管理_物料出库_车间采购_基本件_查询视图.零件名称
,库存管理_物料出库_车间采购_基本件_查询视图.规格
union
select
库存管理_物料出库_车间采购_标准件和外购件_查询视图.物料流水号
,库存管理_物料出库_车间采购_标准件和外购件_查询视图.物料型号 as 零件图号
,库存管理_物料出库_车间采购_标准件和外购件_查询视图.物料名称 as 零件名称
,库存管理_物料出库_车间采购_标准件和外购件_查询视图.物料规格 as 规格
,sum(零件数量 * 机床数量) as 占用数量
from 库存管理_物料出库_车间采购_标准件和外购件_查询视图
inner join PDM_零件明细表_标准件和外购件 on PDM_零件明细表_标准件和外购件.物料流水号 = 库存管理_物料出库_车间采购_标准件和外购件_查询视图.物料流水号
inner join PDM_组件名称 on 库存管理_物料出库_车间采购_标准件和外购件_查询视图.组件流水号 = PDM_组件名称.组件流水号
inner join PDM_机床名称 on PDM_组件名称.机床流水号 = PDM_机床名称.机床流水号
inner join 库存管理_物料主文件_基本 on 库存管理_物料出库_车间采购_标准件和外购件_查询视图.物料流水号 = 库存管理_物料主文件_基本.物料流水号
where 请购单明细流水号 = ${this.purchaseBillNum}
group by 库存管理_物料出库_车间采购_标准件和外购件_查询视图.物料流水号
,库存管理_物料出库_车间采购_标准件和外购件_查询视图.物料型号
,库存管理_物料出库_车间采购_标准件和外购件_查询视图.物料名称
,库存管理_物料出库_车间采购_标准件和外购件_查询视图.物料规格`
}
}
request(param).then(res => {
if (res.data.length > 0) {
this.占用数量 = res.data[0].占用数量
} else {
this.占用数量 = 0
}
})
}
},
// 出库

View File

@@ -0,0 +1,481 @@
<template>
<div class="app-container">
<el-card>
<div slot="header">
<span style="margin: 5px">领料单编号:</span>
<el-input v-model="pickingListNumber" clearable size="small" style="width:200px" />
<el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="searchList()">查询</el-button>
</div>
<h4 style="margin-top:0">领料单</h4>
<el-table :data="pickListTable1" highlight-current-row border style="width: 100%;" size="mini" height="300" @row-click="clickList">
<el-table-column label="序号" align="center" type="index" width="50"/>
<el-table-column label="领料单编号" align="center" min-width="200">
<template slot-scope="scope">
{{ scope.row.领料单编号 }}
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" min-width="200" >
<template slot-scope="scope">
{{ scope.row.操作日期.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="领料人" align="center" min-width="130">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="领料单备注" align="center" min-width="130">
<template slot-scope="scope">
{{ scope.row.领料单备注 }}
</template>
</el-table-column>
<el-table-column label="审批" align="center" min-width="90">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否审批)===1" type="success">已审批</el-tag>
<el-tag v-if="Number(scope.row.是否审批)===0 && Number(token)!==21 && Number(token)!==36" type="warning">未审批</el-tag>
<el-button v-if="Number(scope.row.是否审批)===0 && (Number(token)===21 || Number(token)===36)" size="mini" type="primary" plain icon="el-icon-check" @click="approvalPass(scope.row)">审批</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="float:right;margin: 10px 0;">
<el-pagination
:current-page="pageCurrent3"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize3"
:total="total3"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange3"
@current-change="handleCurrentChange3"/>
</div>
<h4>领料单明细{{ pickingListNumberShow }}</h4>
<el-table :data="pickListTable2" border style="width: 100%;" size="mini" height="300">
<el-table-column label="序号" align="center" type="index" width="50"/>
<el-table-column label="名称" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column label="图号或型号" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.图号或型号 || '—' }}
</template>
</el-table-column>
<el-table-column label="规格" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.规格 || '—' }}
</template>
</el-table-column>
<el-table-column label="机床图号" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="组号" align="center" min-width="70">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column label="总数量" align="center" min-width="70">
<template slot-scope="scope">
{{ scope.row.总数量 }}
</template>
</el-table-column>
<el-table-column label="备件数量" align="center" min-width="70">
<template slot-scope="scope">
{{ scope.row.备件数量 }}
</template>
</el-table-column>
<el-table-column label="已领数量" align="center" min-width="70">
<template slot-scope="scope">
{{ scope.row.出库数量 }}
</template>
</el-table-column>
<el-table-column v-if="true" label="备料确认" align="center" width="100">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否备料确认)===1" type="success" size="mini">已确认</el-tag>
<el-tag v-else type="warning" size="mini">未确认</el-tag>
</template>
</el-table-column>
<el-table-column v-if="true" label="领料确认" align="center" width="100">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否领料确认)===1" type="success" size="mini">已确认</el-tag>
<el-tag v-else type="warning" size="mini">未确认</el-tag>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { initPickPerson, initMachineProject, searchgroup, searchTable, searchList, createList, dropList, selectIntoList, searchListDetail, dropListDetail } from '@/api/Inventory/CreatePickingList'
import request from '@/utils/request'
import { mapGetters } from 'vuex'
export default {
name: 'PickingListApproval',
data() {
return {
PartType: '基本件',
machineNumberValue: '',
machineNumber: [],
groupNumberValue: '',
groupNumber: [],
tableData0: [],
tableData1: [],
tableData2: [],
pageCurrent0: 1,
pageSize0: 20,
total0: 0,
pageCurrent1: 1,
pageSize1: 20,
total1: 0,
pageCurrent2: 1,
pageSize2: 20,
total2: 0,
pickListTable1: [],
pageCurrent3: 1,
pageSize3: 20,
total3: 0,
pickListTable2: [],
dialogFormVisible1: false,
form1: {
领料人流水号: '',
领料单备注: ''
},
rules1: {
领料人流水号: [{ required: true, message: '请选择领料人' }]
},
pickPerson: [],
pickingListNumber: '', // 领料单编号
pickingListNumberShow: '', // 领料单编号
pickingListNum: '', // 领料单流水号
multipleSelection: []
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
mounted() {
this.fetchData()
this.searchTable()
this.searchList()
},
methods: {
// 审批通过
approvalPass(row) {
this.$confirm('是否审批通过?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const param = {
url: '',
method: 'post',
data: {
type: '4',
name: `update 车间装配管理_领料单 set 是否审批 = 1 where 领料单流水号 = ${row.领料单流水号}`
}
}
request(param).then(res => {
if (res.data[0].result === '1') {
this.$message.success('操作成功')
this.pickingListNumber = ''
this.searchList()
} else {
this.$message.error('操作失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
},
// 初始化数据
fetchData() {
initPickPerson().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.pickPerson.push({
label: response.data[i].姓名,
value: response.data[i].人员编号
})
}
})
initMachineProject().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].机床流水号
})
}
})
},
// 根据机床查分组
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].组号,
value: response.data[i].组件流水号
})
}
})
},
// 查三表
searchTable() {
this.multipleSelection = []
if (this.PartType === '标准件') {
this.searchTable0()
} else if (this.PartType === '外购件') {
this.searchTable1()
} else if (this.PartType === '基本件') {
this.searchTable2()
}
},
// 标准件
searchTable0() {
let check1, check2
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
searchTable(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent0, this.pageSize0, 1).then(response => {
this.tableData0 = response.data.rows
this.total0 = response.data.total
})
},
// 外购件
searchTable1() {
let check1, check2
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
searchTable(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent1, this.pageSize1, 2).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
// 基本件
searchTable2() {
let check1, check2
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
searchTable(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent2, this.pageSize2, 3).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
},
handleSizeChange0(val) {
this.pageSize0 = val
this.pageCurrent0 = 1
this.searchTable0()
},
handleCurrentChange0(val) {
this.pageCurrent0 = val
this.searchTable0()
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
handleSizeChange2(val) {
this.pageSize2 = val
this.pageCurrent2 = 1
this.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
},
// 查询领料单列表
searchList() {
let check, isElectrical
this.pickingListNumber ? check = 1 : check = 0
Number(this.token) === 36 || Number(this.token) === 35 ? isElectrical = 1 : isElectrical = 0 // 35电工 36电气部长
searchList(this.pageCurrent3, this.pageSize3, check, this.pickingListNumber, isElectrical).then(response => {
this.pickListTable1 = response.data.rows
this.total3 = response.data.total
})
},
handleSizeChange3(val) {
this.pageSize3 = val
this.pageCurrent3 = 1
this.searchList()
},
handleCurrentChange3(val) {
this.pageCurrent3 = val
this.searchList()
},
// 创建领料单
createList() {
if (this.$refs['form1'] !== undefined) {
this.$refs['form1'].resetFields()
}
this.form1.领料人流水号 = ''
this.form1.领料单备注 = ''
this.dialogFormVisible1 = true
},
// 提交创建领料单
submitCreateList() {
let isElectrical
this.token === 36 || this.token === 35 ? isElectrical = 1 : isElectrical = 0 // 35电工 36电气部长
createList(this.form1.领料人流水号, this.form1.领料单备注, isElectrical).then(response => {
if (response.data[0].result === '1') {
this.$message.success('创建成功')
this.dialogFormVisible1 = false
this.searchList()
} else { this.$message.error('操作失败') }
})
},
// 确认领料单
checkList(row) {
this.$confirm('是否确认领回?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const param = {
url: '',
method: 'post',
data: {
type: '4',
name: `update 车间装配管理_领料单 set 是否启用 = 0 where 领料单流水号 = ${row.领料单流水号}`
}
}
request(param).then(res => {
if (res.data[0].result === '1') {
this.$message.success('操作成功')
this.pickingListNumber = ''
this.searchList()
} else {
this.$message.error('操作失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
},
// 删除领料单
dropList(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
dropList(row.领料单流水号).then(response => {
if (Number(response.data[0].result) === 1) {
this.$message.success('删除成功')
this.searchList()
} else {
this.$message.error('数据占用')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 多选
handleSelectionChange(val) {
this.multipleSelection = val
},
// 选入
selectInto() {
const basePartGroup = []
const purchasePartGroup = []
this.multipleSelection.map(v => {
v.基本件流水号 ? basePartGroup.push(v.基本件流水号) : purchasePartGroup.push(v.标准件和外购件流水号)
})
if (basePartGroup.length === 0 && purchasePartGroup.length === 0) {
this.$message.warning('请勾选零件')
return
}
if (!this.pickingListNum || !this.pickingListNumberShow) {
this.$message.warning('请选择领料单')
return
}
if (basePartGroup.length) { // 基本件
selectIntoList(basePartGroup, null, this.pickingListNum).then(response => {
if (response.data[0].result === '1') {
this.$message.success('操作成功')
this.searchTable()
this.clickList()
} else { this.$message.error('操作失败') }
})
} else { // 标准件外购件
selectIntoList(null, purchasePartGroup, this.pickingListNum).then(response => {
if (response.data[0].result === '1') {
this.$message.success('操作成功')
this.searchTable()
this.clickList()
} else { this.$message.error('操作失败') }
})
}
},
// 查看领料单明细
clickList(row) {
console.log(row)
row ? this.pickingListNum = row.领料单流水号 : this.pickingListNum
row ? this.pickingListNumberShow = row.领料单编号 : this.pickingListNumberShow
searchListDetail(this.pickingListNum).then(res => {
this.pickListTable2 = res.data
})
},
// 删除领料单明细
dropListDetail(row) {
console.log(row)
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
dropListDetail(row.领料单明细流水号).then(response => {
if (Number(response.data[0].result) === 1) {
this.$message.success('删除成功')
this.clickList()
} else {
this.$message.error('已领取,不可删除')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.el-tag{
margin: 0
}
</style>