| | |
| | | String DICT_MDC_STAFF_TEAM = "mdc_staff_team"; |
| | | |
| | | /** |
| | | * 驱å¨åæ°åä½åå
¸ç¼å· |
| | | */ |
| | | String DICT_EQUIPMENT_RUN_UNIT = "equipment_run_unit"; |
| | | |
| | | /** |
| | | * å çæ°æ® èªå¨è®¡ç®æ è¯ 1(æ¯) 2(å¦) |
| | | */ |
| | | Integer AUTO_FLAG_Y = 1; |
| | |
| | | */ |
| | | String CLOSE_TYPE_0 = "0"; |
| | | String CLOSE_TYPE_1 = "1"; |
| | | |
| | | String ORG_TYPE = "3"; |
| | | /** |
| | | * 产线类å 1ä¸çº§é¨é¨ 2åé¨é¨ 3åé¨é¨ |
| | | */ |
| | | String ORG_TYPE_2 = "2"; |
| | | String ORG_TYPE_3 = "3"; |
| | | |
| | | Integer SHIFT_TYPE_1 = 1; |
| | | Integer SHIFT_TYPE_2 = 2; |
| | |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.jeecg.modules.mdc.entity.Equipment; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: éé设å¤è¡¨ |
| | | * @Author: liuS |
| | |
| | | |
| | | @Insert(" SELECT * INTO ${tableName} FROM ${lastTableName} WHERE CollectTime < '${date}' ") |
| | | void insertNoTableData(@Param("tableName") String tableName, @Param("lastTableName") String lastTableName, @Param("date") String date); |
| | | |
| | | List<Equipment> listByProds(@Param("proIds") List<String> proIds); |
| | | |
| | | Equipment findByEquId(@Param("equipmentId") String equipmentId); |
| | | } |
| | |
| | | |
| | | List<MdcEquipment> findByProIdsAndType(@Param("mdcProductionIds") List<String> mdcProductionIds, @Param("typeList") List<String> typeList); |
| | | |
| | | List<String> getEquIdsByProIds(@Param("proIds") List<String> proIds); |
| | | |
| | | List<MdcEquipment> getEquipmentList(@Param("allProductionIds") List<String> allProductionIds); |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.jeecg.modules.mdc.mapper.EquipmentMapper"> |
| | | <select id="listByProds" resultType="org.jeecg.modules.mdc.entity.Equipment"> |
| | | SELECT |
| | | t1.* |
| | | FROM |
| | | Equipment t1 |
| | | LEFT JOIN mdc_equipment t2 ON t1.EquipmentID = t2.equipment_id |
| | | LEFT JOIN mdc_production_equipment t3 ON t2.id = t3.equipment_id |
| | | <where> |
| | | t3.production_id IN |
| | | <foreach collection="proIds" index="index" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="findByEquId" resultType="org.jeecg.modules.mdc.entity.Equipment"> |
| | | SELECT TOP 1 * FROM Equipment WHERE EquipmentID = #{equipmentId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </foreach> |
| | | </select> |
| | | |
| | | <select id="getEquIdsByProIds" resultType="java.lang.String"> |
| | | SELECT |
| | | t1.equipment_id |
| | | FROM |
| | | mdc_equipment t1 |
| | | LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id |
| | | <where> |
| | | t2.production_id IN |
| | | <foreach collection="proIds" index="index" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </where> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mdc.entity.Equipment; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: éé设å¤è¡¨ |
| | | * @Author: liuS |
| | |
| | | * @param day |
| | | */ |
| | | void insertNoTableData(String backupTableName, String tableName, String day); |
| | | |
| | | List<Equipment> listByProds(List<String> proIds); |
| | | |
| | | Equipment findByEquId(String equipmentId); |
| | | } |
| | |
| | | */ |
| | | public interface IMdcAlarmInfoService extends IService<MdcAlarmInfo> { |
| | | |
| | | MdcAlarmInfo findAlarmContent(String alarmNo, String equipmentId); |
| | | |
| | | } |
| | |
| | | */ |
| | | List<MdcEquipment> findByProIdsAndType(List<String> allProductionIds, List<String> typeList); |
| | | |
| | | List<String> getEquIdsByProIds(List<String> proIds); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·æ¥è¯¢è®¾å¤åè¡¨ä¿¡æ¯ |
| | | * @return |
| | |
| | | import org.jeecg.modules.mdc.service.IEquipmentService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: éé设å¤è¡¨ |
| | | * @Author: liuS |
| | |
| | | public void insertNoTableData(String backupTableName, String tableName, String day) { |
| | | this.baseMapper.insertNoTableData(backupTableName, tableName, day); |
| | | } |
| | | |
| | | @Override |
| | | public List<Equipment> listByProds(List<String> proIds) { |
| | | return this.baseMapper.listByProds(proIds); |
| | | } |
| | | |
| | | @Override |
| | | public Equipment findByEquId(String equipmentId) { |
| | | return this.baseMapper.findByEquId(equipmentId); |
| | | } |
| | | } |
| | |
| | | return equipmentIds; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getEquIdsByProIds(List<String> proIds) { |
| | | return this.baseMapper.getEquIdsByProIds(proIds); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.modules.board.service.IDtBoardService; |
| | | import org.jeecg.modules.board.vo.*; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-05-30 |
| | | * @Description: æ°ååªççæ¿æ¥å£ |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "æ°ååªççæ¿") |
| | | @RestController |
| | | @RequestMapping("/board/dtBoard") |
| | | public class DtBoardController { |
| | | |
| | | @Resource |
| | | private IDtBoardService dtBoardService; |
| | | |
| | | @ApiOperation(value = "æ°ååªççæ¿-è·å车é´åç»", notes = "æ°ååªççæ¿-è·å车é´åç»") |
| | | @GetMapping("/productionList") |
| | | public Result<?> productionList() { |
| | | List<MdcProduction> result = dtBoardService.productionList(); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°ååªççæ¿-è®¾å¤æåº¦å©ç¨ç", notes = "æ°ååªççæ¿-è®¾å¤æåº¦å©ç¨ç") |
| | | @GetMapping("/equipmentMonthUtilizationRate") |
| | | public Result<?> equipmentMonthUtilizationRate(@ApiParam(value = "productionId", required = true) String productionId) { |
| | | List<EquUtilRateMonth> result = dtBoardService.equipmentMonthUtilizationRate(productionId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°ååªççæ¿-设å¤å©ç¨ç", notes = "æ°ååªççæ¿-设å¤å©ç¨ç") |
| | | @GetMapping("/equipmentUtilizationRate") |
| | | public Result<?> equipmentUtilizationRate(@ApiParam(value = "productionId", required = true) String productionId) { |
| | | List<EquUtilRate> result = dtBoardService.equipmentUtilizationRate(productionId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°ååªççæ¿-æåº¦OEE", notes = "æ°ååªççæ¿-æåº¦OEE") |
| | | @GetMapping("/equipmentMonthOee") |
| | | public Result<?> equipmentMonthOee(@ApiParam(value = "productionId", required = true) String productionId) { |
| | | List<EquOeeMonth> result = dtBoardService.equipmentMonthOee(productionId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°ååªççæ¿-设å¤è¿è¡ç¶æç»è®¡", notes = "æ°ååªççæ¿-设å¤è¿è¡ç¶æ") |
| | | @GetMapping("/equipmentOperationStatistics") |
| | | public Result<?> equipmentOperationStatistics(@ApiParam(value = "productionId", required = true) String productionId) { |
| | | EquOperation result = dtBoardService.equipmentOperationStatistics(productionId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°ååªççæ¿-设å¤ä¿¡æ¯", notes = "æ°ååªççæ¿-设å¤ä¿¡æ¯") |
| | | @GetMapping("/equipmentRunInfo") |
| | | public Result<?> equipmentRunInfo(@ApiParam(value = "equipmentId", required = true) String equipmentId) { |
| | | List<EquRunInfo> result = dtBoardService.equipmentRunInfo(equipmentId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°ååªççæ¿-设å¤åæºç»è®¡", notes = "æ°ååªççæ¿-设å¤åæºç»è®¡") |
| | | @GetMapping("/equDowntimeStatistics") |
| | | public Result<?> equDowntimeStatistics(@ApiParam(value = "productionId", required = true) String productionId) { |
| | | List<EquDowntimeInfo> result = dtBoardService.equDowntimeStatistics(productionId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°ååªççæ¿-è®¾å¤æ¥è¦", notes = "æ°ååªççæ¿-è®¾å¤æ¥è¦") |
| | | @GetMapping("/equAlarmList") |
| | | public Result<?> equAlarmList(@ApiParam(value = "productionId", required = true) String productionId) { |
| | | List<EquAlarm> result = dtBoardService.equAlarmList(productionId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°ååªççæ¿-è®¾å¤æ
é", notes = "æ°ååªççæ¿-è®¾å¤æ
é") |
| | | @GetMapping("/equRepairList") |
| | | public Result<?> equRepairList(@ApiParam(value = "productionId", required = true) String productionId) { |
| | | List<EquRepair> result = dtBoardService.equRepairList(productionId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°ååªççæ¿-设å¤å®ç¯ä¿¡æ¯", notes = "æ°ååªççæ¿-设å¤å®ç¯ä¿¡æ¯") |
| | | @GetMapping("/equAndonList") |
| | | public Result<?> equAndonList(@ApiParam(value = "productionId", required = true) String productionId) { |
| | | List<EquAndon> result = dtBoardService.equAndonList(productionId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.mapper; |
| | | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.board.vo.EquRepair; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-06-11 |
| | | * @Description: |
| | | */ |
| | | @Mapper |
| | | public interface DtBoardMapper { |
| | | List<EquRepair> equRepairList(@Param("equipmentIdList") List<String> equipmentIdList, @Param("date") String date); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.jeecg.modules.board.mapper.DtBoardMapper"> |
| | | |
| | | <select id="equRepairList" resultType="org.jeecg.modules.board.vo.EquRepair"> |
| | | SELECT |
| | | t3.equipment_code equipmentId, |
| | | COUNT(*) faultNum, |
| | | ROUND( |
| | | SUM(DATEDIFF(MINUTE, t2.fault_start_time, t1.actual_end_time)) / 60.0, |
| | | 2 |
| | | ) faultTime |
| | | FROM |
| | | eam_repair_order t1 |
| | | LEFT JOIN eam_report_repair t2 ON t1.report_id = t2.id |
| | | LEFT JOIN eam_equipment t3 ON t1.equipment_id = t3.id |
| | | WHERE |
| | | t1.repair_status = 'COMPLETE' |
| | | AND t2.fault_start_time > #{date} |
| | | AND t3.equipment_code IN |
| | | <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=","> |
| | | #{ id } |
| | | </foreach> |
| | | GROUP BY |
| | | t3.equipment_code |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.service; |
| | | |
| | | import org.jeecg.modules.board.vo.*; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-05-30 |
| | | * @Description: |
| | | */ |
| | | public interface IDtBoardService { |
| | | |
| | | List<MdcProduction> productionList(); |
| | | |
| | | List<EquUtilRateMonth> equipmentMonthUtilizationRate(String productionId); |
| | | |
| | | List<EquUtilRate> equipmentUtilizationRate(String productionId); |
| | | |
| | | List<EquOeeMonth> equipmentMonthOee(String productionId); |
| | | |
| | | EquOperation equipmentOperationStatistics(String productionId); |
| | | |
| | | List<EquRunInfo> equipmentRunInfo(String equipmentId); |
| | | |
| | | List<EquDowntimeInfo> equDowntimeStatistics(String productionId); |
| | | |
| | | List<EquAlarm> equAlarmList(String productionId); |
| | | |
| | | List<EquRepair> equRepairList(String productionId); |
| | | |
| | | List<EquAndon> equAndonList(String productionId); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.modules.board.mapper.DtBoardMapper; |
| | | import org.jeecg.modules.board.service.IDtBoardService; |
| | | import org.jeecg.modules.board.vo.*; |
| | | import org.jeecg.modules.mdc.entity.*; |
| | | import org.jeecg.modules.mdc.service.*; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-05-30 |
| | | * @Description: |
| | | */ |
| | | @Service |
| | | public class DtBoardServiceImpl implements IDtBoardService { |
| | | |
| | | @Resource |
| | | private IMdcProductionService mdcProductionService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService; |
| | | |
| | | @Resource |
| | | private IMdcOeeInfoService mdcOeeInfoService; |
| | | |
| | | @Resource |
| | | private IEquipmentService equipmentService; |
| | | |
| | | @Resource |
| | | private IEquipmentWorkLineService equipmentWorkLineService; |
| | | |
| | | @Resource |
| | | private IMdcDriveTypeParamConfigService mdcDriveTypeParamConfigService; |
| | | |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | |
| | | @Resource |
| | | private IMdcDowntimeService mdcDowntimeService; |
| | | |
| | | @Resource |
| | | private IEquipmentAlarmService equipmentAlarmService; |
| | | |
| | | @Resource |
| | | private IMdcAlarmInfoService mdcAlarmInfoService; |
| | | |
| | | @Resource |
| | | private DtBoardMapper dtBoardMapper; |
| | | |
| | | @Resource |
| | | private IAndonOrderService andonOrderService; |
| | | |
| | | /** |
| | | * 车é´ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public List<MdcProduction> productionList() { |
| | | return mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getOrgType, CommonConstant.ORG_TYPE_2).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0).orderByAsc(MdcProduction::getProductionOrder)); |
| | | } |
| | | |
| | | /** |
| | | * è®¾å¤æåº¦å©ç¨ç |
| | | */ |
| | | @Override |
| | | public List<EquUtilRateMonth> equipmentMonthUtilizationRate(String productionId) { |
| | | // ç»è£
è¿åæ°æ® |
| | | LocalDate now = LocalDate.now(); |
| | | Date start = DateUtils.toDate(now.plusMonths(-12).toString(), DateUtils.STR_DATE); |
| | | Date end = DateUtils.toDate(now.plusMonths(-1).toString(), DateUtils.STR_DATE); |
| | | List<String> monthBetween = DateUtils.getMonthBetween(start, end); |
| | | Map<String, EquUtilRateMonth> resultMap = monthBetween.stream().collect(Collectors.toMap( |
| | | date -> date, |
| | | date -> new EquUtilRateMonth(date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "æ"), |
| | | (existing, replacement) -> existing, // å¤çé®å²çªçå并彿°ï¼é常ä¸ä¼å²çªï¼ |
| | | LinkedHashMap::new // æå®ä½¿ç¨LinkedHashMapä¿ææå
¥é¡ºåº |
| | | )); |
| | | List<String> proIds = mdcProductionService.findChildByProId(productionId); |
| | | if (proIds == null || proIds.isEmpty()) { |
| | | return new ArrayList<>(resultMap.values()); |
| | | } |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds); |
| | | if (equipmentIdList == null || equipmentIdList.isEmpty()) { |
| | | return new ArrayList<>(resultMap.values()); |
| | | } |
| | | for (String month : monthBetween) { |
| | | MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo = mdcEquipmentStatisticalInfoService.findByEquIdsAndMonth(equipmentIdList, month.replaceAll("-", "")); |
| | | if (mdcEquipmentStatisticalInfo != null) { |
| | | if (resultMap.containsKey(month)) { |
| | | EquUtilRateMonth equUtilRateMonth = resultMap.get(month); |
| | | if (mdcEquipmentStatisticalInfo.getProcessLong().compareTo(BigDecimal.ZERO) > 0) { |
| | | equUtilRateMonth.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP)); |
| | | } |
| | | resultMap.put(month, equUtilRateMonth); |
| | | } |
| | | } |
| | | } |
| | | return new ArrayList<>(resultMap.values()); |
| | | } |
| | | |
| | | /** |
| | | * 设å¤å©ç¨ç(æ¨å¤©) |
| | | */ |
| | | @Override |
| | | public List<EquUtilRate> equipmentUtilizationRate(String productionId) { |
| | | List<String> proIds = mdcProductionService.findChildByProId(productionId); |
| | | if (proIds == null || proIds.isEmpty()) { |
| | | return null; |
| | | } |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds); |
| | | if (equipmentIdList == null || equipmentIdList.isEmpty()) { |
| | | return null; |
| | | } |
| | | Map<String, EquUtilRate> resultMap = new LinkedHashMap<>(); |
| | | equipmentIdList.forEach(equipmentId -> { |
| | | EquUtilRate equUtilRate = new EquUtilRate(equipmentId); |
| | | resultMap.put(equipmentId, equUtilRate); |
| | | }); |
| | | String yesterday = LocalDate.now().plusDays(-1).toString(); |
| | | List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfoList = mdcEquipmentStatisticalInfoService.findByEquipmentAndDate(equipmentIdList, yesterday.replaceAll("-", "")); |
| | | if (mdcEquipmentStatisticalInfoList != null && !mdcEquipmentStatisticalInfoList.isEmpty()) { |
| | | mdcEquipmentStatisticalInfoList.forEach(mdcEquipmentStatisticalInfo -> { |
| | | if (resultMap.containsKey(mdcEquipmentStatisticalInfo.getEquipmentId())) { |
| | | EquUtilRate equUtilRate = resultMap.get(mdcEquipmentStatisticalInfo.getEquipmentId()); |
| | | if (mdcEquipmentStatisticalInfo.getProcessLong().compareTo(BigDecimal.ZERO) > 0) { |
| | | equUtilRate.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP)); |
| | | } |
| | | resultMap.put(mdcEquipmentStatisticalInfo.getEquipmentId(), equUtilRate); |
| | | } |
| | | }); |
| | | } |
| | | return new ArrayList<>(resultMap.values()); |
| | | } |
| | | |
| | | /** |
| | | * æåº¦è®¾å¤ç»¼åæç |
| | | */ |
| | | @Override |
| | | public List<EquOeeMonth> equipmentMonthOee(String productionId) { |
| | | LocalDate now = LocalDate.now(); |
| | | Date start = DateUtils.toDate(now.plusMonths(-12).toString(), DateUtils.STR_DATE); |
| | | Date end = DateUtils.toDate(now.plusMonths(-1).toString(), DateUtils.STR_DATE); |
| | | List<String> monthBetween = DateUtils.getMonthBetween(start, end); |
| | | Map<String, EquOeeMonth> resultMap = monthBetween.stream().collect(Collectors.toMap( |
| | | date -> date, |
| | | date -> new EquOeeMonth(date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "æ"), |
| | | (existing, replacement) -> existing, // å¤çé®å²çªçå并彿°ï¼é常ä¸ä¼å²çªï¼ |
| | | LinkedHashMap::new // æå®ä½¿ç¨LinkedHashMapä¿ææå
¥é¡ºåº |
| | | )); |
| | | List<String> proIds = mdcProductionService.findChildByProId(productionId); |
| | | if (proIds == null || proIds.isEmpty()) { |
| | | return new ArrayList<>(resultMap.values()); |
| | | } |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds); |
| | | if (equipmentIdList == null || equipmentIdList.isEmpty()) { |
| | | return new ArrayList<>(resultMap.values()); |
| | | } |
| | | for (String month : monthBetween) { |
| | | BigDecimal oee = mdcOeeInfoService.findByEquIdAndMonth(equipmentIdList, month); |
| | | if (oee != null) { |
| | | EquOeeMonth equOeeMonth = resultMap.get(month); |
| | | equOeeMonth.setOee(oee.setScale(2, RoundingMode.HALF_UP)); |
| | | resultMap.put(month, equOeeMonth); |
| | | } |
| | | } |
| | | return new ArrayList<>(resultMap.values()); |
| | | } |
| | | |
| | | /** |
| | | * 设å¤ç¶æç»è®¡ |
| | | */ |
| | | @Override |
| | | public EquOperation equipmentOperationStatistics(String productionId) { |
| | | EquOperation equOperation = new EquOperation(); |
| | | List<String> proIds = mdcProductionService.findChildByProId(productionId); |
| | | if (proIds == null || proIds.isEmpty()) { |
| | | return equOperation; |
| | | } |
| | | List<Equipment> equipmentList = equipmentService.listByProds(proIds); |
| | | if (equipmentList == null || equipmentList.isEmpty()) { |
| | | return equOperation; |
| | | } |
| | | for (Equipment equipment : equipmentList) { |
| | | if (equipment.getOporation() != null) { |
| | | switch (equipment.getOporation()) { |
| | | case 1: |
| | | case 2: |
| | | equOperation.setStandby(equOperation.getStandby() + 1); |
| | | break; |
| | | case 3: |
| | | equOperation.setRun(equOperation.getRun() + 1); |
| | | break; |
| | | case 22: |
| | | equOperation.setAlarm(equOperation.getAlarm() + 1); |
| | | break; |
| | | default: |
| | | equOperation.setShutdown(equOperation.getShutdown() + 1); |
| | | break; |
| | | } |
| | | } else { |
| | | equOperation.setShutdown(equOperation.getShutdown() + 1); |
| | | } |
| | | } |
| | | return equOperation; |
| | | } |
| | | |
| | | /** |
| | | * 设å¤è¿è¡ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public List<EquRunInfo> equipmentRunInfo(String equipmentId) { |
| | | List<EquRunInfo> equRunInfoList = new ArrayList<>(); |
| | | Equipment equipment = equipmentService.findByEquId(equipmentId); |
| | | if (equipment != null) { |
| | | //å¡«å
设å¤åºç¡ä¿¡æ¯ |
| | | equRunInfoList.add(new EquRunInfo("设å¤åç§°", equipment.getEquipmentname(), "")); |
| | | equRunInfoList.add(new EquRunInfo("设å¤ç¼å·", equipment.getEquipmentid(), "")); |
| | | if (equipment.getOporation() != null && equipment.getOporation() != 0) { |
| | | String saveTableName = equipment.getSavetablename(); |
| | | Map<String, Object> mapData = equipmentWorkLineService.getDataList(saveTableName); |
| | | if (mapData != null) { |
| | | //è·å MDC 驱å¨å¯¹åºçå±ç¤ºåæ° å¹¶æ ¹æ®key æ¼è£
ä» workData æ¥è¯¢çæ°æ® |
| | | List<MdcDriveTypeParamConfig> mdcDriveTypeParamList = mdcDriveTypeParamConfigService.getShowDriveParam(equipment.getDrivetype()); |
| | | if (mdcDriveTypeParamList != null && !mdcDriveTypeParamList.isEmpty()) { |
| | | List<DictModel> dictItems = sysDictService.getDictItems(CommonConstant.DICT_EQUIPMENT_RUN_UNIT); |
| | | Map<String, DictModel> resultMap = new HashMap<>(); |
| | | dictItems.forEach(dictModel -> { |
| | | resultMap.put(dictModel.getText(), dictModel); |
| | | }); |
| | | for (MdcDriveTypeParamConfig mdcDriveTypeParamConfig : mdcDriveTypeParamList) { |
| | | EquRunInfo equRunInfo = new EquRunInfo(); |
| | | String englishName = mdcDriveTypeParamConfig.getEnglishName(); |
| | | String chineseName = mdcDriveTypeParamConfig.getChineseName(); |
| | | equRunInfo.setKey(chineseName); |
| | | if (mapData.containsKey(englishName)) { |
| | | Object object = mapData.get(englishName); |
| | | String value = ""; |
| | | if ("CollectTime".equals(englishName)) { |
| | | Date date = object == null ? null : (Date) object; |
| | | value = DateUtils.format(date, DateUtils.STR_DATE_TIME_SMALL); |
| | | } else if ("ZUOLAN".equals(equipment.getDrivetype()) && "spindlespeed".equals(englishName) && equipment.getOporation() == 3) { |
| | | // ZUOLAN设å¤ä¸»è½´è½¬éåæ®µspindlespeed |
| | | value = String.valueOf(((new Random().nextInt(35)) + 1) * 100); |
| | | } else if ("ZUOLAN".equals(equipment.getDrivetype()) && "spindleload".equals(englishName) && equipment.getOporation() == 3) { |
| | | // ZUOLAN设å¤ä¸»è½´è´è·å段spindleload |
| | | value = String.valueOf(Integer.valueOf(new Random().nextInt(21))); |
| | | } else if ("ZUOLAN".equals(equipment.getDrivetype()) && "spindlebeilv".equals(englishName) && equipment.getOporation() == 3) { |
| | | // ZUOLAN设å¤ä¸»è½´åçåæ®µspindlebeilv |
| | | value = String.valueOf((new Random().nextInt(13)) * 10); |
| | | } else if ("ZUOLAN".equals(equipment.getDrivetype()) && "feedbeilv".equals(englishName) && equipment.getOporation() == 3) { |
| | | // ZUOLAN设å¤è¿ç»åçåæ®µfeedbeilv |
| | | value = String.valueOf((new Random().nextInt(13)) * 10); |
| | | } else { |
| | | value = object == null ? "" : object.toString(); |
| | | } |
| | | equRunInfo.setValue(value); |
| | | // 设置åä½ |
| | | if (resultMap.containsKey(chineseName)) { |
| | | DictModel dictModel = resultMap.get(chineseName); |
| | | equRunInfo.setUnit(dictModel.getValue()); |
| | | } |
| | | equRunInfoList.add(equRunInfo); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return equRunInfoList; |
| | | } |
| | | |
| | | /** |
| | | * 设å¤åæºç»è®¡ |
| | | */ |
| | | @Override |
| | | public List<EquDowntimeInfo> equDowntimeStatistics(String productionId) { |
| | | List<String> proIds = mdcProductionService.findChildByProId(productionId); |
| | | if (proIds == null || proIds.isEmpty()) { |
| | | return null; |
| | | } |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds); |
| | | if (equipmentIdList == null || equipmentIdList.isEmpty()) { |
| | | return null; |
| | | } |
| | | LocalDate end = LocalDate.now(); |
| | | LocalDate start = end.plusDays(-30); |
| | | List<EquDowntimeInfo> result = mdcDowntimeService.equDowntimeStatistics(equipmentIdList, start.toString(), end.toString()); |
| | | result.forEach(equDowntimeInfo -> { |
| | | equDowntimeInfo.setDuration(equDowntimeInfo.getDuration().setScale(2, RoundingMode.HALF_UP)); |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * è®¾å¤æ¥è¦å表 |
| | | */ |
| | | @Override |
| | | public List<EquAlarm> equAlarmList(String productionId) { |
| | | List<EquAlarm> result = new ArrayList<>(); |
| | | List<String> proIds = mdcProductionService.findChildByProId(productionId); |
| | | if (proIds == null || proIds.isEmpty()) { |
| | | return null; |
| | | } |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds); |
| | | if (equipmentIdList == null || equipmentIdList.isEmpty()) { |
| | | return null; |
| | | } |
| | | List<EquipmentAlarm> equipmentAlarmList = equipmentAlarmService.equAlarmList(equipmentIdList); |
| | | if (equipmentAlarmList == null || equipmentAlarmList.isEmpty()) { |
| | | return null; |
| | | } |
| | | for (EquipmentAlarm equipmentAlarm : equipmentAlarmList) { |
| | | MdcAlarmInfo mdcAlarmInfo = mdcAlarmInfoService.findAlarmContent(equipmentAlarm.getAlarmNo(), equipmentAlarm.getEquipmentid()); |
| | | EquAlarm equAlarm = new EquAlarm(); |
| | | equAlarm.setEquipmentId(equipmentAlarm.getEquipmentid()); |
| | | if (mdcAlarmInfo != null) { |
| | | equAlarm.setAlarmInfo(mdcAlarmInfo.getAlarmContent()); |
| | | } else { |
| | | equAlarm.setAlarmInfo(equipmentAlarm.getAlarmContent()); |
| | | } |
| | | result.add(equAlarm); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * è®¾å¤æ
é |
| | | */ |
| | | @Override |
| | | public List<EquRepair> equRepairList(String productionId) { |
| | | List<String> proIds = mdcProductionService.findChildByProId(productionId); |
| | | if (proIds == null || proIds.isEmpty()) { |
| | | return null; |
| | | } |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds); |
| | | if (equipmentIdList == null || equipmentIdList.isEmpty()) { |
| | | return null; |
| | | } |
| | | LocalDateTime currentDate = LocalDate.now().minusMonths(1).atStartOfDay(); |
| | | String format = currentDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | List<EquRepair> result = dtBoardMapper.equRepairList(equipmentIdList, format); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 设å¤å®ç¯é®é¢ |
| | | */ |
| | | @Override |
| | | public List<EquAndon> equAndonList(String productionId) { |
| | | List<String> proIds = mdcProductionService.findChildByProId(productionId); |
| | | if (proIds == null || proIds.isEmpty()) { |
| | | return null; |
| | | } |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds); |
| | | if (equipmentIdList == null || equipmentIdList.isEmpty()) { |
| | | return null; |
| | | } |
| | | List<EquAndon> result = andonOrderService.equAndonList(equipmentIdList); |
| | | return result; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-06-09 |
| | | * @Description: è®¾å¤æ¥è¦ä¿¡æ¯ |
| | | */ |
| | | @Data |
| | | public class EquAlarm { |
| | | |
| | | /** |
| | | * 设å¤ç¼å· |
| | | */ |
| | | private String equipmentId; |
| | | /** |
| | | * æ¥è¦ä¿¡æ¯ |
| | | */ |
| | | private String alarmInfo; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-06-12 |
| | | * @Description: å®ç¯ä¿¡æ¯ |
| | | */ |
| | | @Data |
| | | public class EquAndon { |
| | | /** |
| | | * 设å¤ç¼å· |
| | | */ |
| | | private String equipmentId; |
| | | /** |
| | | * å®ç¯é®é¢ |
| | | */ |
| | | private String andonInfo; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-06-09 |
| | | * @Description: 设å¤åæºç»è®¡ |
| | | */ |
| | | @Data |
| | | public class EquDowntimeInfo { |
| | | |
| | | /** |
| | | * åæºåå |
| | | */ |
| | | private String shutdownInfo; |
| | | /** |
| | | * åæºæ¶é¿ |
| | | */ |
| | | private BigDecimal duration; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-05-30 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class EquOeeMonth { |
| | | private String month; |
| | | private BigDecimal oee = BigDecimal.ZERO; |
| | | |
| | | public EquOeeMonth(String month) { |
| | | this.month = month; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-06-06 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class EquOperation { |
| | | private Integer shutdown = 0; |
| | | private Integer alarm = 0; |
| | | private Integer standby = 0; |
| | | private Integer run = 0; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-06-10 |
| | | * @Description: è®¾å¤æ
é |
| | | */ |
| | | @Data |
| | | public class EquRepair { |
| | | /** |
| | | * 设å¤ç¼å· |
| | | */ |
| | | private String equipmentId; |
| | | /** |
| | | * æ
鿬¡æ° |
| | | */ |
| | | private BigDecimal faultNum; |
| | | /** |
| | | * æ
éæ¶é¿ |
| | | */ |
| | | private BigDecimal faultTime; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-06-06 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class EquRunInfo { |
| | | private String key; |
| | | private String value; |
| | | private String unit; |
| | | |
| | | public EquRunInfo() { |
| | | } |
| | | |
| | | public EquRunInfo(String key, String value, String unit) { |
| | | this.key = key; |
| | | this.value = value; |
| | | this.unit = unit; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-06-05 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class EquStatus { |
| | | private String equipmentId; |
| | | private Integer state; |
| | | private String plantName; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-05-30 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class EquUtilRate { |
| | | private String deviceNum; |
| | | private BigDecimal utilizationRate = BigDecimal.ZERO; |
| | | |
| | | public EquUtilRate(String deviceNum) { |
| | | this.deviceNum = deviceNum; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.board.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-05-30 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class EquUtilRateMonth { |
| | | private String month; |
| | | private BigDecimal utilizationRate = BigDecimal.ZERO; |
| | | |
| | | public EquUtilRateMonth(String month) { |
| | | this.month = month; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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.modules.mdc.entity.AndonOrder; |
| | | import org.jeecg.modules.mdc.service.IAndonOrderService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @Description: andon_order |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-06-11 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Api(tags="andon_order") |
| | | @RestController |
| | | @RequestMapping("/AndonOrder/andonOrder") |
| | | @Slf4j |
| | | public class AndonOrderController extends JeecgController<AndonOrder, IAndonOrderService> { |
| | | @Autowired |
| | | private IAndonOrderService andonOrderService; |
| | | |
| | | /** |
| | | * ç¨åºå¼å« |
| | | * |
| | | * @param andonOrder |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "å®ç¯å·¥å-ç¨åºå¼å«") |
| | | @ApiOperation(value = "å®ç¯å·¥å-ç¨åºå¼å«", notes = "å®ç¯å·¥å-ç¨åºå¼å«") |
| | | @PostMapping(value = "/procedureCall") |
| | | public Result<?> procedureCall(@RequestBody AndonOrder andonOrder) { |
| | | andonOrderService.procedureCall(andonOrder); |
| | | return Result.OK("å¼å«æåï¼"); |
| | | } |
| | | } |
| | |
| | | * å
³æºæ¶é¿ |
| | | */ |
| | | private BigDecimal closeLong; |
| | | |
| | | /** |
| | | * æ
éæ¶é¿ |
| | | */ |
| | | private BigDecimal faultLong; |
| | | /** |
| | | * æ
éç |
| | | */ |
| | | private BigDecimal faultRate; |
| | | /** |
| | | * è¿è¡æ¶é¿(å»é¤æ
éæ¶é´) |
| | | */ |
| | | private BigDecimal removeFaultRunLong; |
| | | |
| | | } |
| | |
| | | */ |
| | | private BigDecimal closeLong = BigDecimal.ZERO; |
| | | /** |
| | | * æ
éæ¶é¿ |
| | | */ |
| | | private BigDecimal faultLong = BigDecimal.ZERO; |
| | | /** |
| | | * æ
éç |
| | | */ |
| | | private BigDecimal faultRate = BigDecimal.ZERO; |
| | | /** |
| | | * è¿è¡æ¶é¿(å»é¤æ
éæ¶é´) |
| | | */ |
| | | private BigDecimal removeFaultRunLong = BigDecimal.ZERO; |
| | | /** |
| | | * é¢è² |
| | | */ |
| | | private String color; |
| | | |
| | | public MdcEfficiencyResultDto(String theDate, BigDecimal processLong, BigDecimal utilizationRate, BigDecimal startRate, BigDecimal openRate, BigDecimal openLong, BigDecimal waitLong, BigDecimal closeLong) { |
| | | public MdcEfficiencyResultDto(String theDate, BigDecimal processLong, BigDecimal utilizationRate, BigDecimal startRate, BigDecimal openRate, BigDecimal openLong, BigDecimal waitLong, BigDecimal closeLong, BigDecimal faultLong, BigDecimal faultRate, BigDecimal removeFaultRunLong) { |
| | | this.theDate = theDate; |
| | | this.processLong = processLong; |
| | | this.utilizationRate = utilizationRate; |
| | |
| | | this.openLong = openLong; |
| | | this.waitLong = waitLong; |
| | | this.closeLong = closeLong; |
| | | this.faultLong = faultLong; |
| | | this.faultRate = faultRate; |
| | | this.removeFaultRunLong = removeFaultRunLong; |
| | | } |
| | | |
| | | public MdcEfficiencyResultDto() { |
| | |
| | | */ |
| | | private BigDecimal totalLong = new BigDecimal("0"); |
| | | /** |
| | | * æ
éæ¶é¿ |
| | | */ |
| | | private BigDecimal faultLong = new BigDecimal("0"); |
| | | /** |
| | | * æ
éç |
| | | */ |
| | | private BigDecimal faultRate = new BigDecimal("0"); |
| | | /** |
| | | * è¿è¡æ¶é¿(å»é¤æ
éæ¶é´) |
| | | */ |
| | | private BigDecimal removeFaultRunLong = new BigDecimal("0"); |
| | | /** |
| | | * å»é¤æ
éæ¶é´å©ç¨ç |
| | | */ |
| | | private BigDecimal removeFaultRate = new BigDecimal("0"); |
| | | /** |
| | | * å¤©æ° |
| | | */ |
| | | private BigDecimal dayNum; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.entity; |
| | | |
| | | import cn.hutool.core.date.DatePattern; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Description: andon_order |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-06-11 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Data |
| | | @TableName("andon_order") |
| | | @Accessors(chain = true) |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value = "andon_order对象", description = "andon_order") |
| | | public class AndonOrder implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @TableId(type = IdType.ASSIGN_ID) |
| | | @ApiModelProperty(value = "主é®") |
| | | private String id; |
| | | /** |
| | | * 设å¤ç¼å· |
| | | */ |
| | | @Excel(name = "设å¤ç¼å·", width = 15) |
| | | @ApiModelProperty(value = "设å¤ç¼å·") |
| | | private String equipmentId; |
| | | /** |
| | | * æå±åæ¿ |
| | | */ |
| | | @Excel(name = "æå±åæ¿", width = 15) |
| | | @ApiModelProperty(value = "æå±åæ¿") |
| | | private String plantName; |
| | | /** |
| | | * å®ç¯ç±»å |
| | | */ |
| | | @Excel(name = "å®ç¯ç±»å", width = 15) |
| | | @ApiModelProperty(value = "å®ç¯ç±»å") |
| | | @Dict(dicCode = "andon_type") |
| | | private String andonType; |
| | | /** |
| | | * å®ç¯äºº(å¼å«äºº) |
| | | */ |
| | | @Excel(name = "å®ç¯äºº", width = 15) |
| | | @ApiModelProperty(value = "å®ç¯äºº") |
| | | private String operator; |
| | | /** |
| | | * å¼å«åå |
| | | */ |
| | | @Excel(name = "å¼å«åå ", width = 15) |
| | | @ApiModelProperty(value = "å¼å«åå ") |
| | | private String callReason; |
| | | /** |
| | | * å®ç¯æ¶é´ |
| | | */ |
| | | @Excel(name = "å®ç¯æ¶é´", width = 15, format = DatePattern.NORM_DATETIME_PATTERN) |
| | | @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN) |
| | | @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) |
| | | @ApiModelProperty(value = "å®ç¯æ¶é´") |
| | | private Date operateTime; |
| | | /** |
| | | * ååºäºº(责任人) |
| | | */ |
| | | @Excel(name = "ååºäºº", width = 15) |
| | | @ApiModelProperty(value = "ååºäºº") |
| | | private String responder; |
| | | /** |
| | | * ååºæ¶é´ |
| | | */ |
| | | @Excel(name = "ååºæ¶é´", width = 15, format = DatePattern.NORM_DATETIME_PATTERN) |
| | | @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN) |
| | | @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) |
| | | @ApiModelProperty(value = "ååºæ¶é´") |
| | | private Date responseTime; |
| | | /** |
| | | * å¤ç人 |
| | | */ |
| | | @Excel(name = "å¤ç人", width = 15) |
| | | @ApiModelProperty(value = "å¤ç人") |
| | | private String processor; |
| | | /** |
| | | * å¤ç宿æ¶é´ |
| | | */ |
| | | @Excel(name = "å¤ç宿æ¶é´", width = 15, format = DatePattern.NORM_DATETIME_PATTERN) |
| | | @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN) |
| | | @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) |
| | | @ApiModelProperty(value = "å¤ç宿æ¶é´") |
| | | private Date processTime; |
| | | /** |
| | | * å®ç¯ç¶æ;å¾
ååºãå¾
å¤çã已宿 |
| | | */ |
| | | @Excel(name = "å®ç¯ç¶æ;å¾
ååºãå¾
å¤çã已宿", width = 15) |
| | | @ApiModelProperty(value = "å®ç¯ç¶æ;å¾
ååºãå¾
å¤çã已宿") |
| | | @Dict(dicCode = "order_status") |
| | | private String orderStatus; |
| | | /** |
| | | * é®é¢æè¿° |
| | | */ |
| | | @Excel(name = "é®é¢æè¿°", width = 15) |
| | | @ApiModelProperty(value = "é®é¢æè¿°") |
| | | private String problemDescreption; |
| | | /** |
| | | * å¤çç»ææè¿° |
| | | */ |
| | | @Excel(name = "å¤çç»ææè¿°", width = 15) |
| | | @ApiModelProperty(value = "å¤çç»ææè¿°") |
| | | private String resolutionDescreption; |
| | | /** |
| | | * å¤çç»æå¾ç |
| | | */ |
| | | @Excel(name = "å¤çç»æå¾ç", width = 15) |
| | | @ApiModelProperty(value = "å¤çç»æå¾ç") |
| | | private String imageFiles; |
| | | /** |
| | | * å 餿 è®° |
| | | */ |
| | | @Excel(name = "å 餿 è®°", width = 15) |
| | | @ApiModelProperty(value = "å 餿 è®°") |
| | | @TableLogic |
| | | private Integer delFlag = CommonConstant.DEL_FLAG_0; |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @ApiModelProperty(value = "å建人") |
| | | private String createBy; |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN) |
| | | @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | private Date createTime; |
| | | /** |
| | | * æ´æ°äºº |
| | | */ |
| | | @ApiModelProperty(value = "æ´æ°äºº") |
| | | private String updateBy; |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN) |
| | | @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | private Date updateTime; |
| | | } |
| | |
| | | @ApiModelProperty(value = "æ¥è¦æ¶é¿") |
| | | private Integer errorLong; |
| | | /** |
| | | * æ
éæ¶é¿ |
| | | */ |
| | | @Excel(name = "æ
éæ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "æ
éæ¶é¿") |
| | | private Integer faultLong; |
| | | /** |
| | | * å»é¤æ
éæ¶é´çè¿è¡æ¶é´ |
| | | */ |
| | | @Excel(name = "å»é¤æ
éæ¶é´çè¿è¡æ¶é´", width = 15) |
| | | @ApiModelProperty(value = "å»é¤æ
éæ¶é´çè¿è¡æ¶é´") |
| | | private Integer removeFaultRunLong; |
| | | /** |
| | | * å©ç¨ç |
| | | */ |
| | | @Excel(name = "å©ç¨ç", width = 15) |
| | |
| | | @ApiModelProperty(value = "弿ºç") |
| | | private BigDecimal openRate; |
| | | /** |
| | | * æ
éç |
| | | */ |
| | | @Excel(name = "æ
éç", width = 15) |
| | | @ApiModelProperty(value = "æ
éç") |
| | | private BigDecimal faultRate; |
| | | /** |
| | | * å»é¤æ
éæ¶é´å©ç¨ç |
| | | */ |
| | | @Excel(name = "å»é¤æ
éæ¶é´å©ç¨ç", width = 15) |
| | | @ApiModelProperty(value = "å»é¤æ
éæ¶é´å©ç¨ç") |
| | | private BigDecimal removeFaultRate; |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @Excel(name = "å建æ¶é´", width = 20, format = "yyyy-MM-dd HH:mm:ss") |
| | |
| | | if (StringUtils.isNotBlank(this.parameter)) { |
| | | date = DateUtils.format(DateUtils.toDate(this.parameter, DateUtils.STRYEARMONTH), DateUtils.STRYEARMONTH); |
| | | } else { |
| | | date = DateUtils.format(DateUtils.getNow(), DateUtils.STRYEARMONTH); |
| | | date = DateUtils.format(DateUtils.addMonth(-1, DateUtils.getNow()), DateUtils.STRYEARMONTH); |
| | | } |
| | | mdcEquipmentStatisticalInfoMonthService.remove(new LambdaQueryWrapper<MdcEquipmentStatisticalInfoMonth>().eq(MdcEquipmentStatisticalInfoMonth::getTheMonth, date)); |
| | | mdcEquipmentStatisticalShiftInfoMonthService.remove(new LambdaQueryWrapper<MdcEquipmentStatisticalShiftInfoMonth>().eq(MdcEquipmentStatisticalShiftInfoMonth::getTheMonth, date)); |
| | |
| | | MdcEquipmentStatisticalInfoMonth mdcEquipmentStatisticalInfoMonth = new MdcEquipmentStatisticalInfoMonth(); |
| | | mdcEquipmentStatisticalInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | mdcEquipmentStatisticalInfoMonth.setTheMonth(date); |
| | | if (mdcEquipmentStatisticalDto != null) { |
| | | mdcEquipmentStatisticalInfoMonth.setCloseLong(mdcEquipmentStatisticalDto.getCloseLong().intValue()); |
| | | mdcEquipmentStatisticalInfoMonth.setErrorLong(mdcEquipmentStatisticalDto.getErrorLong().intValue()); |
| | | mdcEquipmentStatisticalInfoMonth.setOpenLong(mdcEquipmentStatisticalDto.getOpenLong().intValue()); |
| | | mdcEquipmentStatisticalInfoMonth.setProcessLong(mdcEquipmentStatisticalDto.getProcessLong().intValue()); |
| | | mdcEquipmentStatisticalInfoMonth.setWaitLong(mdcEquipmentStatisticalDto.getWaitLong().intValue()); |
| | | mdcEquipmentStatisticalInfoMonth.setOpenRate(mdcEquipmentStatisticalDto.getOpenLong().divide((new BigDecimal("86400").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP)); |
| | | mdcEquipmentStatisticalInfoMonth.setStartRate(mdcEquipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentStatisticalDto.getProcessLong().divide(mdcEquipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | mdcEquipmentStatisticalInfoMonth.setUtilizationRate(mdcEquipmentStatisticalDto.getProcessLong().divide((new BigDecimal("86400").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP)); |
| | | mdcEquipmentStatisticalInfoMonth.setOpenRate(mdcEquipmentStatisticalDto.getOpenLong().divide((new BigDecimal("864").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP)); |
| | | mdcEquipmentStatisticalInfoMonth.setStartRate(mdcEquipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentStatisticalDto.getProcessLong().divide(mdcEquipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | mdcEquipmentStatisticalInfoMonth.setUtilizationRate(mdcEquipmentStatisticalDto.getProcessLong().divide((new BigDecimal("864").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP)); |
| | | mdcEquipmentStatisticalInfoMonth.setFaultLong(mdcEquipmentStatisticalDto.getFaultLong().intValue()); |
| | | mdcEquipmentStatisticalInfoMonth.setFaultRate(mdcEquipmentStatisticalDto.getFaultRate()); |
| | | mdcEquipmentStatisticalInfoMonth.setRemoveFaultRate(mdcEquipmentStatisticalDto.getRemoveFaultRate()); |
| | | mdcEquipmentStatisticalInfoMonth.setRemoveFaultRunLong(mdcEquipmentStatisticalDto.getRemoveFaultRunLong().intValue()); |
| | | } |
| | | mdcEquipmentStatisticalInfoMonthList.add(mdcEquipmentStatisticalInfoMonth); |
| | | // step.3 æ±æ»ç次å©ç¨çæ°æ® |
| | | MdcEquipmentStatisticalDto mdcEquipmentShiftStatisticalDto = mdcEquipmentStatisticalShiftInfoService.findByEquipmentAndMonth(mdcEquipment.getEquipmentId(), date); |
| | |
| | | mdcEquipmentShiftInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | mdcEquipmentShiftInfoMonth.setTheMonth(date); |
| | | mdcEquipmentShiftInfoMonth.setShiftType(CommonConstant.SHIFT_TYPE_1); |
| | | if (mdcEquipmentShiftStatisticalDto != null) { |
| | | mdcEquipmentShiftInfoMonth.setCloseLong(mdcEquipmentShiftStatisticalDto.getCloseLong().intValue()); |
| | | mdcEquipmentShiftInfoMonth.setTotalLong(mdcEquipmentShiftStatisticalDto.getTotalLong().intValue()); |
| | | mdcEquipmentShiftInfoMonth.setOpenLong(mdcEquipmentShiftStatisticalDto.getOpenLong().intValue()); |
| | | mdcEquipmentShiftInfoMonth.setErrorLong(mdcEquipmentShiftStatisticalDto.getErrorLong().intValue()); |
| | | mdcEquipmentShiftInfoMonth.setWaitLong(mdcEquipmentShiftStatisticalDto.getWaitLong().intValue()); |
| | | mdcEquipmentShiftInfoMonth.setProcessLong(mdcEquipmentShiftStatisticalDto.getProcessLong().intValue()); |
| | | mdcEquipmentShiftInfoMonth.setUtilizationRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | mdcEquipmentShiftInfoMonth.setStartRate(mdcEquipmentShiftStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | mdcEquipmentShiftInfoMonth.setOpenRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getOpenLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | mdcEquipmentShiftInfoMonth.setUtilizationRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | mdcEquipmentShiftInfoMonth.setStartRate(mdcEquipmentShiftStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | mdcEquipmentShiftInfoMonth.setOpenRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getOpenLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | } |
| | | mdcEquipmentStatisticalShiftInfoMonthList.add(mdcEquipmentShiftInfoMonth); |
| | | // step.4 æ±æ»åçæ¬¡å©ç¨çæ°æ® |
| | | List<MdcEquipmentStatisticalDto> essdList = mdcEquipmentStatisticalShiftInfoService.findShiftByEquipmentAndMonth(mdcEquipment.getEquipmentId(), date); |
| | |
| | | equipmentStatisticalShiftInfoMonth.setErrorLong(equipmentStatisticalDto.getErrorLong().intValue()); |
| | | equipmentStatisticalShiftInfoMonth.setWaitLong(equipmentStatisticalDto.getWaitLong().intValue()); |
| | | equipmentStatisticalShiftInfoMonth.setProcessLong(equipmentStatisticalDto.getProcessLong().intValue()); |
| | | equipmentStatisticalShiftInfoMonth.setUtilizationRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | equipmentStatisticalShiftInfoMonth.setStartRate(equipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | equipmentStatisticalShiftInfoMonth.setOpenRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getOpenLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | equipmentStatisticalShiftInfoMonth.setUtilizationRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | equipmentStatisticalShiftInfoMonth.setStartRate(equipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | equipmentStatisticalShiftInfoMonth.setOpenRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getOpenLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | mdcEquipmentStatisticalShiftInfoMonthList.add(equipmentStatisticalShiftInfoMonth); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.job; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.constant.WebsocketConst; |
| | | import org.jeecg.common.util.RedisUtil; |
| | | import org.jeecg.modules.board.vo.EquStatus; |
| | | import org.jeecg.modules.mdc.entity.Equipment; |
| | | import org.jeecg.modules.mdc.service.IEquipmentService; |
| | | import org.jeecg.modules.mdc.util.ThrowableUtil; |
| | | import org.jeecg.modules.message.websocket.WebSocket; |
| | | import org.jeecg.modules.quartz.entity.QuartzJob; |
| | | import org.jeecg.modules.quartz.entity.SysQuartzLog; |
| | | import org.jeecg.modules.quartz.service.IQuartzJobService; |
| | | import org.jeecg.modules.quartz.service.ISysQuartzLogService; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.quartz.DisallowConcurrentExecution; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: Lius |
| | | * @CreateTime: 2025-06-05 |
| | | * @Description: websocketæ¨é设å¤ç¶æä»»å¡ |
| | | */ |
| | | @DisallowConcurrentExecution |
| | | @Slf4j |
| | | public class WebsocketPushEquStatusJob implements Job { |
| | | |
| | | @Resource |
| | | private IQuartzJobService quartzJobService; |
| | | |
| | | @Resource |
| | | private ISysQuartzLogService sysQuartzLogService; |
| | | |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Resource |
| | | private WebSocket webSocket; |
| | | |
| | | @Resource |
| | | private IEquipmentService equipmentService; |
| | | |
| | | @Resource |
| | | private IMdcProductionService mdcProductionService; |
| | | |
| | | final private static String redisKey = "board:equipment:status:"; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext context) throws JobExecutionException { |
| | | SysQuartzLog quartzLog = new SysQuartzLog(); |
| | | quartzLog.setCreateTime(new Date()); |
| | | List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName()); |
| | | if (byJobClassName != null && !byJobClassName.isEmpty()) { |
| | | quartzLog.setJobId(byJobClassName.get(0).getId()); |
| | | } |
| | | long startTime = System.currentTimeMillis(); |
| | | try { |
| | | List<Equipment> equipmentList = equipmentService.list(); |
| | | if (equipmentList != null && !equipmentList.isEmpty()) { |
| | | List<EquStatus> equStatusList = new ArrayList<>(); |
| | | for (Equipment equipment : equipmentList) { |
| | | if (equipment.getOporation() == null) { |
| | | equipment.setOporation(0); |
| | | } |
| | | String key = redisKey + equipment.getEquipmentid(); |
| | | if (redisUtil.hasKey(key)) { |
| | | Integer status = (Integer) redisUtil.get(key); |
| | | if (!status.equals(equipment.getOporation())) { |
| | | EquStatus equStatus = new EquStatus(); |
| | | equStatus.setEquipmentId(equipment.getEquipmentid()); |
| | | equStatus.setState(equipment.getOporation()); |
| | | // éè¿equipmentIdè·å设å¤è½¦é´åç§° |
| | | String productionName = mdcProductionService.findProName(equipment.getEquipmentid()); |
| | | equStatus.setPlantName(productionName); |
| | | equStatusList.add(equStatus); |
| | | redisUtil.set(key, equipment.getOporation()); |
| | | } |
| | | } else { |
| | | EquStatus equStatus = new EquStatus(); |
| | | equStatus.setEquipmentId(equipment.getEquipmentid()); |
| | | equStatus.setState(equipment.getOporation()); |
| | | // éè¿equipmentIdè·å设å¤è½¦é´åç§° |
| | | String productionName = mdcProductionService.findProName(equipment.getEquipmentid()); |
| | | equStatus.setPlantName(productionName); |
| | | equStatusList.add(equStatus); |
| | | redisUtil.set(key, equipment.getOporation()); |
| | | } |
| | | } |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put(WebsocketConst.MSG_CMD, "equStatus"); |
| | | jsonObject.put("data", equStatusList); |
| | | webSocket.sendMessage(jsonObject.toJSONString()); |
| | | } |
| | | quartzLog.setIsSuccess(0); |
| | | } catch (Exception e) { |
| | | quartzLog.setIsSuccess(-1); |
| | | quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); |
| | | } |
| | | long endTime = System.currentTimeMillis(); |
| | | quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); |
| | | sysQuartzLogService.save(quartzLog); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.entity.AndonOrder; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: andon_order |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-06-11 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface AndonOrderMapper extends BaseMapper<AndonOrder> { |
| | | |
| | | List<AndonOrder> equAndonList(@Param("equipmentIdList") List<String> equipmentIdList); |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.entity.EquipmentAlarm; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author: LiuS |
| | | * @create: 2023-04-12 16:39 |
| | | */ |
| | | public interface EquipmentAlarmMapper extends BaseMapper<EquipmentAlarm> { |
| | | |
| | | List<EquipmentAlarm> equAlarmList(@Param("equipmentIdList") List<String> equipmentIdList); |
| | | |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.entity.MdcAlarmInfo; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public interface MdcAlarmInfoMapper extends BaseMapper<MdcAlarmInfo> { |
| | | |
| | | MdcAlarmInfo findAlarmContent(@Param("alarmNo") String alarmNo, @Param("equipmentId") String equipmentId); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.board.vo.EquDowntimeInfo; |
| | | import org.jeecg.modules.mdc.dto.MdcDowntimeDto; |
| | | import org.jeecg.modules.mdc.entity.MdcDowntime; |
| | | import org.jeecg.modules.mdc.vo.MdcDowntimeVo; |
| | |
| | | IPage<MdcDowntimeDto> pageList(Page<MdcDowntimeDto> page, @Param("mdcDowntimeVo") MdcDowntimeVo mdcDowntimeVo); |
| | | |
| | | List<MdcDowntime> findPlanTimeDuration(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate, @Param("closeType") String closeType); |
| | | |
| | | List<EquDowntimeInfo> equDowntimeStatistics(@Param("equipmentIdList") List<String> equipmentIdList, @Param("start") String start, @Param("end") String end); |
| | | } |
| | |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 设å¤åæ¥è¿è¡æ°æ®è¡¨ |
| | | * @Author: jeecg-boot |
| | |
| | | Integer selectProcessLong(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | |
| | | MdcEquipmentStatisticalDto findByEquipmentAndMonth(@Param("equipmentId") String equipmentId, @Param("date") String date); |
| | | |
| | | MdcEquipmentStatisticalInfo findByEquIdsAndMonth(@Param("equipmentIdList") List<String> equipmentIdList, @Param("month") String month); |
| | | |
| | | List<MdcEquipmentStatisticalInfo> findByEquipmentAndDate(@Param("equipmentIdList") List<String> equipmentIdList, @Param("date") String date); |
| | | } |
| | |
| | | import org.jeecg.modules.mdc.entity.MdcOeeInfo; |
| | | import org.jeecg.modules.mdc.vo.MdcOeeInfoVo; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: OEE表 |
| | | * @Author: lius |
| | |
| | | * @return |
| | | */ |
| | | IPage<MdcOeeInfo> pageList(Page<MdcOeeInfo> page, @Param("mdcOeeInfoVo") MdcOeeInfoVo mdcOeeInfoVo); |
| | | |
| | | BigDecimal findByEquIdAndMonth(@Param("equipmentIdList") List<String> equipmentIdList, @Param("month") String month); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.jeecg.modules.mdc.mapper.AndonOrderMapper"> |
| | | |
| | | <select id="equAndonList" resultType="org.jeecg.modules.mdc.entity.AndonOrder"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | andon_order |
| | | WHERE |
| | | CONVERT ( DATE, create_time ) = CONVERT ( DATE, GETDATE( ) ) |
| | | AND equipment_id IN |
| | | <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | ORDER BY |
| | | create_time |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.jeecg.modules.mdc.mapper.EquipmentAlarmMapper"> |
| | | |
| | | <select id="equAlarmList" resultType="org.jeecg.modules.mdc.entity.EquipmentAlarm"> |
| | | SELECT TOP 15 * |
| | | FROM |
| | | EquipmentAlarm |
| | | WHERE EquipmentID IN |
| | | <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | AND alarmNo != '' |
| | | ORDER BY collecttime DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.jeecg.modules.mdc.mapper.MdcAlarmInfoMapper"> |
| | | |
| | | <select id="findAlarmContent" resultType="org.jeecg.modules.mdc.entity.MdcAlarmInfo"> |
| | | SELECT |
| | | t1.* |
| | | FROM |
| | | mdc_alarm_info t1 |
| | | LEFT JOIN mdc_equipment t2 ON t1.drive_type = t2.drive_type |
| | | WHERE |
| | | t2.equipment_id = #{equipmentId} AND t1.alarm_code = #{alarmNo} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | AND t2.downtime_type = #{closeType} |
| | | AND t1.the_date = #{validDate} |
| | | </select> |
| | | |
| | | <select id="equDowntimeStatistics" resultType="org.jeecg.modules.board.vo.EquDowntimeInfo"> |
| | | SELECT |
| | | t2.downtime_description AS shutdown_info, |
| | | SUM ( DATEDIFF( SECOND, t1.start_date, t1.end_date ) ) / 3600.0 AS duration |
| | | FROM |
| | | mdc_downtime t1 |
| | | LEFT JOIN mdc_downtime_reason t2 ON t1.reason_id = t2.id |
| | | WHERE |
| | | t1.reason_id != '' |
| | | AND t1.the_date BETWEEN #{start} AND #{end} |
| | | AND t1.equipment_id IN |
| | | <foreach collection="equipmentIdList" item="equipmentId" index="index" open="(" close=")" separator=","> |
| | | #{ equipmentId } |
| | | </foreach> |
| | | GROUP BY |
| | | t2.downtime_description |
| | | </select> |
| | | </mapper> |
| | |
| | | t1.open_long / 86400 openRate, |
| | | t1.open_long openLong, |
| | | t1.wait_long waitLong, |
| | | t1.close_long closeLong |
| | | t1.close_long closeLong, |
| | | COALESCE(t3.fault_long, 0) faultLong, |
| | | COALESCE(t3.fault_rate, 0) faultRate, |
| | | COALESCE(t3.remove_fault_run_long, 0) removeFaultRunLong |
| | | FROM |
| | | mdc_equipment t2 |
| | | LEFT JOIN mdc_equipment_statistical_info t1 ON t1.equipment_id = t2.equipment_id |
| | | LEFT JOIN mdc_equipment_fault_info t3 ON t2.equipment_id = t3.equipment_id AND t1.the_date = t3.the_date |
| | | WHERE |
| | | t1.the_date <= #{ vo.endTime } |
| | | AND t1.the_date >= #{ vo.startTime } |
| | |
| | | SELECT |
| | | t3.equipment_name, |
| | | t1.utilization_rate AS utilizationRate, |
| | | t2.utilization_rate AS shiftUtilizationRate |
| | | t2.utilization_rate AS shiftUtilizationRate, |
| | | t1.remove_fault_rate AS amendUtilizationRate |
| | | FROM |
| | | mdc_equipment_statistical_info_month t1 |
| | | LEFT JOIN mdc_equipment_statistical_shift_info_month t2 ON t1.the_month = t2.the_month AND t2.shift_type = 1 |
| | |
| | | SELECT |
| | | t3.team_code AS teamCode, |
| | | t1.utilization_rate AS utilizationRate, |
| | | t2.utilization_rate AS shiftUtilizationRate |
| | | t2.utilization_rate AS shiftUtilizationRate, |
| | | t1.remove_fault_rate AS amendUtilizationRate |
| | | FROM |
| | | mdc_equipment_statistical_info_month t1 |
| | | LEFT JOIN mdc_equipment_statistical_shift_info_month t2 ON t1.the_month = t2.the_month AND t2.shift_type = 1 |
| | |
| | | t1.the_month AS theMonth, |
| | | AVG ( t1.utilization_rate ) AS utilizationRate, |
| | | AVG ( t2.utilization_rate ) AS shiftUtilizationRate, |
| | | AVG ( t1.remove_fault_rate ) AS amendUtilizationRate, |
| | | SUM ( t1.process_long ) AS processLong |
| | | FROM |
| | | mdc_equipment_statistical_info_month t1 |
| | |
| | | |
| | | <select id="findByEquipmentAndMonth" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto"> |
| | | SELECT |
| | | SUM(open_long) openLong, |
| | | SUM(close_long) closeLong, |
| | | SUM(wait_long) waitLong, |
| | | SUM(process_long) processLong, |
| | | SUM(error_long) errorLong, |
| | | SUM ( t1.open_long ) openLong, |
| | | SUM ( t1.close_long ) closeLong, |
| | | SUM ( t1.wait_long ) waitLong, |
| | | SUM ( t1.process_long ) processLong, |
| | | SUM ( t1.error_long ) errorLong, |
| | | SUM ( t2.fault_long ) faultLong, |
| | | AVG ( t2.fault_rate ) faultRate, |
| | | SUM ( t2.remove_fault_run_long ) removeFaultRunLong, |
| | | AVG ( t2.remove_fault_rate ) removeFaultRate, |
| | | COUNT(*) dayNum |
| | | FROM |
| | | mdc_equipment_statistical_info t1 LEFT JOIN mdc_equipment_fault_info t2 ON t1.equipment_id = t2.equipment_id AND t1.the_date = t2.the_date |
| | | WHERE |
| | | t1.equipment_id = #{equipmentId} AND t1.the_date LIKE CONCAT(#{date}, '%') |
| | | </select> |
| | | |
| | | <select id="findByEquIdsAndMonth" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo"> |
| | | SELECT |
| | | AVG(open_long) openLong, |
| | | AVG(close_long) closeLong, |
| | | AVG(wait_long) waitLong, |
| | | AVG(process_long) processLong, |
| | | AVG(error_long) errorLong |
| | | FROM |
| | | mdc_equipment_statistical_info |
| | | WHERE |
| | | equipment_id = #{equipmentId} AND the_date LIKE CONCAT(#{date}, '%') |
| | | equipment_id IN |
| | | <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=","> |
| | | #{ id } |
| | | </foreach> |
| | | AND the_date LIKE CONCAT(#{month}, '%') |
| | | </select> |
| | | |
| | | <select id="findByEquipmentAndDate" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | mdc_equipment_statistical_info |
| | | WHERE |
| | | equipment_id IN |
| | | <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=","> |
| | | #{ id } |
| | | </foreach> |
| | | AND the_date = #{date} |
| | | </select> |
| | | </mapper> |
| | |
| | | </where> |
| | | ORDER BY the_date DESC, equipment_id ASC |
| | | </select> |
| | | |
| | | <select id="findByEquIdAndMonth" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | AVG(oee) |
| | | FROM |
| | | mdc_oee_info |
| | | WHERE |
| | | the_date LIKE CONCAT(#{month}, '%') |
| | | AND equipment_id IN |
| | | <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=","> |
| | | #{ id } |
| | | </foreach> |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.board.vo.EquAndon; |
| | | import org.jeecg.modules.mdc.entity.AndonOrder; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: andon_order |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-06-11 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface IAndonOrderService extends IService<AndonOrder> { |
| | | |
| | | void procedureCall(AndonOrder andonOrder); |
| | | |
| | | List<EquAndon> equAndonList(List<String> equipmentIdList); |
| | | } |
| | |
| | | */ |
| | | public interface IEquipmentAlarmService extends IService<EquipmentAlarm> { |
| | | List<EquipmentAlarm> findEquipmentAlarmByDate(String equipmentId, Date startTime, Date endTime); |
| | | |
| | | List<EquipmentAlarm> equAlarmList(List<String> equipmentIdList); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.board.vo.EquDowntimeInfo; |
| | | import org.jeecg.modules.mdc.dto.MdcDowntimeDto; |
| | | import org.jeecg.modules.mdc.entity.MdcDowntime; |
| | | import org.jeecg.modules.mdc.vo.MdcDowntimeVo; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: å¾
æºåæºè¡¨ |
| | |
| | | * @return |
| | | */ |
| | | Integer findPlanTimeDuration(String equipmentId, String validDate, String closeType); |
| | | |
| | | List<EquDowntimeInfo> equDowntimeStatistics(List<String> equipmentIdList, String start, String end); |
| | | } |
| | |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 设å¤åæ¥è¿è¡æ°æ®è¡¨ |
| | | * @Author: lius |
| | |
| | | Integer selectProcessLong(String equipmentId, String validDate); |
| | | |
| | | MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date); |
| | | |
| | | MdcEquipmentStatisticalInfo findByEquIdsAndMonth(List<String> equipmentIdList, String month); |
| | | |
| | | List<MdcEquipmentStatisticalInfo> findByEquipmentAndDate(List<String> equipmentIdList, String date); |
| | | } |
| | |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: OEE表 |
| | |
| | | */ |
| | | void computeOee(MdcOeeComputeVo mdcOeeComputeVo); |
| | | |
| | | BigDecimal findByEquIdAndMonth(List<String> equipmentIdList, String month); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | import cn.hutool.core.date.DatePattern; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringPool; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.constant.WebsocketConst; |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.board.vo.EquAndon; |
| | | import org.jeecg.modules.mdc.dto.MdcEquProDto; |
| | | import org.jeecg.modules.mdc.entity.AndonOrder; |
| | | import org.jeecg.modules.mdc.mapper.AndonOrderMapper; |
| | | import org.jeecg.modules.mdc.service.IAndonOrderService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.vo.AndonOrderWebSocketVo; |
| | | import org.jeecg.modules.message.websocket.WebSocket; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description: andon_order |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-06-11 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | | public class AndonOrderServiceImpl extends ServiceImpl<AndonOrderMapper, AndonOrder> implements IAndonOrderService { |
| | | |
| | | @Resource |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | @Resource |
| | | private WebSocket webSocket; |
| | | @Resource |
| | | private ISysUserService userService; |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | |
| | | @Override |
| | | public void procedureCall(AndonOrder andonOrder) { |
| | | if (StringUtils.isBlank(andonOrder.getEquipmentId())) { |
| | | throw new JeecgBootException("è¯·éæ©è®¾å¤ï¼"); |
| | | } |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | List<String> equipmentIds = Arrays.asList(andonOrder.getEquipmentId().split(StringPool.COMMA)); |
| | | |
| | | List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(equipmentIds); |
| | | Map<String, MdcEquProDto> equipmentIdToProductionIdMap = equipmentList.stream().collect(Collectors.toMap(MdcEquProDto::getEquipmentId, comRateDto -> comRateDto)); |
| | | List<AndonOrder> list = Lists.newArrayList(); |
| | | for (String equipmentId : equipmentIds) { |
| | | AndonOrder andonOrderInfo = new AndonOrder(); |
| | | andonOrderInfo.setEquipmentId(equipmentId); |
| | | andonOrderInfo.setPlantName(equipmentIdToProductionIdMap != null && equipmentIdToProductionIdMap.containsKey(equipmentId) ? equipmentIdToProductionIdMap.get(equipmentId).getId() : null); |
| | | andonOrderInfo.setAndonType(StringPool.ONE); |
| | | andonOrderInfo.setOrderStatus(StringPool.ONE); |
| | | andonOrderInfo.setOperator(andonOrder.getOperator()); |
| | | andonOrderInfo.setOperateTime(new Date()); |
| | | andonOrderInfo.setResponder(userId); |
| | | andonOrderInfo.setCallReason(andonOrder.getCallReason()); |
| | | list.add(andonOrderInfo); |
| | | } |
| | | |
| | | if (this.saveBatch(list)) { |
| | | List<AndonOrderWebSocketVo> andonOrderWebSocketVoList = Lists.newArrayList(); |
| | | //设置websocketè¯·æ±æ¶æ¯æ°æ® |
| | | for (AndonOrder order : list) { |
| | | AndonOrderWebSocketVo andonOrderWebSocketVo = new AndonOrderWebSocketVo(); |
| | | andonOrderWebSocketVo.setEquipmentId(order.getEquipmentId()); |
| | | andonOrderWebSocketVo.setCallPersonnel(userService.getById(order.getOperator()).getRealname()); |
| | | andonOrderWebSocketVo.setCallTime(DateUtils.format(order.getOperateTime(), DatePattern.NORM_DATE_PATTERN)); |
| | | andonOrderWebSocketVo.setCallReason(order.getCallReason()); |
| | | andonOrderWebSocketVo.setAndonType("ç¨åºå¼å«"); |
| | | andonOrderWebSocketVo.setPersonResponsible(user.getRealname()); |
| | | andonOrderWebSocketVo.setRepairTime(StringPool.EMPTY); |
| | | andonOrderWebSocketVo.setFaultInfo(StringPool.EMPTY); |
| | | andonOrderWebSocketVo.setPlantName(equipmentIdToProductionIdMap != null && equipmentIdToProductionIdMap.containsKey(order.getEquipmentId()) ? equipmentIdToProductionIdMap.get(order.getEquipmentId()).getProductionName() : null); |
| | | andonOrderWebSocketVoList.add(andonOrderWebSocketVo); |
| | | } |
| | | |
| | | //åéwebsocketè¯·æ± |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put(WebsocketConst.MSG_CMD, "andon"); |
| | | jsonObject.put("data", andonOrderWebSocketVoList); |
| | | webSocket.sendMessage(jsonObject.toJSONString()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å®ç¯é®é¢å表 |
| | | */ |
| | | @Override |
| | | public List<EquAndon> equAndonList(List<String> equipmentIdList) { |
| | | List<EquAndon> result = new ArrayList<>(); |
| | | List<AndonOrder> andonOrderList = this.baseMapper.equAndonList(equipmentIdList); |
| | | if (andonOrderList != null && !andonOrderList.isEmpty()) { |
| | | andonOrderList.forEach(andonOrder -> { |
| | | EquAndon equAndon = new EquAndon(); |
| | | equAndon.setEquipmentId(andonOrder.getEquipmentId()); |
| | | StringBuilder infoBuilder = new StringBuilder(); |
| | | infoBuilder.append("å®ç¯ç±»å: ").append(sysDictService.queryDictTextByKey("andon_type",andonOrder.getAndonType())).append("\n"); |
| | | infoBuilder.append("å®ç¯äºº: ").append(sysDictService.queryTableDictTextByKey("sys_user", "realname", "id", andonOrder.getOperator())).append("\n"); |
| | | infoBuilder.append("å®ç¯æ¶é´: ").append(DateUtils.format(andonOrder.getOperateTime(), DateUtils.STR_DATE_TIME_SMALL)).append("\n"); |
| | | infoBuilder.append("å®ç¯ç¶æ: ").append(sysDictService.queryDictTextByKey("order_status",andonOrder.getOrderStatus())).append("\n"); |
| | | equAndon.setAndonInfo(infoBuilder.toString()); |
| | | result.add(equAndon); |
| | | }); |
| | | } |
| | | return result; |
| | | } |
| | | } |
| | |
| | | .ge(EquipmentAlarm::getCollecttime, startTime).le(EquipmentAlarm::getCollecttime, endTime) |
| | | .eq(EquipmentAlarm::getEquipmentid, equipmentId).orderByDesc(EquipmentAlarm::getCollecttime)); |
| | | } |
| | | |
| | | @Override |
| | | public List<EquipmentAlarm> equAlarmList(List<String> equipmentIdList) { |
| | | return this.baseMapper.equAlarmList(equipmentIdList); |
| | | } |
| | | } |
| | |
| | | @Service |
| | | public class MdcAlarmInfoServiceImpl extends ServiceImpl<MdcAlarmInfoMapper, MdcAlarmInfo> implements IMdcAlarmInfoService { |
| | | |
| | | @Override |
| | | public MdcAlarmInfo findAlarmContent(String alarmNo, String equipmentId) { |
| | | return this.baseMapper.findAlarmContent(alarmNo, equipmentId); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.modules.board.vo.EquDowntimeInfo; |
| | | import org.jeecg.modules.mdc.dto.MdcDowntimeDto; |
| | | import org.jeecg.modules.mdc.entity.MdcDowntime; |
| | | import org.jeecg.modules.mdc.mapper.MdcDowntimeMapper; |
| | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<EquDowntimeInfo> equDowntimeStatistics(List<String> equipmentIdList, String start, String end) { |
| | | return this.baseMapper.equDowntimeStatistics(equipmentIdList, start, end); |
| | | } |
| | | |
| | | private List<String> getEquipmentIds(String userId, MdcDowntimeVo mdcDowntimeVo) { |
| | | if (StringUtils.isNotEmpty(mdcDowntimeVo.getEquipmentId())) { |
| | | return Collections.singletonList(mdcDowntimeVo.getEquipmentId()); |
| | |
| | | mdcEfficiencyResultDto.setWaitLong(mdcEfficiencyResultDto.getWaitLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto1.setCloseLong(mdcEfficiencyResultDto.getCloseLong()); |
| | | mdcEfficiencyResultDto.setCloseLong(mdcEfficiencyResultDto.getCloseLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto1.setFaultLong(mdcEfficiencyResultDto.getFaultLong()); |
| | | mdcEfficiencyResultDto.setFaultLong(mdcEfficiencyResultDto.getFaultLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto1.setFaultRate(mdcEfficiencyResultDto.getFaultRate()); |
| | | mdcEfficiencyResultDto.setFaultRate(mdcEfficiencyResultDto.getFaultRate().divide(new BigDecimal(dates.size()), 4, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto1.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong()); |
| | | mdcEfficiencyResultDto.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP)); |
| | | long rate = mdcEfficiencyResultDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue(); |
| | | for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { |
| | | if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) { |
| | |
| | | mdcEfficiencyResultDto.setWaitLong(mdcEfficiencyResultDto.getWaitLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto1.setCloseLong(mdcEfficiencyResultDto.getCloseLong()); |
| | | mdcEfficiencyResultDto.setCloseLong(mdcEfficiencyResultDto.getCloseLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto1.setFaultLong(mdcEfficiencyResultDto.getFaultLong()); |
| | | mdcEfficiencyResultDto.setFaultLong(mdcEfficiencyResultDto.getFaultLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto1.setFaultRate(mdcEfficiencyResultDto.getFaultRate()); |
| | | mdcEfficiencyResultDto.setFaultRate(mdcEfficiencyResultDto.getFaultRate().divide(new BigDecimal(dates.size()), 4, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto1.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong()); |
| | | mdcEfficiencyResultDto.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP)); |
| | | long rate = mdcEfficiencyResultDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue(); |
| | | for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { |
| | | if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) { |
| | |
| | | a.getOpenRate().add(b.getOpenRate()), |
| | | a.getOpenLong().add(b.getOpenLong()), |
| | | a.getWaitLong().add(b.getWaitLong()), |
| | | a.getCloseLong().add(b.getCloseLong()))).ifPresent(result::add); |
| | | a.getCloseLong().add(b.getCloseLong()), |
| | | a.getFaultLong().add(b.getFaultLong()), |
| | | a.getFaultRate().add(b.getFaultRate()), |
| | | a.getRemoveFaultRunLong().add(b.getRemoveFaultRunLong()))).ifPresent(result::add); |
| | | }); |
| | | for (MdcEfficiencyResultDto mdcEfficiencyResultDto : result) { |
| | | mdcEfficiencyResultDto.setUtilizationRate(mdcEfficiencyResultDto.getUtilizationRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP)); |
| | |
| | | a.getOpenRate().add(b.getOpenRate()), |
| | | a.getOpenLong().add(b.getOpenLong()), |
| | | a.getWaitLong().add(b.getWaitLong()), |
| | | a.getCloseLong().add(b.getCloseLong()))).ifPresent(result::add); |
| | | a.getCloseLong().add(b.getCloseLong()), |
| | | a.getFaultLong().add(b.getFaultLong()), |
| | | a.getFaultRate().add(b.getFaultRate()), |
| | | a.getRemoveFaultRunLong().add(b.getRemoveFaultRunLong()))).ifPresent(result::add); |
| | | }); |
| | | for (MdcEfficiencyResultDto mdcEfficiencyResultDto : result) { |
| | | mdcEfficiencyResultDto.setUtilizationRate(mdcEfficiencyResultDto.getUtilizationRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP)); |
| | |
| | | a.getOpenRate().add(b.getOpenRate()), |
| | | a.getOpenLong().add(b.getOpenLong()), |
| | | a.getWaitLong().add(b.getWaitLong()), |
| | | a.getCloseLong().add(b.getCloseLong()))).ifPresent(result::add); |
| | | a.getCloseLong().add(b.getCloseLong()), |
| | | a.getFaultLong().add(b.getFaultLong()), |
| | | a.getFaultRate().add(b.getFaultRate()), |
| | | a.getRemoveFaultRunLong().add(b.getRemoveFaultRunLong()))).ifPresent(result::add); |
| | | }); |
| | | for (MdcEfficiencyResultDto mdcEfficiencyResultDto : result) { |
| | | mdcEfficiencyResultDto.setUtilizationRate(mdcEfficiencyResultDto.getUtilizationRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP)); |
| | |
| | | mdcEfficiencyResultDto.setWaitLong(mdcEfficiencyResultDto.getWaitLong().divide(new BigDecimal(mdcEfficiencyList.size()), 0, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto.setOpenLong(mdcEfficiencyResultDto.getOpenLong().divide(new BigDecimal(mdcEfficiencyList.size()), 0, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto.setProcessLong(mdcEfficiencyResultDto.getProcessLong().divide(new BigDecimal(mdcEfficiencyList.size()), 0, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto.setFaultLong(mdcEfficiencyResultDto.getFaultLong().divide(new BigDecimal(mdcEfficiencyList.size()), 0, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto.setFaultRate(mdcEfficiencyResultDto.getFaultRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong().divide(new BigDecimal(mdcEfficiencyList.size()), 0, RoundingMode.HALF_UP)); |
| | | long rate = mdcEfficiencyResultDto.getStartRate().multiply(new BigDecimal("100")).longValue(); |
| | | for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { |
| | | if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) { |
| | |
| | | a.getOpenRate().add(b.getOpenRate()), |
| | | a.getOpenLong().add(b.getOpenLong()), |
| | | a.getWaitLong().add(b.getWaitLong()), |
| | | a.getCloseLong().add(b.getCloseLong()))).ifPresent(result::add); |
| | | a.getCloseLong().add(b.getCloseLong()), |
| | | a.getFaultLong().add(b.getFaultLong()), |
| | | a.getFaultRate().add(b.getFaultRate()), |
| | | a.getRemoveFaultRunLong().add(b.getRemoveFaultRunLong()))).ifPresent(result::add); |
| | | }); |
| | | for (MdcEfficiencyResultDto mdcEfficiencyResultDto : result) { |
| | | mdcEfficiencyResultDto.setUtilizationRate(mdcEfficiencyResultDto.getUtilizationRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto.setOpenRate(mdcEfficiencyResultDto.getOpenRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto.setStartRate(mdcEfficiencyResultDto.getStartRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP)); |
| | | mdcEfficiencyResultDto.setFaultRate(mdcEfficiencyResultDto.getFaultRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP)); |
| | | long rate = mdcEfficiencyResultDto.getStartRate().multiply(new BigDecimal("100")).longValue(); |
| | | for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { |
| | | if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) { |
| | |
| | | mdcEfficiencyResultDto.setOpenLong(efficiencyDto.getOpenLong()); |
| | | mdcEfficiencyResultDto.setWaitLong(efficiencyDto.getWaitLong()); |
| | | mdcEfficiencyResultDto.setCloseLong(efficiencyDto.getCloseLong()); |
| | | mdcEfficiencyResultDto.setFaultLong(efficiencyDto.getFaultLong()); |
| | | mdcEfficiencyResultDto.setFaultRate(efficiencyDto.getFaultRate()); |
| | | mdcEfficiencyResultDto.setRemoveFaultRunLong(efficiencyDto.getRemoveFaultRunLong()); |
| | | long rate = efficiencyDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue(); |
| | | for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { |
| | | if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) { |
| | |
| | | mdcEfficiencyResultDto.setOpenLong(new BigDecimal("0")); |
| | | mdcEfficiencyResultDto.setWaitLong(new BigDecimal("0")); |
| | | mdcEfficiencyResultDto.setCloseLong(new BigDecimal("0")); |
| | | mdcEfficiencyResultDto.setFaultLong(new BigDecimal("0")); |
| | | mdcEfficiencyResultDto.setFaultRate(new BigDecimal("0")); |
| | | mdcEfficiencyResultDto.setRemoveFaultRunLong(new BigDecimal("0")); |
| | | for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { |
| | | if (0 >= mdcUtilizationRate.getMinimumRange() && 0 < mdcUtilizationRate.getMaximumRange()) { |
| | | mdcEfficiencyResultDto.setColor(mdcUtilizationRate.getRateParameterColor()); |
| | |
| | | mdcEfficiencyResultDto.setOpenLong(new BigDecimal("0")); |
| | | mdcEfficiencyResultDto.setWaitLong(new BigDecimal("0")); |
| | | mdcEfficiencyResultDto.setCloseLong(new BigDecimal("0")); |
| | | mdcEfficiencyResultDto.setFaultLong(new BigDecimal("0")); |
| | | mdcEfficiencyResultDto.setFaultRate(new BigDecimal("0")); |
| | | mdcEfficiencyResultDto.setRemoveFaultRunLong(new BigDecimal("0")); |
| | | for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { |
| | | if (0 >= mdcUtilizationRate.getMinimumRange() && 0 < mdcUtilizationRate.getMaximumRange()) { |
| | | mdcEfficiencyResultDto.setColor(mdcUtilizationRate.getRateParameterColor()); |
| | |
| | | efficiencyResultDto.setOpenLong(efficiencyResultDto.getOpenLong().add(mdcEfficiencyResultDto.getOpenLong())); |
| | | efficiencyResultDto.setWaitLong(efficiencyResultDto.getWaitLong().add(mdcEfficiencyResultDto.getWaitLong())); |
| | | efficiencyResultDto.setCloseLong(efficiencyResultDto.getCloseLong().add(mdcEfficiencyResultDto.getCloseLong())); |
| | | efficiencyResultDto.setFaultLong(efficiencyResultDto.getFaultLong().add(mdcEfficiencyResultDto.getFaultLong())); |
| | | efficiencyResultDto.setFaultRate(efficiencyResultDto.getFaultRate().add(mdcEfficiencyResultDto.getFaultRate())); |
| | | efficiencyResultDto.setRemoveFaultRunLong(efficiencyResultDto.getRemoveFaultRunLong().add(mdcEfficiencyResultDto.getRemoveFaultRunLong())); |
| | | return mdcEfficiencyResultDto; |
| | | } |
| | | |
| | |
| | | public MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date) { |
| | | return this.baseMapper.findByEquipmentAndMonth(equipmentId, date); |
| | | } |
| | | |
| | | @Override |
| | | public MdcEquipmentStatisticalInfo findByEquIdsAndMonth(List<String> equipmentIdList, String month) { |
| | | return this.baseMapper.findByEquIdsAndMonth(equipmentIdList, month); |
| | | } |
| | | |
| | | @Override |
| | | public List<MdcEquipmentStatisticalInfo> findByEquipmentAndDate(List<String> equipmentIdList, String date) { |
| | | return this.baseMapper.findByEquipmentAndDate(equipmentIdList, date); |
| | | } |
| | | } |
| | |
| | | super.saveBatch(result); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal findByEquIdAndMonth(List<String> equipmentIdList, String month) { |
| | | return this.baseMapper.findByEquIdAndMonth(equipmentIdList, month); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class AndonOrderWebSocketVo { |
| | | |
| | | /** |
| | | * 设å¤ç¼å· |
| | | */ |
| | | private String equipmentId; |
| | | |
| | | /** |
| | | * å¼å«äººå |
| | | */ |
| | | private String callPersonnel; |
| | | |
| | | /** |
| | | * å®ç¯ç±»å |
| | | */ |
| | | private String andonType; |
| | | |
| | | /** |
| | | * å¼å«æ¶é´ |
| | | */ |
| | | private String callTime; |
| | | |
| | | /** |
| | | * å¼å«åå |
| | | */ |
| | | private String callReason; |
| | | |
| | | /** |
| | | * 责任人 |
| | | */ |
| | | private String personResponsible; |
| | | |
| | | /** |
| | | * æ¥ä¿®æ¶é´ |
| | | */ |
| | | private String repairTime; |
| | | |
| | | /** |
| | | * æ
éæè¿° |
| | | */ |
| | | private String faultInfo; |
| | | |
| | | /** |
| | | * æå±åæ¿ |
| | | */ |
| | | private String plantName; |
| | | } |
| | |
| | | List<String> findTeamValue(@Param("userId") String userId, @Param("productionList") List<String> productionList); |
| | | |
| | | List<String> findProIdsByUId(@Param("userId") String userId, @Param("allProductionIds") List<String> allProductionIds); |
| | | |
| | | List<String> findChildByProId(@Param("productionId") String productionId); |
| | | |
| | | String findProName(@Param("equipmentId") String equipmentId); |
| | | } |
| | |
| | | </foreach> |
| | | AND user_id = #{userId} |
| | | </select> |
| | | |
| | | <select id="findChildByProId" resultType="java.lang.String"> |
| | | WITH temp ( id ) AS ( |
| | | SELECT |
| | | id |
| | | FROM |
| | | mdc_production |
| | | WHERE |
| | | id = #{ productionId } |
| | | AND mdc_flag = '1' UNION ALL |
| | | SELECT |
| | | a.id |
| | | FROM |
| | | mdc_production a |
| | | INNER JOIN temp ON a.parent_id = temp.id |
| | | WHERE |
| | | a.mdc_flag = '1' |
| | | ) SELECT |
| | | * |
| | | FROM |
| | | temp |
| | | </select> |
| | | |
| | | <select id="findProName" resultType="java.lang.String"> |
| | | WITH production_hierarchy AS ( |
| | | SELECT |
| | | t3.id, |
| | | t3.parent_id, |
| | | t3.production_name, |
| | | t3.org_type, |
| | | 0 AS level |
| | | FROM |
| | | mdc_equipment t1 |
| | | JOIN |
| | | mdc_production_equipment t2 ON t1.id = t2.equipment_id |
| | | JOIN |
| | | mdc_production t3 ON t2.production_id = t3.id |
| | | WHERE |
| | | t1.equipment_id = #{equipmentId} |
| | | |
| | | UNION ALL |
| | | SELECT |
| | | t4.id, |
| | | t4.parent_id, |
| | | t4.production_name, |
| | | t4.org_type, |
| | | ph.level + 1 |
| | | FROM |
| | | production_hierarchy ph |
| | | JOIN |
| | | mdc_production t4 ON ph.parent_id = t4.id |
| | | WHERE |
| | | ph.parent_id IS NOT NULL |
| | | ) |
| | | SELECT TOP 1 |
| | | production_name |
| | | FROM |
| | | production_hierarchy |
| | | WHERE |
| | | org_type = 2 |
| | | ORDER BY |
| | | level ASC |
| | | </select> |
| | | </mapper> |
| | |
| | | List<String> findProIdsByUId(String userId, List<String> allProductionIds); |
| | | |
| | | /** |
| | | * |
| | | * @param productionId |
| | | * @return |
| | | */ |
| | | List<String> findChildByProId(String productionId); |
| | | |
| | | String findProName(String equipmentId); |
| | | |
| | | /** |
| | | * æ ¹æ®äº§çº¿orgCodeæ¥è¯¢äº§çº¿ |
| | | * @param orgCode |
| | | * @return |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<String> findChildByProId(String productionId) { |
| | | return this.baseMapper.findChildByProId(productionId); |
| | | } |
| | | |
| | | @Override |
| | | public String findProName(String equipmentId) { |
| | | return this.baseMapper.findProName(equipmentId); |
| | | } |
| | | |
| | | @Override |
| | | public MdcProduction findByOrgCode(String orgCode){ |
| | | return this.baseMapper.selectOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getOrgCode, orgCode)); |
| | | } |