| | |
| | | private static final int STATUS_REPAIR = 3; |
| | | private static final int STATUS_WASTE = 4; |
| | | |
| | | private static final String WORK_TYPE_ASSEMBLY = "1"; |
| | | private static final String WORK_TYPE_TEST = "2"; |
| | | private static final String WORK_TYPE_INSPECTION = "3"; |
| | | private static final String WORK_TYPE_REPAIR = "4"; |
| | | |
| | | private static final String USER_PREFIX = "101"; |
| | | private static final String STATION_PREFIX = "103"; |
| | | |
| | |
| | | } |
| | | BaUser userInfo = getUserInfo(result.getUserId().toString()); |
| | | PltStation stationInfo = getStationInfo(result.getStationId().toString()); |
| | | //校验planId processId nodeId |
| | | PrAssemblyPlan assyPlan = assemblyDao.selectByPrimaryKey(result.getPlanId()); |
| | | boolean hasNodeId = assyPlan.getProcess().getNodes().stream() |
| | | .anyMatch(node -> node.id.equals(result.getNodeId())); |
| | | if (userInfo == null || stationInfo == null || assyPlan == null || (!hasNodeId)) { |
| | | //直接删除记录 |
| | | logout(result.getId().toString()); |
| | | result.setId(null); |
| | | result.setStatus(STATUS_WORK_LAST_LOGOUT); |
| | | if (userInfo == null) { |
| | | result.setUserId(null); |
| | | result.setUserName(""); |
| | | } |
| | | if (stationInfo == null) { |
| | | result.setStationId(null); |
| | | result.setStationName(""); |
| | | } |
| | | if (assyPlan == null) { |
| | | result.setPlanId(null); |
| | | result.setPlanName(""); |
| | | } |
| | | if (!hasNodeId) { |
| | | result.setNodeId(null); |
| | | result.setNodeName(""); |
| | | } |
| | | return result; |
| | | } else { |
| | | result.setPlanName(assyPlan.getName()); |
| | | result.setProcessName(assyPlan.getProcessName()); |
| | | result.setNodeName(assyPlan.getProcess().getNodes().get(0).getContent()); |
| | | //找到对应的产品信息 |
| | | PltProduct product = productDao.selectByPrimaryKey(assyPlan.getProId()); |
| | | if (product != null) { |
| | | result.setProId(product.getId()); |
| | | result.setProName(product.getName()); |
| | | String devicePrefix = QrCodeConstant.TypeProduct + product.getCode() + assyPlan.getBatchNo(); |
| | | result.setDevicePrefix(devicePrefix); |
| | | //如果是维修work_type 没有 planId processId nodeId |
| | | if (WORK_TYPE_REPAIR.equals(result.getWorkType())) { |
| | | //校验planId processId nodeId |
| | | PrAssemblyPlan assyPlan = assemblyDao.selectByPrimaryKey(result.getPlanId()); |
| | | boolean hasNodeId = assyPlan.getProcess().getNodes().stream() |
| | | .anyMatch(node -> node.id.equals(result.getNodeId())); |
| | | if (userInfo == null || stationInfo == null || assyPlan == null || (!hasNodeId)) { |
| | | //直接删除记录 |
| | | logout(result.getId().toString()); |
| | | result.setId(null); |
| | | result.setStatus(STATUS_WORK_LAST_LOGOUT); |
| | | if (userInfo == null) { |
| | | result.setUserId(null); |
| | | result.setUserName(""); |
| | | } |
| | | if (stationInfo == null) { |
| | | result.setStationId(null); |
| | | result.setStationName(""); |
| | | } |
| | | if (assyPlan == null) { |
| | | result.setPlanId(null); |
| | | result.setPlanName(""); |
| | | } |
| | | if (!hasNodeId) { |
| | | result.setNodeId(null); |
| | | result.setNodeName(""); |
| | | } |
| | | return result; |
| | | } else { |
| | | result.setPlanName(assyPlan.getName()); |
| | | result.setProcessName(assyPlan.getProcessName()); |
| | | result.setNodeName(assyPlan.getProcess().getNodes().get(0).getContent()); |
| | | //找到对应的产品信息 |
| | | PltProduct product = productDao.selectByPrimaryKey(assyPlan.getProId()); |
| | | if (product != null) { |
| | | result.setProId(product.getId()); |
| | | result.setProName(product.getName()); |
| | | String devicePrefix = QrCodeConstant.TypeProduct + product.getCode() + assyPlan.getBatchNo(); |
| | | result.setDevicePrefix(devicePrefix); |
| | | } |
| | | } |
| | | } |
| | | result.setStationId(stationInfo.getId()); |