| | |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentVo; |
| | | import org.jeecg.modules.system.model.DepartIdModel; |
| | | import org.jeecg.modules.system.model.ProductionIdModel; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, MdcEquipment mdcEquipment) { |
| | | return super.exportXls(request, mdcEquipment, MdcEquipment.class, "设备表"); |
| | | // Step.1 组装查询条件 |
| | | //QueryWrapper<MdcEquipment> queryWrapper = QueryGenerator.initQueryWrapper(mdcEquipment, request.getParameterMap()); |
| | | //Step.2 AutoPoi 导出Excel |
| | | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
| | | List<MdcEquipment> pageList = mdcEquipmentService.exportXlsList(mdcEquipment); |
| | | List<String> equipmentIds = pageList.stream().map(MdcEquipment::getId).collect(Collectors.toList()); |
| | | if (!equipmentIds.isEmpty()) { |
| | | Map<String, String> equDepNames = mdcEquipmentService.getDepNamesByEquipmentIds(equipmentIds); |
| | | Map<String, String> equProNames = mdcEquipmentService.getProNamesByEquipmentIds(equipmentIds); |
| | | pageList.forEach(item -> { |
| | | item.setOrgCodeTxt(equDepNames.get(item.getId())); |
| | | item.setProductionName(equProNames.get(item.getId())); |
| | | }); |
| | | } |
| | | mv.addObject(NormalExcelConstants.FILE_NAME, "设备列表"); |
| | | mv.addObject(NormalExcelConstants.CLASS, MdcEquipment.class); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | ExportParams exportParams = new ExportParams("设备列表数据", "导出人:" + user.getRealname(), "导出信息"); |
| | | // exportParams.setImageBasePath(upLoadPath); |
| | | mv.addObject(NormalExcelConstants.PARAMS, exportParams); |
| | | mv.addObject(NormalExcelConstants.DATA_LIST, pageList); |
| | | return mv; |
| | | } |
| | | |
| | | /** |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.dto.MdcBigScreenEquipmentDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcWorkshopEquipment; |
| | |
| | | @ApiOperation(value = "大屏车间信息-首页获取大屏入口列表", notes = "大屏车间信息-首页获取大屏入口列表") |
| | | @GetMapping(value = "/getWorkshopList") |
| | | public Result<List<MdcWorkshopInfo>> getWorkshopList() { |
| | | List<MdcWorkshopInfo> list = mdcWorkshopInfoService.list(); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | List<MdcWorkshopInfo> list = mdcWorkshopInfoService.listByUser(userId); |
| | | return Result.OK(list); |
| | | } |
| | | |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecg.common.system.base.entity.JeecgEntity; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | |
| | |
| | | /** |
| | | * 报警号 |
| | | */ |
| | | @Excel(name = "报警号", width = 15) |
| | | //@Excel(name = "报警号", width = 15) |
| | | @ApiModelProperty(value = "报警号") |
| | | private String alarm; |
| | | /** |
| | | * 采集时间 |
| | | */ |
| | | @Excel(name = "采集时间", width = 15) |
| | | //@Excel(name = "采集时间", width = 15) |
| | | @ApiModelProperty(value = "采集时间") |
| | | private String collectTime; |
| | | /** |
| | |
| | | /** |
| | | * 设备实时状态 |
| | | */ |
| | | @Excel(name = "设备实时状态", width = 15) |
| | | //@Excel(name = "设备实时状态", width = 15) |
| | | @ApiModelProperty(value = "设备实时状态") |
| | | private Integer oporation; |
| | | /** |
| | |
| | | /** |
| | | * 采集参数表 |
| | | */ |
| | | @Excel(name = "采集参数表", width = 15) |
| | | @Excel(name = "采集参数表", width = 30) |
| | | @ApiModelProperty(value = "采集参数表") |
| | | private String saveTableName; |
| | | /** |
| | |
| | | /** |
| | | * 设备状态 |
| | | */ |
| | | @Excel(name = "设备状态", width = 15) |
| | | @Excel(name = "设备状态", width = 15, dicCode = "mdc_equipment_status") |
| | | @Dict(dicCode = "mdc_equipment_status") |
| | | @ApiModelProperty(value = "设备状态") |
| | | private Integer equipmentStatus; |
| | | |
| | | /**部门名称*/ |
| | | @Excel(name = "部门名称", width = 15) |
| | | private transient String orgCodeTxt; |
| | | |
| | | /**产线名称*/ |
| | | @Excel(name = "车间名称", width = 15) |
| | | private transient String productionName; |
| | | |
| | | @TableField(exist = false) |
| | |
| | | @ApiModelProperty(value = "设备编号颜色") |
| | | private String equipmentIdColor; |
| | | |
| | | /** |
| | | * 菜单权限编码,例如:“sys:schedule:list,sys:schedule:info”,多个逗号隔开 |
| | | */ |
| | | @ApiModelProperty(value = "菜单权限编码") |
| | | private String perms; |
| | | |
| | | |
| | | } |
| | |
| | | equipmentRateJudge = Integer.valueOf(dictModelList1.get(0).getValue()); |
| | | } |
| | | // 获取利用率正常值 |
| | | List<DictModel> dictModelList2 = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_EQUIPMENT_SPEED_JUDGE); |
| | | List<DictModel> dictModelList2 = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_EQUIPMENT_RATE_NORMAL); |
| | | Integer equipmentRateNormal = 20; |
| | | if (dictModelList2 != null && !dictModelList2.isEmpty()) { |
| | | equipmentRateNormal = Integer.valueOf(dictModelList2.get(0).getValue()); |
| | | } |
| | | // 获取设备状态天数 |
| | | List<DictModel> dictModelList3 = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_EQUIPMENT_RATE_NORMAL); |
| | | List<DictModel> dictModelList3 = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_EQUIPMENT_SPEED_JUDGE); |
| | | Integer equipmentStatusJudge = 5; |
| | | if (dictModelList3 != null && !dictModelList3.isEmpty()) { |
| | | equipmentStatusJudge = Integer.valueOf(dictModelList3.get(0).getValue()); |
| | |
| | | if (flag) { |
| | | // 上报 |
| | | MessageDTO messageDTO = new MessageDTO(); |
| | | messageDTO.setTitle("设备利用率报警!"); |
| | | messageDTO.setCategory("预警消息"); |
| | | messageDTO.setFromUser("admin"); |
| | | messageDTO.setToUser("admin"); |
| | |
| | | if (flag) { |
| | | // 上报 |
| | | MessageDTO messageDTO = new MessageDTO(); |
| | | messageDTO.setTitle("设备状态长期无变化报警!"); |
| | | messageDTO.setCategory("预警消息"); |
| | | messageDTO.setFromUser("admin"); |
| | | messageDTO.setToUser("admin"); |
| | |
| | | |
| | | @InterceptorIgnore(tenantLine = "1") |
| | | MdcEquipmentDto getWorkLineLast(@Param("tableName") String saveTableName); |
| | | |
| | | /** |
| | | * 导出list |
| | | * @param mdcEquipment |
| | | * @return |
| | | */ |
| | | List<MdcEquipment> exportXlsList(@Param("mdcEquipment") MdcEquipment mdcEquipment); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 大屏信息 |
| | | * |
| | | * @param workshopId |
| | | * @return |
| | | */ |
| | | List<MdcBigScreenEquipmentDto> getBigScreenInfo(@Param("workshopId") String workshopId); |
| | | |
| | | /** |
| | | * 大屏车间列表 |
| | | * |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<MdcWorkshopInfo> listByUser(@Param("userId") String userId); |
| | | } |
| | |
| | | AND t1.drive_type = #{mdcEquipment.driveType} |
| | | </if> |
| | | <if test="mdcEquipment.productionName != null and mdcEquipment.productionName != '' "> |
| | | AND t3.production_name LIKE CONCAT(CONCAT('%',#{mdcEquipment.productionName}),'%') |
| | | AND t3.id = #{ mdcEquipment.productionName } OR t3.parent_id = #{ mdcEquipment.productionName } |
| | | </if> |
| | | </where> |
| | | order by t1.sort_no |
| | |
| | | select top 1 spindlespeed, actualspindlespeed from [${tableName}] order by CollectTime desc |
| | | </select> |
| | | |
| | | <select id="exportXlsList" resultType="org.jeecg.modules.mdc.entity.MdcEquipment"> |
| | | SELECT |
| | | t1.* |
| | | FROM |
| | | mdc_equipment t1 |
| | | LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id |
| | | LEFT JOIN mdc_production t3 ON t2.production_id = t3.id |
| | | <where> |
| | | <if test="mdcEquipment.equipmentId != null and mdcEquipment.equipmentId != '' "> |
| | | AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentId}),'%') |
| | | </if> |
| | | <if test="mdcEquipment.equipmentName != null and mdcEquipment.equipmentName != '' "> |
| | | AND t1.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentName}),'%') |
| | | </if> |
| | | <if test="mdcEquipment.equipmentModel != null and mdcEquipment.equipmentModel != '' "> |
| | | AND t1.equipment_name = #{mdcEquipment.equipmentModel} |
| | | </if> |
| | | <if test="mdcEquipment.equipmentType != null and mdcEquipment.equipmentType != '' "> |
| | | AND t1.equipmentType = #{mdcEquipment.equipmentType} |
| | | </if> |
| | | <if test="mdcEquipment.driveType != null and mdcEquipment.driveType != '' "> |
| | | AND t1.drive_type = #{mdcEquipment.driveType} |
| | | </if> |
| | | <if test="mdcEquipment.productionName != null and mdcEquipment.productionName != '' "> |
| | | AND t3.id = #{ mdcEquipment.productionName } OR t3.parent_id = #{ mdcEquipment.productionName } |
| | | </if> |
| | | </where> |
| | | order by t1.sort_no |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | AND a.CollectTime= b.maxgdtime |
| | | AND mew.workshop_id = #{ workshopId } |
| | | </select> |
| | | |
| | | <select id="listByUser" resultType="org.jeecg.modules.mdc.entity.MdcWorkshopInfo"> |
| | | SELECT |
| | | DISTINCT t1.* |
| | | FROM |
| | | mdc_workshop_info t1 |
| | | LEFT JOIN sys_permission t2 ON t1.perms = t2.perms |
| | | LEFT JOIN sys_role_permission t3 ON t2.id = t3.permission_id |
| | | LEFT JOIN sys_role t4 ON t4.id = t3.role_id |
| | | LEFT JOIN sys_user_role t5 ON t5.role_id = t4.id |
| | | WHERE |
| | | t5.user_id = #{ userId } |
| | | </select> |
| | | </mapper> |
| | |
| | | */ |
| | | void monitoringSpeedProcess(); |
| | | |
| | | /** |
| | | * 导出List |
| | | * @param mdcEquipment |
| | | * @return |
| | | */ |
| | | List<MdcEquipment> exportXlsList(MdcEquipment mdcEquipment); |
| | | |
| | | } |
| | |
| | | * 大屏信息 |
| | | */ |
| | | List<MdcBigScreenEquipmentDto> getBigScreenInfo(String workshopId); |
| | | |
| | | /** |
| | | * 车间大屏列表 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<MdcWorkshopInfo> listByUser(String userId); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 导出list |
| | | * |
| | | * @param mdcEquipment |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MdcEquipment> exportXlsList(MdcEquipment mdcEquipment) { |
| | | return this.baseMapper.exportXlsList(mdcEquipment); |
| | | } |
| | | |
| | | } |
| | |
| | | public List<MdcBigScreenEquipmentDto> getBigScreenInfo(String workshopId) { |
| | | return this.baseMapper.getBigScreenInfo(workshopId); |
| | | } |
| | | |
| | | /** |
| | | * 大屏车间列表 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MdcWorkshopInfo> listByUser(String userId) { |
| | | return this.baseMapper.listByUser(userId); |
| | | } |
| | | } |