| | |
| | | |
| | | import com.alibaba.excel.util.StringUtils; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.GlException; |
| | | import com.dy.pmsGlobal.daoBa.BaUserMapper; |
| | | import com.dy.pmsGlobal.daoOth.OthFileMapper; |
| | | import com.dy.pmsGlobal.daoPlt.PltStationMapper; |
| | |
| | | this.othFileMapper = othFileMapper; |
| | | } |
| | | |
| | | public String checkUser(String id){ |
| | | public BaUser getUserInfo(String id){ |
| | | Long userId = null; |
| | | String message = "USER"; |
| | | if(StringUtils.isBlank(id)){ |
| | | message = "FALSE^员工编码不能为空"; |
| | | return message; |
| | | } |
| | | //工站103 |
| | | if((!StringUtils.isBlank(id)) && id.toString().startsWith("103")){ |
| | | message = checkStation(id); |
| | | return message; |
| | | throw new RuntimeException("员工编码不能为空"); |
| | | } |
| | | //用户101 |
| | | if(id.toString().startsWith("101")){ |
| | | if(id.startsWith("101")){ |
| | | userId = Long.parseLong(id.toString().substring(3)); |
| | | }else{ |
| | | userId = Long.parseLong(id.toString()); |
| | | } |
| | | BaUser userInfo = baUserDao.selectByPrimaryKey(userId); |
| | | if(userInfo == null){ |
| | | message = "FALSE^员工编码:"+ userId +"不在系统中,请先维护员工信息"; |
| | | return message; |
| | | throw new RuntimeException("员工编码:"+ userId +"不在系统中,请先维护员工信息"); |
| | | }else if(userInfo.getDisabled()){ |
| | | throw new RuntimeException("员工("+userInfo.getName()+")编码:"+ userId +"在系统已禁用,请先启用员工"); |
| | | }else if(userInfo.getDeleted()){ |
| | | throw new RuntimeException("员工("+userInfo.getName()+")编码:"+ userId +"在系统已删除,请先恢复员工信息"); |
| | | } |
| | | message += "^"+ userId; |
| | | return message; |
| | | return userInfo; |
| | | } |
| | | |
| | | public String checkStation(String id){ |
| | | public PltStation getStationInfo(String id){ |
| | | Long stationId = null; |
| | | String message = "STATION"; |
| | | if(StringUtils.isBlank(id)){ |
| | | message = "FALSE^工站编码不能为空"; |
| | | return message; |
| | | } |
| | | //用户101 |
| | | if((!StringUtils.isBlank(id)) && id.toString().startsWith("101")){ |
| | | message = checkUser(id); |
| | | return message; |
| | | throw new RuntimeException("工站编码不能为空"); |
| | | } |
| | | //工站103 |
| | | if(id.toString().startsWith("103")){ |
| | | if(id.startsWith("103")){ |
| | | stationId = Long.parseLong(id.toString().substring(3)); |
| | | }else{ |
| | | stationId = Long.parseLong(id.toString()); |
| | |
| | | record.setId(stationId); |
| | | List<PltStation> stationInfo = pltStationDao.selectStationList(record); |
| | | if(stationInfo.size() == 0){ |
| | | message = "FALSE^工站编码:"+ stationId +"不在系统中,请先维护工站信息"; |
| | | return message; |
| | | throw new RuntimeException("工站编码:"+ stationId +"不在系统中,请先维护工站信息"); |
| | | } |
| | | //检查工站 |
| | | message += "^"+ stationId; |
| | | return message; |
| | | //检查表中stationId是否已经存在 |
| | | StaAssemblyWorkLast param = new StaAssemblyWorkLast(); |
| | | param.setStationId(stationId); |
| | | param.setStatus(1); |
| | | List<StaAssemblyWorkLast> userStationList = assemblyWorkLastDao.selectList(param); |
| | | if(userStationList.size() > 0){ |
| | | throw new RuntimeException("员工("+userStationList.get(0).getUserName()+")编码:"+ userStationList.get(0).getUserId() + "已经绑定该工站("+userStationList.get(0).getStationName()+")编码:" + userStationList.get(0).getStationId() + ".请先让其解绑"); |
| | | } |
| | | public String checkStationUsed(QueryVo last){ |
| | | return stationInfo.get(0); |
| | | } |
| | | public String checkUserAndStation(QueryVo last){ |
| | | String message = "OK"; |
| | | Long userId = null; |
| | | Long stationId = null; |
| | | String userMsg = checkUser(last.getUserId()); |
| | | String stationMsg = checkStation(last.getStationId()); |
| | | String userMsg ="";// checkUser(last.getUserId()); |
| | | String stationMsg = "";//checkStationUsed(last.getStationId()); |
| | | //工站103 |
| | | if(last.getUserId().startsWith("103")){ |
| | | stationId = getStationInfo(last.getUserId()).getId(); |
| | | }else{ |
| | | userId = getUserInfo(last.getUserId()).getId(); |
| | | } |
| | | if(last.getStationId().startsWith("103")){ |
| | | stationId = getStationInfo(last.getStationId()).getId(); |
| | | }else{ |
| | | //userMsg = checkUser(last.getStationId()); |
| | | } |
| | | |
| | | if(userMsg.startsWith("FALSE") || stationMsg.startsWith("FALSE")){ |
| | | if(userMsg.startsWith("FALSE") && stationMsg.startsWith("FALSE")){ |
| | | message = userMsg +","+ stationMsg.split("\\^")[1]; |
| | |
| | | message = "FALSE^员工编码:"+ last.getUserId() + "或工站编码:" + last.getStationId() + "不正确,请检查"; |
| | | return message; |
| | | } |
| | | //检查表中stationId是否已经存在 |
| | | StaAssemblyWorkLast param = new StaAssemblyWorkLast(); |
| | | param.setStationId(stationId); |
| | | param.setStatus(1); |
| | | List<StaAssemblyWorkLast> userStationList = assemblyWorkLastDao.selectList(param); |
| | | if(userStationList.size() > 0){ |
| | | message = "FALSE^员工编码:"+ userStationList.get(0).getUserId() + "已经绑定该工站编码:" + userStationList.get(0).getStationId() + ".请先让其解绑"; |
| | | }//message = "OK^员工编码:"+ userId+ "已经绑定该工站编码:" + stationId + ".验证通过"; |
| | | return message; |
| | | } |
| | | public List<PrAssemblyPlan> selectAssyPlanList(PrAssemblyPlan params){ |