| | |
| | | if (workLasts.size() > 0) { |
| | | List<StaAssemblyWorkLast> userStationList = workLasts.stream().filter(item -> userId == item.getUserId()).collect(Collectors.toList()); |
| | | if (userStationList.size() == 0) { |
| | | throw new RuntimeException("员工(" + workLasts.get(0).getUserName() + ")编码:" + workLasts.get(0).getUserId() + "已经绑定该工站(" + workLasts.get(0).getStationName() + ")编码:" + workLasts.get(0).getStationId() + ".请先让其解绑"); |
| | | //删除工站登录信息 |
| | | for (int i = 0; i < workLasts.size(); i++) { |
| | | logout(workLasts.get(i).getId().toString()); |
| | | } |
| | | //throw new RuntimeException("员工(" +userInfo.getName() + ")编码:" + workLasts.get(0).getUserId() + "已经绑定该工站(" + stationInfo.getName() + ")编码:" + workLasts.get(0).getStationId() + ".请先让其解绑"); |
| | | } else { |
| | | BeanUtils.copyProperties(userStationList.get(0), result); |
| | | } |
| | | } else { |
| | | } |
| | | if (result.getId() == null) { |
| | | result.setUserId(userInfo.getId()); |
| | | result.setUserName(userInfo.getName()); |
| | | result.setStationId(stationInfo.getId()); |
| | |
| | | } |
| | | |
| | | public StaAssemblyWorkLast getWorkLast(String workId) { |
| | | if(StringUtils.isBlank(workId)){ |
| | | if (StringUtils.isBlank(workId)) { |
| | | throw new RuntimeException("登录ID为空,请联系管理员查看并解决问题."); |
| | | } |
| | | StaAssemblyWorkLast result = assemblyWorkLastDao.selectByPrimaryKey(Long.parseLong(workId)); |
| | |
| | | logout(result.getId().toString()); |
| | | result.setId(null); |
| | | result.setStatus(STATUS_WORK_LAST_LOGOUT); |
| | | if(userInfo == null){ |
| | | if (userInfo == null) { |
| | | result.setUserId(null); |
| | | result.setUserName(""); |
| | | } |
| | | if(stationInfo == null){ |
| | | if (stationInfo == null) { |
| | | result.setStationId(null); |
| | | result.setStationName(""); |
| | | } |
| | | if(assyPlan == null){ |
| | | if (assyPlan == null) { |
| | | result.setPlanId(null); |
| | | result.setPlanName(""); |
| | | } |
| | | if(!hasNodeId){ |
| | | if (!hasNodeId) { |
| | | result.setNodeId(null); |
| | | result.setNodeName(""); |
| | | } |
| | | return result; |
| | | }else { |
| | | } else { |
| | | result.setPlanName(assyPlan.getName()); |
| | | result.setProcessName(assyPlan.getProcessName()); |
| | | result.setNodeName(assyPlan.getProcess().getNodes().get(0).getContent()); |
| | | //找到对应的产品信息 |
| | | PltProduct product = productDao.selectByPrimaryKey(assyPlan.getProId()); |
| | | PltProduct product = productDao.selectByPrimaryKey(assyPlan.getProId()); |
| | | if (product != null) { |
| | | result.setProId(product.getId()); |
| | | result.setProName(product.getName()); |
| | |
| | | param.setStatus(STATUS_NORMAL); |
| | | List<StaAssemblyWorkLast> workLasts = assemblyWorkLastDao.selectList(param); |
| | | if (workLasts.size() > 0) { |
| | | result = getWorkLast(workLasts.get(0).getId().toString()); |
| | | result = getWorkLast(workLasts.get(0).getId().toString()); |
| | | } |
| | | result.setStationId(stationInfo.getId()); |
| | | result.setStationName(stationInfo.getName()); |
| | |
| | | result.setProcessName(assyPlan.getProcessName()); |
| | | result.setNodeName(assyPlan.getProcess().getNodes().get(0).getContent()); |
| | | //找到对应的产品信息 |
| | | PltProduct product = productDao.selectByPrimaryKey(assyPlan.getProId()); |
| | | PltProduct product = productDao.selectByPrimaryKey(assyPlan.getProId()); |
| | | if (product == null) { |
| | | throw new RuntimeException("产品信息有误或被其他人员修改,请登录管理系统查看任务关联产品ID为:" + assyPlan.getProId()); |
| | | } |