| | |
| | | import com.dy.common.webFilter.UserTokenContext; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pmsGlobal.daoOth.OthFileMapper; |
| | | import com.dy.pmsGlobal.daoPr.PrAssemblyPlanMapper; |
| | | import com.dy.pmsGlobal.daoPr.PrProductionNodeMapper; |
| | | import com.dy.pmsGlobal.daoPr.PrProductionProcessMapper; |
| | | import com.dy.pmsGlobal.daoPr.PrWorkingInstructionMapper; |
| | |
| | | import com.dy.pmsGlobal.dyFile.FileRestVo; |
| | | import com.dy.pmsGlobal.pojoBa.BaUser; |
| | | import com.dy.pmsGlobal.pojoOth.OthFile; |
| | | import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan; |
| | | import com.dy.pmsGlobal.pojoPr.PrProductionNode; |
| | | import com.dy.pmsGlobal.pojoPr.PrProductionProcess; |
| | | import com.dy.pmsGlobal.pojoPr.PrWorkingInstruction; |
| | | import com.dy.pmsGlobal.util.UserUtil; |
| | | import com.dy.pmsProduct.taskPlan.PlanStatusEnum; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class ProcessSv { |
| | | private PrAssemblyPlanMapper assemblyDao; |
| | | private PrProductionProcessMapper processDao; |
| | | private PrProductionNodeMapper nodeDao; |
| | | private PrWorkingInstructionMapper workDao; |
| | |
| | | private OthFileMapper othFileMapper; |
| | | @Value("${dy.webFile.fmUrl}") |
| | | private String fmUrl ; |
| | | @Autowired |
| | | public void setAssemblyDao(PrAssemblyPlanMapper assemblyDao) { |
| | | this.assemblyDao = assemblyDao; |
| | | } |
| | | @Autowired |
| | | public void setProcessDao(PrProductionProcessMapper dao){ |
| | | processDao = dao; |
| | |
| | | if (processDao.exists(process.name, process.id)) { |
| | | throw new RuntimeException("流程名称不能重复"); |
| | | } |
| | | PrProductionProcess originProductionProcess = processDao.selectByPrimaryKey(process.id); |
| | | //如果已经绑定任务(目前不包括暂停\结束状态 投入数为0的任务 以外的 所有任务),产品\节点id不能删除不能修改 |
| | | if(!originProductionProcess.getProName().equals(process.getProName())){ |
| | | //组装任务计划 |
| | | PrAssemblyPlan params = new PrAssemblyPlan(); |
| | | params.setProcessId(process.id); |
| | | List<PrAssemblyPlan> planList = assemblyDao.selectAssyPlanSimplify(params); |
| | | List<PrAssemblyPlan> onlinePlanList = planList.stream().filter(plan -> plan.getStatus() == PlanStatusEnum.NORMAL.getCode()).collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(planList)) { |
| | | if (planList.stream().anyMatch(plan -> plan.getInputNumber() > 0)) { |
| | | throw new RuntimeException("存在绑定的任务,并且投入生产,产品不能修改"); |
| | | }else if(CollectionUtils.isNotEmpty(onlinePlanList)){ |
| | | //先将组装任务置为暂停状态 |
| | | onlinePlanList.forEach(plan -> { |
| | | plan.status = PlanStatusEnum.PAUSE.getCode(); |
| | | assemblyDao.updateByPrimaryKeySelective(plan); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | prepareProcess(process); |
| | | int count = processDao.updateByPrimaryKeySelective(process); |
| | | // 优化:只有当节点有变更时才删除并重新插入 |