备料到货
This commit is contained in:
@@ -1,27 +1,38 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function searchCailiao(name) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
type: '1',
|
||||
name: '备料管理_外购备料到货_材料查询',
|
||||
param: `供应商=${name}`
|
||||
}
|
||||
})
|
||||
}
|
||||
// 查询采购单
|
||||
export function searchPurchaseOrder(pageCurrent, pageSize, check1, num, check2, name) {
|
||||
export function searchPurchaseOrder(pageCurrent, pageSize, check1, num, check2, name, material) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
type: '1',
|
||||
name: '备料管理_采购计划_查询数据_到货',
|
||||
param: `采购单号_check=${check1}&采购单号=${num}&供应商_check=${check2}&供应商=${name}`,
|
||||
param: `采购单号_check=${check1}&采购单号=${num}&供应商_check=${check2}&供应商=${name}&材料=${material}`,
|
||||
Pagination: pageCurrent + '&' + pageSize
|
||||
}
|
||||
})
|
||||
}
|
||||
// 查询采购计划明细
|
||||
export function searchMateriel(num) {
|
||||
export function searchMateriel(num, num1) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
type: '1',
|
||||
name: '备料管理_采购计划明细_查询数据_未选入',
|
||||
param: `采购计划流水号=${num}`
|
||||
param: `采购计划流水号=${num}&材料=${num1}`
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -97,14 +108,14 @@ export function deleteArrivalMX(num) {
|
||||
}
|
||||
})
|
||||
}
|
||||
export function EditArrivalOrderMX(num, num1, num2, num3, num4, num5) {
|
||||
export function EditArrivalOrderMX(num, num2, num3, num4, num5) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
type: '2',
|
||||
name: '备料管理_编辑到货单明细',
|
||||
param: `到货单明细流水号=${num}&材料=${num1}&数量=${num2}&单位=${num3}&单价=${num4}&金额=${num5}`
|
||||
param: `到货单明细流水号=${num}&数量=${num2}&单位=${num3}&单价=${num4}&金额=${num5}`
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="单件重量" align="center" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number v-model="scope.row.单件重量" :step="1" size="mini" style="width:120px" @change="save(scope.$index, scope.row)"/>
|
||||
<el-input-number v-model="scope.row.单件重量" :step="1" :min="0" size="mini" style="width:120px" @change="save(scope.$index, scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总重量" align="center" prop="总重量">
|
||||
@@ -246,8 +246,14 @@
|
||||
<el-dialog v-el-drag-dialog :title="title1" :visible.sync="dialogVisible1" center style="min-height: 200px" width="430px">
|
||||
<el-form ref="form1" :model="form1" :rules="rules1" label-position="right" label-width="120px">
|
||||
<el-row>
|
||||
<el-form-item label="材料" prop="材料">
|
||||
<el-input v-model="form1.材料" size="small"/>
|
||||
<el-form-item v-show="title1==='添加到货明细'" label="材料" prop="CailiaoValue">
|
||||
<el-select v-model="form1.CailiaoValue" placeholder="材料" size="small" filterable>
|
||||
<el-option
|
||||
v-for="item in Cailiao"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
@@ -274,8 +280,9 @@
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button
|
||||
v-show="title1==='添加到货明细'"
|
||||
type="primary"
|
||||
type="warning"
|
||||
size="small"
|
||||
plain
|
||||
icon="el-icon-check"
|
||||
@click="submitAddArrivalOrderMX">保存</el-button>
|
||||
<el-button
|
||||
@@ -301,6 +308,8 @@
|
||||
<el-tooltip :open-delay="1200" effect="dark" content="查询采购计划单" placement="top">
|
||||
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px" @click="pageCurrent2=1;pageSize2=10;total2=0;searchTable2()">查询</el-button>
|
||||
</el-tooltip>
|
||||
<span style="font-size: 15px;margin-left: 10px;font-weight: bold">材料:</span><span>{{ 材料111 }}</span>
|
||||
<span style="font-size: 15px;margin-left: 10px;font-weight: bold">材料数量:</span><span>{{ 材料数量 }}</span>
|
||||
</div>
|
||||
<el-table v-loading="" :data="tableData2" border stripe style="max-height: 460px;" height="230px" size="mini" highlight-current-row @row-click="searchTable3">
|
||||
<el-table-column label="采购计划单号" align="center">
|
||||
@@ -391,21 +400,28 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { searchPurchaseOrder, searchMateriel, addMateriel, searchArriveOrder, addPurchaseOrder, editPurchaseOrder, deletePurchaseOrder, saveWeight, searchTable5, searchSupplier, deleteArrivalMX, EditArrivalOrderMX, AddArrivalOrderMX, deleteMateriel, searchTable6 } from '@/api/WorkshopProcurement/NewArrivalList.js'
|
||||
import { searchCailiao, searchPurchaseOrder, searchMateriel, addMateriel, searchArriveOrder, addPurchaseOrder, editPurchaseOrder, deletePurchaseOrder, saveWeight, searchTable5, searchSupplier, deleteArrivalMX, EditArrivalOrderMX, AddArrivalOrderMX, deleteMateriel, searchTable6 } from '@/api/WorkshopProcurement/NewArrivalList.js'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
Cailiao: [],
|
||||
purchasingOrder: '',
|
||||
ArrivalOrderNumber: '',
|
||||
ArrivalOrderMXNumber: '',
|
||||
supplierName0: '',
|
||||
arrest: [],
|
||||
check: 0,
|
||||
材料111: '',
|
||||
Name: '',
|
||||
单价: '',
|
||||
数量: '',
|
||||
SUM: 0,
|
||||
ALLMoney: '',
|
||||
材料数量: '',
|
||||
材料名称: '',
|
||||
未绑定数量: '',
|
||||
tableData2: [],
|
||||
total2: 0,
|
||||
pageCurrent2: 1,
|
||||
@@ -420,12 +436,14 @@ export default {
|
||||
tableData5: [],
|
||||
到货单流水号: '',
|
||||
dateRange: '',
|
||||
中间变量: '',
|
||||
form: {
|
||||
备注: '',
|
||||
日期: '',
|
||||
supplierNameValue: ''
|
||||
},
|
||||
form1: {
|
||||
CailiaoValue: '',
|
||||
材料: '',
|
||||
数量: '',
|
||||
单位: 'KG',
|
||||
@@ -444,7 +462,7 @@ export default {
|
||||
日期: [{ required: true, message: '请选择日期' }]
|
||||
},
|
||||
rules1: {
|
||||
材料: [{ required: true, message: '请填写材料' }],
|
||||
CailiaoValue: [{ required: true, message: '请选择材料' }],
|
||||
数量: [{ required: true, message: '请填写数量' }],
|
||||
单位: [{ required: true, message: '请填写单位' }],
|
||||
单价: [{ required: true, message: '请填写单价' }]
|
||||
@@ -466,10 +484,21 @@ export default {
|
||||
this.searchTable4()
|
||||
},
|
||||
methods: {
|
||||
searchCailiao() {
|
||||
this.Cailiao = []
|
||||
searchCailiao(this.供应商111).then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.Cailiao.push({
|
||||
value: response.data[i].材料,
|
||||
label: response.data[i].材料
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
searchTable2() { // 查询采购单列表
|
||||
this.purchasingOrder ? this.check3 = 1 : this.check3 = 0
|
||||
this.supplierName0 ? this.check4 = 1 : this.check4 = 0
|
||||
searchPurchaseOrder(this.pageCurrent2, this.pageSize2, this.check3, this.purchasingOrder, this.check4, this.supplierName0).then(response => {
|
||||
searchPurchaseOrder(this.pageCurrent2, this.pageSize2, this.check3, this.purchasingOrder, this.check4, this.supplierName0, this.材料111).then(response => {
|
||||
this.tableData2 = response.data.rows
|
||||
this.total2 = response.data.total
|
||||
})
|
||||
@@ -484,7 +513,7 @@ export default {
|
||||
},
|
||||
searchTable3(row) { // 查询采购计划明细
|
||||
this.采购计划流水号 = row.采购计划流水号
|
||||
searchMateriel(this.采购计划流水号).then(response => {
|
||||
searchMateriel(this.采购计划流水号, this.材料111).then(response => {
|
||||
this.tableData3 = response.data
|
||||
})
|
||||
},
|
||||
@@ -536,7 +565,12 @@ export default {
|
||||
const { columns, data } = param
|
||||
const sums = []
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 5) {
|
||||
if (index === 3) {
|
||||
sums[index] = '未绑定数量:'
|
||||
return
|
||||
} else if (index === 4) {
|
||||
sums[index] = this.未绑定数量
|
||||
} if (index === 5) {
|
||||
sums[index] = '总重量:'
|
||||
return
|
||||
} else if (index === 6) {
|
||||
@@ -586,19 +620,35 @@ export default {
|
||||
})
|
||||
},
|
||||
save(index, row) {
|
||||
this.SUM = 0
|
||||
this.allWeight = parseInt(row.批次数量 * row.单件重量 * 100) / 100
|
||||
this.ALLMoney = parseInt(this.allWeight * this.单价 * 100) / 100
|
||||
saveWeight(row.采购计划明细流水号, row.单件重量, this.allWeight, this.ALLMoney).then(response => {
|
||||
console.log(response)
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('录入成功')
|
||||
searchTable6(this.ArrivalOrderMXNumber).then(response => {
|
||||
this.tableData6 = response.data
|
||||
})
|
||||
} else {
|
||||
this.$message.error('录入失败')
|
||||
}
|
||||
})
|
||||
for (let i = 0; i < this.tableData6.length; i++) {
|
||||
this.SUM += parseFloat(this.tableData6[i].单件重量) * parseFloat(this.tableData6[i].批次数量)
|
||||
}
|
||||
if (this.数量 - this.SUM < 0) {
|
||||
this.$message.warning('总重量已超出上限')
|
||||
searchTable6(this.ArrivalOrderMXNumber).then(response => {
|
||||
this.tableData6 = response.data
|
||||
if (response.data.length !== 0) {
|
||||
this.未绑定数量 = response.data[0].未绑定数量
|
||||
}
|
||||
})
|
||||
} else {
|
||||
saveWeight(row.采购计划明细流水号, row.单件重量, this.allWeight, this.ALLMoney).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('录入成功')
|
||||
searchTable6(this.ArrivalOrderMXNumber).then(response => {
|
||||
this.tableData6 = response.data
|
||||
if (response.data.length !== 0) {
|
||||
this.未绑定数量 = response.data[0].未绑定数量
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error('录入失败')
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
Calculation() {
|
||||
this.form1.金额 = this.form1.单价 * this.form1.数量
|
||||
@@ -699,6 +749,7 @@ export default {
|
||||
searchTable5(row) {
|
||||
this.tableData6 = []
|
||||
this.到货单流水号 = row.到货单流水号
|
||||
this.ArrivalOrderNumber = row.到货单流水号
|
||||
searchTable5(this.到货单流水号).then(response => {
|
||||
this.tableData5 = response.data
|
||||
})
|
||||
@@ -707,8 +758,10 @@ export default {
|
||||
if (this.$refs['form1'] !== undefined) {
|
||||
this.$refs['form1'].resetFields()
|
||||
}
|
||||
this.供应商111 = row.供应商流水号
|
||||
this.searchCailiao()
|
||||
this.title1 = '添加到货明细'
|
||||
this.form1.材料 = ''
|
||||
this.form1.CailiaoValue = ''
|
||||
this.form1.数量 = ''
|
||||
this.form1.单价 = ''
|
||||
this.form1.金额 = ''
|
||||
@@ -716,46 +769,42 @@ export default {
|
||||
this.dialogVisible1 = true
|
||||
},
|
||||
submitAddArrivalOrderMX() {
|
||||
this.form1.金额 = this.form1.数量 * this.form1.单价
|
||||
this.$refs['form1'].validate((valid) => {
|
||||
if (valid) {
|
||||
AddArrivalOrderMX(this.ArrivalOrderNumber, this.form1.材料, this.form1.数量, this.form1.单位, this.form1.单价, this.form1.金额).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('新增到货材料成功')
|
||||
searchTable5(this.ArrivalOrderNumber).then(response => {
|
||||
this.tableData5 = response.data
|
||||
})
|
||||
this.dialogVisible1 = false
|
||||
} else { this.$message.error('新建到货单失败') }
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
if (this.form1.数量 > 0) {
|
||||
this.form1.金额 = this.form1.数量 * this.form1.单价
|
||||
this.$refs['form1'].validate((valid) => {
|
||||
if (valid) {
|
||||
AddArrivalOrderMX(this.ArrivalOrderNumber, this.form1.CailiaoValue, this.form1.数量, this.form1.单位, this.form1.单价, this.form1.金额).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('新增到货材料成功')
|
||||
searchTable5(this.ArrivalOrderNumber).then(response => {
|
||||
this.tableData5 = response.data
|
||||
})
|
||||
// this.dialogVisible1 = false
|
||||
} else { this.$message.error('新建到货单失败') }
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error('数量不能为0')
|
||||
}
|
||||
},
|
||||
submitAddArrivalOrderMX1() {
|
||||
this.form1.金额 = this.form1.数量 * this.form1.单价
|
||||
this.$refs['form1'].validate((valid) => {
|
||||
if (valid) {
|
||||
AddArrivalOrderMX(this.ArrivalOrderNumber, this.form1.材料, this.form1.数量, this.form1.单位, this.form1.单价, this.form1.金额).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('新增到货材料成功')
|
||||
searchTable5(this.ArrivalOrderNumber).then(response => {
|
||||
this.tableData5 = response.data
|
||||
})
|
||||
} else { this.$message.error('新建到货单失败') }
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
this.searchCailiao()
|
||||
this.form1.CailiaoValue = ''
|
||||
this.form1.数量 = ''
|
||||
this.form1.单价 = ''
|
||||
this.form1.金额 = ''
|
||||
},
|
||||
editArrivalMX(row) {
|
||||
if (this.$refs['form1'] !== undefined) {
|
||||
this.$refs['form1'].resetFields()
|
||||
}
|
||||
this.供应商111 = row.供应商流水号
|
||||
this.searchCailiao()
|
||||
this.title1 = '编辑到货明细'
|
||||
this.form1.材料 = row.材料
|
||||
// this.form1.CailiaoValue = row.材料
|
||||
this.form1.数量 = row.数量
|
||||
this.form1.单位 = row.单位
|
||||
this.form1.单价 = row.单价
|
||||
@@ -764,10 +813,11 @@ export default {
|
||||
this.dialogVisible1 = true
|
||||
},
|
||||
submitEditArrivalOrderMX() {
|
||||
this.form1.CailiaoValue = '1'
|
||||
this.form1.金额 = this.form1.数量 * this.form1.单价
|
||||
this.$refs['form1'].validate((valid) => {
|
||||
if (valid) {
|
||||
EditArrivalOrderMX(this.ArrivalOrderMXNumber, this.form1.材料, this.form1.数量, this.form1.单位, this.form1.单价, this.form1.金额).then(response => {
|
||||
EditArrivalOrderMX(this.ArrivalOrderMXNumber, this.form1.数量, this.form1.单位, this.form1.单价, this.form1.金额).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('编辑到货材料成功')
|
||||
searchTable5(this.ArrivalOrderNumber).then(response => {
|
||||
@@ -805,19 +855,26 @@ export default {
|
||||
searchTable6(row) {
|
||||
this.ArrivalOrderMXNumber = row.到货单明细流水号
|
||||
this.单价 = row.单价
|
||||
this.数量 = row.数量
|
||||
searchTable6(this.ArrivalOrderMXNumber).then(response => {
|
||||
this.tableData6 = response.data
|
||||
if (response.data.length !== 0) {
|
||||
this.中间变量 = response.data[0].单件重量
|
||||
this.未绑定数量 = response.data[0].未绑定数量
|
||||
}
|
||||
})
|
||||
},
|
||||
addArrivalCL(row) {
|
||||
this.材料111 = row.材料
|
||||
this.材料数量 = row.数量
|
||||
this.supplierName0 = row.供应商流水号
|
||||
this.ArrivalOrderMXNumber = row.到货单明细流水号
|
||||
this.tableData3 = []
|
||||
this.dialogVisible2 = true
|
||||
this.searchTable2()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.arrest = val
|
||||
console.log(val)
|
||||
},
|
||||
// 选入
|
||||
addMateriel() {
|
||||
@@ -835,12 +892,14 @@ export default {
|
||||
addMateriel(this.ArrivalOrderMXNumber, this.工艺计划流水号组, this.采购计划明细流水号组).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('关联成功')
|
||||
this.dialogVisible2 = false
|
||||
searchMateriel(this.采购计划流水号).then(response => {
|
||||
this.tableData3 = response.data
|
||||
})
|
||||
searchTable6(this.ArrivalOrderMXNumber).then(response => {
|
||||
this.tableData6 = response.data
|
||||
if (response.data.length !== 0) {
|
||||
this.未绑定数量 = response.data[0].未绑定数量
|
||||
}
|
||||
})
|
||||
} else { this.$message.error('关联失败') }
|
||||
})
|
||||
@@ -852,12 +911,14 @@ export default {
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
console.log(row)
|
||||
deleteMateriel(row.到货单明细绑定流水号, row.采购计划明细流水号).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('取消成功')
|
||||
searchTable6(this.ArrivalOrderMXNumber).then(response => {
|
||||
this.tableData6 = response.data
|
||||
if (response.data.length !== 0) {
|
||||
this.未绑定数量 = response.data[0].未绑定数量
|
||||
}
|
||||
})
|
||||
} else { this.$message.error('取消失败') }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user