给其它入库和其它出库增加关联待出入库单据

This commit is contained in:
季圣华 2023-12-04 01:04:38 +08:00
parent 5bc74e7e10
commit 31411c0d6b
4 changed files with 453 additions and 3 deletions

View File

@ -0,0 +1,330 @@
<template>
<div ref="container">
<a-modal
:title="title"
:width="1250"
:visible="visible"
:getContainer="() => $refs.container"
:maskStyle="{'top':'93px','left':'154px'}"
:wrapClassName="wrapClassNameInfo()"
:mask="isDesktop()"
:maskClosable="false"
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭"
style="top:20px;height: 95%;">
<!-- 查询区域 -->
<div class="table-page-search-wrapper" v-if="selectType === 'list'">
<!-- 搜索区域 -->
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="24">
<a-form-item label="单据编号" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
<a-input placeholder="请输入单据编号查询" v-model="queryParam.number"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-form-item label="商品信息" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
<a-input placeholder="条码|名称|规格|型号" v-model="queryParam.materialParam"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-form-item label="单据日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-range-picker
style="width: 100%"
v-model="queryParam.createTimeRange"
format="YYYY-MM-DD"
:placeholder="['开始时间', '结束时间']"
@change="onDateChange"
@ok="onDateOk"
/>
</a-form-item>
</a-col>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button type="primary" @click="searchQuery">查询</a-button>
<a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<!-- table区域-begin -->
<a-table v-if="selectType === 'list'"
bordered
ref="table"
size="middle"
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: getType}"
:customRow="rowAction"
@change="handleTableChange">
<span slot="numberCustomRender" slot-scope="text, record">
<a v-if="!queryParam.purchaseStatus" @click="myHandleDetail(record)">{{record.number}}</a>
<span v-if="queryParam.purchaseStatus">{{record.number}}</span>
</span>
<template slot="customRenderStatus" slot-scope="text, record">
<template>
<a-tag v-if="record.status === '1'" color="green">已审核</a-tag>
<a-tag v-if="record.status === '3' && queryParam.type === '入库'" color="blue">部分入库</a-tag>
<a-tag v-if="record.status === '3' && queryParam.type === '出库'" color="blue">部分出库</a-tag>
</template>
</template>
</a-table>
<a-table v-if="selectType === 'detail'"
bordered
ref="table"
size="middle"
rowKey="id"
:pagination="false"
:columns="columnsDetail"
:dataSource="dataSourceDetail"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedDetailRowKeys, onChange: onSelectDetailChange, type: 'checkbox'}"
@change="handleTableChange">
</a-table>
<!-- table区域-end -->
<!-- 表单区域 -->
<bill-detail ref="billDetail"></bill-detail>
</a-modal>
</div>
</template>
<script>
import BillDetail from './BillDetail'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import {mixinDevice} from '@/utils/mixin'
import { findBillDetailByNumber } from '@/api/api'
import { getAction } from '@/api/manage'
export default {
name: 'WaitBillList',
mixins:[JeecgListMixin, mixinDevice],
components: {
BillDetail
},
data () {
return {
title: "操作",
visible: false,
disableMixinCreated: true,
selectedRowKeys: [],
selectedDetailRowKeys: [],
selectBillRows: [],
selectBillDetailRows: [],
showType: 'basic',
selectType: 'list',
linkNumber: '',
organId: '',
discountMoney: '',
deposit: '',
remark: '',
queryParam: {
number: "",
materialParam: "",
type: "",
subType: "",
status: ""
},
labelCol: {
xs: { span: 24 },
sm: { span: 8 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
// 表头
columns: [
{ title: '', dataIndex: 'organName',width:120, ellipsis:true},
{ title: '单据编号', dataIndex: 'number',width:130,
scopedSlots: { customRender: 'numberCustomRender' },
},
{ title: '商品信息', dataIndex: 'materialsList',width:280, ellipsis:true,
customRender:function (text,record,index) {
if(text) {
return text.replace(",","");
}
}
},
{ title: '单据日期', dataIndex: 'operTimeStr',width:145},
{ title: '操作员', dataIndex: 'userName',width:70},
{ title: '数量', dataIndex: 'materialCount',width:60},
{ title: '状态', dataIndex: 'status', width: 70, align: "center",
scopedSlots: { customRender: 'customRenderStatus' }
}
],
columnsDetail: [
{ title: '条码', dataIndex: 'barCode',width:120},
{ title: '名称', dataIndex: 'name',width:100, ellipsis:true},
{ title: '规格', dataIndex: 'standard',width:120, ellipsis:true},
{ title: '型号', dataIndex: 'model',width:120, ellipsis:true},
{ title: '单位', dataIndex: 'unit',width:50},
{ title: '数量', dataIndex: 'operNumber',width:50},
{ title: '备注', dataIndex: 'remark',width:100, ellipsis:true},
],
dataSource:[],
dataSourceDetail: [],
url: {
list: "/depotHead/waitBillList"
}
}
},
computed: {
getType: function () {
return 'radio';
}
},
created() {
},
methods: {
show(type, subType, status) {
this.selectType = 'list'
this.showType = 'basic'
this.queryParam.type = type
this.queryParam.subType = subType
this.queryParam.status = status
this.columns[0].title = '供应商或客户'
this.model = Object.assign({}, {});
this.visible = true;
this.loadData(1)
},
myHandleDetail(record) {
findBillDetailByNumber({ number: record.number }).then((res) => {
if (res && res.code === 200) {
let type = res.data.depotHeadType
type = type.replace('其它','')
this.$refs.billDetail.show(res.data, type)
this.$refs.billDetail.title=type+"-详情"
}
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleCancel () {
this.close()
},
onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys;
},
onSelectDetailChange(selectedRowKeys) {
this.selectedDetailRowKeys = selectedRowKeys;
},
handleOk () {
if(this.selectType === 'list') {
this.getSelectBillRows();
this.selectType = 'detail'
this.title = "选择单据明细"
if(this.selectBillRows && this.selectBillRows.length>0) {
let record = this.selectBillRows[0]
this.linkNumber = record.number
this.organId = record.organId
this.remark = record.remark
this.loadDetailData(1)
}
} else {
if(this.selectedDetailRowKeys.length) {
this.getSelectBillDetailRows()
this.$emit('ok', this.selectBillDetailRows, this.linkNumber, this.organId, this.discountMoney, this.deposit, this.remark)
this.close()
} else {
this.$message.warning('抱歉请选择单据明细')
}
}
},
//查询明细列表
loadDetailData(arg) {
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1;
}
if(this.selectBillRows && this.selectBillRows.length>0) {
let record = this.selectBillRows[0]
let param = {
headerId: record.id,
mpList : '',
linkType: this.showType
}
this.loading = true;
getAction('/depotItem/getDetailList', param).then((res) => {
if (res.code===200) {
let list = res.data.rows;
let listEx = []
for(let j=0; j<list.length; j++){
let info = list[j];
if(info.preNumber !== info.finishNumber) {
//去掉已经全部转换的明细
listEx.push(info)
}
}
this.dataSourceDetail = listEx
this.ipagination.total = res.data.total;
}
if(res.code===510){
this.$message.warning(res.data)
}
this.loading = false;
})
}
},
onDateChange: function (value, dateString) {
this.queryParam.beginTime=dateString[0];
this.queryParam.endTime=dateString[1];
},
onDateOk(value) {
console.log(value);
},
searchReset() {
this.queryParam = {
type: this.queryParam.type,
subType: this.queryParam.subType,
status: "1,3"
}
this.loadData(1);
},
getSelectBillRows() {
let dataSource = this.dataSource;
this.selectBillRows = [];
for (let i = 0, len = dataSource.length; i < len; i++) {
if (this.selectedRowKeys.includes(dataSource[i].id)) {
this.selectBillRows.push(dataSource[i]);
}
}
},
getSelectBillDetailRows() {
let dataSource = this.dataSourceDetail;
this.selectBillDetailRows = [];
for (let i = 0, len = dataSource.length; i < len; i++) {
if (this.selectedDetailRowKeys.includes(dataSource[i].id)) {
this.selectBillDetailRows.push(dataSource[i]);
}
}
},
rowAction(record, index) {
return {
on: {
click: () => {
let arr = []
arr.push(record.id)
this.selectedRowKeys = arr
},
dblclick: () => {
let arr = []
arr.push(record.id)
this.selectedRowKeys = arr
this.handleOk()
}
}
}
}
}
}
</script>
<style scoped>
</style>

View File

@ -45,7 +45,11 @@
<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 v-if="inOutManageFlag" :labelCol="labelCol" :wrapperCol="wrapperCol" label="待入库单据">
<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]"
@ -105,6 +109,7 @@
<depot-modal ref="depotModalForm" @ok="depotModalFormOk"></depot-modal>
<batch-set-depot ref="batchSetDepotModalForm" @ok="batchSetDepotModalFormOk"></batch-set-depot>
<import-item-modal ref="importItemModalForm" @ok="importItemModalFormOk"></import-item-modal>
<wait-bill-list ref="waitBillList" @ok="waitBillListOk"></wait-bill-list>
<workflow-iframe ref="modalWorkflow"></workflow-iframe>
</j-modal>
</template>
@ -122,6 +127,7 @@
import JUpload from '@/components/jeecg/JUpload'
import JDate from '@/components/jeecg/JDate'
import Vue from 'vue'
import WaitBillList from '../dialog/WaitBillList'
export default {
name: "OtherInModal",
mixins: [JEditableTableMixin, BillModalMixin],
@ -130,6 +136,7 @@
DepotModal,
BatchSetDepot,
ImportItemModal,
WaitBillList,
WorkflowIframe,
JUpload,
JDate,
@ -149,6 +156,8 @@
operTimeStr: '',
prefixNo: 'QTRK',
fileList:[],
//出入库管理开关适合独立仓管场景
inOutManageFlag: false,
model: {},
labelCol: {
xs: { span: 24 },
@ -275,6 +284,57 @@
rows: JSON.stringify(detailArr),
}
},
onSearchLinkNumber() {
this.$refs.waitBillList.show('入库', '采购,销售退货', "1,3")
this.$refs.waitBillList.title = "选择采购入库或销售退货"
},
waitBillListOk(selectBillDetailRows, linkNumber, organId, discountMoney, deposit, 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(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.unitPrice = 0
info.allPrice = 0
info.linkId = info.id
allTaxLastMoney += info.taxLastMoney
listEx.push(info)
this.changeColumnShow(info)
}
this.materialTable.dataSource = listEx
///给优惠后金额重新赋值
allTaxLastMoney = allTaxLastMoney?allTaxLastMoney:0
let discount = 0
if(allTaxLastMoney!==0) {
discount = (discountMoney / allTaxLastMoney * 100).toFixed(2) - 0
}
let discountLastMoney = (allTaxLastMoney - discountMoney).toFixed(2)-0
let changeAmount = discountLastMoney
if(deposit) {
this.depositStatus = true
changeAmount = (discountLastMoney - deposit).toFixed(2)-0
}
this.$nextTick(() => {
this.form.setFieldsValue({
'organId': organId,
'linkNumber': linkNumber,
'discount': discount,
'discountMoney': discountMoney,
'discountLastMoney': discountLastMoney,
'deposit': deposit,
'changeAmount': changeAmount,
'remark': remark
})
})
}
}
}
}
</script>

