增加销售订单与采购订单的关联,优化分批入出库的交互

This commit is contained in:
季圣华
2022-05-18 00:21:43 +08:00
parent 3438524a47
commit 951793d396
8 changed files with 376 additions and 169 deletions

View File

@@ -21,7 +21,7 @@
<a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="供应商" data-step="1" data-title="供应商"
data-intro="供应商必须选择如果发现需要选择的供应商尚未录入可以在下拉框中点击新增供应商进行录入">
<a-select placeholder="选择供应商" v-decorator="[ 'organId', validatorRules.organId ]"
<a-select placeholder="选择供应商" v-decorator="[ 'organId', validatorRules.organId ]" :disabled="!rowCanEdit"
:dropdownMatchSelectWidth="false" showSearch optionFilterProp="children">
<div slot="dropdownRender" slot-scope="menu">
<v-nodes :vnodes="menu" />
@@ -61,14 +61,14 @@
:dataSource="materialTable.dataSource"
:maxHeight="300"
:rowNumber="false"
:rowSelection="true"
:actionButton="true"
:dragSort="true"
:rowSelection="rowCanEdit"
:actionButton="rowCanEdit"
:dragSort="rowCanEdit"
@valueChange="onValueChange"
@added="onAdded"
@deleted="onDeleted">
<template #buttonAfter>
<a-row :gutter="24" style="float:left;" data-step="4" data-title="扫码录入" data-intro="此功能支持扫码枪扫描商品条码进行录入">
<a-row v-if="rowCanEdit" :gutter="24" style="float:left;padding-bottom: 5px;" data-step="4" data-title="扫码录入" data-intro="此功能支持扫码枪扫描商品条码进行录入">
<a-col v-if="scanStatus" :md="6" :sm="24">
<a-button @click="scanEnter">扫码录入</a-button>
</a-col>
@@ -79,7 +79,7 @@
<a-button @click="stopScan">收起扫码</a-button>
</a-col>
</a-row>
<a-row :gutter="24" style="float:left;">
<a-row :gutter="24" style="float:left;padding-bottom: 5px;">
<a-col :md="24" :sm="24">
<a-dropdown>
<a-menu slot="overlay">
@@ -223,6 +223,7 @@
operTimeStr: '',
prefixNo: 'CGRK',
fileList:[],
rowCanEdit: true,
model: {},
labelCol: {
xs: { span: 24 },
@@ -300,6 +301,8 @@
methods: {
//调用完edit()方法之后会自动调用此方法
editAfter() {
this.rowCanEdit = true
this.materialTable.columns[1].type = FormTypes.popupJsh
this.changeColumnHide()
this.changeFormTypes(this.materialTable.columns, 'snList', 0)
this.changeFormTypes(this.materialTable.columns, 'batchNumber', 0)
@@ -382,68 +385,46 @@
this.$refs.linkBillList.show('其它', '采购订单', '供应商', "1,3")
this.$refs.linkBillList.title = "选择采购订单"
},
linkBillListOk(selectBillRows) {
linkBillListOk(selectBillDetailRows, linkNumber, organId, discount, remark) {
this.rowCanEdit = false
this.materialTable.columns[1].type = FormTypes.normal
this.changeFormTypes(this.materialTable.columns, 'preNumber', 1)
this.changeFormTypes(this.materialTable.columns, 'finishNumber', 1)
if(selectBillRows && selectBillRows.length>0) {
let record = selectBillRows[0]
this.$nextTick(() => {
this.form.setFieldsValue({
'organId': record.organId,
'linkNumber': record.number,
'remark': record.remark,
'discount': record.discount
})
});
// 加载子表数据
let params = {
headerId: record.id,
mpList: getMpListShort(Vue.ls.get('materialPropertyList')) //扩展属性
if(selectBillDetailRows && selectBillDetailRows.length>0) {
let listEx = []
let allTaxLastMoney = 0
for(let j=0; j<selectBillDetailRows.length; j++) {
let info = selectBillDetailRows[j];
if(info.finishNumber>0) {
info.operNumber = info.preNumber - info.finishNumber
info.allPrice = info.operNumber * info.unitPrice-0
let taxRate = info.taxRate-0
info.taxMoney = (info.allPrice*taxRate/100).toFixed(2)-0
info.taxLastMoney = (info.allPrice + info.taxMoney).toFixed(2)-0
}
allTaxLastMoney += info.taxLastMoney
listEx.push(info)
this.changeColumnShow(info)
}
this.materialTable.dataSource = listEx
///给优惠后金额重新赋值
if(allTaxLastMoney) {
let discountMoney = (discount*allTaxLastMoney/100).toFixed(2)-0
let discountLastMoney = (allTaxLastMoney - discountMoney).toFixed(2)-0
this.$nextTick(() => {
this.form.setFieldsValue({
'organId': organId,
'linkNumber': linkNumber,
'discount': discount,
'discountMoney': discountMoney,
'discountLastMoney': discountLastMoney,
'changeAmount': discountLastMoney,
'remark': remark
})
})
}
this.requestSubTableDataEx(this.url.detailList, params, this.materialTable);
}
},
/** 查询某个tab的数据,给明细里面的价税合计赋值 */
requestSubTableDataEx(url, params, tab, success) {
tab.loading = true
getAction(url, params).then(res => {
if(res && res.code === 200){
let list = res.data.rows
let listEx = []
let allTaxLastMoney = 0
for(let j=0; j<list.length; j++){
let info = list[j]
if(info.finishNumber>0) {
info.operNumber = info.preNumber - info.finishNumber
info.allPrice = info.operNumber * info.unitPrice-0
let taxRate = info.taxRate-0
info.taxMoney = (info.allPrice*taxRate/100).toFixed(2)-0
info.taxLastMoney = info.allPrice + info.taxMoney
}
allTaxLastMoney += info.taxLastMoney
listEx.push(info)
this.changeColumnShow(info)
}
tab.dataSource = listEx
//给优惠后金额重新赋值
if(allTaxLastMoney) {
let discount = this.form.getFieldValue('discount')-0
let discountMoney = (discount*allTaxLastMoney/100).toFixed(2)-0
let discountLastMoney = allTaxLastMoney - discountMoney
this.$nextTick(() => {
this.form.setFieldsValue({
'discountMoney': discountMoney,
'discountLastMoney': discountLastMoney,
'changeAmount': discountLastMoney
})
});
}
typeof success === 'function' ? success(res) : ''
}
}).finally(() => {
tab.loading = false
})
}
}
}
</script>

View File

@@ -46,7 +46,13 @@
<a-input placeholder="请输入单据编号" v-decorator.trim="[ 'number' ]" :readOnly="true"/>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24"></a-col>
<a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="关联订单" data-step="3" data-title="关联订单"
data-intro="采购订单单据可以通过关联订单来选择已录入的销售订单选择之后会自动加载订单的内容
提交之后原来的销售订单会对应的改变单据状态另外本系统支持分批多次关联">
<a-input-search placeholder="请选择关联订单" v-decorator="[ 'linkNumber' ]" @search="onSearchLinkNumber" :readOnly="true"/>
</a-form-item>
</a-col>
</a-row>
<j-editable-table id="billModal"
:ref="refKeys[0]"
@@ -55,13 +61,13 @@
:dataSource="materialTable.dataSource"
:maxHeight="300"
:rowNumber="false"
:rowSelection="true"
:actionButton="true"
:dragSort="true"
:rowSelection="rowCanEdit"
:actionButton="rowCanEdit"
:dragSort="rowCanEdit"
@valueChange="onValueChange"
@deleted="onDeleted">
<template #buttonAfter>
<a-row :gutter="24" style="float:left;" data-step="3" data-title="扫码录入" data-intro="此功能支持扫码枪扫描商品条码进行录入">
<a-row v-if="rowCanEdit" :gutter="24" style="float:left;padding-bottom: 5px;" data-step="4" data-title="扫码录入" data-intro="此功能支持扫码枪扫描商品条码进行录入">
<a-col v-if="scanStatus" :md="6" :sm="24">
<a-button @click="scanEnter">扫码录入</a-button>
</a-col>
@@ -105,7 +111,7 @@
</a-row>
<a-row class="form-row" :gutter="24">
<a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="附件" data-step="4" data-title="附件" data-intro="可以上传与单据相关的图片文档支持多个文件">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="附件" data-step="8" data-title="附件" data-intro="可以上传与单据相关的图片文档支持多个文件">
<j-upload v-model="fileList" bizPath="bill"></j-upload>
</a-form-item>
</a-col>
@@ -113,10 +119,12 @@
</a-form>
</a-spin>
<vendor-modal ref="vendorModalForm" @ok="vendorModalFormOk"></vendor-modal>
<link-bill-list ref="linkBillList" @ok="linkBillListOk"></link-bill-list>
</j-modal>
</template>
<script>
import pick from 'lodash.pick'
import LinkBillList from '../dialog/LinkBillList'
import VendorModal from '../../system/modules/VendorModal'
import { FormTypes } from '@/utils/JEditableTableUtil'
import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
@@ -129,6 +137,7 @@
name: "PurchaseOrderModal",
mixins: [JEditableTableMixin,BillModalMixin],
components: {
LinkBillList,
VendorModal,
JUpload,
JDate,
@@ -150,6 +159,7 @@
operTimeStr: '',
prefixNo: 'CGDD',
fileList:[],
rowCanEdit: true,
model: {},
labelCol: {
xs: { span: 24 },
@@ -214,6 +224,8 @@
methods: {
//调用完edit()方法之后会自动调用此方法
editAfter() {
this.rowCanEdit = true
this.materialTable.columns[1].type = FormTypes.popupJsh
this.changeColumnHide()
if (this.action === 'add') {
this.addInit(this.prefixNo)
@@ -269,7 +281,46 @@
info: JSON.stringify(billMain),
rows: JSON.stringify(detailArr),
}
}
},
onSearchLinkNumber() {
this.$refs.linkBillList.purchaseShow('其它', '销售订单', '客户', "1,3","0,3")
this.$refs.linkBillList.title = "选择销售订单"
},
linkBillListOk(selectBillDetailRows, linkNumber, organId) {
this.rowCanEdit = false
this.materialTable.columns[1].type = FormTypes.normal
this.changeFormTypes(this.materialTable.columns, 'preNumber', 1)
this.changeFormTypes(this.materialTable.columns, 'finishNumber', 1)
if(selectBillDetailRows && selectBillDetailRows.length>0) {
let discountLastMoney = 0
for(let j=0; j<selectBillDetailRows.length; j++) {
let info = selectBillDetailRows[j];
if (info.preNumber) {
info.operNumber = info.preNumber - info.finishNumber
info.allPrice = (info.operNumber * info.unitPrice).toFixed(2) - 0;
info.taxRate = 0
info.taxMoney = 0
info.taxLastMoney = info.allPrice
discountLastMoney += info.allPrice
}
}
this.$nextTick(() => {
this.form.setFieldsValue({
'linkNumber': linkNumber
})
})
//给优惠后金额重新赋值
if(discountLastMoney) {
this.$nextTick(() => {
this.form.setFieldsValue({
'discountLastMoney': discountLastMoney.toFixed(2),
'changeAmount': discountLastMoney
})
});
}
this.materialTable.dataSource = selectBillDetailRows
}
},
}
}
</script>

View File

@@ -111,7 +111,7 @@
</a-row>
<a-row class="form-row" :gutter="24">
<a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="附件" data-step="5" data-title="附件" data-intro="可以上传与单据相关的图片文档支持多个文件">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="附件" data-step="8" data-title="附件" data-intro="可以上传与单据相关的图片文档支持多个文件">
<j-upload v-model="fileList" bizPath="bill"></j-upload>
</a-form-item>
</a-col>

View File

@@ -22,7 +22,7 @@
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="客户" data-step="1" data-title="客户"
data-intro="客户必须选择如果发现需要选择的客户尚未录入可以在下拉框中点击新增客户进行录入
特别注意客户如果录入之后在下拉框中不显示请检查是否给当前用户分配对应的客户权限">
<a-select placeholder="选择客户" v-decorator="[ 'organId', validatorRules.organId ]"
<a-select placeholder="选择客户" v-decorator="[ 'organId', validatorRules.organId ]" :disabled="!rowCanEdit"
:dropdownMatchSelectWidth="false" showSearch optionFilterProp="children">
<div slot="dropdownRender" slot-scope="menu">
<v-nodes :vnodes="menu" />
@@ -62,14 +62,14 @@
:dataSource="materialTable.dataSource"
:maxHeight="300"
:rowNumber="false"
:rowSelection="true"
:actionButton="true"
:dragSort="true"
:rowSelection="rowCanEdit"
:actionButton="rowCanEdit"
:dragSort="rowCanEdit"
@valueChange="onValueChange"
@added="onAdded"
@deleted="onDeleted">
<template #buttonAfter>
<a-row :gutter="24" style="float:left;" data-step="4" data-title="扫码录入" data-intro="此功能支持扫码枪扫描商品条码进行录入">
<a-row v-if="rowCanEdit" :gutter="24" style="float:left;padding-bottom: 5px;" data-step="4" data-title="扫码录入" data-intro="此功能支持扫码枪扫描商品条码进行录入">
<a-col v-if="scanStatus" :md="6" :sm="24">
<a-button @click="scanEnter">扫码录入</a-button>
</a-col>
@@ -80,7 +80,7 @@
<a-button @click="stopScan">收起扫码</a-button>
</a-col>
</a-row>
<a-row :gutter="24" style="float:left;">
<a-row :gutter="24" style="float:left;padding-bottom: 5px;">
<a-col :md="24" :sm="24">
<a-dropdown>
<a-menu slot="overlay">
@@ -229,6 +229,7 @@
operTimeStr: '',
prefixNo: 'XSCK',
fileList:[],
rowCanEdit: true,
model: {},
labelCol: {
xs: { span: 24 },
@@ -304,6 +305,8 @@
methods: {
//调用完edit()方法之后会自动调用此方法
editAfter() {
this.rowCanEdit = true
this.materialTable.columns[1].type = FormTypes.popupJsh
this.changeColumnHide()
this.changeFormTypes(this.materialTable.columns, 'snList', 0)
this.changeFormTypes(this.materialTable.columns, 'batchNumber', 0)
@@ -388,68 +391,46 @@
this.$refs.linkBillList.show('其它', '销售订单', '客户', "1,3")
this.$refs.linkBillList.title = "选择销售订单"
},
linkBillListOk(selectBillRows) {
linkBillListOk(selectBillDetailRows, linkNumber, organId, discount, remark) {
this.rowCanEdit = false
this.materialTable.columns[1].type = FormTypes.normal
this.changeFormTypes(this.materialTable.columns, 'preNumber', 1)
this.changeFormTypes(this.materialTable.columns, 'finishNumber', 1)
if(selectBillRows && selectBillRows.length>0) {
let record = selectBillRows[0]
this.$nextTick(() => {
this.form.setFieldsValue({
'organId': record.organId,
'linkNumber': record.number,
'remark': record.remark,
'discount': record.discount
})
});
// 加载子表数据
let params = {
headerId: record.id,
mpList: getMpListShort(Vue.ls.get('materialPropertyList')) //扩展属性
if(selectBillDetailRows && selectBillDetailRows.length>0) {
let listEx = []
let allTaxLastMoney = 0
for(let j=0; j<selectBillDetailRows.length; j++) {
let info = selectBillDetailRows[j];
if(info.finishNumber>0) {
info.operNumber = info.preNumber - info.finishNumber
info.allPrice = info.operNumber * info.unitPrice-0
let taxRate = info.taxRate-0
info.taxMoney = (info.allPrice*taxRate/100).toFixed(2)-0
info.taxLastMoney = (info.allPrice + info.taxMoney).toFixed(2)-0
}
allTaxLastMoney += info.taxLastMoney
listEx.push(info)
this.changeColumnShow(info)
}
this.materialTable.dataSource = listEx
///给优惠后金额重新赋值
if(allTaxLastMoney) {
let discountMoney = (discount*allTaxLastMoney/100).toFixed(2)-0
let discountLastMoney = (allTaxLastMoney - discountMoney).toFixed(2)-0
this.$nextTick(() => {
this.form.setFieldsValue({
'organId': organId,
'linkNumber': linkNumber,
'discount': discount,
'discountMoney': discountMoney,
'discountLastMoney': discountLastMoney,
'changeAmount': discountLastMoney,
'remark': remark
})
})
}
this.requestSubTableDataEx(this.url.detailList, params, this.materialTable);
}
},
/** 查询某个tab的数据,给明细里面的价税合计赋值 */
requestSubTableDataEx(url, params, tab, success) {
tab.loading = true
getAction(url, params).then(res => {
if(res && res.code === 200){
let list = res.data.rows
let listEx = []
let allTaxLastMoney = 0
for(let j=0; j<list.length; j++){
let info = list[j]
if(info.finishNumber>0) {
info.operNumber = info.preNumber - info.finishNumber
info.allPrice = info.operNumber * info.unitPrice-0
let taxRate = info.taxRate-0
info.taxMoney = (info.allPrice*taxRate/100).toFixed(2)-0
info.taxLastMoney = info.allPrice + info.taxMoney
}
allTaxLastMoney += info.taxLastMoney
listEx.push(info)
this.changeColumnShow(info)
}
tab.dataSource = listEx
//给优惠后金额重新赋值
if(allTaxLastMoney) {
let discount = this.form.getFieldValue('discount')-0
let discountMoney = (discount*allTaxLastMoney/100).toFixed(2)-0
let discountLastMoney = allTaxLastMoney - discountMoney
this.$nextTick(() => {
this.form.setFieldsValue({
'discountMoney': discountMoney,
'discountLastMoney': discountLastMoney,
'changeAmount': discountLastMoney
})
});
}
typeof success === 'function' ? success(res) : ''
}
}).finally(() => {
tab.loading = false
})
}
}
}
</script>