| | |
| | | */ |
| | | String DICT_USER_FIRST_LOGIN = "user_first_login"; |
| | | |
| | | /** |
| | | * 设å¤è¿è¡è½¬éèå´åå
¸ç¼å· |
| | | */ |
| | | String DICT_OPERATING_SPEED_RANGE = "operating_speed_range"; |
| | | |
| | | /** |
| | | * å©ç¨çå¤å®é´éåå
¸ç¼å· |
| | | */ |
| | | String DICT_EQUIPMENT_RATE_JUDGE = "equipment_rate_judge"; |
| | | |
| | | /** |
| | | * 设å¤ç¶æå¤æé´éåå
¸ç¼å· |
| | | */ |
| | | String DICT_EQUIPMENT_SPEED_JUDGE = "equipment_status_judge"; |
| | | |
| | | /** |
| | | * å©ç¨çæ£å¸¸å¼åå
¸ç¼å· |
| | | */ |
| | | String DICT_EQUIPMENT_RATE_NORMAL = "equipment_rate_normal"; |
| | | |
| | | /** |
| | | * å çæ°æ® èªå¨è®¡ç®æ è¯ 1(æ¯) 2(å¦) |
| | | */ |
| | | Integer AUTO_FLAG_Y = 1; |
| | | Integer AUTO_FLAG_N = 2; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | 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.common.system.query.QueryGenerator; |
| | | import org.jeecg.modules.mdc.entity.EquipmentBeilvAlarm; |
| | | import org.jeecg.modules.mdc.service.IEquipmentBeilvAlarmService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * @Description: 设å¤åçæ¥è¦ |
| | | * @Author: jeecg-boot |
| | | * @Date: 2024-01-17 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "设å¤åçæ¥è¦") |
| | | @RestController |
| | | @RequestMapping("/mdc/equipmentBeilvAlarm") |
| | | public class EquipmentBeilvAlarmController extends JeecgController<EquipmentBeilvAlarm, IEquipmentBeilvAlarmService> { |
| | | |
| | | @Resource |
| | | private IEquipmentBeilvAlarmService equipmentBeilvAlarmService; |
| | | |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | | * |
| | | * @param equipmentBeilvAlarm |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤åçæ¥è¦-å页å表æ¥è¯¢") |
| | | @ApiOperation(value = "设å¤åçæ¥è¦-å页å表æ¥è¯¢", notes = "设å¤åçæ¥è¦-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(EquipmentBeilvAlarm equipmentBeilvAlarm, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<EquipmentBeilvAlarm> queryWrapper = QueryGenerator.initQueryWrapper(equipmentBeilvAlarm, req.getParameterMap()); |
| | | queryWrapper.notLike("AlarmContent", "æ£å¸¸"); |
| | | Page<EquipmentBeilvAlarm> page = new Page<EquipmentBeilvAlarm>(pageNo, pageSize); |
| | | IPage<EquipmentBeilvAlarm> pageList = equipmentBeilvAlarmService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å |
| | | * |
| | | * @param equipmentBeilvAlarm |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤åçæ¥è¦-æ·»å ") |
| | | @ApiOperation(value = "设å¤åçæ¥è¦-æ·»å ", notes = "设å¤åçæ¥è¦-æ·»å ") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EquipmentBeilvAlarm equipmentBeilvAlarm) { |
| | | equipmentBeilvAlarmService.save(equipmentBeilvAlarm); |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾ |
| | | * |
| | | * @param equipmentBeilvAlarm |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤åçæ¥è¦-ç¼è¾") |
| | | @ApiOperation(value = "设å¤åçæ¥è¦-ç¼è¾", notes = "设å¤åçæ¥è¦-ç¼è¾") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody EquipmentBeilvAlarm equipmentBeilvAlarm) { |
| | | equipmentBeilvAlarmService.updateById(equipmentBeilvAlarm); |
| | | return Result.OK("ç¼è¾æå!"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idå é¤ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤åçæ¥è¦-éè¿idå é¤") |
| | | @ApiOperation(value = "设å¤åçæ¥è¦-éè¿idå é¤", notes = "设å¤åçæ¥è¦-éè¿idå é¤") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
| | | equipmentBeilvAlarmService.removeById(id); |
| | | return Result.OK("å 餿å!"); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤åçæ¥è¦-æ¹éå é¤") |
| | | @ApiOperation(value = "设å¤åçæ¥è¦-æ¹éå é¤", notes = "设å¤åçæ¥è¦-æ¹éå é¤") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | this.equipmentBeilvAlarmService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("æ¹éå 餿åï¼"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idæ¥è¯¢ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤åçæ¥è¦-éè¿idæ¥è¯¢") |
| | | @ApiOperation(value = "设å¤åçæ¥è¦-éè¿idæ¥è¯¢", notes = "设å¤åçæ¥è¦-éè¿idæ¥è¯¢") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
| | | EquipmentBeilvAlarm equipmentBeilvAlarm = equipmentBeilvAlarmService.getById(id); |
| | | return Result.OK(equipmentBeilvAlarm); |
| | | } |
| | | |
| | | /** |
| | | * 导åºexcel |
| | | * |
| | | * @param request |
| | | * @param equipmentBeilvAlarm |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, EquipmentBeilvAlarm equipmentBeilvAlarm) { |
| | | return super.exportXls(request, equipmentBeilvAlarm, EquipmentBeilvAlarm.class, "设å¤åçæ¥è¦"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿excel导å
¥æ°æ® |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, EquipmentBeilvAlarm.class); |
| | | } |
| | | |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentOvertimeService; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.math.BigDecimal; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 设å¤å ç管ç |
| | |
| | | @ApiOperation(value = "设å¤å ç管ç-æ·»å ", notes = "设å¤å ç管ç-æ·»å ") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody MdcEquipmentOvertime mdcEquipmentOvertime) { |
| | | String[] calendarIdList = mdcEquipmentOvertime.getCalendarId().split(","); |
| | | List<MdcEquipmentOvertime> equipmentOvertimeList = new ArrayList<>(); |
| | | mdcEquipmentOvertimeService.remove(new LambdaQueryWrapper<MdcEquipmentOvertime>().in(MdcEquipmentOvertime::getCalendarId, Arrays.asList(calendarIdList))); |
| | | for (String calendarId : calendarIdList) { |
| | | MdcEquipmentOvertime equipmentOvertime = new MdcEquipmentOvertime(); |
| | | equipmentOvertime.setCalendarId(calendarId); |
| | | equipmentOvertime.setStartTime(mdcEquipmentOvertime.getStartTime()); |
| | | equipmentOvertime.setEndTime(mdcEquipmentOvertime.getEndTime()); |
| | | equipmentOvertime.setRemark(mdcEquipmentOvertime.getRemark()); |
| | | equipmentOvertimeList.add(equipmentOvertime); |
| | | if (org.apache.commons.lang3.StringUtils.isBlank(mdcEquipmentOvertime.getEquipmentId())) { |
| | | return Result.error("æªéæ©è®¾å¤ï¼è¯·ææ¥ï¼"); |
| | | } |
| | | mdcEquipmentOvertimeService.saveBatch(equipmentOvertimeList); |
| | | boolean result = mdcEquipmentOvertimeService.addOvertime(mdcEquipmentOvertime); |
| | | if (!result) { |
| | | return Result.error("æ·»å 失败ï¼"); |
| | | } |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "设å¤å ç管ç-ç¼è¾", notes = "设å¤å ç管ç-ç¼è¾") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody MdcEquipmentOvertime mdcEquipmentOvertime) { |
| | | String startTime = mdcEquipmentOvertime.getStartTime(); |
| | | String endTime = mdcEquipmentOvertime.getEndTime(); |
| | | long duration = DateUtils.differentSecond(DateUtils.setTimeForDay(DateUtils.getNow(), startTime), DateUtils.setTimeForDay(DateUtils.getNow(), endTime)); |
| | | mdcEquipmentOvertime.setDuration(new BigDecimal(duration)); |
| | | mdcEquipmentOvertimeService.updateById(mdcEquipmentOvertime); |
| | | return Result.OK("ç¼è¾æå!"); |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: æç©é
置管ç |
| | |
| | | @RequestMapping("/importExcel") |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, MdcTorqueConfig.class); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æç©å¼çæä¸»è½´è¿è¡æ²çº¿ |
| | | * |
| | | * @param torqueValue |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "æç©é
置管ç-æ ¹æ®æç©å¼çæä¸»è½´è¿è¡æ²çº¿") |
| | | @ApiOperation(value = "æç©é
置管ç-æ ¹æ®æç©å¼çæä¸»è½´è¿è¡æ²çº¿", notes = "æç©é
置管ç-æ ¹æ®æç©å¼çæä¸»è½´è¿è¡æ²çº¿") |
| | | @GetMapping("/findSpindleRunningCurve") |
| | | public Result<List<MdcTorqueConfig>> findSpindleRunningCurve(@RequestParam(name = "torqueValue", required = true) float torqueValue, |
| | | @RequestParam(name = "equipmentId", required = true) String equipmentId) { |
| | | List<MdcTorqueConfig> list = mdcTorqueConfigService.findSpindleRunningCurve(torqueValue, equipmentId); |
| | | return Result.ok(list); |
| | | } |
| | | |
| | | /** |
| | |
| | | //夿³¨ |
| | | private String remark; |
| | | |
| | | //æç©å¼ |
| | | private float torque; |
| | | |
| | | //è¿ç»åæ° |
| | | private String feedParameter; |
| | | |
| | | // 设å¤é©±å¨åæ° |
| | | private List<MdcDriveTypeParamConfig> mdcDriveTypeParamConfigList; |
| | | |
| | |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public float getTorque() { |
| | | return torque; |
| | | } |
| | | |
| | | public void setTorque(float torqueValue) { |
| | | this.torque = torqueValue; |
| | | } |
| | | |
| | | public String getFeedParameter() { |
| | | return feedParameter; |
| | | } |
| | | |
| | | public void setFeedParameter(String feedParameter) { |
| | | this.feedParameter = feedParameter; |
| | | } |
| | | |
| | | public void setMdcDriveTypeParamConfigList(List<MdcDriveTypeParamConfig> mdcDriveTypeParamConfigList) { |
| | | this.mdcDriveTypeParamConfigList = mdcDriveTypeParamConfigList; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.entity; |
| | | |
| | | 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.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Description: 设å¤åçæ¥è¦ |
| | | * @Author: jeecg-boot |
| | | * @Date: 2024-01-17 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Data |
| | | @TableName("EquipmentBeilvAlarm") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "EquipmentBeilvAlarm对象", description = "设å¤åçæ¥è¦") |
| | | public class EquipmentBeilvAlarm { |
| | | |
| | | /** |
| | | * 设å¤ç¼å· |
| | | */ |
| | | @Excel(name = "设å¤ç¼å·", width = 15) |
| | | @ApiModelProperty(value = "设å¤ç¼å·") |
| | | private String equipmentid; |
| | | /** |
| | | * æ¥è¦æ¶é´ |
| | | */ |
| | | @Excel(name = "æ¥è¦æ¶é´", width = 20, format = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "æ¥è¦æ¶é´") |
| | | private Date collecttime; |
| | | /** |
| | | * 设å®å¼ |
| | | */ |
| | | @Excel(name = "设å®å¼", width = 15) |
| | | @ApiModelProperty(value = "设å®å¼") |
| | | private String setvalue; |
| | | /** |
| | | * å®é
å¼ |
| | | */ |
| | | @Excel(name = "å®é
å¼", width = 15) |
| | | @ApiModelProperty(value = "å®é
å¼") |
| | | private String realvalue; |
| | | /** |
| | | * æ¥è¦å· |
| | | */ |
| | | @Excel(name = "æ¥è¦å·", width = 15) |
| | | @ApiModelProperty(value = "æ¥è¦å·") |
| | | private String alarmno; |
| | | /** |
| | | * æ¥è¦å
容 |
| | | */ |
| | | @Excel(name = "æ¥è¦å
容", width = 15) |
| | | @ApiModelProperty(value = "æ¥è¦å
容") |
| | | private String alarmcontent; |
| | | /** |
| | | * isexamine |
| | | */ |
| | | @Excel(name = "isexamine", width = 15) |
| | | @ApiModelProperty(value = "isexamine") |
| | | private Integer isexamine; |
| | | /** |
| | | * iseffective |
| | | */ |
| | | @Excel(name = "iseffective", width = 15) |
| | | @ApiModelProperty(value = "iseffective") |
| | | private Integer iseffective; |
| | | /** |
| | | * examinetime |
| | | */ |
| | | @Excel(name = "examinetime", width = 20, format = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "examinetime") |
| | | private Date examinetime; |
| | | /** |
| | | * examineperson |
| | | */ |
| | | @Excel(name = "examineperson", width = 15) |
| | | @ApiModelProperty(value = "examineperson") |
| | | private String examineperson; |
| | | /** |
| | | * remark |
| | | */ |
| | | @Excel(name = "夿³¨", width = 15) |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | } |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.entity.JeecgEntity; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | private static final long serialVersionUID = -7163039765166584824L; |
| | | |
| | | @TableField(exist = false) |
| | | @Excel(name = "设å¤ç¼å·", width = 20) |
| | | @ApiModelProperty("设å¤ç¼å·") |
| | | private String equipmentId; |
| | | |
| | | @TableField(exist = false) |
| | | @Excel(name = "设å¤åç§°", width = 20) |
| | | @ApiModelProperty("设å¤åç§°") |
| | | private String equipmentName; |
| | | |
| | | /** |
| | | * çææ¥æ |
| | | */ |
| | | @Excel(name = "çææ¥æ", width = 15) |
| | | @TableField(exist = false) |
| | | private String effectiveDate; |
| | | @ApiModelProperty("æ¥æ") |
| | | @Excel(name = "æ¥æ", width = 20) |
| | | private String theDate; |
| | | |
| | | /** |
| | | * çæ¬¡å¼å§æ¶é´ |
| | | */ |
| | | @Excel(name = "çæ¬¡å¼å§æ¶é´", width = 20) |
| | | @ApiModelProperty("çæ¬¡å¼å§æ¶é´") |
| | | @TableField(exist = false) |
| | | private String startDate; |
| | | |
| | | /** |
| | | * çæ¬¡ç»ææ¶é´ |
| | | */ |
| | | @Excel(name = "çæ¬¡ç»ææ¶é´", width = 20) |
| | | @ApiModelProperty("çæ¬¡ç»ææ¶é´") |
| | | @TableField(exist = false) |
| | | private String endDate; |
| | | |
| | | /** |
| | | * 工使¥åid |
| | | */ |
| | | @ApiModelProperty(value = "工使¥åid") |
| | | private String calendarId; |
| | | // @Excel(name = "èªå¨è®¡ç®æ è¯", width = 15) |
| | | @ApiModelProperty("èªå¨è®¡ç®æ è¯") |
| | | private Integer autoFlag = CommonConstant.AUTO_FLAG_N; |
| | | |
| | | /** |
| | | * å çå¼å§æ¶é´ |
| | |
| | | private String endTime; |
| | | |
| | | /** |
| | | * å çæ¶é¿ |
| | | */ |
| | | @Excel(name = "æ¶é¿", width = 20) |
| | | @ApiModelProperty(value = "æ¶é¿") |
| | | private BigDecimal duration; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @Excel(name = "夿³¨") |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.job; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.util.ThrowableUtil; |
| | | 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.ISysAnnouncementService; |
| | | import org.quartz.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @Description: çæ§è®¾å¤è½¬éä»»å¡ |
| | | * @date 2024/1/16 17:36 |
| | | */ |
| | | @PersistJobDataAfterExecution |
| | | @DisallowConcurrentExecution |
| | | @Slf4j |
| | | public class RunMonitoringSpeedJob implements Job { |
| | | |
| | | @Resource |
| | | private IQuartzJobService quartzJobService; |
| | | |
| | | @Resource |
| | | private ISysQuartzLogService sysQuartzLogService; |
| | | |
| | | @Resource |
| | | private ISysAnnouncementService sysAnnouncementService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext jobExecutionContext) 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()); |
| | | } |
| | | log.info("çæ§è®¾å¤è½¬éä»»å¡ RunMonitoringSpeedJob start! æ¶é´:" + DateUtils.now()); |
| | | long startTime = System.currentTimeMillis(); |
| | | try { |
| | | mdcEquipmentService.monitoringSpeedProcess(); |
| | | quartzLog.setIsSuccess(0); |
| | | } catch (Exception e) { |
| | | quartzLog.setIsSuccess(-1); |
| | | quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); |
| | | // åéæ¶æ¯éç¥ |
| | | sysAnnouncementService.jobSendMessage("çæ§è®¾å¤è½¬éä»»å¡å¤±è´¥ï¼", quartzLog.getExceptionDetail()); |
| | | } |
| | | long endTime = System.currentTimeMillis(); |
| | | quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); |
| | | sysQuartzLogService.save(quartzLog); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.job; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.dto.message.MessageDTO; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.api.ISysBaseAPI; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentRunningSectionService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.service.MdcEfficiencyReportService; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.util.ThrowableUtil; |
| | | 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.ISysAnnouncementService; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.quartz.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @Description: å©ç¨çæ£å¸¸å¼ï¼è®¾å¤ç¶æé¿ææ ååæ¥è¦ |
| | | * @date 2024/1/17 14:10 |
| | | */ |
| | | @PersistJobDataAfterExecution |
| | | @DisallowConcurrentExecution |
| | | @Slf4j |
| | | public class RunningEquipmentStatusJob implements Job { |
| | | |
| | | @Resource |
| | | private IQuartzJobService quartzJobService; |
| | | |
| | | @Resource |
| | | private ISysQuartzLogService sysQuartzLogService; |
| | | |
| | | @Resource |
| | | private ISysAnnouncementService sysAnnouncementService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | |
| | | @Resource |
| | | private MdcEfficiencyReportService mdcEfficiencyReportService; |
| | | |
| | | @Resource |
| | | private ISysBaseAPI sysBaseApi; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext jobExecutionContext) 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()); |
| | | } |
| | | log.info("设å¤ç¶æé¿ææ å忥è¦ä»»å¡ RunningEquipmentStatusJob start! æ¶é´:" + DateUtils.getNow()); |
| | | long startTime = System.currentTimeMillis(); |
| | | try { |
| | | List<MdcEquipment> equipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<>()); |
| | | //List<MdcEquipment> equipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, "2140198")); |
| | | // è·åå©ç¨çå¤å®å¤©æ° |
| | | List<DictModel> dictModelList1 = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_EQUIPMENT_RATE_JUDGE); |
| | | Integer equipmentRateJudge = 5; |
| | | if (dictModelList1 != null && !dictModelList1.isEmpty()) { |
| | | equipmentRateJudge = Integer.valueOf(dictModelList1.get(0).getValue()); |
| | | } |
| | | // è·åå©ç¨çæ£å¸¸å¼ |
| | | List<DictModel> dictModelList2 = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_EQUIPMENT_SPEED_JUDGE); |
| | | Integer equipmentRateNormal = 20; |
| | | if (dictModelList2 != null && !dictModelList2.isEmpty()) { |
| | | equipmentRateNormal = Integer.valueOf(dictModelList2.get(0).getValue()); |
| | | } |
| | | // è·å设å¤ç¶æå¤©æ° |
| | | List<DictModel> dictModelList3 = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_EQUIPMENT_RATE_NORMAL); |
| | | Integer equipmentStatusJudge = 5; |
| | | if (dictModelList3 != null && !dictModelList3.isEmpty()) { |
| | | equipmentStatusJudge = Integer.valueOf(dictModelList3.get(0).getValue()); |
| | | } |
| | | for (MdcEquipment mdcEquipment : equipmentList) { |
| | | // 夿å©ç¨ç |
| | | String date = DateUtils.format(DateUtils.toDate(LocalDate.now().plusDays(-equipmentRateJudge).toString(), DateUtils.STR_DATE), DateUtils.STRDATE); |
| | | List<BigDecimal> efficiencyRateList = mdcEfficiencyReportService.getEfficiencyRate(mdcEquipment.getEquipmentId(), date); |
| | | if (efficiencyRateList != null && !efficiencyRateList.isEmpty()) { |
| | | boolean flag = true; |
| | | for (BigDecimal processLong : efficiencyRateList) { |
| | | BigDecimal efficiencyRate = processLong.divide(new BigDecimal("86400"), 4, RoundingMode.HALF_UP); |
| | | if (efficiencyRate.compareTo(new BigDecimal(equipmentRateNormal)) > -1) { |
| | | flag = false; |
| | | } |
| | | } |
| | | if (flag) { |
| | | // 䏿¥ |
| | | MessageDTO messageDTO = new MessageDTO(); |
| | | messageDTO.setCategory("é¢è¦æ¶æ¯"); |
| | | messageDTO.setFromUser("admin"); |
| | | messageDTO.setToUser("admin"); |
| | | messageDTO.setContent("设å¤ç¼å·ä¸º [" + mdcEquipment.getEquipmentId() + "] ç设å¤å©ç¨çä½äºæ£å¸¸å¼æ¥è¦ï¼"); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | } |
| | | } |
| | | // å¤æè®¾å¤ç¶æ |
| | | Date date1 = DateUtils.toDate(LocalDate.now().plusDays(-equipmentStatusJudge).toString(), DateUtils.STR_DATE); |
| | | List<Integer> sectionList = mdcEquipmentRunningSectionService.getDataList(mdcEquipment.getEquipmentId(), date1); |
| | | if (sectionList != null && !sectionList.isEmpty() && sectionList.size() > 1) { |
| | | boolean flag = true; |
| | | Integer integer = sectionList.get(0); |
| | | for (Integer integer1 : sectionList) { |
| | | if (!integer.equals(integer1)) { |
| | | flag = false; |
| | | } |
| | | } |
| | | if (flag) { |
| | | // 䏿¥ |
| | | MessageDTO messageDTO = new MessageDTO(); |
| | | messageDTO.setCategory("é¢è¦æ¶æ¯"); |
| | | messageDTO.setFromUser("admin"); |
| | | messageDTO.setToUser("admin"); |
| | | messageDTO.setContent("设å¤ç¼å·ä¸º [" + mdcEquipment.getEquipmentId() + "] ç设å¤ç¶æé¿ææ å忥è¦ï¼"); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | } |
| | | } |
| | | } |
| | | quartzLog.setIsSuccess(0); |
| | | } catch (Exception e) { |
| | | quartzLog.setIsSuccess(-1); |
| | | quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); |
| | | // åéæ¶æ¯éç¥ |
| | | sysAnnouncementService.jobSendMessage("设å¤ç¶æé¿ææ å忥è¦ä»»å¡å¤±è´¥ï¼", quartzLog.getExceptionDetail()); |
| | | } |
| | | long endTime = System.currentTimeMillis(); |
| | | quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); |
| | | sysQuartzLogService.save(quartzLog); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.job; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; |
| | | import org.jeecg.modules.mdc.entity.MdcSystemParameters; |
| | | import org.jeecg.modules.mdc.service.*; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.util.ThrowableUtil; |
| | | import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; |
| | | 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.ISysAnnouncementService; |
| | | import org.quartz.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @Description: 设å¤å çæ¶é¿ç®æ³ç»è®¡ |
| | | * @date 2024/1/24 17:12 |
| | | */ |
| | | @PersistJobDataAfterExecution |
| | | @DisallowConcurrentExecution |
| | | @Slf4j |
| | | public class RunningOvertimeDurationJob implements Job { |
| | | |
| | | @Resource |
| | | private IQuartzJobService quartzJobService; |
| | | |
| | | @Resource |
| | | private ISysQuartzLogService sysQuartzLogService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentOvertimeService mdcEquipmentOvertimeService; |
| | | |
| | | /** |
| | | * è¥åæ°åéåä¿®æ¹ QuartzJobControllerä¸ä¹é对åºä¿®æ¹ æ¶é´ï¼ yyyyMMdd ä¾ï¼ 20230414 |
| | | */ |
| | | private String parameter; |
| | | |
| | | public void setParameter(String parameter) { |
| | | this.parameter = parameter; |
| | | } |
| | | |
| | | @Resource |
| | | private ISysAnnouncementService sysAnnouncementService; |
| | | |
| | | @Resource |
| | | private IMdcDeviceCalendarService mdcDeviceCalendarService; |
| | | |
| | | @Resource |
| | | private IMdcSystemParametersService mdcSystemParametersService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext jobExecutionContext) 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()); |
| | | } |
| | | quartzLog.setParams(this.parameter); |
| | | log.info(String.format("宿¶ç»è®¡è®¾å¤å çæ¶é¿ä»»å¡ param: %s RunningOvertimeDurationJob start! æ¶é´:" + DateUtils.getNow(), this.parameter)); |
| | | long startTime = System.currentTimeMillis(); |
| | | try { |
| | | String date = ""; |
| | | if (StringUtils.isNotBlank(this.parameter)) { |
| | | date = DateUtils.format(DateUtils.toDate(this.parameter, DateUtils.STRDATE), DateUtils.STR_DATE); |
| | | Date initDate = DateUtils.toDate(this.parameter, DateUtils.STRDATE); |
| | | if (initDate != null) { |
| | | mdcEquipmentOvertimeService.remove(new LambdaQueryWrapper<MdcEquipmentOvertime>().eq(MdcEquipmentOvertime::getTheDate, this.parameter).eq(MdcEquipmentOvertime::getAutoFlag, CommonConstant.AUTO_FLAG_Y)); |
| | | } |
| | | } else { |
| | | date = DateUtils.format(DateUtils.getNow(), DateUtils.STR_DATE); |
| | | } |
| | | List<MdcEquipment> equipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<>()); |
| | | MdcSystemParameters mdcSystemParameters = mdcSystemParametersService.getOne(new LambdaQueryWrapper<MdcSystemParameters>().eq(MdcSystemParameters::getCode, "equip_log_statis_time")); |
| | | if (mdcSystemParameters == null) { |
| | | throw new JobExecutionException("mdc_system_parameters è¡¨ä¸æ°æ®ç¼ºå¤±"); |
| | | } |
| | | String value = mdcSystemParameters.getValue(); |
| | | List<MdcEquipmentOvertime> result = new ArrayList<>(); |
| | | for (MdcEquipment mdcEquipment : equipmentList) { |
| | | // è·å设å¤å·¥ä½æ¥å |
| | | List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = mdcDeviceCalendarService.listByEquipmentIdAndDate(mdcEquipment.getEquipmentId(), this.parameter); |
| | | if (mdcDeviceCalendarVos != null && !mdcDeviceCalendarVos.isEmpty()) { |
| | | //è·åæåä¸ä¸ªçæ¬¡ç»ææ¶é´ |
| | | Date startDate = this.getCalendarEndDate(mdcDeviceCalendarVos, date); |
| | | Date endDate = DateUtils.plusTime(DateUtils.toDate(date + " " + value, DateUtils.STR_DATE_TIME_SMALL), 1); |
| | | List<MdcEquipmentRunningSection> equipmentRunningSectionList = mdcEquipmentRunningSectionService.selectRunningData(mdcEquipment.getEquipmentId(), startDate, endDate); |
| | | if (equipmentRunningSectionList != null && !equipmentRunningSectionList.isEmpty()) { |
| | | // æ¶é´ä¿®æ£ |
| | | if (equipmentRunningSectionList.get(0).getStartTime().before(startDate)) { |
| | | equipmentRunningSectionList.get(0).setStartTime(startDate); |
| | | } |
| | | if (equipmentRunningSectionList.get(equipmentRunningSectionList.size() - 1).getEndTime().after(endDate)) { |
| | | equipmentRunningSectionList.get(equipmentRunningSectionList.size() - 1).setEndTime(endDate); |
| | | } |
| | | BigDecimal duration = BigDecimal.ZERO; |
| | | for (MdcEquipmentRunningSection mdcEquipmentRunningSection : equipmentRunningSectionList) { |
| | | duration = duration.add(new BigDecimal(DateUtils.differentSecond(mdcEquipmentRunningSection.getStartTime(), mdcEquipmentRunningSection.getEndTime()))); |
| | | } |
| | | MdcEquipmentOvertime mdcEquipmentOvertime = new MdcEquipmentOvertime(); |
| | | mdcEquipmentOvertime.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | mdcEquipmentOvertime.setDuration(duration); |
| | | mdcEquipmentOvertime.setAutoFlag(CommonConstant.AUTO_FLAG_Y); |
| | | mdcEquipmentOvertime.setTheDate(this.parameter); |
| | | result.add(mdcEquipmentOvertime); |
| | | } |
| | | |
| | | } else { |
| | | // 没æç次é
ç½®ï¼è®¡ç®å
¨å¤©ç设å¤å å·¥ç¶æ |
| | | Date startDate = DateUtils.toDate(date + " " + value, DateUtils.STR_DATE_TIME_SMALL); |
| | | Date endDate = DateUtils.plusTime(startDate, 1); |
| | | List<MdcEquipmentRunningSection> equipmentRunningSectionList = mdcEquipmentRunningSectionService.selectRunningData(mdcEquipment.getEquipmentId(), startDate, endDate); |
| | | if (equipmentRunningSectionList != null && !equipmentRunningSectionList.isEmpty()) { |
| | | // æ¶é´ä¿®æ£ |
| | | if (equipmentRunningSectionList.get(0).getStartTime().before(startDate)) { |
| | | equipmentRunningSectionList.get(0).setStartTime(startDate); |
| | | } |
| | | if (equipmentRunningSectionList.get(equipmentRunningSectionList.size() - 1).getEndTime().after(endDate)) { |
| | | equipmentRunningSectionList.get(equipmentRunningSectionList.size() - 1).setEndTime(endDate); |
| | | } |
| | | BigDecimal duration = BigDecimal.ZERO; |
| | | for (MdcEquipmentRunningSection mdcEquipmentRunningSection : equipmentRunningSectionList) { |
| | | duration = duration.add(new BigDecimal(DateUtils.differentSecond(mdcEquipmentRunningSection.getStartTime(), mdcEquipmentRunningSection.getEndTime()))); |
| | | } |
| | | MdcEquipmentOvertime mdcEquipmentOvertime = new MdcEquipmentOvertime(); |
| | | mdcEquipmentOvertime.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | mdcEquipmentOvertime.setDuration(duration); |
| | | mdcEquipmentOvertime.setAutoFlag(CommonConstant.AUTO_FLAG_Y); |
| | | mdcEquipmentOvertime.setTheDate(this.parameter); |
| | | result.add(mdcEquipmentOvertime); |
| | | } |
| | | |
| | | } |
| | | } |
| | | if (!result.isEmpty()) { |
| | | mdcEquipmentOvertimeService.saveBatch(result); |
| | | } |
| | | quartzLog.setIsSuccess(0); |
| | | } catch (Exception e) { |
| | | quartzLog.setIsSuccess(-1); |
| | | quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); |
| | | // åéæ¶æ¯éç¥ |
| | | sysAnnouncementService.jobSendMessage("宿¶ç»è®¡è®¾å¤å çæ¶é¿ä»»å¡å¤±è´¥", quartzLog.getExceptionDetail()); |
| | | } |
| | | long endTime = System.currentTimeMillis(); |
| | | quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); |
| | | sysQuartzLogService.save(quartzLog); |
| | | } |
| | | |
| | | private Date getCalendarEndDate(List<MdcDeviceCalendarVo> mdcDeviceCalendarVos, String date) { |
| | | date = DateUtils.format(DateUtils.toDate(date, DateUtils.STRDATE), DateUtils.STR_DATE); |
| | | String endDate = ""; |
| | | for (MdcDeviceCalendarVo mdcDeviceCalendarVo : mdcDeviceCalendarVos) { |
| | | String shiftEndDate = ""; |
| | | if ("true".equals(mdcDeviceCalendarVo.getIsDaySpan())) { |
| | | shiftEndDate = DateUtils.format(DateUtils.plusTime(DateUtils.toDate(date, DateUtils.STR_DATE), 1), DateUtils.STR_DATE) + " " + mdcDeviceCalendarVo.getEndDate(); |
| | | } else { |
| | | shiftEndDate = date + " " + mdcDeviceCalendarVo.getEndDate(); |
| | | } |
| | | if (StringUtils.isBlank(endDate)) { |
| | | endDate = shiftEndDate; |
| | | } else { |
| | | // endDate |
| | | Date date1 = DateUtils.toDate(endDate, DateUtils.STR_DATE_TIME_SMALL); |
| | | // shiftEndDate |
| | | Date date2 = DateUtils.toDate(shiftEndDate, DateUtils.STR_DATE_TIME_SMALL); |
| | | if (date2.after(date1)) { |
| | | endDate = shiftEndDate; |
| | | } |
| | | } |
| | | } |
| | | return DateUtils.toDate(endDate, DateUtils.STR_DATE_TIME_SMALL); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.jeecg.modules.mdc.entity.EquipmentBeilvAlarm; |
| | | |
| | | /** |
| | | * @Description: 设å¤è¿è¡æ°æ®æ¥è¦ |
| | | * @Author: jeecg-boot |
| | | * @Date: 2024-01-17 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface EquipmentBeilvAlarmMapper extends BaseMapper<EquipmentBeilvAlarm> { |
| | | |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.dto.MdcComAnaDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEfficiencyDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEfficiencyResultDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo; |
| | | import org.jeecg.modules.mdc.vo.ComparativeAnalysisQueryVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEfficiencyReportQueryVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEfficiencyReportShiftQueryVo; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | List<MdcComAnaDto> comparativeAnalysis(@Param("vo") ComparativeAnalysisQueryVo vo); |
| | | |
| | | List<BigDecimal> getEfficiencyRate(@Param("equipmentId") String equipmentId, @Param("date") String date); |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | 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.mdc.dto.MdcEquDepDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEquProDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentDepVo; |
| | |
| | | * å页å表 |
| | | */ |
| | | IPage<MdcEquipment> pageList(Page<MdcEquipment> page, @Param("mdcEquipment") MdcEquipmentVo mdcEquipment); |
| | | |
| | | @InterceptorIgnore(tenantLine = "1") |
| | | MdcEquipmentDto getWorkLineLast(@Param("tableName") String saveTableName); |
| | | } |
| | |
| | | List<MdcEquipmentRunningSection> selectRunningData(@Param("equipmentId") String equipmentId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); |
| | | |
| | | List<MdcAlarmListDto> selectAlarmList(@Param("vo") MdcAlarmAnalyzeQueryVo mdcAlarmAnalyzeQueryVo, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | List<Integer> getDataList(@Param("equipmentId") String equipmentId, @Param("date") Date date); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.dto.EquipmentMachingDto; |
| | | import org.jeecg.modules.mdc.entity.MdcTorqueConfig; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public interface MdcTorqueConfigMapper extends BaseMapper<MdcTorqueConfig> { |
| | | |
| | | /** |
| | | * æ ¹æ®æç©å¼å设å¤ç¼å·çæä¸»è½´è¿è¡æ²çº¿ |
| | | * @param torqueValue |
| | | * @return |
| | | */ |
| | | List<MdcTorqueConfig> findSpindleRunningCurve(@Param("torqueValue") float torqueValue, @Param("equipmentId") String equipmentId); |
| | | |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * @param pageData |
| | | * @param mdcTorqueConfig |
| | |
| | | IPage<MdcTorqueConfig> pageList(IPage<MdcTorqueConfig> pageData, @Param("mdcTorqueConfig") MdcTorqueConfig mdcTorqueConfig); |
| | | |
| | | MdcTorqueConfig findLast(@Param("equipmentId") String equipmentId); |
| | | |
| | | List<EquipmentMachingDto> getWorkLineList(@Param("equipmentId") String equipmentId, @Param("startTime") Date startTime, @Param("endTime") Date endTime); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.EquipmentBeilvAlarmMapper"> |
| | | |
| | | </mapper> |
| | |
| | | GROUP BY |
| | | mesi.equipment_id |
| | | </select> |
| | | |
| | | |
| | | <select id="getEfficiencyRate" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | process_long |
| | | FROM |
| | | mdc_equipment_statistical_info |
| | | WHERE |
| | | equipment_id = #{ equipmentId } AND the_date >= #{ date } |
| | | ORDER BY the_date ASC |
| | | </select> |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="getWorkLineLast" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto"> |
| | | select top 1 spindlespeed, actualspindlespeed from [${tableName}] order by CollectTime desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime"> |
| | | SELECT |
| | | t1.id, |
| | | t2.equipment_id equipmentId, |
| | | t4.equipment_name equipmentName, |
| | | t2.effective_date effectiveDate, |
| | | t3.start_date startDate, |
| | | t3.end_date endDate, |
| | | t1.equipment_id equipmentId, |
| | | t2.equipment_name equipmentName, |
| | | t1.the_date theDate, |
| | | t1.start_time startTime, |
| | | t1.end_time endTime, |
| | | t1.duration duration, |
| | | t1.remark remark, |
| | | t1.create_by createBy, |
| | | t1.create_time createTime, |
| | |
| | | t1.update_time updateTime |
| | | FROM |
| | | mdc_equipment_overtime t1 |
| | | LEFT JOIN mdc_device_calendar t2 ON t1.calendar_id = t2.id |
| | | LEFT JOIN mdc_shift_sub t3 ON t3.id = t2.shift_sub_id |
| | | LEFT JOIN mdc_equipment t4 ON t4.equipment_id = t2.equipment_id |
| | | LEFT JOIN mdc_equipment t2 ON t2.equipment_id = t1.equipment_id |
| | | <where> |
| | | <if test="mdcEquipmentOvertime.equipmentName != null and mdcEquipmentOvertime.equipmentName != '' "> |
| | | AND t4.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentName}),'%') |
| | | AND t2.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentName}),'%') |
| | | </if> |
| | | <if test="mdcEquipmentOvertime.equipmentId != null and mdcEquipmentOvertime.equipmentId != '' "> |
| | | AND t2.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentId}),'%') |
| | | AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentId}),'%') |
| | | </if> |
| | | <if test="mdcEquipmentOvertime.mdcSectionIds != null and mdcEquipmentOvertime.mdcSectionIds.size() > 0 "> |
| | | AND t2.equipment_id IN |
| | | AND t1.equipment_id IN |
| | | <foreach collection="mdcEquipmentOvertime.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> |
| | | #{ id } |
| | | </foreach> |
| | | </if> |
| | | <if test="mdcEquipmentOvertime.startTime != null and mdcEquipmentOvertime.startTime != '' and mdcEquipmentOvertime.endTime != null and mdcEquipmentOvertime.endTime != ''"> |
| | | AND t1.the_date BETWEEN #{ mdcEquipmentOvertime.startTime } AND #{ mdcEquipmentOvertime.endTime } |
| | | </if> |
| | | </where> |
| | | order by t2.effective_date asc |
| | | order by t1.the_date asc |
| | | </select> |
| | | |
| | | <!--listå表--> |
| | | <select id="list" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime"> |
| | | SELECT |
| | | t1.id, |
| | | t2.equipment_id equipmentId, |
| | | t4.equipment_name equipmentName, |
| | | t2.effective_date effectiveDate, |
| | | t3.start_date startDate, |
| | | t3.end_date endDate, |
| | | t1.equipment_id equipmentId, |
| | | t2.equipment_name equipmentName, |
| | | t1.the_date theDate, |
| | | t1.start_time startTime, |
| | | t1.end_time endTime, |
| | | t1.duration duration, |
| | | t1.remark remark, |
| | | t1.create_by createBy, |
| | | t1.create_time createTime, |
| | |
| | | t1.update_time updateTime |
| | | FROM |
| | | mdc_equipment_overtime t1 |
| | | LEFT JOIN mdc_device_calendar t2 ON t1.calendar_id = t2.id |
| | | LEFT JOIN mdc_shift_sub t3 ON t3.id = t2.shift_sub_id |
| | | LEFT JOIN mdc_equipment t4 ON t4.equipment_id = t2.equipment_id |
| | | LEFT JOIN mdc_equipment t2 ON t2.equipment_id = t1.equipment_id |
| | | <where> |
| | | <if test="mdcEquipmentOvertime.equipmentName != null and mdcEquipmentOvertime.equipmentName != '' "> |
| | | AND t4.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentName}),'%') |
| | | AND t2.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentName}),'%') |
| | | </if> |
| | | <if test="mdcEquipmentOvertime.equipmentId != null and mdcEquipmentOvertime.equipmentId != '' "> |
| | | AND t2.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentId}),'%') |
| | | AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentId}),'%') |
| | | </if> |
| | | <if test="mdcEquipmentOvertime.mdcSectionIds != null and mdcEquipmentOvertime.mdcSectionIds.size() > 0 "> |
| | | AND t2.equipment_id IN |
| | | AND t1.equipment_id IN |
| | | <foreach collection="mdcEquipmentOvertime.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> |
| | | #{ id } |
| | | </foreach> |
| | | </if> |
| | | <if test="mdcEquipmentOvertime.startTime != null and mdcEquipmentOvertime.startTime != '' and mdcEquipmentOvertime.endTime != null and mdcEquipmentOvertime.endTime != ''"> |
| | | AND t1.the_date BETWEEN #{ mdcEquipmentOvertime.startTime } AND #{ mdcEquipmentOvertime.endTime } |
| | | </if> |
| | | </where> |
| | | order by t2.effective_date asc |
| | | order by t1.the_date asc |
| | | </select> |
| | | |
| | | <!--æ¥è¯¢å çæ¶é¿--> |
| | | <select id="computeOvertime" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime"> |
| | | SELECT |
| | | meo.* |
| | | * |
| | | FROM |
| | | mdc_equipment_overtime meo |
| | | LEFT JOIN mdc_device_calendar mdc ON meo.calendar_id = mdc.id |
| | | mdc_equipment_overtime |
| | | WHERE |
| | | mdc.effective_date LIKE CONCAT(#{ validDate }, '%') |
| | | AND mdc.equipment_id = #{ equipmentId } |
| | | the_date LIKE CONCAT(#{ validDate }, '%') AND equipment_id = #{ equipmentId } |
| | | </select> |
| | | </mapper> |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="getDataList" resultType="java.lang.Integer"> |
| | | SELECT |
| | | status |
| | | FROM |
| | | mdc_equipment_running_section |
| | | WHERE |
| | | equipment_id = #{ equipmentId } |
| | | AND start_time > #{date} |
| | | AND status IS NOT NULL |
| | | </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.MdcTorqueConfigMapper"> |
| | | <!--æ ¹æ®æç©å¼çæä¸»è½´è¿è¡æ²çº¿--> |
| | | <select id="findSpindleRunningCurve" resultType="org.jeecg.modules.mdc.entity.MdcTorqueConfig"> |
| | | select mtc.* from mdc_torque_config mtc where mtc.torque_value=#{torqueValue} and mtc.equipment_id=#{equipmentId} |
| | | </select> |
| | | |
| | | <!--æ ¹æ®è½¦é´å±çº§æ¥è¯¢æç©é
ç½®å表--> |
| | | <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcTorqueConfig"> |
| | |
| | | ORDER BY |
| | | torque_date DESC |
| | | </select> |
| | | |
| | | <!--çæå·¥ä½æ²çº¿--> |
| | | <select id="getWorkLineList" resultType="org.jeecg.modules.mdc.dto.EquipmentMachingDto"> |
| | | SELECT |
| | | torque_date CollectTime, |
| | | torque_value torque, |
| | | feed_parameter |
| | | FROM |
| | | mdc_torque_config |
| | | WHERE |
| | | equipment_id = #{ equipmentId } AND torque_date BETWEEN #{ startTime } AND #{ endTime } |
| | | ORDER BY |
| | | torque_date ASC |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mdc.entity.EquipmentBeilvAlarm; |
| | | |
| | | /** |
| | | * @Description: 设å¤è¿è¡æ°æ®æ¥è¦ |
| | | * @Author: jeecg-boot |
| | | * @Date: 2024-01-17 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface IEquipmentBeilvAlarmService extends IService<EquipmentBeilvAlarm> { |
| | | |
| | | } |
| | |
| | | void generateDeviceCalendar(); |
| | | |
| | | MdcDeviceCalendar getFirstData(String equipmentId); |
| | | |
| | | List<MdcDeviceCalendarVo> listByEquipmentIdAndDate(String equipmentId, String date); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | BigDecimal computeOvertime(String equipmentId, String validDate); |
| | | |
| | | /** |
| | | * æ·»å |
| | | * @param mdcEquipmentOvertime |
| | | * @return |
| | | */ |
| | | boolean addOvertime(MdcEquipmentOvertime mdcEquipmentOvertime); |
| | | |
| | | } |
| | |
| | | List<MdcEquipmentRunningSection> selectRunningData(String equipmentId, Date startDate, Date endDate); |
| | | |
| | | List<MdcAlarmListDto> selectAlarmList(MdcAlarmAnalyzeQueryVo mdcAlarmAnalyzeQueryVo, String startDate, String endDate); |
| | | |
| | | List<Integer> getDataList(String equipmentId, Date date); |
| | | |
| | | } |
| | |
| | | * å表æ¥è¯¢ |
| | | */ |
| | | IPage<MdcEquipment> pageList(Page<MdcEquipment> page, MdcEquipmentVo mdcEquipment, HttpServletRequest req); |
| | | |
| | | /** |
| | | * çæ§è®¾å¤è½¬éä»»å¡ |
| | | */ |
| | | void monitoringSpeedProcess(); |
| | | |
| | | |
| | | } |
| | |
| | | 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.mdc.dto.EquipmentMachingDto; |
| | | import org.jeecg.modules.mdc.entity.MdcTorqueConfig; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | Boolean deleteBatchTorque(String ids); |
| | | |
| | | /** |
| | | * çæä¸»è½´è¿è¡æ²çº¿ |
| | | * |
| | | * @param torqueValue |
| | | * @return |
| | | */ |
| | | List<MdcTorqueConfig> findSpindleRunningCurve(float torqueValue, String equipmentId); |
| | | |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param userId |
| | |
| | | * @return |
| | | */ |
| | | ModelAndView exportXls(String userId, MdcTorqueConfig mdcTorqueConfig); |
| | | |
| | | /** |
| | | * è·å工使²çº¿ |
| | | * @param equipmentId |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | List<EquipmentMachingDto> getWorkLineList(String equipmentId, Date startTime, Date endTime); |
| | | |
| | | } |
| | |
| | | import org.jeecg.modules.mdc.dto.DayUtilizationRateDto; |
| | | import org.jeecg.modules.mdc.vo.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author: LiuS |
| | | * @create: 2023-06-15 17:25 |
| | |
| | | * @return |
| | | */ |
| | | MdcUtilizationRateDto utilizationRateTrendAnalyze(String userId, DayUtilizationRateContrastQueryVo vo); |
| | | |
| | | /** |
| | | * è·åå©ç¨ç |
| | | * |
| | | * @param equipmentId |
| | | * @param date |
| | | * @return |
| | | */ |
| | | List<BigDecimal> getEfficiencyRate(String equipmentId, String date); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.mdc.entity.EquipmentBeilvAlarm; |
| | | import org.jeecg.modules.mdc.mapper.EquipmentBeilvAlarmMapper; |
| | | import org.jeecg.modules.mdc.service.IEquipmentBeilvAlarmService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Description: 设å¤è¿è¡æ°æ®æ¥è¦ |
| | | * @Author: jeecg-boot |
| | | * @Date: 2024-01-17 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | | public class EquipmentBeilvAlarmServiceImpl extends ServiceImpl<EquipmentBeilvAlarmMapper, EquipmentBeilvAlarm> implements IEquipmentBeilvAlarmService { |
| | | |
| | | } |
| | |
| | | return this.baseMapper.getFirstData(equipmentId); |
| | | } |
| | | |
| | | @Override |
| | | public List<MdcDeviceCalendarVo> listByEquipmentIdAndDate(String equipmentId, String date) { |
| | | return this.baseMapper.listByEquipmentAndDate(equipmentId, date); |
| | | } |
| | | |
| | | } |
| | |
| | | mdcEfficiencyShiftResultDto.setCloseLong(equipmentStatisticalShiftInfo.getCloseLong()); |
| | | mdcEfficiencyShiftResultDto.setOpenLong(equipmentStatisticalShiftInfo.getOpenLong()); |
| | | mdcEfficiencyShiftResultDto.setWaitLong(equipmentStatisticalShiftInfo.getWaitLong()); |
| | | |
| | | mdcEfficiencyShiftResultDto.setOpenRate(equipmentStatisticalShiftInfo.getOpenLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, RoundingMode.HALF_UP)); |
| | | if (equipmentStatisticalShiftInfo.getTotalLong().compareTo(BigDecimal.ZERO) == 0) { |
| | | mdcEfficiencyShiftResultDto.setOpenRate(BigDecimal.ZERO); |
| | | } else { |
| | | mdcEfficiencyShiftResultDto.setOpenRate(equipmentStatisticalShiftInfo.getOpenLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, RoundingMode.HALF_UP)); |
| | | } |
| | | long rate = mdcEfficiencyShiftResultDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue(); |
| | | for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { |
| | | if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) { |
| | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<BigDecimal> getEfficiencyRate(String equipmentId, String date) { |
| | | return mdcEfficiencyReportMapper.getEfficiencyRate(equipmentId, date); |
| | | } |
| | | |
| | | private MdcUtilizationResultDto utilizationRate(String equipmentId, String equipmentName, String equipmentType, Date startTime, Date endTime, String date, List<MdcUtilizationRate> mdcUtilizationRateList) { |
| | | MdcUtilizationResultDto dto = new MdcUtilizationResultDto(); |
| | | dto.setEquipmentId(equipmentId); |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; |
| | | import org.jeecg.modules.mdc.mapper.MdcEquipmentOvertimeMapper; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.time.Duration; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | |
| | | BigDecimal result = new BigDecimal("0"); |
| | | if (list != null && !list.isEmpty()) { |
| | | for (MdcEquipmentOvertime equipmentOvertime : list) { |
| | | String date = DateUtils.format(DateUtils.toDate(validDate + "-01", DateUtils.STR_DATE), DateUtils.STR_DATE) + " "; |
| | | String startTime = date + equipmentOvertime.getStartTime(); |
| | | String endTime = date + equipmentOvertime.getEndTime(); |
| | | LocalDateTime localStartTime = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern(DateUtils.STR_DATE_TIME_SMALL)); |
| | | LocalDateTime localEndTime = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern(DateUtils.STR_DATE_TIME_SMALL)); |
| | | int minutes = Math.toIntExact(Duration.between(localStartTime, localEndTime).toMinutes()); |
| | | result = result.add(new BigDecimal(minutes)); |
| | | result = result.add(equipmentOvertime.getDuration().divide(new BigDecimal("60"), 0, RoundingMode.HALF_UP)); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ·»å |
| | | * |
| | | * @param mdcEquipmentOvertime |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addOvertime(MdcEquipmentOvertime mdcEquipmentOvertime) { |
| | | String[] equipmentIds = mdcEquipmentOvertime.getEquipmentId().split(","); |
| | | List<MdcEquipmentOvertime> mdcEquipmentOvertimes = new ArrayList<>(); |
| | | // è®¡ç®æ¶é¿(ç§) |
| | | String startTime = mdcEquipmentOvertime.getStartTime(); |
| | | String endTime = mdcEquipmentOvertime.getEndTime(); |
| | | long duration = DateUtils.differentSecond(DateUtils.setTimeForDay(DateUtils.getNow(), startTime), DateUtils.setTimeForDay(DateUtils.getNow(), endTime)); |
| | | for (String equipmentId : equipmentIds) { |
| | | MdcEquipmentOvertime equipmentOvertime = new MdcEquipmentOvertime(); |
| | | equipmentOvertime.setEquipmentId(equipmentId); |
| | | equipmentOvertime.setTheDate(mdcEquipmentOvertime.getTheDate()); |
| | | equipmentOvertime.setAutoFlag(CommonConstant.AUTO_FLAG_N); |
| | | equipmentOvertime.setStartTime(mdcEquipmentOvertime.getStartTime()); |
| | | equipmentOvertime.setEndTime(mdcEquipmentOvertime.getEndTime()); |
| | | equipmentOvertime.setDuration(new BigDecimal(duration)); |
| | | mdcEquipmentOvertimes.add(equipmentOvertime); |
| | | } |
| | | return super.saveBatch(mdcEquipmentOvertimes); |
| | | } |
| | | } |
| | |
| | | return this.baseMapper.selectAlarmList(mdcAlarmAnalyzeQueryVo, startDate, endDate); |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> getDataList(String equipmentId, Date date) { |
| | | return this.baseMapper.getDataList(equipmentId, date); |
| | | } |
| | | |
| | | private Map<String, List<MdcEquipmentRunningSectionDto>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo, String date) { |
| | | Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>(); |
| | | List<MdcEquipmentRunningSectionDto> normal = new ArrayList<>(); |
| | |
| | | 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.common.api.dto.message.MessageDTO; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.api.ISysBaseAPI; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.mdc.dto.MdcEquDepDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEquProDto; |
| | |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.util.FindsEquipmentDepartUtil; |
| | | import org.jeecg.modules.mdc.util.FindsEquipmentProductionUtil; |
| | | import org.jeecg.modules.mdc.vo.*; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentDepVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentProVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentVo; |
| | | import org.jeecg.modules.mdc.vo.WorkshopEquipmentVo; |
| | | import org.jeecg.modules.system.entity.MdcEquipmentDepart; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.entity.MdcProductionEquipment; |
| | | import org.jeecg.modules.system.entity.SysDepart; |
| | | import org.jeecg.modules.system.mapper.MdcEquipmentDepartMapper; |
| | | import org.jeecg.modules.system.mapper.MdcProductionEquipmentMapper; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.IMdcUserProductionService; |
| | | import org.jeecg.modules.system.service.ISysDepartService; |
| | | import org.jeecg.modules.system.service.ISysUserDepartService; |
| | | import org.jeecg.modules.system.service.*; |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Resource |
| | | private IEquipmentBaseInfoService equipmentBaseInfoService; |
| | | |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | |
| | | @Resource |
| | | private ISysBaseAPI sysBaseApi; |
| | | |
| | | |
| | | @Override |
| | | public Map<String, String> getDepNamesByEquipmentIds(List<String> equipmentIds) { |
| | |
| | | return this.baseMapper.pageList(page, mdcEquipment); |
| | | } |
| | | |
| | | /** |
| | | * çæ§è®¾å¤è½¬éä»»å¡ |
| | | */ |
| | | @Override |
| | | public void monitoringSpeedProcess() { |
| | | List<MdcEquipment> equipmentList = super.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getDriveType, "FANUC")); |
| | | //List<MdcEquipment> equipmentList = super.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, "2140198")); |
| | | // è·ååå
¸æ°æ® |
| | | List<DictModel> dictModelList = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_OPERATING_SPEED_RANGE); |
| | | Integer range = 0; |
| | | if (dictModelList != null && !dictModelList.isEmpty()) { |
| | | range = Integer.valueOf(dictModelList.get(0).getValue()); |
| | | } |
| | | for (MdcEquipment mdcEquipment : equipmentList) { |
| | | String saveTableName = mdcEquipment.getSaveTableName(); |
| | | //æ¥è¯¢åè¡¨æ°æ® |
| | | MdcEquipmentDto mdcEquipmentDto = this.baseMapper.getWorkLineLast(saveTableName); |
| | | if (mdcEquipmentDto != null) { |
| | | MessageDTO messageDTO = new MessageDTO(); |
| | | messageDTO.setTitle("设å¤è¿è¡è½¬éæ¥è¦ï¼"); |
| | | messageDTO.setCategory("é¢è¦æ¶æ¯"); |
| | | messageDTO.setFromUser("admin"); |
| | | messageDTO.setToUser("admin"); |
| | | Integer spindlespeed = Integer.valueOf(mdcEquipmentDto.getSpindlespeed()); |
| | | Integer actualspindlespeed = Integer.valueOf(mdcEquipmentDto.getActualspindlespeed()); |
| | | if (range.equals(0)) { |
| | | if (spindlespeed > actualspindlespeed) { |
| | | // å®é
å¼å¤§äºè®¾å®å¼ é« |
| | | messageDTO.setContent("设å¤ç¼å·ä¸º [" + mdcEquipment.getEquipmentId() + "] ç设å¤è¿è¡è½¬é髿¥è¦ï¼"); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | } else if (spindlespeed < actualspindlespeed) { |
| | | // å®é
å¼å°äºè®¾å®å¼ ä½ |
| | | messageDTO.setContent("设å¤ç¼å·ä¸º [" + mdcEquipment.getEquipmentId() + "] ç设å¤è¿è¡è½¬é使¥è¦ï¼"); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | } |
| | | } else { |
| | | int max = actualspindlespeed + actualspindlespeed * (range / 100); |
| | | int min = actualspindlespeed - actualspindlespeed * (range / 100); |
| | | if (spindlespeed > max || spindlespeed < min) { |
| | | if (spindlespeed > actualspindlespeed) { |
| | | // å®é
å¼å¤§äºè®¾å®å¼ é« |
| | | messageDTO.setContent("设å¤ç¼å·ä¸º [" + mdcEquipment.getEquipmentId() + "] ç设å¤è¿è¡è½¬é髿¥è¦ï¼"); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | } else if (spindlespeed < actualspindlespeed) { |
| | | // å®é
å¼å°äºè®¾å®å¼ ä½ |
| | | messageDTO.setContent("设å¤ç¼å·ä¸º [" + mdcEquipment.getEquipmentId() + "] ç设å¤è¿è¡è½¬é使¥è¦ï¼"); |
| | | sysBaseApi.sendSysAnnouncement(messageDTO); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | import org.jeecg.modules.mdc.service.IMdcDriveTypeParamConfigService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentWorkLineService; |
| | | import org.jeecg.modules.mdc.service.IMdcTorqueConfigService; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.vo.MdcWorkChartVo; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Resource |
| | | private EquipmentWorklineMapper equipmentWorklineMapper; |
| | | |
| | | @Resource |
| | | private IMdcTorqueConfigService mdcTorqueConfigService; |
| | | |
| | | /** |
| | | * æ¥æ¾æå®æ¥æçæ°æ® |
| | | */ |
| | |
| | | endTime = DateUtils.toDateMedium(mdcWorkChartVo.getDate() + " " + mdcWorkChartVo.getEnd() + ":00"); |
| | | } |
| | | |
| | | if (startTime != null && endTime != null && (startTime.getTime() > endTime.getTime() || startTime.getTime() > new Date().getTime())) { |
| | | if (startTime != null && endTime != null && (startTime.getTime() > endTime.getTime() || startTime.getTime() > System.currentTimeMillis())) { |
| | | return Collections.emptyList(); |
| | | } |
| | | MdcEquipment mdcEquipment = mdcEquipmentService.getOne(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, mdcWorkChartVo.getEquipmentId())); |
| | |
| | | return null; |
| | | } |
| | | List<EquipmentMachingDto> result = this.getWorkLineList(saveTableName, mdcDriveTypeParamConfigs, mdcWorkChartVo, startTime, endTime); |
| | | // æ¥æ¾æç©åè¿ç»åæ° |
| | | List<EquipmentMachingDto> torqueList = mdcTorqueConfigService.getWorkLineList(mdcWorkChartVo.getEquipmentId(), startTime, endTime); |
| | | if (torqueList != null && !torqueList.isEmpty()) { |
| | | result.addAll(torqueList); |
| | | result = result.stream().sorted(Comparator.comparing(EquipmentMachingDto::getCollectTime)).collect(Collectors.toList()); |
| | | } |
| | | if (result == null || result.isEmpty()) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | // BigDecimal shiftTimeCount = mdcDeviceCalendarService.computeShiftTimeCount(equipmentId, validDate); |
| | | mdcOverallEquipmentEfficiency.setShiftTimeCount(new BigDecimal("8")); |
| | | if (StringUtils.isEmpty(mdcOverallEquipmentEfficiency.getShift())) { |
| | | mdcOverallEquipmentEfficiency.setShiftTimeCount(BigDecimal.ZERO); |
| | | } else { |
| | | mdcOverallEquipmentEfficiency.setShiftTimeCount(new BigDecimal("8")); |
| | | } |
| | | |
| | | // 计ç®å çæ¶é´ |
| | | // TODO 计ç®å çæ¶é´ |
| | | BigDecimal overtime = mdcEquipmentOvertimeService.computeOvertime(equipmentId, validDate); |
| | | mdcOverallEquipmentEfficiency.setOvertime(overtime); |
| | | |
| | |
| | | mdcOverallEquipmentEfficiency.setActualWorkDayCount(actualWorkDayCount); |
| | | |
| | | // æåº¦å®é
çäº§æ»æ¶é´(åé) |
| | | mdcOverallEquipmentEfficiency.setMonthActualWorkDayTimeCount(mdcOverallEquipmentEfficiency.getShiftTimeCount().add(overtime)); |
| | | mdcOverallEquipmentEfficiency.setMonthActualWorkDayTimeCount(mdcOverallEquipmentEfficiency.getShiftTimeCount().multiply(actualWorkDayCount).multiply(new BigDecimal("60")).add(overtime)); |
| | | |
| | | // æ
éåæºæ¶é¿ç»è®¡(åé) |
| | | BigDecimal breakdownDownDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.BREAKDOWN_DOWN); |
| | |
| | | // mdcOverallEquipmentEfficiency.getShiftTimeCount() - plannedMaintenanceDuration - conferenceTrainingDuration - otherRestDuration |
| | | // è´è·æ¶é´(åé) |
| | | BigDecimal loadTime = mdcOverallEquipmentEfficiency.getShiftTimeCount().subtract(plannedMaintenanceDuration).subtract(conferenceTrainingDuration).subtract(otherRestDuration); |
| | | if (loadTime.compareTo(BigDecimal.ZERO) > -1) { |
| | | if (loadTime.compareTo(BigDecimal.ZERO) < 0) { |
| | | loadTime = BigDecimal.ZERO; |
| | | } |
| | | mdcOverallEquipmentEfficiency.setLoadTime(loadTime.divide(new BigDecimal("60"), 1, RoundingMode.HALF_UP)); |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.dto.EquipmentMachingDto; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcTorqueConfig; |
| | | import org.jeecg.modules.mdc.mapper.MdcTorqueConfigMapper; |
| | |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description: æç©é
置管ç |
| | |
| | | @Override |
| | | public Boolean deleteBatchTorque(String ids) { |
| | | return this.removeBatchByIds(Arrays.asList(ids.split(","))); |
| | | } |
| | | |
| | | @Override |
| | | public List<MdcTorqueConfig> findSpindleRunningCurve(float torqueValue, String equipmentId) { |
| | | return this.baseMapper.findSpindleRunningCurve(torqueValue, equipmentId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | mv.addObject(NormalExcelConstants.DATA_LIST, mdcTorqueConfigs); |
| | | return mv; |
| | | } |
| | | |
| | | @Override |
| | | public List<EquipmentMachingDto> getWorkLineList(String equipmentId, Date startTime, Date endTime) { |
| | | return this.baseMapper.getWorkLineList(equipmentId, startTime, endTime); |
| | | } |
| | | } |