采购库存

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

@@ -83,6 +83,18 @@ export function searchStockNumber2(...params) {
}
})
}
// 查看领料单明细相关的物料货位数量
export function searchStockNumber3(...params) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '库存管理_物料出库_车间采购件_查询数据',
param: `请购单明细流水号=${params[0]}`
}
})
}
// 出库
export function submitOutStore(...params) {
return request({
@@ -91,7 +103,7 @@ export function submitOutStore(...params) {
data: {
type: '2',
name: '库存管理_物料出库_出库记录_增加数据',
param: `物料流水号=${params[0]}&货位流水号=${params[1]}&出库数量=${params[2]}&出库人流水号=${params[3]}&基本件流水号=${params[4]}&标准件和外购件流水号=${params[5]}`
param: `物料流水号=${params[0]}&货位流水号=${params[1]}&出库数量=${params[2]}&出库人流水号=${params[3]}&基本件流水号=${params[4]}&标准件和外购件流水号=${params[5]}&请购单明细流水号=${params[6]}&领料单流水号=${params[7]}&领料人流水号=${params[8]}&仓库流水号=${params[9]}&出库类别=${params[10]}`
}
})
}
@@ -107,3 +119,14 @@ export function errorRecord(...params) {
}
})
}
// 初始化出库类别
export function initOutType() {
return request({
url: '',
method: 'post',
data: {
type: '3',
name: 'select * from 库存管理_出库类别'
}
})
}

View File

@@ -45,7 +45,7 @@ export function doneContract(...params) {
data: {
type: '2',
name: '采购管理_采购合同_增加数据',
param: `采购合同编号=${params[0]}\\&采购合同名称=${params[1]}\\&交货日期=${params[2]}\\&支付日期=${params[3]}\\&支付方式=${params[4]}\\&开票信息=${params[5]}\\&其他说明=${params[6]}\\&合同总额=${params[7]}\\&采购员流水号=${params[8]}\\&供应商流水号=${params[9]}\\&单价是否含税=${params[10]}\\&组件零件流水号组=${params[11]}\\&组件零件基本件流水号组=${params[12]}\\&数量组=${params[13]}\\&单价组=${params[14]}\\&交货期组=${params[15]}\\&合同内容\\=${params[16]}\\&税率=${params[17]}`
param: `采购合同编号=${params[0]}\\&采购合同名称=${params[1]}\\&交货日期=${params[2]}\\&支付日期=${params[3]}\\&支付方式=${params[4]}\\&开票信息=${params[5]}\\&其他说明=${params[6]}\\&合同总额=${params[7]}\\&采购员流水号=${params[8]}\\&供应商流水号=${params[9]}\\&单价是否含税=${params[10]}\\&组件零件流水号组=${params[11]}\\&组件零件基本件流水号组=${params[12]}\\&数量组=${params[13]}\\&单价组=${params[14]}\\&交货期组=${params[15]}\\&合同内容\\=${params[16]}\\&税率=${params[17]}\\&询价单明细流水号组=${params[18]}`
}
})
}
@@ -61,3 +61,14 @@ export function searchBaseInfo(id) {
}
})
}
// 实时保存单价
export function savePrice(price, num1, num2) {
return request({
url: '',
method: 'post',
data: {
type: '4',
name: `update 采购管理_询价单明细_视图 set 单价 = ${price} where 物料流水号 = ${num1} and 询价单流水号 = ${num2}`
}
})
}

View File

