From e08409737bfe8dcd22fcc945d9c50b61696fe70d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Sat, 16 May 2026 20:08:23 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#514:=20[=E5=BA=93=E6=88=BF?= =?UTF-8?q?=E7=AE=A1=E7=90=86-=E8=B0=83=E6=8B=A8=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E8=B0=83=E6=8B=A8]=20=E8=B0=83=E6=8B=A8=E5=8D=95=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E4=B8=8E=E6=8F=90=E4=BA=A4=E6=A0=A1=E9=AA=8C=E7=BC=BA?= =?UTF-8?q?=E5=A4=B1=EF=BC=9A=E5=85=81=E8=AE=B8=E4=BF=9D=E5=AD=98/?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=95=B0=E9=87=8F=E4=B8=BA0=E6=88=96?= =?UTF-8?q?=E6=97=A0=E5=BA=93=E5=AD=98=E7=9A=84=E6=97=A0=E6=95=88=E5=8D=95?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 后端:在 addOrEditBatchTransferReceipt、addOrEditTransferReceipt、submitApproval 三个方法中补充调拨单价 > 0 的校验(数量校验已存在但缺单价)。 前端:在 batchTransfer 和 transferManagent 的批量保存 handleSave() 中补充调拨数量 > 0 及不超过源库存数量的前端校验,实现前后端双重拦截。 Co-Authored-By: Claude Opus 4.7 --- .../impl/ProductTransferAppServiceImpl.java | 12 ++++++++++++ .../transferManagent/batchTransfer/index.vue | 15 +++++++++++++++ .../transferManagent/transferManagent/index.vue | 15 +++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ProductTransferAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ProductTransferAppServiceImpl.java index cb68c6787..5012ba73d 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ProductTransferAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ProductTransferAppServiceImpl.java @@ -205,6 +205,10 @@ public class ProductTransferAppServiceImpl implements IProductTransferAppService // 校验调拨数量:必须 > 0 且不超过源库存数量(从数据库查实时库存) Integer tenantId = SecurityUtils.getLoginUser().getTenantId(); for (ProductTransferDto dto : productTransferDtoList) { + // 校验单价 + if (dto.getPrice() == null || dto.getPrice().compareTo(java.math.BigDecimal.ZERO) <= 0) { + return R.fail("调拨单价不能为空或为0,请检查!"); + } if (dto.getItemQuantity() == null || dto.getItemQuantity().compareTo(java.math.BigDecimal.ZERO) <= 0) { return R.fail("调拨数量必须大于0"); } @@ -335,6 +339,10 @@ public class ProductTransferAppServiceImpl implements IProductTransferAppService // 校验调拨数量:必须 > 0 且不超过源库存数量(从数据库查实时库存) Integer tenantId = SecurityUtils.getLoginUser().getTenantId(); for (ProductTransferDto dto : productTransferDtoList) { + // 校验单价 + if (dto.getPrice() == null || dto.getPrice().compareTo(java.math.BigDecimal.ZERO) <= 0) { + return R.fail("调拨单价不能为空或为0,请检查!"); + } if (dto.getItemQuantity() == null || dto.getItemQuantity().compareTo(java.math.BigDecimal.ZERO) <= 0) { return R.fail("调拨数量必须大于0"); } @@ -424,6 +432,10 @@ public class ProductTransferAppServiceImpl implements IProductTransferAppService if (requestList != null && !requestList.isEmpty()) { Integer tenantId = SecurityUtils.getLoginUser().getTenantId(); for (SupplyRequest request : requestList) { + // 校验单价 + if (request.getPrice() == null || request.getPrice().compareTo(java.math.BigDecimal.ZERO) <= 0) { + return R.fail("调拨单价不能为空或为0,请检查后重新保存"); + } if (request.getItemQuantity() == null || request.getItemQuantity().compareTo(java.math.BigDecimal.ZERO) <= 0) { return R.fail("调拨数量必须大于0,请检查后重新保存"); } diff --git a/openhis-ui-vue3/src/views/medicationmanagement/transferManagent/batchTransfer/index.vue b/openhis-ui-vue3/src/views/medicationmanagement/transferManagent/batchTransfer/index.vue index b173b2994..5b494c74c 100755 --- a/openhis-ui-vue3/src/views/medicationmanagement/transferManagent/batchTransfer/index.vue +++ b/openhis-ui-vue3/src/views/medicationmanagement/transferManagent/batchTransfer/index.vue @@ -907,6 +907,21 @@ function remakeBlur(row, index) { editBatchTransfer(index); } function handleSave() { + // 校验调拨数量 + const invalidQtyRow = totalIncentoryInfoList.value.find( + (row) => !row.itemQuantity || row.itemQuantity <= 0 + ); + if (invalidQtyRow) { + proxy.$modal.msgError('调拨数量必须大于0,请检查!'); + return; + } + const overStockRow = totalIncentoryInfoList.value.find( + (row) => row.itemQuantity > row.totalSourceQuantity + ); + if (overStockRow) { + proxy.$modal.msgError('调拨数量不可超出源库存数量,请检查!'); + return; + } // 校验单价 const invalidPriceRow = totalIncentoryInfoList.value.find( (row) => !row.price || row.price <= 0 diff --git a/openhis-ui-vue3/src/views/medicationmanagement/transferManagent/transferManagent/index.vue b/openhis-ui-vue3/src/views/medicationmanagement/transferManagent/transferManagent/index.vue index bbed6fb1b..84d61dd2d 100755 --- a/openhis-ui-vue3/src/views/medicationmanagement/transferManagent/transferManagent/index.vue +++ b/openhis-ui-vue3/src/views/medicationmanagement/transferManagent/transferManagent/index.vue @@ -1263,6 +1263,21 @@ function editBatchTransfer(index) { function handleSave(row, index) { rowList.value = []; + // 校验调拨数量 + const invalidQtyRow = form.purchaseinventoryList.find( + (r) => !r.itemQuantity || r.itemQuantity <= 0 + ); + if (invalidQtyRow) { + proxy.$message.warning('调拨数量必须大于0,请检查!'); + return; + } + const overStockRow = form.purchaseinventoryList.find( + (r) => r.itemQuantity > r.totalSourceQuantity + ); + if (overStockRow) { + proxy.$message.warning('调拨数量不可超出源库存数量,请检查!'); + return; + } if (route.query.supplyBusNo) { // 编辑 forms.purchaseinventoryList.map((row, index) => {