| | |
| | | package com.dy.pmsStation.workOrder; |
| | | |
| | | import com.alibaba.excel.util.StringUtils; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pmsGlobal.daoBa.BaUserMapper; |
| | | import com.dy.pmsGlobal.daoOth.OthFileMapper; |
| | | import com.dy.pmsGlobal.daoPlt.PltStationMapper; |
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicLong; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | |
| | | private OthFileMapper othFileMapper; |
| | | @Value("${dy.webFile.fmUrl}") |
| | | private String fmUrl ; |
| | | |
| | | @Autowired |
| | | public void setAssemblyDao(PrAssemblyPlanMapper assemblyDao) { |
| | | this.assemblyDao = assemblyDao; |
| | | } |
| | | |
| | | @Autowired |
| | | private void setBaUserDao(BaUserMapper baUserDao){ |
| | | this.baUserDao = baUserDao; |
| | | } |
| | | |
| | | @Autowired |
| | | private void setPltStationDao(PltStationMapper pltStationDao){ |
| | | this.pltStationDao = pltStationDao; |
| | | } |
| | | |
| | | @Autowired |
| | | private void setStaAssemblyWorkHistoryDao(StaAssemblyWorkHistoryMapper assemblyWorkHistoryDao){ |
| | | this.assemblyWorkHistoryDao = assemblyWorkHistoryDao; |
| | | } |
| | | |
| | | @Autowired |
| | | private void setStaAssemblyWorkLastDao(StaAssemblyWorkLastMapper assemblyWorkLastDao){ |
| | | this.assemblyWorkLastDao = assemblyWorkLastDao; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setFileOperate(FileOperate fileOperate){ |
| | | this.fileOperate = fileOperate; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setOthFileMapper(OthFileMapper othFileMapper){ |
| | | this.othFileMapper = othFileMapper; |
| | |
| | | } |
| | | return userInfo; |
| | | } |
| | | |
| | | public PltStation getStationInfo(String id){ |
| | | //仅检查工站信息以及工站占用情况 |
| | | Long stationId = null; |
| | |
| | | } |
| | | return stationInfo; |
| | | } |
| | | |
| | | public StaAssemblyWorkLast checkStationUsed(String id){ |
| | | StaAssemblyWorkLast result = new StaAssemblyWorkLast(); |
| | | PltStation stationInfo = null; |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Transactional |
| | | public StaAssemblyWorkLast save(QueryVo vo) { |
| | | //先check |
| | | StaAssemblyWorkLast checkResult = checkUserAndStationUsed(vo); |
| | | //校验planId processId nodeId |
| | | PrAssemblyPlan params = new PrAssemblyPlan(); |
| | | params.setStatus(STATUS_NORMAL); |
| | | params.setId(vo.getPlanId()); |
| | | params.setProcessId(vo.getProcessId()); |
| | | List<PrAssemblyPlan> planList = selectAssyPlanList(params); |
| | | boolean hasNodeId= planList.stream() |
| | | .flatMap(process -> process.getProcess().getNodes().stream()) |
| | | PrAssemblyPlan assyPlan = assemblyDao.selectByPrimaryKey(vo.getPlanId()); |
| | | if(assyPlan == null){ |
| | | throw new RuntimeException("组装任务已经在系统中删除请检查,刷新并重新选择任务"); |
| | | } |
| | | boolean hasNodeId = assyPlan.getProcess().getNodes().stream() |
| | | .anyMatch(node -> node.id.equals(vo.getNodeId())); |
| | | if(!hasNodeId){ |
| | | throw new RuntimeException("节点信息有误或被其他人员修改,请重新选择节点信息"); |
| | | } |
| | | //怎么将只包含这个节点的信息全部回传呢 |
| | | vo.setLineId(checkResult.getLineId()); |
| | | StaAssemblyWorkLast staLast = new StaAssemblyWorkLast(); |
| | | BeanUtils.copyProperties(vo,staLast); |
| | |
| | | throw new RuntimeException("数据库存储失败"); |
| | | } |
| | | StaAssemblyWorkLast result = assemblyWorkLastDao.selectByPrimaryKey(staLast.getId()); |
| | | List<PrProductionNode> nodeInfo =assyPlan.getProcess().getNodes().stream() |
| | | .filter(node -> node.id.equals(vo.getNodeId())).collect(Collectors.toList()); |
| | | assyPlan.getProcess().setNodes(nodeInfo); |
| | | result.setPlan(assyPlan); |
| | | return result; |
| | | } |
| | | |
| | | @Transactional |
| | | public int logout(String id) { |
| | | //找到登录记录 |
| | |
| | | assemblyWorkLastDao.deleteByPrimaryKey(Long.parseLong(id)); |
| | | return count; |
| | | } |
| | | |
| | | public List<PrAssemblyPlan> selectAssyPlanList(PrAssemblyPlan params){ |
| | | List<PrAssemblyPlan> planList = assemblyDao.selectAssyPlanList(params); |
| | | planList.stream().forEach(process -> { |
| | | List<PrAssemblyPlan> planList = assemblyDao.selectAssyPlanSimplify(params); |
| | | /* planList.stream().forEach(process -> { |
| | | process.getProcess().getNodes().forEach(node -> { |
| | | if(node.instruction != null){ |
| | | addUrl(node.instruction); |
| | | } |
| | | }); |
| | | }); |
| | | });*/ |
| | | return planList; |
| | | } |
| | | |
| | | private void addUrl(PrWorkingInstruction ins){ |
| | | if (ins == null || ins.fileId == null) { |
| | | return; |
| | |
| | | ins.orgName = file.orgName; |
| | | ins.extName = file.extName; |
| | | } |
| | | |
| | | //workId assistants 传的是单个的userId 必传参数 |
| | | public List<BaUser> updateAssistant(QueryVo vo) { |
| | | //找到workId |
| | |
| | | int count = assemblyWorkLastDao.updateByPrimaryKey(workLast); |
| | | return count; |
| | | } |
| | | |
| | | public int removeAssistant(String workId ,String assistant) { |
| | | //找到workId |
| | | StaAssemblyWorkLast workLast = assemblyWorkLastDao.selectByPrimaryKey(Long.parseLong(workId)); |
| | |
| | | int count = assemblyWorkLastDao.updateByPrimaryKey(workLast); |
| | | return count; |
| | | } |
| | | |
| | | public List<BaUser> getAssistantList(String workId) { |
| | | //找到workId |
| | | StaAssemblyWorkLast workLast = assemblyWorkLastDao.selectByPrimaryKey(Long.parseLong(workId)); |
| | |
| | | List<BaUser> assistantList = baUserDao.selectByAssistants(workLast.getAssistants()); |
| | | return assistantList; |
| | | } |
| | | //根据节点的查出节点作业指导书 |
| | | |
| | | // 根据产品查出产品文件 主要技术参数 |
| | | } |