@@ -129,6 +129,8 @@ export function groupBy(datas, keys) {
group.key.数量 = group.data1 += v.数量
group.data2 = group.data2 || ''
group.key.机床图号_组号 = group.data2 += (v.机床图号 || '') + '-' + (v.组号 ? v.组号.split('组')[0] : '') + ';'
group.data3 = group.data3 || 0
group.key.合计 = group.data3 += v.合计
})
groups.map(v => {
result.push(v.key)

View File

@@ -185,6 +185,15 @@
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="出库类别" prop="outTypeValue" label-width="100px">
<el-select v-model="form1.outTypeValue" size="small" placeholder="出库类别" style="width: 200px;margin-right:10px">
<el-option
v-for="item in outType"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1=false">取消</el-button>
@@ -210,12 +219,14 @@
</template>
<script>
import { initPickPerson, initMachineProject, searchgroup, searchList, searchListDetail, searchStockNumber1, searchStockNumber2, submitOutStore, errorRecord } from '@/api/Inventory/MaterialOut'
import { initPickPerson, initMachineProject, searchgroup, searchList, searchListDetail, searchStockNumber1, searchStockNumber2, submitOutStore, errorRecord, searchStockNumber3, initOutType } from '@/api/Inventory/MaterialOut'
import { mapGetters } from 'vuex'
export default {
name: 'MaterialOut',
data() {
return {
pickingListNum: '', // 领料单流水号
pickingPersonNum: '', // 领料人流水号
pickingListNumber: '',
pickingListNumberShow: '',
pickListTable1: [],
@@ -226,12 +237,14 @@ export default {
StockNumberTable: [],
dialogFormVisible1: false,
dialogFormVisible2: false,
outType: [],
form1: {
machineValue: '',
groupNumValue: '',
outNumber: '',
outNumberMax: '', // 出库最大值
personValue: ''
personValue: '',
outTypeValue: '' // 出库类别
},
form2: {
errorNumber: '',
@@ -244,7 +257,8 @@ export default {
machineValue: [{ required: true, message: '请选择' }],
groupNumValue: [{ required: true, message: '请选择' }],
outNumber: [{ required: true, message: '请输入' }],
personValue: [{ required: true, message: '请输入' }]
personValue: [{ required: true, message: '请输入' }],
outTypeValue: [{ required: true, message: '请选择' }] // 出库类别
},
rules2: {
errorNumber: [{ required: true, message: '请输入' }],
@@ -256,8 +270,10 @@ export default {
materialNum: '', // 中间变量物料流水号
machineValue: '', // 中间变量机床流水号
groupNumValue: '', // 中间变量组件流水号
basePartNum: '', // 中间变量基本件流水u和
basePartNum: '', // 中间变量基本件流水
purchaseBillNum: '', // 中间变量请购单明细流水号
parchasePartNum: '', // 中间变量标准件和外购件流水号
inventoryNum: '', // 中间变量仓库流水号
locationNum: '', // 中间变量货位流水号
outNumber: 0 // 中间变量出库数量
}
@@ -293,6 +309,14 @@ export default {
})
}
})
initOutType().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.outType.push({
label: response.data[i].出库类别名称,
value: response.data[i].出库类别流水号
})
}
})
},
// 查询组号
searchGroup() {
@@ -328,6 +352,7 @@ export default {
// 查看领料单明细
clickList(row) {
row && row.领料单流水号 ? this.pickingListNum = row.领料单流水号 : this.pickingListNum
row && row.人员编号 ? this.pickingPersonNum = row.人员编号 : this.pickingListNum
row && row.领料单编号 ? this.pickingListNumberShow = row.领料单编号 : this.pickingListNumberShow
searchListDetail(this.pickingListNum).then(res => {
this.pickListTable2 = res.data
@@ -335,9 +360,10 @@ export default {
},
// 查看领料单明细相关的物料货位数量
clickListDetail(row) {
row && row.基本件流水号 ? (this.basePartNum = row.基本件流水号, this.materialNum = null, this.parchasePartNum = null) : this.basePartNum
row && row.物料流水号 ? (this.materialNum = row.物料流水号, this.basePartNum = null) : this.materialNum
row && row.标准件和外购件流水号 ? (this.parchasePartNum = row.标准件和外购件流水号, this.basePartNum = null) : this.parchasePartNum
row && row.基本件流水号 ? (this.basePartNum = row.基本件流水号, this.materialNum = null, this.parchasePartNum = null, this.purchaseBillNum = null) : this.basePartNum
row && row.物料流水号 ? (this.materialNum = row.物料流水号, this.basePartNum = null, this.purchaseBillNum = null) : this.materialNum
row && row.标准件和外购件流水号 ? (this.parchasePartNum = row.标准件和外购件流水号, this.basePartNum = null, this.purchaseBillNum = null) : this.parchasePartNum
row && row.请购单明细流水号 ? (this.purchaseBillNum = row.请购单明细流水号, this.basePartNum = null, this.materialNum = null, this.parchasePartNum = null) : this.parchasePartNum
row && row.机床流水号 ? this.machineValue = row.机床流水号 : this.machineValue
row && row.组件流水号 ? this.groupNumValue = row.组件流水号 : this.groupNumValue
row && row.总数量 ? this.outNumber = row.总数量 : this.outNumber
@@ -349,6 +375,10 @@ export default {
searchStockNumber2(this.basePartNum).then(res => {
this.StockNumberTable = res.data
})
} else if (this.purchaseBillNum) {
searchStockNumber3(this.purchaseBillNum).then(res => {
this.StockNumberTable = res.data
})
}
},
// 出库
@@ -357,6 +387,7 @@ export default {
this.$refs['form1'].resetFields()
}
this.form1.machineValue = this.machineValue
this.inventoryNum = row.仓库流水号
this.locationNum = row.货位流水号
this.outNumber > row.货位存量 ? (this.form1.outNumber = row.货位存量, this.form1.outNumberMax = row.货位存量) : (this.form1.outNumber = this.outNumber, this.form1.outNumberMax = this.outNumber) // 货位存量和领料数量对比取小
this.form1.personValue = Number(this.id)
@@ -380,7 +411,7 @@ export default {
if (valid) {
// 出库数量,出库人,基本件流水号/标准件和外购件流水号 => 记录到一个新表
// 物料流水号,货位流水号,出库数量 => 减掉货位物料数
submitOutStore(this.materialNum, this.locationNum, this.form1.outNumber, this.form1.personValue, this.basePartNum, this.parchasePartNum).then(response => {
submitOutStore(this.materialNum, this.locationNum, this.form1.outNumber, this.form1.personValue, this.basePartNum, this.parchasePartNum, this.purchaseBillNum, this.pickingListNum, this.pickingPersonNum, this.inventoryNum, this.form1.outTypeValue).then(response => {
if (response.data[0].result === '1') {
this.$message.success('出库成功')
this.dialogFormVisible1 = false

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] }}