View File

@ -45,7 +45,11 @@
<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 v-if="inOutManageFlag" :labelCol="labelCol" :wrapperCol="wrapperCol" label="待出库单据">
<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]"
@ -105,6 +109,7 @@
<depot-modal ref="depotModalForm" @ok="depotModalFormOk"></depot-modal>
<batch-set-depot ref="batchSetDepotModalForm" @ok="batchSetDepotModalFormOk"></batch-set-depot>
<import-item-modal ref="importItemModalForm" @ok="importItemModalFormOk"></import-item-modal>
<wait-bill-list ref="waitBillList" @ok="waitBillListOk"></wait-bill-list>
<workflow-iframe ref="modalWorkflow"></workflow-iframe>
</j-modal>
</template>
@ -122,6 +127,7 @@
import JUpload from '@/components/jeecg/JUpload'
import JDate from '@/components/jeecg/JDate'
import Vue from 'vue'
import WaitBillList from '../dialog/WaitBillList'
export default {
name: "OtherOutModal",
mixins: [JEditableTableMixin, BillModalMixin],
@ -130,6 +136,7 @@
DepotModal,
BatchSetDepot,
ImportItemModal,
WaitBillList,
WorkflowIframe,
JUpload,
JDate,
@ -149,6 +156,8 @@
operTimeStr: '',
prefixNo: 'QTCK',
fileList:[],
//出入库管理开关适合独立仓管场景
inOutManageFlag: false,
model: {},
labelCol: {
xs: { span: 24 },
@ -275,6 +284,57 @@
rows: JSON.stringify(detailArr),
}
},
onSearchLinkNumber() {
this.$refs.waitBillList.show('出库', '销售,采购退货', "1,3")
this.$refs.waitBillList.title = "选择销售出库或采购退货"
},
waitBillListOk(selectBillDetailRows, linkNumber, organId, discountMoney, deposit, 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(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.unitPrice = 0
info.allPrice = 0
info.linkId = info.id
allTaxLastMoney += info.taxLastMoney
listEx.push(info)
this.changeColumnShow(info)
}
this.materialTable.dataSource = listEx
///给优惠后金额重新赋值
allTaxLastMoney = allTaxLastMoney?allTaxLastMoney:0
let discount = 0
if(allTaxLastMoney!==0) {
discount = (discountMoney / allTaxLastMoney * 100).toFixed(2) - 0
}
let discountLastMoney = (allTaxLastMoney - discountMoney).toFixed(2)-0
let changeAmount = discountLastMoney
if(deposit) {
this.depositStatus = true
changeAmount = (discountLastMoney - deposit).toFixed(2)-0
}
this.$nextTick(() => {
this.form.setFieldsValue({
'organId': organId,
'linkNumber': linkNumber,
'discount': discount,
'discountMoney': discountMoney,
'discountLastMoney': discountLastMoney,
'deposit': deposit,
'changeAmount': changeAmount,
'remark': remark
})
})
}
}
}
}
</script>

View File

@ -98,7 +98,7 @@
<a-col :lg="12" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="出入库管理">
<a-switch checked-children="启用" un-checked-children="关闭" v-model="inOutManageFlagSwitch" @change="onInOutManageChange"></a-switch>
启用后采购入库退货销售出库退货单据都会经过其它出入库单据
启用后采购销售相关单据都会经过其它出入库单据才能产生库存
</a-form-item>
</a-col>
</a-row>