feat(finance): 更新开票单详情和操作功能
- 修改详情抽屉中的字段显示,将创建时间改为预计开票时间 - 添加开票状态、审批节点、审批状态和审批通过时间显示 - 更新销售-应收单表格的数据源和字段映射 - 扩展操作列宽度以适应更多按钮 - 添加发票按钮的显示条件控制 - 添加申请开票按钮的显示条件控制 - 添加申请红冲按钮的显示条件控制 - 实现撤销功能按钮和相关逻辑 - 添加撤销发票API接口 - 优化票据类型选择的交互逻辑 - 添加发票金额验证和自动计算功能 - 实现附件上传的权限控制 - 完善发票撤销的业务逻辑处理dev_1.0.1
parent
693899f45c
commit
d3bbf2da62
|
|
@ -82,3 +82,11 @@ export function applyInvoice(data) {
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 撤销销售收票单
|
||||||
|
export function revokeInvoice(id) {
|
||||||
|
return request({
|
||||||
|
url: '/finance/invoice/revoke/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
<div class="detail-item">销售-开票单编号: {{ detail.invoiceBillCode }}</div>
|
<div class="detail-item">销售-开票单编号: {{ detail.invoiceBillCode }}</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<div class="detail-item">销售-生成时间: {{ detail.createTime }}</div>
|
<div class="detail-item">预计开票时间: {{ detail.createTime }}</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<div class="detail-item">进货商名称: {{ detail.partnerName }}</div>
|
<div class="detail-item">进货商名称: {{ detail.partnerName }}</div>
|
||||||
|
|
@ -45,14 +45,28 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="8">
|
||||||
<div class="detail-item">票据类型:
|
<div class="detail-item">开票状态:
|
||||||
<span class="item-value"><dict-tag :options="dict.type.finance_invoice_type" :value="detail.invoiceType"/></span>
|
<dict-tag :options="dict.type.invoice_bill_status" :value="detail.invoiceStatus"/>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="8">
|
||||||
<div class="detail-item">发票/红冲:
|
<div class="detail-item">审批节点: {{ detail.approveNode }}</div>
|
||||||
{{detail.totalPriceWithTax<0?'红冲票据':'正常票据'}}
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<div class="detail-item">审批状态:
|
||||||
|
<dict-tag :options="dict.type.approve_status" :value="detail.approveStatus"/></div>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="8">
|
||||||
|
<div class="detail-item">审批通过时间 :{{detail.approveTime}}
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="16">
|
||||||
|
<div class="detail-item">票据类型:
|
||||||
|
<span class="item-value"><dict-tag :options="dict.type.finance_invoice_type" :value="detail.invoiceType"/></span>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
@ -92,45 +106,20 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col :span="8">
|
|
||||||
<div class="detail-item">备注: {{ detail.remark }}</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<div class="detail-item">上传人姓名: {{ detail.createByName }}</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<div class="detail-item">开票状态:
|
|
||||||
<dict-tag :options="dict.type.invoice_bill_status" :value="detail.invoiceStatus"/>
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col :span="8">
|
|
||||||
<div class="detail-item">审批节点: {{ detail.approveNode }}</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<div class="detail-item">审批状态:
|
|
||||||
<dict-tag :options="dict.type.approve_status" :value="detail.approveStatus"/></div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<div class="detail-item">审批通过时间 :{{detail.approveTime}}
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<el-divider content-position="left">销售-应收单</el-divider>
|
<el-divider content-position="left">销售-应收单</el-divider>
|
||||||
<el-table :data="detail.detailList">
|
<el-table :data="detail.detailDTOList">
|
||||||
<el-table-column type="index" label="序号" width="50"></el-table-column>
|
<el-table-column type="index" label="序号" width="50"></el-table-column>
|
||||||
<el-table-column property="projectCode" label="项目编号"></el-table-column>
|
<!-- <el-table-column property="projectCode" label="项目编号"></el-table-column>-->
|
||||||
<el-table-column property="projectName" label="项目名称"></el-table-column>
|
<el-table-column property="projectName" label="项目名称"></el-table-column>
|
||||||
<el-table-column property="receivableBillCode" label="销售应收单编号"></el-table-column>
|
<el-table-column property="receivableBillCode" label="销售-应收单编号"></el-table-column>
|
||||||
<el-table-column property="totalPriceWithTax" label="含税总价"></el-table-column>
|
<el-table-column property="totalPriceWithTax" label="含税总价(元)"></el-table-column>
|
||||||
<el-table-column property="invoiceAmount" label="本次收票金额"></el-table-column>
|
<el-table-column property="receiptAmount" label="本次开票金额"></el-table-column>
|
||||||
<el-table-column property="invoiceRate" label="本次收票比例(%)"></el-table-column>
|
<el-table-column property="receiptRate" label="本次开票比例(%)"></el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="receipt-dialog-body">
|
<div v-else class="receipt-dialog-body">
|
||||||
<div v-if="canUpload" class="upload-btn-container">
|
<div v-if="canUpload" class="upload-btn-container">
|
||||||
<el-button type="primary" icon="el-icon-upload" @click="openUploadDialog">上传{{ titleText }}</el-button>
|
<el-button type="primary" v-hasPermi="['finance:invoice:upload']"icon="el-icon-upload" @click="openUploadDialog">上传{{ titleText }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-timeline v-if="attachments.length > 0">
|
<el-timeline v-if="attachments.length > 0">
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
<div class="receipt-details">
|
<div class="receipt-details">
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<span class="item-label">票据类型</span>
|
<span class="item-label">票据类型</span>
|
||||||
<span class="item-value"><dict-tag :options="dict.type.finance_invoice_type" :value="attachment.ticketType"/></span>
|
<span class="item-value"><dict-tag :options="dict.type.finance_invoice_type" :value="invoiceData.invoiceType"/></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<span class="item-label">{{ titleText }}</span>
|
<span class="item-label">{{ titleText }}</span>
|
||||||
|
|
@ -113,8 +113,8 @@
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form :model="uploadForm" ref="uploadForm" :rules="rules" label-width="120px" size="medium" >
|
<el-form :model="uploadForm" ref="uploadForm" :rules="rules" label-width="120px" size="medium" >
|
||||||
<el-form-item label="票据类型" prop="ticketType" required>
|
<el-form-item label="票据类型" prop="invoiceType" required>
|
||||||
<el-select v-model="uploadForm.ticketType" placeholder="请选择票据类型">
|
<el-select v-model="uploadForm.invoiceType" placeholder="请选择票据类型" @change="handleTypeChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dict.type.finance_invoice_type"
|
v-for="item in dict.type.finance_invoice_type"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
|
|
@ -123,7 +123,7 @@
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="收票附件" prop="file" required>
|
<el-form-item label="开票附件" prop="file" required>
|
||||||
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="upload"
|
ref="upload"
|
||||||
|
|
@ -140,22 +140,22 @@
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="含税总价">
|
<el-form-item label="含税总价">
|
||||||
<span>{{ invoiceData.invoicePriceWithTax }}</span>
|
<span>{{ invoiceData.totalPriceWithTax }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="发票含税总价" prop="ticketPriceWithTax" required>
|
<el-form-item label="发票含税总价" prop="invoicePriceWithTax" required>
|
||||||
<el-input v-model="uploadForm.ticketPriceWithTax" placeholder="请输入发票含税总价"></el-input>
|
<el-input v-model="uploadForm.invoicePriceWithTax" placeholder="请输入发票含税总价"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="未税总价">
|
<el-form-item label="未税总价">
|
||||||
<span>{{ invoiceData.invoicePriceWithoutTax }}</span>
|
<span>{{ invoiceData.totalPriceWithoutTax }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="发票未税总价" prop="ticketPriceWithoutTax" required>
|
<el-form-item label="发票未税总价" prop="invoicePriceWithoutTax" required>
|
||||||
<el-input v-model="uploadForm.ticketPriceWithoutTax" placeholder="请输入发票未税总价"></el-input>
|
<el-input v-model="uploadForm.invoicePriceWithoutTax" placeholder="请输入发票未税总价" @input="handleWithoutTaxChange"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="税额">
|
<el-form-item label="税额">
|
||||||
<span>{{ invoiceData.taxAmount }}</span>
|
<span>{{ invoiceData.taxAmount }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="发票税额" prop="ticketAmount" required>
|
<el-form-item label="发票税额" prop="invoiceAmount" required>
|
||||||
<el-input v-model="uploadForm.ticketAmount" placeholder="请输入发票税额"></el-input>
|
<el-input v-model="uploadForm.invoiceAmount" placeholder="请输入发票税额" @input="handleAmountChange"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注">
|
<el-form-item label="备注">
|
||||||
<el-input
|
<el-input
|
||||||
|
|
@ -220,21 +220,21 @@ export default {
|
||||||
// Upload Dialog Data
|
// Upload Dialog Data
|
||||||
uploadDialogVisible: false,
|
uploadDialogVisible: false,
|
||||||
uploadForm: {
|
uploadForm: {
|
||||||
ticketPriceWithTax: '',
|
invoicePriceWithTax: '',
|
||||||
ticketPriceWithoutTax: '',
|
invoicePriceWithoutTax: '',
|
||||||
ticketAmount: '',
|
invoiceAmount: '',
|
||||||
ticketType: '',
|
invoiceType: this.invoiceData.invoiceType,
|
||||||
remark: '',
|
remark: '',
|
||||||
file: null
|
file: null
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
ticketPriceWithTax: [
|
invoicePriceWithTax: [
|
||||||
{ required: true, message: "请输入发票含税总价", trigger: "blur" }
|
{ required: true, message: "请输入发票含税总价", trigger: "blur" }
|
||||||
],
|
],
|
||||||
ticketPriceWithoutTax: [
|
invoicePriceWithoutTax: [
|
||||||
{ required: true, message: "请输入发票未税总价", trigger: "blur" }
|
{ required: true, message: "请输入发票未税总价", trigger: "blur" }
|
||||||
],
|
],
|
||||||
ticketAmount: [
|
invoiceAmount: [
|
||||||
{ required: true, message: "请输入发票税额", trigger: "blur" }
|
{ required: true, message: "请输入发票税额", trigger: "blur" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -281,7 +281,7 @@ export default {
|
||||||
fetchAttachments() {
|
fetchAttachments() {
|
||||||
if (!this.invoiceData.id) return;
|
if (!this.invoiceData.id) return;
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
getInvoiceAttachments(this.invoiceData.id, { type: 'ticket' })
|
getInvoiceAttachments(this.invoiceData.id, { type: 'invoice' })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
const data = response.data || [];
|
const data = response.data || [];
|
||||||
data.sort((a, b) => new Date(b.createTime) - new Date(a.createTime));
|
data.sort((a, b) => new Date(b.createTime) - new Date(a.createTime));
|
||||||
|
|
@ -339,10 +339,10 @@ export default {
|
||||||
// New Upload Dialog Methods
|
// New Upload Dialog Methods
|
||||||
openUploadDialog() {
|
openUploadDialog() {
|
||||||
this.uploadForm = {
|
this.uploadForm = {
|
||||||
ticketPriceWithTax: '',
|
invoicePriceWithTax: '',
|
||||||
ticketPriceWithoutTax: '',
|
invoicePriceWithoutTax: '',
|
||||||
ticketAmount: '',
|
invoiceAmount: '',
|
||||||
ticketType: '',
|
invoiceType: '',
|
||||||
remark: '',
|
remark: '',
|
||||||
file: null
|
file: null
|
||||||
};
|
};
|
||||||
|
|
@ -358,6 +358,26 @@ export default {
|
||||||
this.uploadForm.file = null;
|
this.uploadForm.file = null;
|
||||||
this.previewUrl = '';
|
this.previewUrl = '';
|
||||||
},
|
},
|
||||||
|
handleTypeChange(val) {
|
||||||
|
if (val === '2') {
|
||||||
|
this.uploadForm.invoiceAmount = '0';
|
||||||
|
this.handleAmountChange('0');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleWithoutTaxChange(val) {
|
||||||
|
const total = parseFloat(this.uploadForm.invoicePriceWithTax);
|
||||||
|
const withoutTax = parseFloat(val);
|
||||||
|
if (!isNaN(total) && !isNaN(withoutTax)) {
|
||||||
|
this.uploadForm.invoiceAmount = (total - withoutTax).toFixed(2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleAmountChange(val) {
|
||||||
|
const total = parseFloat(this.uploadForm.invoicePriceWithTax);
|
||||||
|
const tax = parseFloat(val);
|
||||||
|
if (!isNaN(total) && !isNaN(tax)) {
|
||||||
|
this.uploadForm.invoicePriceWithoutTax = (total - tax).toFixed(2);
|
||||||
|
}
|
||||||
|
},
|
||||||
handleFileChange(file) {
|
handleFileChange(file) {
|
||||||
const isLt2M = file.size / 1024 / 1024 < 2;
|
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||||
const isAcceptedType = ['image/jpeg', 'image/png', 'application/pdf'].includes(file.raw.type);
|
const isAcceptedType = ['image/jpeg', 'image/png', 'application/pdf'].includes(file.raw.type);
|
||||||
|
|
@ -388,15 +408,50 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const limitTotal = parseFloat(this.invoiceData.totalPriceWithTax);
|
||||||
|
const inputTotal = parseFloat(this.uploadForm.invoicePriceWithTax);
|
||||||
|
const inputWithoutTax = parseFloat(this.uploadForm.invoicePriceWithoutTax);
|
||||||
|
const inputTax = parseFloat(this.uploadForm.invoiceAmount);
|
||||||
|
|
||||||
|
if (!isNaN(limitTotal)) {
|
||||||
|
if (limitTotal >= 0) {
|
||||||
|
if (!isNaN(inputTotal) && inputTotal > limitTotal) {
|
||||||
|
this.$message.warning("发票含税总价不能超过开票单含税总价");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isNaN(inputWithoutTax) && inputWithoutTax < 0) {
|
||||||
|
this.$message.warning("发票未税总价不能为负数");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isNaN(inputTax) && inputTax < 0) {
|
||||||
|
this.$message.warning("发票税额不能为负数");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!isNaN(inputTotal) && inputTotal < limitTotal) {
|
||||||
|
this.$message.warning("发票含税总价不能小于开票单含税总价");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isNaN(inputWithoutTax) && inputWithoutTax > 0) {
|
||||||
|
this.$message.warning("发票未税总价不能为正数");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isNaN(inputTax) && inputTax > 0) {
|
||||||
|
this.$message.warning("发票税额不能为正数");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("file", this.uploadForm.file);
|
formData.append("file", this.uploadForm.file);
|
||||||
formData.append("id", this.invoiceData.id);
|
formData.append("id", this.invoiceData.id);
|
||||||
formData.append("remark", this.uploadForm.remark);
|
formData.append("remark", this.uploadForm.remark);
|
||||||
formData.append("ticketPriceWithTax", this.uploadForm.ticketPriceWithTax);
|
formData.append("invoicePriceWithTax", this.uploadForm.invoicePriceWithTax);
|
||||||
formData.append("ticketPriceWithoutTax", this.uploadForm.ticketPriceWithoutTax);
|
formData.append("invoicePriceWithoutTax", this.uploadForm.invoicePriceWithoutTax);
|
||||||
formData.append("ticketAmount", this.uploadForm.ticketAmount);
|
formData.append("invoiceAmount", this.uploadForm.invoiceAmount);
|
||||||
formData.append("ticketType", this.uploadForm.ticketType);
|
formData.append("invoiceType", this.uploadForm.invoiceType);
|
||||||
|
this.invoiceData.invoiceType=this.uploadForm.invoiceType
|
||||||
uploadInvoiceAttachment(formData)
|
uploadInvoiceAttachment(formData)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$message.success("上传成功");
|
this.$message.success("上传成功");
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="审批节点" align="center" prop="approveNode" width="200" fixed="right"/>
|
<el-table-column label="审批节点" align="center" prop="approveNode" width="200" fixed="right"/>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200" fixed="right">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
|
|
@ -170,12 +170,14 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-document"
|
icon="el-icon-document"
|
||||||
|
v-show="scope.row.approveStatus==='2'"
|
||||||
@click="handleReceipt(scope.row)"
|
@click="handleReceipt(scope.row)"
|
||||||
>发票</el-button>
|
>发票</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-s-ticket"
|
icon="el-icon-s-ticket"
|
||||||
|
v-show="scope.row.invoiceStatus==='1' &&(scope.row.approveStatus==='0'||scope.row.approveStatus==='3')"
|
||||||
@click="handleApplyInvoice(scope.row)"
|
@click="handleApplyInvoice(scope.row)"
|
||||||
>申请开票</el-button>
|
>申请开票</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -189,9 +191,16 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-refresh-left"
|
icon="el-icon-refresh-left"
|
||||||
v-show="scope.row.approveStatus=='2'"
|
v-show="scope.row.approveStatus === '2' && scope.row.invoiceStatus === '1'"
|
||||||
@click="handleRedRush(scope.row)"
|
@click="handleRedRush(scope.row)"
|
||||||
>申请红冲</el-button>
|
>申请红冲</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
v-show="(scope.row.invoiceBillType === 'FROM_RECEIVABLE' && (scope.row.approveStatus === '2' || scope.row.approveStatus === '3') && scope.row.invoiceStatus === '1') || (scope.row.invoiceBillType === 'RED_RUSH' && scope.row.approveStatus === '3')"
|
||||||
|
@click="handleRevoke(scope.row)"
|
||||||
|
>撤销</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -217,7 +226,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {listInvoice, getInvoice, redRush, addInvoice, returnInvoice} from "@/api/finance/invoice";
|
import {listInvoice, getInvoice, redRush, addInvoice, returnInvoice, revokeInvoice} from "@/api/finance/invoice";
|
||||||
import { addDateRange } from "@/utils/ruoyi";
|
import { addDateRange } from "@/utils/ruoyi";
|
||||||
import DetailDrawer from "./components/DetailDrawer.vue";
|
import DetailDrawer from "./components/DetailDrawer.vue";
|
||||||
import AddForm from "./components/AddForm.vue";
|
import AddForm from "./components/AddForm.vue";
|
||||||
|
|
@ -353,6 +362,15 @@ export default {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("退回成功");
|
this.$modal.msgSuccess("退回成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 撤销按钮操作 */
|
||||||
|
handleRevoke(row) {
|
||||||
|
this.$modal.confirm('是否确认撤销收票单编号为"' + row.invoiceBillCode + '"的数据项?').then(function() {
|
||||||
|
return revokeInvoice(row.id);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("撤销成功");
|
||||||
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ public class OmsInvoiceBillController extends BaseController
|
||||||
}
|
}
|
||||||
@RequiresPermissions("sip:invoiceBill:query")
|
@RequiresPermissions("sip:invoiceBill:query")
|
||||||
@PostMapping(value = "/apply")
|
@PostMapping(value = "/apply")
|
||||||
public AjaxResult getInfo(@RequestBody OmsInvoiceBill omsInvoiceBill)
|
public AjaxResult apply(@RequestBody OmsInvoiceBill omsInvoiceBill)
|
||||||
{
|
{
|
||||||
return omsInvoiceBillService.applyInvoice(omsInvoiceBill);
|
return omsInvoiceBillService.applyInvoice(omsInvoiceBill);
|
||||||
}
|
}
|
||||||
|
|
@ -206,6 +206,27 @@ public class OmsInvoiceBillController extends BaseController
|
||||||
return AjaxResult.error("操作失败:" + e.getMessage());
|
return AjaxResult.error("操作失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 退回开票单
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("finance:invoice:return")
|
||||||
|
@Log(title = "撤销开票单", businessType = BusinessType.UPDATE)
|
||||||
|
@DeleteMapping("/revoke/{id}")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult revokeInvoice(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// 验证开票单ID
|
||||||
|
if (id == null) {
|
||||||
|
return AjaxResult.error("开票ID不能为空");
|
||||||
|
}
|
||||||
|
// 调用服务层方法处理退回逻辑
|
||||||
|
return omsInvoiceBillService.revokeInvoice(id);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("退回开票单失败", e);
|
||||||
|
return AjaxResult.error("操作失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/product/{code}")
|
@GetMapping("/product/{code}")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO;
|
import com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO;
|
||||||
|
import com.ruoyi.sip.domain.dto.ReceiptDetailDTO;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
@ -116,6 +117,9 @@ public class OmsInvoiceBill extends BaseEntity
|
||||||
private String sellerCreditCode;
|
private String sellerCreditCode;
|
||||||
private String sellerBank;
|
private String sellerBank;
|
||||||
private String sellerBankAccount;
|
private String sellerBankAccount;
|
||||||
|
|
||||||
|
|
||||||
|
private List<ReceiptDetailDTO> detailDTOList;
|
||||||
public BigDecimal getTaxAmount() {
|
public BigDecimal getTaxAmount() {
|
||||||
if (null != totalPriceWithTax && null != totalPriceWithoutTax){
|
if (null != totalPriceWithTax && null != totalPriceWithoutTax){
|
||||||
return totalPriceWithTax.subtract(totalPriceWithoutTax);
|
return totalPriceWithTax.subtract(totalPriceWithoutTax);
|
||||||
|
|
|
||||||
|
|
@ -90,4 +90,7 @@ public interface OmsInvoiceBillMapper
|
||||||
void clearRelationReceivable(String invoiceBillCode);
|
void clearRelationReceivable(String invoiceBillCode);
|
||||||
|
|
||||||
void applyInvoice(OmsInvoiceBill omsInvoiceBill);
|
void applyInvoice(OmsInvoiceBill omsInvoiceBill);
|
||||||
|
|
||||||
|
void clearApprove(OmsInvoiceBill invoiceBill);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.sip.mapper;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.sip.domain.OmsReceivableInvoiceDetail;
|
import com.ruoyi.sip.domain.OmsReceivableInvoiceDetail;
|
||||||
|
import com.ruoyi.sip.domain.dto.ReceiptDetailDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应收单开票明细Mapper接口
|
* 应收单开票明细Mapper接口
|
||||||
|
|
@ -69,4 +70,9 @@ public interface OmsReceivableInvoiceDetailMapper
|
||||||
* @return 开票明细集合
|
* @return 开票明细集合
|
||||||
*/
|
*/
|
||||||
List<OmsReceivableInvoiceDetail> selectByInvoicePlanIds(List<Long> invoicePlanIds);
|
List<OmsReceivableInvoiceDetail> selectByInvoicePlanIds(List<Long> invoicePlanIds);
|
||||||
|
|
||||||
|
void insertBatch(List<OmsReceivableInvoiceDetail> addList);
|
||||||
|
|
||||||
|
List<ReceiptDetailDTO> listReceivableByInvoiceBillCode(List<String> strings);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +69,11 @@ public interface IOmsFinAttachmentService
|
||||||
* @return 附件信息
|
* @return 附件信息
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public OmsFinAttachment uploadAttachment(MultipartFile file, Long invoiceReceiptBillId, OmsFinAttachment.RelatedBillTypeEnum type) throws Exception;
|
default OmsFinAttachment uploadAttachment(MultipartFile file, Long invoiceReceiptBillId, OmsFinAttachment.RelatedBillTypeEnum type) throws Exception
|
||||||
|
{
|
||||||
|
return uploadAttachment(file, invoiceReceiptBillId, type,null);
|
||||||
|
}
|
||||||
|
public OmsFinAttachment uploadAttachment(MultipartFile file, Long invoiceReceiptBillId, OmsFinAttachment.RelatedBillTypeEnum type,String remark) throws Exception;
|
||||||
|
|
||||||
List<OmsFinAttachment> list(List<Long> ids, String type);
|
List<OmsFinAttachment> list(List<Long> ids, String type);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,4 +116,7 @@ public interface IOmsInvoiceBillService
|
||||||
List<InvoiceProductDto> listProduct(String code);
|
List<InvoiceProductDto> listProduct(String code);
|
||||||
|
|
||||||
AjaxResult applyInvoice(OmsInvoiceBill omsInvoiceBill);
|
AjaxResult applyInvoice(OmsInvoiceBill omsInvoiceBill);
|
||||||
|
|
||||||
|
AjaxResult revokeInvoice(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.sip.domain.OmsPayableTicketDetail;
|
import com.ruoyi.sip.domain.OmsPayableTicketDetail;
|
||||||
import com.ruoyi.sip.domain.OmsReceivableInvoiceDetail;
|
import com.ruoyi.sip.domain.OmsReceivableInvoiceDetail;
|
||||||
|
import com.ruoyi.sip.domain.dto.ReceiptDetailDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应收单开票明细Service接口
|
* 应收单开票明细Service接口
|
||||||
|
|
@ -73,4 +74,8 @@ public interface IOmsReceivableInvoiceDetailService
|
||||||
List<OmsReceivableInvoiceDetail> selectByInvoicePlanIds(List<Long> invoicePlanIds);
|
List<OmsReceivableInvoiceDetail> selectByInvoicePlanIds(List<Long> invoicePlanIds);
|
||||||
|
|
||||||
List<OmsReceivableInvoiceDetail> listByInvoiceBillCode(String invoiceBillCode);
|
List<OmsReceivableInvoiceDetail> listByInvoiceBillCode(String invoiceBillCode);
|
||||||
|
|
||||||
|
void applyRefund(String invoiceBillCode, String invoiceBillCode1);
|
||||||
|
|
||||||
|
List<ReceiptDetailDTO> listReceivableByInvoiceBillCode(String invoiceBillCode);
|
||||||
}
|
}
|
||||||
|
|
@ -26,7 +26,7 @@ public class OmsFinAttachmentServiceImpl implements IOmsFinAttachmentService
|
||||||
private OmsFinAttachmentMapper omsFinAttachmentMapper;
|
private OmsFinAttachmentMapper omsFinAttachmentMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OmsFinAttachment uploadAttachment(MultipartFile file, Long relatedBillId, OmsFinAttachment.RelatedBillTypeEnum type) throws Exception
|
public OmsFinAttachment uploadAttachment(MultipartFile file, Long relatedBillId, OmsFinAttachment.RelatedBillTypeEnum type,String remark) throws Exception
|
||||||
{
|
{
|
||||||
// 上传文件路径
|
// 上传文件路径
|
||||||
String filePath = RuoYiConfig.getUploadPath();
|
String filePath = RuoYiConfig.getUploadPath();
|
||||||
|
|
@ -40,6 +40,7 @@ public class OmsFinAttachmentServiceImpl implements IOmsFinAttachmentService
|
||||||
attachment.setFileType(file.getContentType());
|
attachment.setFileType(file.getContentType());
|
||||||
attachment.setRelatedBillType(type.getCode());
|
attachment.setRelatedBillType(type.getCode());
|
||||||
attachment.setRelatedBillId(relatedBillId);
|
attachment.setRelatedBillId(relatedBillId);
|
||||||
|
attachment.setRemark(remark);
|
||||||
attachment.setCreateBy(com.ruoyi.common.utils.ShiroUtils.getLoginName());
|
attachment.setCreateBy(com.ruoyi.common.utils.ShiroUtils.getLoginName());
|
||||||
this.insertOmsFinAttachment(attachment);
|
this.insertOmsFinAttachment(attachment);
|
||||||
return attachment;
|
return attachment;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import java.util.stream.Collectors;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.ruoyi.common.constant.Constants;
|
|
||||||
import com.ruoyi.common.enums.ApproveStatusEnum;
|
import com.ruoyi.common.enums.ApproveStatusEnum;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.ShiroUtils;
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
|
|
@ -17,7 +16,7 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
import com.ruoyi.sip.domain.*;
|
import com.ruoyi.sip.domain.*;
|
||||||
import com.ruoyi.sip.domain.dto.InvoiceProductDto;
|
import com.ruoyi.sip.domain.dto.InvoiceProductDto;
|
||||||
import com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO;
|
import com.ruoyi.sip.domain.dto.ReceiptDetailDTO;
|
||||||
import com.ruoyi.sip.flowable.domain.Todo;
|
import com.ruoyi.sip.flowable.domain.Todo;
|
||||||
import com.ruoyi.sip.service.*;
|
import com.ruoyi.sip.service.*;
|
||||||
import org.flowable.engine.runtime.ProcessInstance;
|
import org.flowable.engine.runtime.ProcessInstance;
|
||||||
|
|
@ -73,6 +72,9 @@ public class OmsInvoiceBillServiceImpl implements IOmsInvoiceBillService, TodoCo
|
||||||
{
|
{
|
||||||
OmsInvoiceBill omsInvoiceBill = omsInvoiceBillMapper.selectOmsInvoiceBillById(id);
|
OmsInvoiceBill omsInvoiceBill = omsInvoiceBillMapper.selectOmsInvoiceBillById(id);
|
||||||
// 如果需要关联查询其他数据,可以在这里添加
|
// 如果需要关联查询其他数据,可以在这里添加
|
||||||
|
List<ReceiptDetailDTO> receiptDetailDTOS = detailService.listReceivableByInvoiceBillCode(omsInvoiceBill.getInvoiceBillCode());
|
||||||
|
omsInvoiceBill.setDetailDTOList(receiptDetailDTOS);
|
||||||
|
|
||||||
return omsInvoiceBill;
|
return omsInvoiceBill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,7 +144,10 @@ public class OmsInvoiceBillServiceImpl implements IOmsInvoiceBillService, TodoCo
|
||||||
@Override
|
@Override
|
||||||
public int deleteOmsInvoiceBillById(Long id)
|
public int deleteOmsInvoiceBillById(Long id)
|
||||||
{
|
{
|
||||||
return omsInvoiceBillMapper.deleteOmsInvoiceBillById(id);
|
OmsInvoiceBill invoiceBill = selectOmsInvoiceBillById(id);
|
||||||
|
int i = omsInvoiceBillMapper.deleteOmsInvoiceBillById(id);
|
||||||
|
omsInvoiceBillMapper.clearRelationReceivable(invoiceBill.getInvoiceBillCode());
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -183,24 +188,14 @@ public class OmsInvoiceBillServiceImpl implements IOmsInvoiceBillService, TodoCo
|
||||||
}
|
}
|
||||||
|
|
||||||
// 这里可以添加上传附件的逻辑
|
// 这里可以添加上传附件的逻辑
|
||||||
// omsFinAttachmentService.uploadAttachment(file, omsInvoiceBill.getId(), "INVOICE_RECEIPT");
|
omsFinAttachmentService.uploadAttachment(file, omsInvoiceBill.getId(), OmsFinAttachment.RelatedBillTypeEnum.RECEIVE_INVOICE, bill.getRemark());
|
||||||
|
|
||||||
omsInvoiceBill.setActualInvoiceTime(DateUtils.getNowDate());
|
omsInvoiceBill.setActualInvoiceTime(DateUtils.getNowDate());
|
||||||
omsInvoiceBill.setApproveStatus(ApproveStatusEnum.WAIT_APPROVE.getCode());
|
omsInvoiceBill.setInvoiceStatus(OmsInvoiceBill.InvoiceStatusEnum.INVOICE.getCode());
|
||||||
omsInvoiceBill.setInvoicePriceWithTax(bill.getInvoicePriceWithTax());
|
omsInvoiceBill.setInvoicePriceWithTax(bill.getInvoicePriceWithTax());
|
||||||
omsInvoiceBill.setInvoicePriceWithoutTax(bill.getInvoicePriceWithoutTax());
|
omsInvoiceBill.setInvoicePriceWithoutTax(bill.getInvoicePriceWithoutTax());
|
||||||
omsInvoiceBill.setInvoiceType(bill.getInvoiceType());
|
omsInvoiceBill.setInvoiceType(bill.getInvoiceType());
|
||||||
updateOmsInvoiceBill(omsInvoiceBill);
|
updateOmsInvoiceBill(omsInvoiceBill);
|
||||||
|
|
||||||
// // 根据开票单类型启动不同流程
|
|
||||||
// if (OmsInvoiceBill.InvoiceBillTypeEnum.FROM_RECEIVABLE.getCode().equals(omsInvoiceBill.getInvoiceBillType())) {
|
|
||||||
// todoService.startProcessDeleteBefore(omsInvoiceBill.getInvoiceBillCode(), omsInvoiceBill.getInvoiceBillCode(),
|
|
||||||
// "financeInvoice", omsInvoiceBill.getCreateBy());
|
|
||||||
// } else {
|
|
||||||
// todoService.startProcessDeleteBefore(omsInvoiceBill.getInvoiceBillCode(), omsInvoiceBill.getInvoiceBillCode(),
|
|
||||||
// "financeInvoiceRefound", omsInvoiceBill.getCreateBy());
|
|
||||||
// }
|
|
||||||
|
|
||||||
return AjaxResult.success("上传成功");
|
return AjaxResult.success("上传成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -266,16 +261,34 @@ public class OmsInvoiceBillServiceImpl implements IOmsInvoiceBillService, TodoCo
|
||||||
// 创建红冲单
|
// 创建红冲单
|
||||||
OmsInvoiceBill refundBill = new OmsInvoiceBill();
|
OmsInvoiceBill refundBill = new OmsInvoiceBill();
|
||||||
refundBill.setInvoiceBillCode(generateInvoiceBillCode());
|
refundBill.setInvoiceBillCode(generateInvoiceBillCode());
|
||||||
refundBill.setInvoiceType(originalBill.getInvoiceType());
|
refundBill.setPartnerName(originalBill.getPartnerName());
|
||||||
refundBill.setPartnerCode(originalBill.getPartnerCode());
|
refundBill.setPartnerCode(originalBill.getPartnerCode());
|
||||||
refundBill.setTotalPriceWithTax(originalBill.getTotalPriceWithTax().negate()); // 负数金额
|
refundBill.setInvoiceType(originalBill.getInvoiceType());
|
||||||
|
refundBill.setInvoiceTime(DateUtils.getNowDate());
|
||||||
|
// 负数金额
|
||||||
|
refundBill.setTotalPriceWithTax(originalBill.getTotalPriceWithTax().negate());
|
||||||
refundBill.setTotalPriceWithoutTax(originalBill.getTotalPriceWithoutTax().negate());
|
refundBill.setTotalPriceWithoutTax(originalBill.getTotalPriceWithoutTax().negate());
|
||||||
|
refundBill.setInvoicePriceWithTax(originalBill.getInvoicePriceWithTax().negate());
|
||||||
|
refundBill.setInvoicePriceWithoutTax(originalBill.getInvoicePriceWithoutTax().negate());
|
||||||
refundBill.setTaxRate(originalBill.getTaxRate());
|
refundBill.setTaxRate(originalBill.getTaxRate());
|
||||||
refundBill.setApproveStatus(ApproveStatusEnum.WAIT_COMMIT.getCode());
|
refundBill.setApproveStatus(ApproveStatusEnum.WAIT_COMMIT.getCode());
|
||||||
refundBill.setInvoiceBillType(OmsInvoiceBill.InvoiceBillTypeEnum.RED_RUSH.getCode());
|
refundBill.setInvoiceBillType(OmsInvoiceBill.InvoiceBillTypeEnum.RED_RUSH.getCode());
|
||||||
refundBill.setInvoiceStatus(OmsInvoiceBill.InvoiceStatusEnum.INVOICE.getCode());
|
refundBill.setInvoiceStatus(OmsInvoiceBill.InvoiceStatusEnum.INVOICE.getCode());
|
||||||
refundBill.setRefundStatus(OmsInvoiceBill.RefundStatusEnum.REFUNDED.getCode());
|
refundBill.setRefundStatus(OmsInvoiceBill.RefundStatusEnum.REFUNDED.getCode());
|
||||||
refundBill.setOriginalBillId(originalBill.getId()); // 关联原始单据
|
|
||||||
|
refundBill.setBuyerName(originalBill.getBuyerName());
|
||||||
|
refundBill.setBuyerCreditCode(originalBill.getBuyerCreditCode());
|
||||||
|
refundBill.setBuyerBank(originalBill.getBuyerBank());
|
||||||
|
refundBill.setBuyerBankAccount(originalBill.getBuyerBankAccount());
|
||||||
|
refundBill.setSellerName(originalBill.getSellerName());
|
||||||
|
refundBill.setSellerCreditCode(originalBill.getSellerCreditCode());
|
||||||
|
refundBill.setSellerBank(originalBill.getSellerBank());
|
||||||
|
refundBill.setSellerBankAccount(originalBill.getSellerBankAccount());
|
||||||
|
|
||||||
|
// 关联原始单据
|
||||||
|
refundBill.setOriginalBillId(originalBill.getId());
|
||||||
|
refundBill.setActualInvoiceTime(null);
|
||||||
|
refundBill.setApproveTime(null);
|
||||||
refundBill.setCreateTime(DateUtils.getNowDate());
|
refundBill.setCreateTime(DateUtils.getNowDate());
|
||||||
|
|
||||||
insertOmsInvoiceBill(refundBill);
|
insertOmsInvoiceBill(refundBill);
|
||||||
|
|
@ -284,6 +297,10 @@ public class OmsInvoiceBillServiceImpl implements IOmsInvoiceBillService, TodoCo
|
||||||
originalBill.setRefundStatus(OmsInvoiceBill.RefundStatusEnum.REFUNDED.getCode());
|
originalBill.setRefundStatus(OmsInvoiceBill.RefundStatusEnum.REFUNDED.getCode());
|
||||||
updateOmsInvoiceBill(originalBill);
|
updateOmsInvoiceBill(originalBill);
|
||||||
|
|
||||||
|
//创建开票明细
|
||||||
|
detailService.applyRefund(originalBill.getInvoiceBillCode(), refundBill.getInvoiceBillCode());
|
||||||
|
|
||||||
|
|
||||||
return AjaxResult.success("红冲申请已提交");
|
return AjaxResult.success("红冲申请已提交");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -367,6 +384,44 @@ public class OmsInvoiceBillServiceImpl implements IOmsInvoiceBillService, TodoCo
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult revokeInvoice(Long id) {
|
||||||
|
OmsInvoiceBill originalBill = selectOmsInvoiceBillById(id);
|
||||||
|
//未开票的审批通过
|
||||||
|
if (originalBill.getInvoiceBillType().equals(OmsInvoiceBill.InvoiceBillTypeEnum.FROM_RECEIVABLE.getCode())) {
|
||||||
|
if (originalBill.getRefundStatus().equals(OmsInvoiceBill.RefundStatusEnum.REFUNDED.getCode())){
|
||||||
|
return AjaxResult.error("已申请红冲的开票单不能撤销");
|
||||||
|
}
|
||||||
|
|
||||||
|
//应付单生成 未开票的审批通过
|
||||||
|
if ((originalBill.getApproveStatus().equals(ApproveStatusEnum.APPROVE_COMPLETE.getCode()) && originalBill.getInvoiceStatus().equals(OmsInvoiceBill.InvoiceStatusEnum.WAIT_INVOICE.getCode()))
|
||||||
|
||
|
||||||
|
originalBill.getApproveStatus().equals(ApproveStatusEnum.APPROVE_REJECT.getCode())) {
|
||||||
|
OmsInvoiceBill invoiceBill = new OmsInvoiceBill();
|
||||||
|
invoiceBill.setApproveStatus(ApproveStatusEnum.WAIT_COMMIT.getCode());
|
||||||
|
invoiceBill.setApproveTime(null);
|
||||||
|
invoiceBill.setId(id);
|
||||||
|
omsInvoiceBillMapper.clearApprove(invoiceBill);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return AjaxResult.error("应收单发起开票单只有未开票的数据才能撤回才能撤销");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (originalBill.getApproveStatus().equals(ApproveStatusEnum.APPROVE_REJECT.getCode())){
|
||||||
|
deleteOmsInvoiceBillById(id);
|
||||||
|
OmsInvoiceBill invoiceBill = new OmsInvoiceBill();
|
||||||
|
invoiceBill.setId(originalBill.getOriginalBillId());
|
||||||
|
invoiceBill.setRefundStatus(OmsInvoiceBill.RefundStatusEnum.WAIT_REFUNDED.getCode());
|
||||||
|
omsInvoiceBillMapper.updateOmsInvoiceBill(invoiceBill);
|
||||||
|
}else{
|
||||||
|
return AjaxResult.error("红冲单只有审批驳回的数据才能撤回才能撤销");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return AjaxResult.success("撤销成功");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object todoDetail(String businessKey, String processKey, String todoId) {
|
public Object todoDetail(String businessKey, String processKey, String todoId) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,19 @@
|
||||||
package com.ruoyi.sip.service.impl;
|
package com.ruoyi.sip.service.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.sip.domain.OmsFinAttachment;
|
import com.ruoyi.sip.domain.OmsFinAttachment;
|
||||||
|
import com.ruoyi.sip.domain.OmsPayableTicketDetail;
|
||||||
|
import com.ruoyi.sip.domain.dto.ReceiptDetailDTO;
|
||||||
import com.ruoyi.sip.service.IOmsFinAttachmentService;
|
import com.ruoyi.sip.service.IOmsFinAttachmentService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -146,4 +152,38 @@ public class OmsReceivableInvoiceDetailServiceImpl implements IOmsReceivableInvo
|
||||||
omsReceivableInvoiceDetail.setInvoiceBillCode(invoiceBillCode);
|
omsReceivableInvoiceDetail.setInvoiceBillCode(invoiceBillCode);
|
||||||
return omsReceivableInvoiceDetailMapper.list(omsReceivableInvoiceDetail);
|
return omsReceivableInvoiceDetailMapper.list(omsReceivableInvoiceDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyRefund(String originalCode, String targetCode) {
|
||||||
|
OmsReceivableInvoiceDetail query = new OmsReceivableInvoiceDetail();
|
||||||
|
query.setInvoiceBillCode(originalCode);
|
||||||
|
List<OmsReceivableInvoiceDetail> list = omsReceivableInvoiceDetailMapper.selectOmsReceivableInvoiceDetailList(query);
|
||||||
|
if (CollUtil.isNotEmpty(list)){
|
||||||
|
List<OmsReceivableInvoiceDetail> addList=new ArrayList<>();
|
||||||
|
for (OmsReceivableInvoiceDetail detail : list) {
|
||||||
|
OmsReceivableInvoiceDetail temp = new OmsReceivableInvoiceDetail();
|
||||||
|
BeanUtil.copyProperties(detail,temp);
|
||||||
|
temp.setId(null);
|
||||||
|
temp.setReceivableDetailType(OmsReceivableInvoiceDetail.ReceivableDetailTypeEnum.REFUND.getCode());
|
||||||
|
temp.setCreateBy(ShiroUtils.getUserId().toString());
|
||||||
|
temp.setInvoiceAmount(detail.getInvoiceAmount().negate());
|
||||||
|
temp.setInvoiceRate(detail.getInvoiceRate().negate());
|
||||||
|
temp.setInvoiceBillCode(targetCode);
|
||||||
|
temp.setRemark("退款");
|
||||||
|
addList.add( temp);
|
||||||
|
}
|
||||||
|
omsReceivableInvoiceDetailMapper.insertBatch(addList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ReceiptDetailDTO> listReceivableByInvoiceBillCode(String invoiceBillCode) {
|
||||||
|
List<ReceiptDetailDTO> receiptDetailDTOS = omsReceivableInvoiceDetailMapper.listReceivableByInvoiceBillCode(Collections.singletonList(invoiceBillCode));
|
||||||
|
for (ReceiptDetailDTO detailDTO : receiptDetailDTOS) {
|
||||||
|
detailDTO.setReceiptRate(detailDTO.getReceiptAmount()
|
||||||
|
.divide(detailDTO.getTotalPriceWithTax(),4,java.math.RoundingMode.HALF_UP)
|
||||||
|
.multiply(new BigDecimal("100")));
|
||||||
|
}
|
||||||
|
return receiptDetailDTOS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,6 +14,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="partnerCode" column="partner_code" />
|
<result property="partnerCode" column="partner_code" />
|
||||||
<result property="totalPriceWithTax" column="total_price_with_tax" />
|
<result property="totalPriceWithTax" column="total_price_with_tax" />
|
||||||
<result property="totalPriceWithoutTax" column="total_price_without_tax" />
|
<result property="totalPriceWithoutTax" column="total_price_without_tax" />
|
||||||
|
<result property="invoicePriceWithTax" column="invoice_price_with_tax" />
|
||||||
|
<result property="invoicePriceWithoutTax" column="invoice_price_without_tax" />
|
||||||
<result property="taxRate" column="tax_rate" />
|
<result property="taxRate" column="tax_rate" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
|
|
@ -40,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<sql id="selectOmsInvoiceBillVo">
|
<sql id="selectOmsInvoiceBillVo">
|
||||||
select id, invoice_bill_code, invoice_type, invoice_bill_type,
|
select id, invoice_bill_code, invoice_type, invoice_bill_type,
|
||||||
invoice_time, partner_code,partner_name, total_price_with_tax, total_price_without_tax,
|
invoice_time, partner_code,partner_name, total_price_with_tax, total_price_without_tax,invoice_price_with_tax,invoice_price_without_tax,
|
||||||
tax_rate, create_by, create_time, update_by, update_time,
|
tax_rate, create_by, create_time, update_by, update_time,
|
||||||
remark, del_flag, actual_invoice_time, invoice_status,
|
remark, del_flag, actual_invoice_time, invoice_status,
|
||||||
approve_status, approve_time, refund_status
|
approve_status, approve_time, refund_status
|
||||||
|
|
@ -176,6 +178,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="totalPriceWithoutTax != null">
|
<if test="totalPriceWithoutTax != null">
|
||||||
total_price_without_tax,
|
total_price_without_tax,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="invoicePriceWithTax != null">
|
||||||
|
invoice_price_with_tax,
|
||||||
|
</if>
|
||||||
|
<if test="invoicePriceWithoutTax != null">
|
||||||
|
invoice_price_without_tax,
|
||||||
|
</if>
|
||||||
<if test="taxRate != null">
|
<if test="taxRate != null">
|
||||||
tax_rate,
|
tax_rate,
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -268,6 +276,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="totalPriceWithoutTax != null">
|
<if test="totalPriceWithoutTax != null">
|
||||||
#{totalPriceWithoutTax},
|
#{totalPriceWithoutTax},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="invoicePriceWithTax != null">
|
||||||
|
#{invoicePriceWithTax},
|
||||||
|
</if>
|
||||||
|
<if test="invoicePriceWithoutTax != null">
|
||||||
|
#{invoicePriceWithoutTax},
|
||||||
|
</if>
|
||||||
<if test="taxRate != null">
|
<if test="taxRate != null">
|
||||||
#{taxRate},
|
#{taxRate},
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -363,6 +377,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="totalPriceWithoutTax != null">
|
<if test="totalPriceWithoutTax != null">
|
||||||
total_price_without_tax = #{totalPriceWithoutTax},
|
total_price_without_tax = #{totalPriceWithoutTax},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="invoicePriceWithTax != null">
|
||||||
|
invoice_price_with_tax = #{invoicePriceWithTax},
|
||||||
|
</if>
|
||||||
|
<if test="invoicePriceWithoutTax != null">
|
||||||
|
invoice_price_without_tax = #{invoicePriceWithoutTax},
|
||||||
|
</if>
|
||||||
<if test="taxRate != null">
|
<if test="taxRate != null">
|
||||||
tax_rate = #{taxRate},
|
tax_rate = #{taxRate},
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -472,6 +492,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where invoice_bill_code = #{invoiceBillCode}
|
where invoice_bill_code = #{invoiceBillCode}
|
||||||
|
|
||||||
</update>
|
</update>
|
||||||
|
<update id="clearApprove">
|
||||||
|
update oms_invoice_bill
|
||||||
|
set approve_status=#{approveStatus},
|
||||||
|
approve_time=null
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteOmsInvoiceBillById" parameterType="Long">
|
<delete id="deleteOmsInvoiceBillById" parameterType="Long">
|
||||||
delete from oms_invoice_bill where id = #{id}
|
delete from oms_invoice_bill where id = #{id}
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</where>
|
</where>
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
<select id="listReceivableByInvoiceBillCode" resultType="com.ruoyi.sip.domain.dto.ReceiptDetailDTO">
|
||||||
|
select t1.receipt_amount, t2.receivable_bill_code, t4.project_name, t4.project_code, t2.total_price_with_tax
|
||||||
|
from (SELECT sum(invoice_amount) receipt_amount,
|
||||||
|
receivable_bill_id
|
||||||
|
FROM oms_receivable_invoice_detail
|
||||||
|
WHERE write_off_id is null and invoice_bill_code in
|
||||||
|
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
group by receivable_bill_id) t1
|
||||||
|
left join oms_receivable_bill t2 on t1.receivable_bill_id = t2.id
|
||||||
|
left join project_order_info t3 on t2.order_code = t3.order_code
|
||||||
|
left join project_info t4 on t3.project_id = t4.id
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertOmsReceivableInvoiceDetail" parameterType="com.ruoyi.sip.domain.OmsReceivableInvoiceDetail" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertOmsReceivableInvoiceDetail" parameterType="com.ruoyi.sip.domain.OmsReceivableInvoiceDetail" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into oms_receivable_invoice_detail
|
insert into oms_receivable_invoice_detail
|
||||||
|
|
@ -121,6 +136,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertBatch">
|
||||||
|
insert into oms_receivable_invoice_detail(
|
||||||
|
invoice_plan_id,receivable_bill_id,invoice_time,invoice_amount,invoice_amount_without_tax,invoice_amount_tax,
|
||||||
|
invoice_rate,invoice_bill_code,receivable_detail_type,remark,create_time,create_by,update_time,update_by
|
||||||
|
)
|
||||||
|
values
|
||||||
|
<foreach item="item" collection="list" separator="," index="index">
|
||||||
|
(
|
||||||
|
#{item.invoicePlanId},#{item.receivableBillId},#{item.invoiceTime},#{item.invoiceAmount},#{item.invoiceAmountWithoutTax},#{item.invoiceAmountTax}
|
||||||
|
,#{item.invoiceRate},#{item.invoiceBillCode},#{item.receivableDetailType},#{item.remark},#{item.createTime},#{item.createBy},#{item.updateTime},#{item.updateBy}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
<update id="updateOmsReceivableInvoiceDetail" parameterType="com.ruoyi.sip.domain.OmsReceivableInvoiceDetail">
|
<update id="updateOmsReceivableInvoiceDetail" parameterType="com.ruoyi.sip.domain.OmsReceivableInvoiceDetail">
|
||||||
update oms_receivable_invoice_detail
|
update oms_receivable_invoice_detail
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
group by receivable_bill_id) t1
|
group by receivable_bill_id) t1
|
||||||
left join oms_receivable_bill t2 on t1.receivable_bill_id = t2.id
|
left join oms_receivable_bill t2 on t1.receivable_bill_id = t2.id
|
||||||
left join project_order_info t3 on t2.order_code = t3.order_code
|
left join project_order_info t3 on t2.order_code = t3.order_code
|
||||||
left join project_info t4 on t3.project_id = t4.id;
|
left join project_info t4 on t3.project_id = t4.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertOmsReceivableReceiptDetail" parameterType="com.ruoyi.sip.domain.OmsReceivableReceiptDetail" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertOmsReceivableReceiptDetail" parameterType="com.ruoyi.sip.domain.OmsReceivableReceiptDetail" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue