From 6ddd2b18b9308366155b4a9c1a0ede531a893b4b Mon Sep 17 00:00:00 2001 From: zxy Date: Thu, 4 Jun 2026 17:45:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(biz):=20=E4=BF=AE=E5=A4=8D=E9=80=80?= =?UTF-8?q?=E5=BA=93=E5=8A=9F=E8=83=BD=E4=B8=AD=E7=9A=84=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=92=8C=E6=95=B0=E6=8D=AE=E5=85=B3=E8=81=94?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复查看详情时的表单打开方式,使用 formRef.value.open 替代 handleMasterRowClick - 在退库表单中添加 operatorQty 输入框的实时计算逻辑 - 修改 calculateBagQty 方法中使用的字段名称,从 returnQty 和 stockQty 改为 operatorQty 和 yardQty - 添加 calculateQty 方法用于根据袋数和规格反向计算数量 - 修复库存扣减时的数据关联错误,移除冗余的 ProStorageMatDO 插入逻辑 - 修正存储日志中的关联明细ID,确保指向正确的记录ID --- .../prostorage/ProStorageServiceImpl.java | 28 +-------------- .../src/views/biz/proreturn/ProReturnForm.vue | 34 +++++++++++++++---- .../src/views/biz/proreturn/index.vue | 2 +- 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/mes-module-chemmes/mes-module-chemmes-biz/src/main/java/com/ningxia/yunxi/chemmes/module/biz/service/prostorage/ProStorageServiceImpl.java b/mes-module-chemmes/mes-module-chemmes-biz/src/main/java/com/ningxia/yunxi/chemmes/module/biz/service/prostorage/ProStorageServiceImpl.java index f610f0a..a8ea4fa 100644 --- a/mes-module-chemmes/mes-module-chemmes-biz/src/main/java/com/ningxia/yunxi/chemmes/module/biz/service/prostorage/ProStorageServiceImpl.java +++ b/mes-module-chemmes/mes-module-chemmes-biz/src/main/java/com/ningxia/yunxi/chemmes/module/biz/service/prostorage/ProStorageServiceImpl.java @@ -73,32 +73,6 @@ public class ProStorageServiceImpl implements ProStorageService { storageInventoryDO.setYardQty(storageInventoryDO.getYardQty().subtract(proStorageMatDO.getOperatorQty())); storageInventoryDO.setPackQty(storageInventoryDO.getPackQty() - proStorageMatDO.getBagQty()); proStorageInventoryMapper.updateById(storageInventoryDO); - - ProStorageMatDO proStorageMat = new ProStorageMatDO(); - proStorageMat.setStockId(proStorage.getId()); - proStorageMat.setDescription(""); - proStorageMat.setStoreHouseId(storageInventoryDO.getStoreHouseId()); - proStorageMat.setStoreAreaId(storageInventoryDO.getStoreAreaId()); - proStorageMat.setStoreHouseCd(storageInventoryDO.getStoreHouseCd()); - proStorageMat.setStoreHouseName(storageInventoryDO.getStoreHouseName()); - proStorageMat.setStoreAreCd(storageInventoryDO.getStoreAreCd()); - proStorageMat.setStoreAreaName(storageInventoryDO.getStoreAreaName()); - proStorageMat.setMaterialId(storageInventoryDO.getMaterialId()); - proStorageMat.setMatName(storageInventoryDO.getMatName()); - proStorageMat.setMatCode(storageInventoryDO.getMatCode()); - proStorageMat.setSpec(storageInventoryDO.getSpec()); - proStorageMat.setUnit(storageInventoryDO.getUnit()); - proStorageMat.setLotNo(storageInventoryDO.getLotNo()); - proStorageMat.setOperatorQty(proStorageMatDO.getOperatorQty()); -// proStorageMat.setSourceId(0L); -// proStorageMat.setRelarionId(0); -// proStorageMat.setBagSpec(0); -// proStorageMat.setBagQty(0); -// proStorageMat.setPlanId(0); -// proStorageMat.setProNo(""); - proStorageMat.setInventBillNo(storageInventoryDO.getInventBillNo()); - proStorageMatMapper.insert(proStorageMat); - ProStorageLogDO proStorageLog = new ProStorageLogDO(); // proStorageLog.setStockId(0); // proStorageLog.setDescription(""); @@ -126,7 +100,7 @@ public class ProStorageServiceImpl implements ProStorageService { proStorageLog.setOperatorName(nickname); proStorageLog.setRelarionNo(proStorage.getBillNo()); proStorageLog.setRelarionId(proStorage.getId()); - proStorageLog.setRelarionDetailId(proStorageMat.getId()); + proStorageLog.setRelarionDetailId(proStorageMatDO.getId()); // proStorageLog.setDpstNo(""); proStorageLog.setInventBillNo(storageInventoryDO.getInventBillNo()); proStorageLogService.saveProStorageLog(proStorageLog); diff --git a/mes-ui/mes-ui-admin-vue3/src/views/biz/proreturn/ProReturnForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/biz/proreturn/ProReturnForm.vue index e05169c..31be7f7 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/biz/proreturn/ProReturnForm.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/biz/proreturn/ProReturnForm.vue @@ -139,6 +139,7 @@ placeholder="手动录入" :disabled="formType === 'detail'" class="bg-yellow-100" + @input="calculateQty(scope.row)" /> @@ -362,17 +363,38 @@ const deleteDetailRow = (index: number) => { /** 计算袋数(根据退库数量和单袋规格) */ const calculateBagQty = (row: any) => { // 校验退库数量不能大于库存数量 - const returnQty = parseFloat(row.returnQty) || 0 - const stockQty = parseFloat(row.stockQty) || 0 + const returnQty = parseFloat(row.operatorQty) || 0 + const stockQty = parseFloat(row.yardQty) || 0 if (returnQty > stockQty) { message.warning('退库数量不能大于库存数量') - row.returnQty = stockQty.toString() + row.operatorQty = stockQty.toString() + row.bagQty = Math.ceil(stockQty / (parseFloat(row.bagSpec) || 1)).toString() + return } - // 计算袋数 - if (row.returnQty && row.bagSpec) { - row.returnBagQty = Math.ceil(parseFloat(row.returnQty) / parseFloat(row.bagSpec)) + // 根据数量计算袋数 + if (row.operatorQty && row.bagSpec) { + row.bagQty = Math.ceil(parseFloat(row.operatorQty) / parseFloat(row.bagSpec)).toString() + } +} + +/** 计算数量(根据退库袋数和单袋规格) */ +const calculateQty = (row: any) => { + // 校验退库袋数不能大于库存袋数 + const returnBagQty = parseInt(row.bagQty) || 0 + const stockBagQty = parseInt(row.packQty) || 0 + + if (returnBagQty > stockBagQty) { + message.warning('退库袋数不能大于库存袋数') + row.bagQty = stockBagQty.toString() + row.operatorQty = (stockBagQty * (parseFloat(row.bagSpec) || 1)).toString() + return + } + + // 根据袋数计算数量 + if (row.bagQty && row.bagSpec) { + row.operatorQty = (parseInt(row.bagQty) * parseFloat(row.bagSpec)).toString() } } diff --git a/mes-ui/mes-ui-admin-vue3/src/views/biz/proreturn/index.vue b/mes-ui/mes-ui-admin-vue3/src/views/biz/proreturn/index.vue index b9ce50d..659d108 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/biz/proreturn/index.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/biz/proreturn/index.vue @@ -279,7 +279,7 @@ const openForm = (type: string, id?: number) => { /** 查看详情 */ const handleViewDetail = (row) => { - handleMasterRowClick(row) + formRef.value.open('detail', row.id) } /** 删除按钮操作 */