From fb9432524649ab3b6f2314b1e0978cc6c26020eb Mon Sep 17 00:00:00 2001 From: Fancy <Fancy.fx@outlook.com> Date: 星期四, 27 六月 2024 15:36:47 +0800 Subject: [PATCH] some NotNull error --- pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblySv.java | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 insertions(+), 6 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 3466bb7..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 @@ -8,11 +8,13 @@ import com.dy.pmsGlobal.daoPr.PrAssemblyPlanMapper; import com.dy.pmsGlobal.daoPr.PrBatchNumberMapper; import com.dy.pmsGlobal.daoPr.PrEquipMapper; +import com.dy.pmsGlobal.daoPr.PrProductionProcessMapper; import com.dy.pmsGlobal.pojoBa.BaUser; import com.dy.pmsGlobal.pojoPlt.PltProduct; import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan; import com.dy.pmsGlobal.pojoPr.PrBatchNumber; import com.dy.pmsGlobal.pojoPr.PrEquip; +import com.dy.pmsGlobal.pojoPr.PrProductionProcess; import com.dy.pmsGlobal.util.QrCodeUtil; import com.dy.pmsGlobal.util.UserUtil; import lombok.extern.slf4j.Slf4j; @@ -38,7 +40,7 @@ private PrBatchNumberMapper batchDao; private PrEquipMapper equipDao; private PltProductMapper productDao; - private SqlSessionFactory sqlSessionFactory; + private PrProductionProcessMapper processDao; @Autowired public void setAssemblyDao(PrAssemblyPlanMapper assemblyDao) { this.assemblyDao = assemblyDao; @@ -61,12 +63,20 @@ } @Autowired - public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) { - this.sqlSessionFactory = sqlSessionFactory; + public void setProcessDao(PrProductionProcessMapper processDao) { + this.processDao = processDao; } @Transactional public int save(PrAssemblyPlan plan){ + //璁″垝鍚嶇О涓嶈兘閲嶅 + 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("浜у搧涓庣敓浜ф祦绋嬩笉鍖归厤"); + } PrBatchNumber batch = new PrBatchNumber(); batch.batchNumber = getNextCode(); batch.proId = plan.proId; @@ -87,10 +97,21 @@ @Transactional public int update(PrAssemblyPlan plan){ + //璁″垝鍚嶇О涓嶈兘閲嶅 + 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); //浜у搧鏀瑰彉鍒欐洿鏂板叏閮ㄥ凡鐢熸垚璁惧鍙� if(origPlan.proId != plan.proId){ + batch.proId = plan.proId; + batchDao.updateByPrimaryKeySelective(batch); + equipDao.deleteByBatchId(origPlan.batchId); insertEquip(plan.proId,origPlan.batchId,batch.batchNumber,plan.number,1); }else if(origPlan.number < plan.number){ @@ -107,7 +128,7 @@ PrBatchNumber batch = batchDao.selectByPrimaryKey(plan.batchId); int count =insertEquip(plan.proId,plan.batchId,batch.batchNumber,num + plan.number,plan.number+1); plan.number = plan.number + num; - assemblyDao.updateByPrimaryKeySelective(plan); + assemblyDao.updateByPrimaryKeySelective (plan); return count; } @@ -210,7 +231,7 @@ public QueryResultVo<List<PrEquip>> selectSomeEquip(QueryVo queryVo) { Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); //鏌ヨ绗﹀悎鏉′欢鐨勮褰曟�绘暟 - Long itemTotal = assemblyDao.selectSomeCount(params); + Long itemTotal = equipDao.selectSomeCount(params); QueryResultVo<List<PrEquip>> rsVo = new QueryResultVo<>(queryVo.pageSize, queryVo.pageCurr) ; //璁$畻鍒嗛〉绛変俊鎭� rsVo.calculateAndSet(itemTotal, params); @@ -236,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