From 432a1b0c4dd251f686e9bb7950c4868aaf3e4ed7 Mon Sep 17 00:00:00 2001 From: liuxm <liuxm_a@163.com> Date: 星期四, 06 六月 2024 09:55:57 +0800 Subject: [PATCH] 添加验证和异常处理 --- pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java index 252dff5..0b6b158 100644 --- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java +++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java @@ -74,7 +74,7 @@ throw new RuntimeException("璁″垝鍚嶇О涓嶈兘閲嶅"); } PrProductionProcess process = processDao.selectByPrimaryKey(plan.processId); - if(process == null || process.proId != plan.proId){ + if(process == null || !process.proId.equals(plan.proId)){ throw new RuntimeException("浜у搧涓庣敓浜ф祦绋嬩笉鍖归厤"); } PrBatchNumber batch = new PrBatchNumber(); @@ -100,6 +100,10 @@ //璁″垝鍚嶇О涓嶈兘閲嶅 if(assemblyDao.exists(plan.name,plan.id)){ throw new RuntimeException("璁″垝鍚嶇О涓嶈兘閲嶅"); + } + PrProductionProcess process = processDao.selectByPrimaryKey(plan.processId); + if(process == null || !process.proId.equals(plan.proId)){ + throw new RuntimeException("浜у搧涓庣敓浜ф祦绋嬩笉鍖归厤"); } PrAssemblyPlan origPlan = assemblyDao.selectByPrimaryKey(plan.id); PrBatchNumber batch = batchDao.selectByPrimaryKey(origPlan.batchId); @@ -253,6 +257,6 @@ PrAssemblyPlan param = new PrAssemblyPlan(); param.id =plan.id; param.status = plan.status; - return assemblyDao.updateByPrimaryKeySelective(plan); + return assemblyDao.updateByPrimaryKeySelective(param); } } -- Gitblit v1.8.0