| | |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.base.model.FactoryIdModel; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; |
| | | import org.jeecg.modules.mdc.model.MdcEquipmentTree; |
| | | import org.jeecg.modules.mdc.model.ProductionIdModel; |
| | | import org.jeecg.modules.mdc.service.IFactoryEquipmentService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentDepartService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.service.IMdcProductionEquipmentService; |
| | |
| | | private IMdcEquipmentDepartService mdcEquipmentDepartService; |
| | | |
| | | @Resource |
| | | private IMdcProductionEquipmentService mdcProductionEquipmentService; |
| | | private IFactoryEquipmentService factoryEquipmentService; |
| | | |
| | | // @Resource |
| | | // private IMdcProductionEquipmentService mdcProductionEquipmentService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | |
| | | return Result.OK("批量移除成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 批量移除产线和设备关系 |
| | | */ |
| | | @AutoLog(value = "设备产线表-批量移除产线和设备关系") |
| | | @ApiOperation(value = "设备产线表-批量移除产线和设备关系", notes = "设备产线表-批量移除产线和设备关系") |
| | | @PostMapping(value = "/removeEquipmentsForProduction") |
| | | public Result<?> removeEquipmentsForProduction(@RequestParam(name = "productionId", required = true) String productionId, |
| | | @RequestParam(name = "equipmentIds", required = true) String equipmentIds) { |
| | | if (StringUtils.isNotBlank(productionId) && StringUtils.isNotBlank(equipmentIds)) { |
| | | List<String> equipmentIdList = Arrays.asList(equipmentIds.split(",")); |
| | | mdcEquipmentService.removeEquipmentsForProduction(productionId, equipmentIdList); |
| | | } |
| | | return Result.OK("批量移除成功!"); |
| | | } |
| | | // /** |
| | | // * 批量移除产线和设备关系 |
| | | // */ |
| | | // @AutoLog(value = "设备产线表-批量移除产线和设备关系") |
| | | // @ApiOperation(value = "设备产线表-批量移除产线和设备关系", notes = "设备产线表-批量移除产线和设备关系") |
| | | // @PostMapping(value = "/removeEquipmentsForProduction") |
| | | // public Result<?> removeEquipmentsForProduction(@RequestParam(name = "productionId", required = true) String productionId, |
| | | // @RequestParam(name = "equipmentIds", required = true) String equipmentIds) { |
| | | // if (StringUtils.isNotBlank(productionId) && StringUtils.isNotBlank(equipmentIds)) { |
| | | // List<String> equipmentIdList = Arrays.asList(equipmentIds.split(",")); |
| | | // mdcEquipmentService.removeEquipmentsForProduction(productionId, equipmentIdList); |
| | | // } |
| | | // return Result.OK("批量移除成功!"); |
| | | // } |
| | | |
| | | /** |
| | | * 移除产线和设备关系 |
| | | */ |
| | | @AutoLog(value = "设备产线表-移除产线和设备关系") |
| | | @ApiOperation(value = "设备产线表-移除产线和设备关系", notes = "设备产线表-移除产线和设备关系") |
| | | @PostMapping(value = "/removeEquipmentForProduction") |
| | | public Result<?> removeEquipmentForProduction(@RequestParam(name = "productionId", required = true) String productionId, |
| | | @RequestParam(name = "equipmentId", required = true) String equipmentId) { |
| | | if (StringUtils.isNotBlank(productionId) && StringUtils.isNotBlank(equipmentId)) { |
| | | mdcEquipmentService.removeEquipmentForProduction(productionId, equipmentId); |
| | | } |
| | | return Result.OK("移除成功!"); |
| | | } |
| | | // /** |
| | | // * 移除产线和设备关系 |
| | | // */ |
| | | // @AutoLog(value = "设备产线表-移除产线和设备关系") |
| | | // @ApiOperation(value = "设备产线表-移除产线和设备关系", notes = "设备产线表-移除产线和设备关系") |
| | | // @PostMapping(value = "/removeEquipmentForProduction") |
| | | // public Result<?> removeEquipmentForProduction(@RequestParam(name = "productionId", required = true) String productionId, |
| | | // @RequestParam(name = "equipmentId", required = true) String equipmentId) { |
| | | // if (StringUtils.isNotBlank(productionId) && StringUtils.isNotBlank(equipmentId)) { |
| | | // mdcEquipmentService.removeEquipmentForProduction(productionId, equipmentId); |
| | | // } |
| | | // return Result.OK("移除成功!"); |
| | | // } |
| | | |
| | | /** |
| | | * 添加 |
| | |
| | | public Result<MdcEquipment> add(@RequestBody MdcEquipment mdcEquipment) { |
| | | Result<MdcEquipment> result = new Result<>(); |
| | | String selectedDeparts = mdcEquipment.getSelectedDeparts(); |
| | | String selectedProduction = mdcEquipment.getSelectedProduction(); |
| | | String selectedProduction = mdcEquipment.getSelectedFactory(); |
| | | mdcEquipment.setEquipmentStatus(CommonConstant.STATUS_NORMAL); |
| | | try { |
| | | mdcEquipmentService.saveMdcEquipment(mdcEquipment, selectedDeparts, selectedProduction); |
| | |
| | | */ |
| | | @AutoLog(value = "设备表-查询指定设备和产线关联的数据") |
| | | @ApiOperation(value = "设备表-查询指定设备和产线关联的数据", notes = "设备表-查询指定设备和产线关联的数据") |
| | | @GetMapping(value = "/equipmentProductionList") |
| | | public Result<List<ProductionIdModel>> getEquipmentProductionList(@RequestParam(name = "equipmentId", required = true) String equipmentId) { |
| | | Result<List<ProductionIdModel>> result = new Result<>(); |
| | | @GetMapping(value = "/equipmentFactoryList") |
| | | public Result<List<FactoryIdModel>> equipmentFactoryList(@RequestParam(name = "equipmentId", required = true) String equipmentId) { |
| | | Result<List<FactoryIdModel>> result = new Result<>(); |
| | | try { |
| | | List<ProductionIdModel> proIdModelList = this.mdcProductionEquipmentService.queryProductionIdsOfEquipment(equipmentId); |
| | | List<FactoryIdModel> proIdModelList = this.factoryEquipmentService.queryFactoryIdsOfEquipment(equipmentId); |
| | | if (proIdModelList != null && !proIdModelList.isEmpty()) { |
| | | result.setSuccess(true); |
| | | result.setMessage("查找成功"); |
| | |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | // /** |
| | | // * 查询指定设备和产线关联的数据 |
| | | // */ |
| | | // @AutoLog(value = "设备表-查询指定设备和产线关联的数据") |
| | | // @ApiOperation(value = "设备表-查询指定设备和产线关联的数据", notes = "设备表-查询指定设备和产线关联的数据") |
| | | // @GetMapping(value = "/equipmentProductionList") |
| | | // public Result<List<ProductionIdModel>> getEquipmentProductionList(@RequestParam(name = "equipmentId", required = true) String equipmentId) { |
| | | // Result<List<ProductionIdModel>> result = new Result<>(); |
| | | // try { |
| | | // List<ProductionIdModel> proIdModelList = this.mdcProductionEquipmentService.queryProductionIdsOfEquipment(equipmentId); |
| | | // if (proIdModelList != null && !proIdModelList.isEmpty()) { |
| | | // result.setSuccess(true); |
| | | // result.setMessage("查找成功"); |
| | | // result.setResult(proIdModelList); |
| | | // } else { |
| | | // result.setSuccess(false); |
| | | // result.setMessage("查找失败"); |
| | | // } |
| | | // return result; |
| | | // } catch (Exception e) { |
| | | // log.error(e.getMessage(), e); |
| | | // result.setSuccess(false); |
| | | // result.setMessage("查找过程中出现了异常: " + e.getMessage()); |
| | | // return result; |
| | | // } |
| | | // } |
| | | |
| | | /** |
| | | * 加载部门设备树 |
| | |
| | | @ApiOperation(value = "设备表-加载产线设备树", notes = "设备表-加载产线设备树") |
| | | @GetMapping(value = "/queryTreeListByProduction") |
| | | public Result<List<MdcEquipmentTree>> queryTreeListByProduction() { |
| | | Result<List<MdcEquipmentTree>> result = new Result<>(); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | try { |
| | | List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProduction(userId); |
| | | result.setSuccess(true); |
| | | result.setResult(mdcEquipmentTreeList); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 加载产线设备树 |
| | | */ |
| | | @AutoLog(value = "设备表-加载产线设备树") |
| | | @ApiOperation(value = "设备表-加载产线设备树", notes = "设备表-加载产线设备树") |
| | | @GetMapping(value = "/queryTreeListByFactory") |
| | | public Result<List<MdcEquipmentTree>> queryTreeListByFactory() { |
| | | Result<List<MdcEquipmentTree>> result = new Result<>(); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | |
| | | } |
| | | |
| | | |
| | | @AutoLog(value = "设备表-通过车间ids获取设备树") |
| | | @ApiOperation(value = "设备表-通过车间ids获取设备树", notes = "设备表-通过车间ids获取设备树") |
| | | @GetMapping(value = "/loadTreeListByProductionIds") |
| | | public Result<?> loadTreeListByProductionIds(@RequestParam(name = "ids", required = true) String ids) { |
| | | Result<List<MdcEquipmentTree>> result = new Result<>(); |
| | | try { |
| | | List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProductionIds(ids); |
| | | result.setSuccess(true); |
| | | result.setResult(mdcEquipmentTreeList); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | return result; |
| | | } |
| | | // @AutoLog(value = "设备表-通过车间ids获取设备树") |
| | | // @ApiOperation(value = "设备表-通过车间ids获取设备树", notes = "设备表-通过车间ids获取设备树") |
| | | // @GetMapping(value = "/loadTreeListByProductionIds") |
| | | // public Result<?> loadTreeListByProductionIds(@RequestParam(name = "ids", required = true) String ids) { |
| | | // Result<List<MdcEquipmentTree>> result = new Result<>(); |
| | | // try { |
| | | // List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProductionIds(ids); |
| | | // result.setSuccess(true); |
| | | // result.setResult(mdcEquipmentTreeList); |
| | | // } catch (Exception e) { |
| | | // log.error(e.getMessage(), e); |
| | | // } |
| | | // return result; |
| | | // } |
| | | } |