采购库存

This commit is contained in:
chenjianan
2019-06-13 11:11:51 +08:00
parent 13d9ed148a
commit 3124baa9d7
7 changed files with 156 additions and 55 deletions

View File

@@ -162,11 +162,11 @@
{{ scope.row.供货商 }}
</template>
</el-table-column>
<el-table-column :filters="source" :filter-method="filterSource" align="center" label="数据来源" min-width="90px" prop="零件类型">
<template slot-scope="scope">
{{ Number(scope.row.零件类型) === 1 ? 'BZ' : 'WG' }}
</template>
</el-table-column>
<!--<el-table-column :filters="source" :filter-method="filterSource" align="center" label="数据来源" min-width="90px" prop="零件类型">-->
<!--<template slot-scope="scope">-->
<!--{{ Number(scope.row.零件类型) === 1 ? 'BZ' : 'WG' }}-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
</el-row>
<div class="block">
@@ -1150,10 +1150,10 @@ export default {
return (parseInt(row.询价状态编号) === 1 && parseInt(row.采购状态编号) < 3 && parseInt(row.是否确认) === 1) // 未询价&&未采购&&确认物料修改
},
filterHandler0(value, row) { // 筛选备注
return row['备注'] === value
return row['备注'].trim() === value
},
filterHandler(value, row) { // 筛选供货商
return row['供货商'] === value
return row['供货商'].trim() === value
},
searchTable11() { // 查询外购件列表
let check1, check2, check3, check4, check5, check6
@@ -1171,10 +1171,14 @@ export default {
this.remarkFilters = []
this.supplierFilters = []
response.data.rows.map(v => {
if (v.备注 === null) { v.备注 = '' }
if (v.供货商 === null) { v.供货商 = '' }
if (!remark.includes(v.备注)) {
remark.push(v.备注)
supplier.push(v.供货商)
this.remarkFilters.push({ text: v.备注, value: v.备注 })
}
if (!supplier.includes(v.供货商)) {
supplier.push(v.供货商)
this.supplierFilters.push({ text: v.供货商, value: v.供货商 })
}
})

View File

@@ -129,13 +129,13 @@
</el-table-column>
<el-table-column v-show="hasTax==='未税'" label="单价(未税)" align="center" width="120">
<template slot-scope="scope">
<el-input v-show="hasTax==='未税'" v-model="scope.row.未税单价" size="mini" style="width:100%"/>
<el-input-number v-show="hasTax==='未税'" :min="0" v-model="scope.row.未税单价" controls-position="right" size="mini" style="width:100%" @focus="scope.row.未税单价=''" @change="priceChange(scope.row.未税单价, scope.row.物料流水号, scope.row.询价单流水号, scope.row)"/>
<b v-show="hasTax!=='未税'"></b>
</template>
</el-table-column>
<el-table-column v-show="hasTax==='含税'" label="单价(含税)" align="center" width="120">
<template slot-scope="scope">
<el-input v-show="hasTax==='含税'" v-model="scope.row.含税单价" size="mini" style="width:100%"/>
<el-input-number v-show="hasTax==='含税'" :min="0" v-model="scope.row.含税单价" controls-position="right" size="mini" style="width:100%" @focus="scope.row.含税单价=''" @change="priceChange(scope.row.含税单价, scope.row.物料流水号, scope.row.询价单流水号, scope.row)"/>
<b v-show="hasTax!=='含税'"></b>
</template>
</el-table-column>
@@ -185,7 +185,7 @@
<script>
import Tinymce from '@/components/Tinymce'
import { initSupplier, searchInquirySheet, searchSheetContract, doneContract, searchBaseInfo } from '@/api/PurchasingCenter/CreatePurchaseContract'
import { initSupplier, searchInquirySheet, searchSheetContract, doneContract, searchBaseInfo, savePrice } from '@/api/PurchasingCenter/CreatePurchaseContract'
import { convertCurrency } from '@/vendor/int2Chinese'
import { mapGetters } from 'vuex'
import { sleep, groupBy } from '@/utils/tool'
@@ -256,6 +256,26 @@ export default {
this.fetchData()
},
methods: {
// 价格实时保存
priceChange(price, num1, num2, row) {
this.tableData1.map(v => {
if (Number(v.物料流水号) === Number(row.物料流水号) && Number(v.询价单流水号) === Number(row.询价单流水号)) {
v.含税单价 = row.含税单价
v.未税单价 = row.未税单价
}
})
const group = this.tableData1
this.tableData1 = []
this.tableData1 = group
price = price || 0
savePrice(price, num1, num2).then(res => {
if (res.data[0].result === '1') {
console.log('单价实时保存成功')
} else {
console.log('单价实时保存失败')
}
})
},
deleteAllDate() {
this.tableData1.map(v => {
v.交货期 = ''
@@ -357,6 +377,9 @@ export default {
searchSheetContract(this.contractNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.tableData1.push({
询价单流水号: response.data[i].询价单流水号,
物料流水号: response.data[i].物料流水号,
询价单明细流水号: response.data[i].询价单明细流水号,
机床图号: response.data[i].机床图号,
组号: response.data[i].组号,
组件零件流水号: response.data[i].组件零件流水号,
@@ -367,9 +390,9 @@ export default {
规格: response.data[i].组件零件流水号 ? response.data[i].物料规格 : response.data[i].规格,
数量: response.data[i].数量,
计量单位: response.data[i].计量单位,
未税单价: 0,
未税单价: response.data[i].单价,
未税总额: 0,
含税单价: 0,
含税单价: response.data[i].单价,
含税总额: 0,
备注: response.data[i].备注
})
@@ -570,22 +593,24 @@ export default {
}
const merge = []
this.tableData1.map(v => {
merge.push({
机床图号: v.机床图号,
: v.,
: v.,
名称: v.名称,
规格: v.规格,
数量: Number(v.数量),
计量单位: v.计量单位,
单价: this.hasTax === '含税' ? v.含税单价 : v.未税单价,
合计: (Number(v.数量) * (this.hasTax === '含税' ? Number(v.含税单价) : Number(v.未税单价))).toFixed(2),
交货期: v.交货期 ? v.交货期.split(' ')[0] : '',
备注: v.备注
})
if ((this.hasTax === '含税' && Number(v.含税单价)) || (this.hasTax === '未税' && Number(v.未税单价))) { // 筛掉未询到价格的物料
merge.push({
机床图: v.机床图,
: v.,
图号: v.图号,
名称: v.名称,
规格: v.规格,
数量: Number(v.数量),
计量单位: v.计量单位,
单价: this.hasTax === '含税' ? v.含税单价 : v.未税单价,
合计: (Number(v.数量) * (this.hasTax === '含税' ? Number(v.含税单价) : Number(v.未税单价))).toFixed(2),
交货期: v.交货期 ? v.交货期.split(' ')[0] : '',
备注: v.备注
})
}
})
let mergeData = []
mergeData = groupBy(merge, ['图号', '名称', '规格', '计量单位', '单价', '合计', '交货期', '备注'])
mergeData = groupBy(merge, ['图号', '名称', '规格', '计量单位', '单价', '交货期', '备注'])
// 放入新数据
const tr = []
for (let i = 0; i < mergeData.length; i++) {
@@ -653,20 +678,25 @@ export default {
this.单价组 = []
this.交货期组 = []
this.hasTax === '含税' ? this.单价是否含税 = 1 : this.单价是否含税 = 0
for (let i = 0; i < this.tableData1.length; i++) {
this.组件零件流水号组.push(this.tableData1[i].组件零件流水号)
this.组件零件基本件流水号组.push(this.tableData1[i].组件零件基本件流水号)
this.数量.push(this.tableData1[i].数量)
this.hasTax === '含税' ? this.单价.push(this.tableData1[i].含税单价) : this.单价组.push(this.tableData1[i].未税单价)
this.交货期.push(this.tableData1[i].交货期)
}
const inquiryDetailNum_old = [] // 需要转移到新询价单的物料的询价单明细流水号
this.tableData1.map(v => {
if ((this.hasTax === '含税' && Number(v.含税单价)) || (this.hasTax === '未税' && Number(v.未税单价))) { // 筛掉未询到价格的物料
this.组件零件流水号.push(v.组件零件流水号)
this.组件零件基本件流水号.push(v.组件零件基本件流水号)
this.数量.push(v.数量)
this.hasTax === '含税' ? this.单价组.push(v.含税单价) : this.单价组.push(v.未税单价)
this.交货期组.push(v.交货期)
} else { // 获取未询到价格的物料的询价单明细流水号们
inquiryDetailNum_old.push(v.询价单明细流水号)
}
})
if (this.contractNumValue) {
this.$confirm('此采购合同将递交审批,递交后该合同不可删除,确认完成编辑?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
doneContract(this.contractNum, this.contractName, this.deliveryDate, this.payDate, this.payMethod, this.invoiceInfo, this.otherInfo, this.actualTotal, this.id, this.supplierValue, this.单价是否含税, this.组件零件流水号组, this.组件零件基本件流水号组, this.数量组, this.单价组, this.交货期组, this.content, this.taxRate * 100).then(response => {
doneContract(this.contractNum, this.contractName, this.deliveryDate, this.payDate, this.payMethod, this.invoiceInfo, this.otherInfo, this.actualTotal, this.id, this.supplierValue, this.单价是否含税, this.组件零件流水号组, this.组件零件基本件流水号组, this.数量组, this.单价组, this.交货期组, this.content, this.taxRate * 100, inquiryDetailNum_old).then(response => {
if (response.data[0].result === '1') {
this.$message.success('合同生成成功')
this.reload()

View File

@@ -166,11 +166,11 @@
{{ scope.row.供货商 }}
</template>
</el-table-column>
<el-table-column :filters="source" :filter-method="filterSource" align="center" label="数据来源" min-width="90px" prop="零件类型">
<template slot-scope="scope">
{{ Number(scope.row.零件类型) === 1 ? 'BZ' : 'WG' }}
</template>
</el-table-column>
<!--<el-table-column :filters="source" :filter-method="filterSource" align="center" label="数据来源" min-width="90px" prop="零件类型">-->
<!--<template slot-scope="scope">-->
<!--{{ Number(scope.row.零件类型) === 1 ? 'BZ' : 'WG' }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="计划到货时间" min-width="100px">
<template slot-scope="scope">
{{ scope.row.物料计划到货时间.split(' ')[0] }}
@@ -380,11 +380,11 @@
{{ scope.row.供货商 }}
</template>
</el-table-column>
<el-table-column :filters="source" :filter-method="filterSource" align="center" label="数据来源" min-width="90px" prop="零件类型">
<template slot-scope="scope">
{{ Number(scope.row.零件类型) === 1 ? 'BZ' : 'WG' }}
</template>
</el-table-column>
<!--<el-table-column :filters="source" :filter-method="filterSource" align="center" label="数据来源" min-width="90px" prop="零件类型">-->
<!--<template slot-scope="scope">-->
<!--{{ Number(scope.row.零件类型) === 1 ? 'BZ' : 'WG' }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="计划到货时间" min-width="100px">
<template slot-scope="scope">
{{ scope.row.物料计划到货时间.split(' ')[0] }}