diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/ProductTransferController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/ProductTransferController.java index e92c8cf84..bbdac4e2f 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/ProductTransferController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/ProductTransferController.java @@ -93,7 +93,7 @@ public class ProductTransferController { * @return 操作结果 */ @PutMapping("/product-transfer-batch") - public R addOrEditBatchTransferReceipt(@RequestBody List productTransferDtoList) { + public R addOrEditBatchTransferReceipt(@Validated @RequestBody List productTransferDtoList) { // 批量保存按钮 Boolean flag = true; return productTransferAppService.addOrEditBatchTransferReceipt(productTransferDtoList, flag); 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..b7d6f4349 100755 --- a/openhis-ui-vue3/src/views/medicationmanagement/transferManagent/batchTransfer/index.vue +++ b/openhis-ui-vue3/src/views/medicationmanagement/transferManagent/batchTransfer/index.vue @@ -739,15 +739,25 @@ function handleSubmitApproval() { let length = totalIncentoryInfoList.value.length; if (length < 1) { proxy.$modal.msgWarning('请先添加单据'); - } else if (data.isEdit) { - proxy.$modal.msgWarning('单据未保存'); - } else { - submitApproval(receiptHeaderForm.busNo).then((response) => { - proxy.$modal.msgSuccess('提交审批成功'); - tagsViewStore.delView(router.currentRoute.value); - router.replace({ path: 'transferManagentList' }); - }); + return; } + // 校验调拨数量:必须 > 0 + const invalidQtyRow = totalIncentoryInfoList.value.find( + (row) => !row.itemQuantity || row.itemQuantity <= 0 + ); + if (invalidQtyRow) { + proxy.$modal.msgWarning('存在调拨数量为0或无效的明细,请检查后提交'); + return; + } + if (data.isEdit) { + proxy.$modal.msgWarning('单据未保存'); + return; + } + submitApproval(receiptHeaderForm.busNo).then((response) => { + proxy.$modal.msgSuccess('提交审批成功'); + tagsViewStore.delView(router.currentRoute.value); + router.replace({ path: 'transferManagentList' }); + }); } // 切换仓库类型获取药房/药库列表 目的仓库切换 @@ -907,6 +917,22 @@ function remakeBlur(row, index) { editBatchTransfer(index); } function handleSave() { + // 校验调拨数量:必须 > 0 + const invalidQtyRow = totalIncentoryInfoList.value.find( + (row) => !row.itemQuantity || row.itemQuantity <= 0 + ); + if (invalidQtyRow) { + proxy.$modal.msgError('调拨数量必须大于0,请检查!'); + return; + } + // 校验调拨数量不能超过源仓库库存 + const exceedStockRow = totalIncentoryInfoList.value.find( + (row) => row.itemQuantity > row.totalSourceQuantity + ); + if (exceedStockRow) { + proxy.$modal.msgError('调拨数量不可超出源库存数量,请检查!'); + return; + } // 校验单价 const invalidPriceRow = totalIncentoryInfoList.value.find( (row) => !row.price || row.price <= 0