| | |
| | | if(existsByCode(vo.getCode(),null)){ |
| | | throw new ServiceException("机床编码已存在:"+vo.getCode()); |
| | | } |
| | | if(existsByEquipmentCode(vo.getEquipmentCode(),null)){ |
| | | throw new ServiceException("设备编号已存在:"+vo.getEquipmentCode()); |
| | | } |
| | | |
| | | Machine machine = new Machine(); |
| | | BeanUtil.copyProperties(vo, machine); |
| | |
| | | Path dir; |
| | | if(StringUtils.isNotBlank(machine.getProgSendDir())){ |
| | | createDirIsNotExists(machine.getProgSendDir()); |
| | | |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(machine.getProgReceiveDir())){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据 设备编号判断机床是否存在 |
| | | * @param equipmentCode 设备编号 |
| | | * @param excludeId 排除id |
| | | * @return 是否存在 |
| | | */ |
| | | boolean existsByEquipmentCode(String equipmentCode,Long excludeId){ |
| | | return this.lambdaQuery().eq(Machine::getEquipmentCode, equipmentCode).ne(excludeId!=null,Machine::getId, excludeId).count()>0; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改机床信息 |
| | | * @param vo |
| | | * @return |
| | |
| | | if(existsByCode(vo.getCode(),vo.getId())){ |
| | | throw new ServiceException("机床编码已存在:"+vo.getCode()); |
| | | } |
| | | |
| | | if(existsByEquipmentCode(vo.getEquipmentCode(),vo.getId())){ |
| | | throw new ServiceException("设备编号已存在:"+vo.getEquipmentCode()); |
| | | } |
| | | Machine machine = this.getById(vo.getId()); |
| | | |
| | | Machine machineBak = new Machine(); |
| | |
| | | |
| | | machine.setMachineSpec(vo.getMachineSpec()); |
| | | machine.setCode(vo.getCode()); |
| | | machine.setEquipmentCode(vo.getEquipmentCode()); |
| | | machine.setName(vo.getName()); |
| | | machine.setMachineGroupCode(vo.getMachineGroupCode()); |
| | | machine.setManufacturer(vo.getManufacturer()); |
| | |
| | | * @param sendPathLine 下发路径注释文本 |
| | | */ |
| | | public Machine getMachineBySendPathAnnotation(String sendPathLine) { |
| | | //路径为空,不匹配任何机器 |
| | | if(StringUtils.isBlank(sendPathLine)){ |
| | | return null; |
| | | } |
| | | //去掉首位括号,排除发那科机床注释 |
| | | String sendPath = escapeSqlWildcard(StringUtils.trim(StringUtils.removeEnd(StringUtils.removeStart(sendPathLine,"("),")"))); |
| | | |