From 4398d00146b2a06a025b8b0f863fe2222a89c850 Mon Sep 17 00:00:00 2001 From: kangwenjing <1138819403@qq.com> Date: Wed, 21 Oct 2026 16:55:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(payment,=20inventory):=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BB=98=E6=AC=BE=E5=8D=95=E9=99=84=E4=BB=B6=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BB=98=E6=AC=BE=E5=8D=95?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=91=E8=B4=A7=E9=A1=B5=E7=AD=BE=E5=A4=9A?= =?UTF-8?q?=E9=A1=B5=E7=AD=BE=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../payment/components/DetailDrawer.vue | 40 +-- .../src/views/finance/payment/index.vue | 4 +- .../outer/components/GenerateDeliveryForm.vue | 263 +++++++++++++----- .../sip/domain/dto/MergedPaymentDataDto.java | 2 + .../impl/OmsPayableBillServiceImpl.java | 3 + .../impl/OmsPaymentBillServiceImpl.java | 44 ++- 6 files changed, 267 insertions(+), 89 deletions(-) diff --git a/oms_web/oms_vue/src/views/finance/payment/components/DetailDrawer.vue b/oms_web/oms_vue/src/views/finance/payment/components/DetailDrawer.vue index 13d80426..e142e0b4 100644 --- a/oms_web/oms_vue/src/views/finance/payment/components/DetailDrawer.vue +++ b/oms_web/oms_vue/src/views/finance/payment/components/DetailDrawer.vue @@ -13,7 +13,7 @@
付款单
- 保存 + 保存 导出PDF 打印
@@ -34,7 +34,7 @@
含税总价(元):
附件: - +
@@ -130,7 +130,7 @@
- +
附件补充: @@ -223,10 +223,14 @@ export default { }; }, computed: { - // 仅"预付单"且处于"待提交(0)/已驳回(3)"状态时才允许编辑含税总价与附件 - editEnabled() { + // 未发起审批(待提交/已驳回)的付款单均允许维护附件 + attachmentEditable() { const detail = this.detail || {}; - return detail.paymentBillType === 'PRE_PAYMENT' && ['0', '3'].includes(detail.approveStatus); + return ['0', '3'].includes(detail.approveStatus); + }, + // 仅"预付单"且处于"待提交(0)/已驳回(3)"状态时才允许编辑含税总价 + priceEditable() { + return (this.detail || {}).paymentBillType === 'PRE_PAYMENT' && this.attachmentEditable; }, // 过滤掉已删除的已存在附件 visibleFileList() { @@ -299,19 +303,21 @@ export default { this.$refs.filePreview.handlePreview(file); }, handleSaveAttachment() { - const totalPriceWithTax = Number(this.editTotalPriceWithTax); - if (this.editTotalPriceWithTax === null || this.editTotalPriceWithTax === undefined - || this.editTotalPriceWithTax === '' || Number.isNaN(totalPriceWithTax) || totalPriceWithTax <= 0) { - this.$modal.msgWarning('请输入大于0的含税总价'); - return; + const saveData = { + id: this.detail.id, + }; + if (this.priceEditable) { + const totalPriceWithTax = Number(this.editTotalPriceWithTax); + if (this.editTotalPriceWithTax === null || this.editTotalPriceWithTax === undefined + || this.editTotalPriceWithTax === '' || Number.isNaN(totalPriceWithTax) || totalPriceWithTax <= 0) { + this.$modal.msgWarning('请输入大于0的含税总价'); + return; + } + saveData.totalPriceWithTax = this.editTotalPriceWithTax; } const keptFileIds = this.visibleFileList.map(f => f.id).filter(id => !!id); const newFileIds = this.fileList.map(f => f.id).filter(id => !!id); - const saveData = { - id: this.detail.id, - totalPriceWithTax: this.editTotalPriceWithTax, - fileId: keptFileIds.concat(newFileIds).join(','), - }; + saveData.fileId = keptFileIds.concat(newFileIds).join(','); this.$emit('submit', saveData); }, getAllAttachments() { diff --git a/oms_web/oms_vue/src/views/finance/payment/index.vue b/oms_web/oms_vue/src/views/finance/payment/index.vue index 4c52446b..b53ea47d 100644 --- a/oms_web/oms_vue/src/views/finance/payment/index.vue +++ b/oms_web/oms_vue/src/views/finance/payment/index.vue @@ -255,7 +255,7 @@ type="text" icon="el-icon-delete" v-hasPermi="['finance:payment:remove']" - v-show="(scope.row.approveStatus==='0' || scope.row.approveStatus==='3') && (scope.row.paymentBillType==='PRE_PAYMENT' || scope.row.paymentBillType==='REFUND') && scope.row.paymentStatus === '1' " + v-show="(scope.row.approveStatus==='0' || scope.row.approveStatus==='3') && scope.row.paymentStatus !== '2' " @click="handleDelete(scope.row.id)" >删除 @@ -689,7 +689,7 @@ export default { }); }, handleDelete(id){ - this.$modal.confirm('确认删除该笔预付单数据吗?').then(() => { + this.$modal.confirm('确认删除该笔付款单数据吗?').then(() => { return deletePayment(id); }).then(() => { this.getList(); diff --git a/oms_web/oms_vue/src/views/inventory/outer/components/GenerateDeliveryForm.vue b/oms_web/oms_vue/src/views/inventory/outer/components/GenerateDeliveryForm.vue index f1ea5382..2d6abc05 100644 --- a/oms_web/oms_vue/src/views/inventory/outer/components/GenerateDeliveryForm.vue +++ b/oms_web/oms_vue/src/views/inventory/outer/components/GenerateDeliveryForm.vue @@ -142,7 +142,6 @@ export default { deliveryType: [{ required: true, message: "发货方式不能为空", trigger: "change" }], }, snList: [], - selectedSnList: [], total: 0, queryParams: { pageNum: 1, @@ -152,7 +151,22 @@ export default { warehouseId: undefined, orderCode: undefined, }, - isImported: false, + // 各采购单页签的已选 SN:{ [purchaseNo]: { [productSn]: row } } + selectedSnMap: {}, + // 各采购单页签的数据缓存:{ [purchaseNo]: { rows, total, pageNum, pageSize } } + tabDataMap: {}, + // 各采购单页签是否处于导入态:{ [purchaseNo]: true } + isImportedTabs: {}, + // 切换页签恢复勾选期间忽略 selection-change + suppressSelectionChange: false, + // 请求序号,避免快速切换页签时旧响应覆盖新页签 + snReqSeq: 0, + // 上一个激活的采购单页签(tab-click 时 activePurchaseNo 已被 v-model 更新) + lastActivePurchaseNo: '', + // 当前表格数据实际所属的采购单页签 + loadedTab: '', + // 每个页签默认的每页条数(剩余应发数量) + defaultPageSize: 10, isInitialLoad: false, purchaseOrderSelectVisible: false, queryProductType: ['1', '2', '99'], @@ -172,6 +186,21 @@ export default { const bhNum = purchase.bhNum || 0; return phNum > 0 && phNum > bhNum; }); + }, + // 所有页签已选 SN 的汇总 + selectedSnList() { + const result = []; + Object.keys(this.selectedSnMap).forEach(purchaseNo => { + const rows = this.selectedSnMap[purchaseNo] || {}; + Object.keys(rows).forEach(productSn => { + result.push(rows[productSn]); + }); + }); + return result; + }, + // 当前页签是否处于导入态 + isImported() { + return !!this.isImportedTabs[this.activePurchaseNo]; } }, watch: { @@ -202,7 +231,6 @@ export default { notifierAddress: outerForm && outerForm.notifierAddress }); console.groupEnd(); - this.selectedSnList.length=0; this.reset(); this.productData = productRow; this.outerData = outerForm; @@ -213,7 +241,8 @@ export default { this.queryParams.productCode = productRow.productCode; this.queryParams.warehouseId = productRow.warehouseId; this.queryParams.orderCode = outerForm && outerForm.orderCode; - this.queryParams.pageSize = productRow.quantity - productRow.deliveryGenerateQuantity - productRow.deliveryConfirmQuantity; + this.defaultPageSize = productRow.quantity - productRow.deliveryGenerateQuantity - productRow.deliveryConfirmQuantity; + this.queryParams.pageSize = this.defaultPageSize; this.isInitialLoad = true; this.visible = true; @@ -239,40 +268,141 @@ export default { this.activePurchaseNo = ''; this.queryParams.purchaseNo = undefined; } + this.lastActivePurchaseNo = this.activePurchaseNo; this.getSnList(); }).catch(() => { this.getSnList(); }); }, getSnList() { + const seq = ++this.snReqSeq; + const purchaseNo = this.activePurchaseNo; + const pageNum = this.queryParams.pageNum; + const pageSize = this.queryParams.pageSize; listProductSn(this.queryParams).then(response => { - this.snList = response.rows; - this.total = response.total; - if (this.isInitialLoad) { - this.isInitialLoad = false; - this.$nextTick(() => { - if (this.$refs.snTable) { - this.$refs.snTable.clearSelection(); - this.$refs.snTable.toggleAllSelection(); + // 快速切换页签时,只采用最后一次请求的结果 + if (seq !== this.snReqSeq || purchaseNo !== this.activePurchaseNo) return; + const rows = response.rows || []; + const total = response.total || 0; + this.$set(this.tabDataMap, purchaseNo, { rows, total, pageNum, pageSize }); + const selectAll = this.isInitialLoad; + this.isInitialLoad = false; + this.applyTabData(purchaseNo, rows, total, pageNum, pageSize, selectAll); + }); + }, + // 渲染某个页签的数据并恢复该页签的勾选状态 + applyTabData(purchaseNo, rows, total, pageNum, pageSize, selectAll) { + this.suppressSelectionChange = true; + this.snList = rows; + this.total = total; + this.loadedTab = purchaseNo; + this.queryParams.pageNum = pageNum; + this.queryParams.pageSize = pageSize; + this.$nextTick(() => { + const table = this.$refs.snTable; + if (!table) { + this.suppressSelectionChange = false; + return; + } + table.clearSelection(); + if (selectAll) { + // 仅弹窗首次加载时全选 + table.toggleAllSelection(); + } else { + const selected = this.selectedSnMap[purchaseNo] || {}; + rows.forEach(row => { + if (selected[row.productSn]) { + table.toggleRowSelection(row, true); } }); } + this.$nextTick(() => { + // 恢复勾选过程中同步一次缓存,避免 selection-change 被忽略后缓存不一致 + this.$set(this.selectedSnMap, purchaseNo, this.collectTableSelection()); + this.suppressSelectionChange = false; + }); + }); + }, + // 当前表格的真实勾选(含 reserve-selection 保留的跨页行) + collectTableSelection() { + const table = this.$refs.snTable; + const rows = (table && table.selection) || []; + return rows.reduce((map, row) => { + map[row.productSn] = row; + return map; + }, {}); + }, + // 把当前页签的勾选与数据写入缓存 + saveCurrentTab(purchaseNo) { + // 表格数据必须确实属于该页签,避免请求未返回时把上一个页签的数据写到新页签 + if (!purchaseNo || purchaseNo !== this.loadedTab) return; + this.$set(this.selectedSnMap, purchaseNo, this.collectTableSelection()); + this.$set(this.tabDataMap, purchaseNo, { + rows: this.snList, + total: this.total, + pageNum: this.queryParams.pageNum, + pageSize: this.queryParams.pageSize }); }, handleTabClick(tab) { - this.activePurchaseNo = tab.name; - this.queryParams.purchaseNo = tab.name; - this.queryParams.pageNum = 1; - this.isInitialLoad = true; - this.getSnList(); - }, - handleSelectionChange(selection) { - if (this.isImported && selection.length!=(this.productData.quantity - this.productData.deliveryGenerateQuantity - this.productData.deliveryConfirmQuantity)) { - this.$message.error("导入数据不允许取消勾选"); - this.$refs.snTable.toggleAllSelection(); + const newTab = tab.name; + const prevTab = this.lastActivePurchaseNo; + // 重复点击当前页签不做任何重置,避免覆盖刚勾选的内容 + if (prevTab === newTab) { + this.activePurchaseNo = newTab; + this.queryParams.purchaseNo = newTab; return; } - this.selectedSnList = selection; + // 切换前先保存上一个页签的勾选 + this.saveCurrentTab(prevTab); + this.lastActivePurchaseNo = newTab; + this.activePurchaseNo = newTab; + this.queryParams.purchaseNo = newTab; + this.queryParams.pageNum = 1; + this.queryParams.pageSize = this.defaultPageSize; + const cached = this.tabDataMap[newTab]; + if (cached) { + this.applyTabData(newTab, cached.rows, cached.total, cached.pageNum, cached.pageSize, false); + } else { + this.getSnList(); + } + }, + handleSelectionChange(selection) { + if (this.suppressSelectionChange) return; + const purchaseNo = this.activePurchaseNo; + const cachedCount = Object.keys(this.selectedSnMap[purchaseNo] || {}).length; + if (this.isImported && selection.length < cachedCount) { + this.$message.error("导入数据不允许取消勾选"); + this.suppressSelectionChange = true; + this.$refs.snTable.toggleAllSelection(); + this.$nextTick(() => { + this.$set(this.selectedSnMap, purchaseNo, this.collectTableSelection()); + this.suppressSelectionChange = false; + }); + return; + } + this.$set(this.selectedSnMap, purchaseNo, selection.reduce((map, row) => { + map[row.productSn] = row; + return map; + }, {})); + }, + // 剩余应发数量 + getRemainQuantity() { + return Number(this.productData.quantity) + - Number(this.productData.deliveryGenerateQuantity || 0) + - Number(this.productData.deliveryConfirmQuantity || 0); + }, + // 所有导入页签的已选行,用于提交 productSnDataList + getImportedProductSnDataList() { + const list = []; + Object.keys(this.isImportedTabs).forEach(purchaseNo => { + if (!this.isImportedTabs[purchaseNo]) return; + const rows = this.selectedSnMap[purchaseNo] || {}; + Object.keys(rows).forEach(productSn => { + list.push(rows[productSn]); + }); + }); + return list; }, handleDownloadTemplate() { exportDownloadTemplateData({ @@ -366,27 +496,23 @@ export default { importSnData(formData).then(response => { this.$message.success('导入成功'); - this.snList = response.data.productSnDataList; + const rows = response.data.productSnDataList || []; if (this.warehouseName) { - this.snList.forEach(item => { + rows.forEach(item => { item.warehouseName = this.warehouseName; item.warehouseId = this.warehouseId; item.innerPrice = this.price; }); } - this.total = this.snList.length; - this.queryParams.pageNum = 1; - this.queryParams.pageSize = this.total; - this.$nextTick(() => { - if (this.$refs.snTable) { - this.$refs.snTable.clearSelection(); - this.$refs.snTable.toggleAllSelection(); - this.selectedSnList = this.snList; - this.$nextTick(() => { - this.isImported = true; - }); - } + const purchaseNo = this.activePurchaseNo; + this.$set(this.isImportedTabs, purchaseNo, true); + this.$set(this.tabDataMap, purchaseNo, { + rows, + total: rows.length, + pageNum: 1, + pageSize: rows.length }); + this.applyTabData(purchaseNo, rows, rows.length, 1, rows.length, true); }).catch(() => { this.$message.error('导入失败'); }); @@ -404,31 +530,32 @@ export default { assignDeliverySnData(formData).then(response => { this.$message.success('指定发货导入成功'); - this.snList = response.data.productSnDataList; + const rows = response.data.productSnDataList || []; if (this.warehouseName) { - this.snList.forEach(item => { + rows.forEach(item => { item.warehouseName = this.warehouseName; item.warehouseId = this.warehouseId; item.innerPrice = this.price; }); } - this.total = this.snList.length; - this.queryParams.pageNum = 1; - this.queryParams.pageSize = this.total; - - // 切换到选择的采购单标签页 - if (this.form.purchaseNo) { - this.activePurchaseNo = this.form.purchaseNo; - this.queryParams.purchaseNo = this.form.purchaseNo; + + // 指定发货可能选中了其他采购单,需先保存当前页签再切换 + const purchaseNo = this.form.purchaseNo || this.activePurchaseNo; + if (purchaseNo !== this.activePurchaseNo) { + this.saveCurrentTab(this.lastActivePurchaseNo); + this.activePurchaseNo = purchaseNo; + this.lastActivePurchaseNo = purchaseNo; + this.queryParams.purchaseNo = purchaseNo; } - - this.$nextTick(() => { - if (this.$refs.snTable) { - this.$refs.snTable.clearSelection(); - this.$refs.snTable.toggleAllSelection(); - this.selectedSnList = this.snList; - } + + this.$set(this.isImportedTabs, purchaseNo, true); + this.$set(this.tabDataMap, purchaseNo, { + rows, + total: rows.length, + pageNum: 1, + pageSize: rows.length }); + this.applyTabData(purchaseNo, rows, rows.length, 1, rows.length, true); }).catch(() => { this.$message.error('指定发货导入失败'); }); @@ -443,18 +570,21 @@ export default { } // 发货必须一次发满剩余应发数量:所有发货方式(手工选择/导入/指定发货)通用,不允许分多次发货 - const remainQuantity = Number(this.productData.quantity) - - Number(this.productData.deliveryGenerateQuantity || 0) - - Number(this.productData.deliveryConfirmQuantity || 0); + const remainQuantity = this.getRemainQuantity(); // 数量数据缺失(NaN)时不在此拦截,交由后端兜底校验,避免异常数据把发货彻底拦住 if (!Number.isNaN(remainQuantity) && this.selectedSnList.length !== remainQuantity) { this.$message.error(`发货必须一次发满剩余应发数量(剩余 ${remainQuantity} 台,当前已选 ${this.selectedSnList.length} 台)`); return; } - if (this.isImported) { - this.snList.forEach(item => item.taxRate = this.taxRate) - } + // 导入页签的行需要带上税率 + Object.keys(this.isImportedTabs).forEach(purchaseNo => { + if (!this.isImportedTabs[purchaseNo]) return; + const rows = this.selectedSnMap[purchaseNo] || {}; + Object.keys(rows).forEach(productSn => { + rows[productSn].taxRate = this.taxRate; + }); + }); const data = { ...this.form, productSnList: this.selectedSnList.map(item => item.productSn), @@ -463,7 +593,7 @@ export default { warehouseId: this.queryParams.warehouseId, outerCode: this.outerData.outerCode, detailId: this.productData.id, - productSnDataList: this.isImported ? this.snList : [], + productSnDataList: this.getImportedProductSnDataList(), orderCode: this.queryParams.orderCode, }; @@ -490,7 +620,15 @@ export default { }; this.resetForm("form"); this.snList = []; - this.selectedSnList = []; + this.selectedSnMap = {}; + this.tabDataMap = {}; + this.isImportedTabs = {}; + this.suppressSelectionChange = false; + this.lastActivePurchaseNo = ''; + this.loadedTab = ''; + this.defaultPageSize = 10; + // 自增请求序号,让上一次打开弹窗时未返回的请求失效 + this.snReqSeq++; this.queryParams = { pageNum: 1, pageSize: 10, @@ -500,7 +638,6 @@ export default { orderCode: undefined, purchaseNo: undefined, }; - this.isImported = false; this.price = null; this.taxRate = 0.13; this.warehouseId = null; diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/dto/MergedPaymentDataDto.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/dto/MergedPaymentDataDto.java index d0244d5e..6c77eec0 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/dto/MergedPaymentDataDto.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/dto/MergedPaymentDataDto.java @@ -14,5 +14,7 @@ public class MergedPaymentDataDto { private List payableOrders; private BigDecimal totalMergePaymentAmount; private String remark; + /** 附件ID,多个以逗号分隔 */ + private String fileId; } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPayableBillServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPayableBillServiceImpl.java index bd2ef210..ae095249 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPayableBillServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPayableBillServiceImpl.java @@ -262,6 +262,9 @@ public class OmsPayableBillServiceImpl implements IOmsPayableBillService { if (StringUtils.isNotEmpty(dto.getRemark())) { paymentBill.setRemark(dto.getRemark()); } + if (StringUtils.isNotEmpty(dto.getFileId())) { + paymentBill.setFileId(dto.getFileId()); + } omsPaymentBillService.insertOmsPaymentBill(paymentBill); // 3. 创建付款明细 - 防止重复付款 diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPaymentBillServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPaymentBillServiceImpl.java index 9d2c1c89..49fc321b 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPaymentBillServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPaymentBillServiceImpl.java @@ -448,7 +448,36 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService , TodoC @Override public int deleteOmsPaymentBillByIds(String ids) { - return omsPaymentBillMapper.deleteOmsPaymentBillByIds(Convert.toStrArray(ids)); + if (StrUtil.isBlank(ids)) { + return 0; + } + int result = 0; + for (Long id : Convert.toLongArray(ids)) { + OmsPaymentBill paymentBill = omsPaymentBillMapper.selectOmsPaymentBillById(id); + if (paymentBill == null) { + continue; + } + // 仅未发起审批(待提交/已驳回)的付款单允许删除 + if (!ApproveStatusEnum.WAIT_COMMIT.getCode().equals(paymentBill.getApproveStatus()) + && !ApproveStatusEnum.APPROVE_REJECT.getCode().equals(paymentBill.getApproveStatus())) { + throw new ServiceException(StrUtil.format("付款单[{}]已发起审批,不允许删除", paymentBill.getPaymentBillCode())); + } + // 已付款的付款单不允许删除 + if (OmsPaymentBill.PaymentStatusEnum.PAYMENT.getCode().equals(paymentBill.getPaymentStatus())) { + throw new ServiceException(StrUtil.format("付款单[{}]已付款,不允许删除", paymentBill.getPaymentBillCode())); + } + // 应付单生成的付款单:清理付款明细并重算应付单已付金额 + List paymentDetails = detailService.listBypaymentCode(paymentBill.getPaymentBillCode()); + if (CollUtil.isNotEmpty(paymentDetails)) { + omsPaymentBillMapper.clearRelationPayable(paymentBill.getPaymentBillCode()); + } + result += omsPaymentBillMapper.deleteOmsPaymentBillById(id); + if (CollUtil.isNotEmpty(paymentDetails)) { + payableBillService.updatePaymentAmount(paymentDetails.stream() + .map(OmsPayablePaymentDetail::getPayableBillId).distinct().collect(Collectors.toList())); + } + } + return result; } /** @@ -1028,23 +1057,24 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService , TodoC if (existBill == null) { throw new ServiceException("付款单不存在"); } - // 仅"预付单"允许编辑含税总价与附件 - if (!OmsPaymentBill.PaymentBillTypeEnum.PRE_PAYMENT.getCode().equals(existBill.getPaymentBillType())) { - throw new ServiceException("仅预付单支持编辑"); - } // 仅"待提交"与"已驳回"状态允许编辑 if (!ApproveStatusEnum.WAIT_COMMIT.getCode().equals(existBill.getApproveStatus()) && !ApproveStatusEnum.APPROVE_REJECT.getCode().equals(existBill.getApproveStatus())) { throw new ServiceException("当前审批状态不允许编辑"); } - if (omsPaymentBill.getTotalPriceWithTax() != null + // 仅"预付单"允许编辑含税总价,其它单据仅允许维护附件 + boolean prePayment = OmsPaymentBill.PaymentBillTypeEnum.PRE_PAYMENT.getCode().equals(existBill.getPaymentBillType()); + if (!prePayment && omsPaymentBill.getTotalPriceWithTax() != null) { + throw new ServiceException("仅预付单支持修改含税总价"); + } + if (prePayment && omsPaymentBill.getTotalPriceWithTax() != null && omsPaymentBill.getTotalPriceWithTax().compareTo(BigDecimal.ZERO) <= 0) { throw new ServiceException("含税总价必须大于0"); } // 白名单更新,避免越权修改审批状态、付款状态等字段 OmsPaymentBill updateBill = new OmsPaymentBill(); updateBill.setId(existBill.getId()); - updateBill.setTotalPriceWithTax(omsPaymentBill.getTotalPriceWithTax()); + updateBill.setTotalPriceWithTax(prePayment ? omsPaymentBill.getTotalPriceWithTax() : null); updateBill.setFileId(omsPaymentBill.getFileId()); updateBill.setUpdateBy(ShiroUtils.getLoginName()); updateBill.setUpdateTime(DateUtils.getNowDate());