From 986de1ea52ea40a848a8e8ffe478122850bb03a2 Mon Sep 17 00:00:00 2001 From: 刘小明 <liuxm_a@163.com> Date: 星期二, 13 八月 2024 09:36:34 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java | 46 +++++++++++++++++++++++++++------------------- 1 files changed, 27 insertions(+), 19 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 8e318f6..0d8501b 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,10 +74,7 @@ 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("浜у搧涓庣敓浜ф祦绋嬩笉鍖归厤"); - } + extractedCheck(plan); PrBatchNumber batch = new PrBatchNumber(); batch.batchNumber = getNextCode(); batch.proId = plan.proId; @@ -102,10 +99,6 @@ 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); //濡傛灉鏈夋姇鍏�,浜у搧鍜屾祦绋嬩笉鑳藉彉鏇� @@ -114,17 +107,7 @@ throw new RuntimeException("璁″垝宸叉姇鍏�,浜у搧涓庣敓浜ф祦绋嬩笉鑳藉彉鏇�"); } } - //Fancy add 2024/07/09 濡傛灉鐘舵�佷负鎵ц ,鍒欑粨鏉熸棩鏈熷繀椤诲ぇ浜庣瓑浜庡綋鍓嶆棩鏈� - if(plan.status == PlanStatusEnum.NORMAL.getCode()){ - String endDateStr = plan.getEndDate(); - LocalDate endDate = LocalDate.parse(endDateStr, DateTimeFormatter.ISO_LOCAL_DATE); - LocalDate nextDay = endDate.plusDays(1); - LocalDate today = LocalDate.now(); // 鑾峰彇褰撳墠鏃ユ湡 - if (nextDay.isBefore(today)) { - throw new RuntimeException("鎵ц鐘舵�佺粨鏉熸棩鏈熷繀椤诲ぇ浜庣瓑浜庡綋鍓嶆棩鏈�"); - } - } - + extractedCheck(plan); //浜у搧鏀瑰彉鍒欐洿鏂板叏閮ㄥ凡鐢熸垚璁惧鍙� if(origPlan.proId != plan.proId){ batch.proId = plan.proId; @@ -139,6 +122,26 @@ return assemblyDao.updateByPrimaryKeySelective(plan); } + private void extractedCheck(PrAssemblyPlan plan) { + PrProductionProcess process = processDao.selectByPrimaryKey(plan.processId); + if(process == null || !process.proId.equals(plan.proId)){ + throw new RuntimeException("浜у搧涓庣敓浜ф祦绋嬩笉鍖归厤"); + } + //寮�濮嬫棩鏈熻灏忎簬缁撴潫鏃ユ湡 + if(plan.startDate.compareTo(plan.endDate) > 0){ + throw new RuntimeException("寮�濮嬫棩鏈熶笉鑳藉ぇ浜庣粨鏉熸棩鏈�"); + } + //Fancy add 2024/07/09 濡傛灉鐘舵�佷负鎵ц ,鍒欑粨鏉熸棩鏈熷繀椤诲ぇ浜庣瓑浜庡綋鍓嶆棩鏈� + if(plan.status == PlanStatusEnum.NORMAL.getCode()){ + String endDateStr = plan.getEndDate(); + LocalDate endDate = LocalDate.parse(endDateStr, DateTimeFormatter.ISO_LOCAL_DATE); + LocalDate nextDay = endDate.plusDays(1); + LocalDate today = LocalDate.now(); // 鑾峰彇褰撳墠鏃ユ湡 + if (nextDay.isBefore(today)) { + throw new RuntimeException("鎵ц鐘舵�佺粨鏉熸棩鏈熷繀椤诲ぇ浜庣瓑浜庡綋鍓嶆棩鏈�,璇蜂慨鏀圭粨鏉熸棩鏈�"); + } + } + } @Transactional public int addDevice(Long planId,int num){ @@ -272,6 +275,11 @@ */ @Transactional public int updateStatus(PrAssemblyPlan plan) { + if(plan.status == PlanStatusEnum.NORMAL.getCode()){ + PrAssemblyPlan assemblyPlan = assemblyDao.selectByPrimaryKey(plan.id); + assemblyPlan.status = plan.status; + extractedCheck(assemblyPlan); + } PrAssemblyPlan param = new PrAssemblyPlan(); param.id =plan.id; param.status = plan.status; -- Gitblit v1.8.0