From a51ed995ac6e9a8ba63b53aca929aeed15edf8a8 Mon Sep 17 00:00:00 2001 From: Fancy <Fancy.fx@outlook.com> Date: 星期二, 20 八月 2024 09:05:23 +0800 Subject: [PATCH] order manage --- pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java | 51 +++++++++++++++++++++++++++++++++------------------ 1 files changed, 33 insertions(+), 18 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 a1b8c38..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,22 +99,15 @@ 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("浜у搧涓庣敓浜ф祦绋嬩笉鍖归厤"); - } - //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("鎵ц鐘舵�佺粨鏉熸棩鏈熷繀椤诲ぇ浜庣瓑浜庡綋鍓嶆棩鏈�"); - } - } PrAssemblyPlan origPlan = assemblyDao.selectByPrimaryKey(plan.id); PrBatchNumber batch = batchDao.selectByPrimaryKey(origPlan.batchId); + //濡傛灉鏈夋姇鍏�,浜у搧鍜屾祦绋嬩笉鑳藉彉鏇� + if(origPlan.getInputNumber() > 0){ + if(!origPlan.proId.equals(plan.proId) || !origPlan.processId.equals(plan.processId)){ + throw new RuntimeException("璁″垝宸叉姇鍏�,浜у搧涓庣敓浜ф祦绋嬩笉鑳藉彉鏇�"); + } + } + extractedCheck(plan); //浜у搧鏀瑰彉鍒欐洿鏂板叏閮ㄥ凡鐢熸垚璁惧鍙� if(origPlan.proId != plan.proId){ batch.proId = plan.proId; @@ -132,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){ @@ -265,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