¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.constant; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/11/1 16:05 |
| | | */ |
| | | public class MdcConstant { |
| | | |
| | | /** |
| | | * æ
éåæº |
| | | */ |
| | | public static final String BREAKDOWN_DOWN = "æ
éåæº"; |
| | | |
| | | /** |
| | | * æ¢åè°è¯ |
| | | */ |
| | | public static final String CONVERSION_DEBUG = "æ¢åè°è¯"; |
| | | |
| | | /** |
| | | * ç©æç缺 |
| | | */ |
| | | public static final String MATERIAL_SHORTAGE = "ç©æç缺"; |
| | | |
| | | /** |
| | | * 计åçä»»å¡ |
| | | */ |
| | | public static final String PLANNED_TASK = "计åçä»»å¡"; |
| | | |
| | | /** |
| | | * æ£éª |
| | | */ |
| | | public static final String INSPECT = "æ£éª"; |
| | | |
| | | /** |
| | | * å
¶å® |
| | | */ |
| | | public static final String OTHER = "å
¶å®"; |
| | | |
| | | /** |
| | | * 计åä¿å
» |
| | | */ |
| | | public static final String PLANNED_MAINTENANCE = "æ¥ä¿,å¨ä¿"; |
| | | |
| | | /** |
| | | * ä¼è®®å¹è® |
| | | */ |
| | | public static final String CONFERENCE_TRAINING = "OPLå¹è®,çåä¼"; |
| | | |
| | | /** |
| | | * å
¶ä»ä¼æ¯ |
| | | */ |
| | | public static final String OTHER_REST = "伿¯ç¨é¤,é¢é²æ§ç»´ä¿®"; |
| | | |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentOvertimeService; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 设å¤å ç管ç |
| | |
| | | @ApiOperation(value = "设å¤å ç管ç-æ·»å ", notes = "设å¤å ç管ç-æ·»å ") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody MdcEquipmentOvertime mdcEquipmentOvertime) { |
| | | mdcEquipmentOvertimeService.save(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); |
| | | } |
| | | mdcEquipmentOvertimeService.saveBatch(equipmentOvertimeList); |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/10/24 10:39 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("EquipmentRunningTrace") |
| | | public class EquipmentRunningTrace implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 2229764130687476736L; |
| | | |
| | | private Long sequence; |
| | | |
| | | /** |
| | | * æ¥è¦ |
| | | */ |
| | | private String alarm; |
| | | |
| | | @TableField(value = "createTime") |
| | | private Date createTime; |
| | | |
| | | private long duration; |
| | | |
| | | @TableField(value = "endTime") |
| | | private Date endTime; |
| | | |
| | | @TableField(value = "startTime") |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * ç¶æ,0:å
³æº,1:弿º,2:å¾
æº,3:å·¥ä½,22:æ¥è¦ |
| | | */ |
| | | private int status; |
| | | |
| | | /** |
| | | * è®¾å¤ |
| | | */ |
| | | private String equipment; |
| | | |
| | | private String beltline; |
| | | |
| | | /** |
| | | * ç¨åºå· |
| | | */ |
| | | @TableField(value = "Sequencenumber") |
| | | private String Sequencenumber; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("EquipmentStatisticalInfo") |
| | | public class EquipmentStatisticalInfo implements Serializable { |
| | | /** |
| | | * 设å¤ID |
| | | */ |
| | | private String equipment; |
| | | /** |
| | | * ç产线 |
| | | */ |
| | | private String beltline; |
| | | /** |
| | | * 弿ºæ¶é¿ |
| | | */ |
| | | @TableField(value = "openingLong") |
| | | private BigDecimal openingLong = new BigDecimal("0"); |
| | | /** |
| | | * å¾
æºæ¶é¿ |
| | | */ |
| | | @TableField(value = "waitingLong") |
| | | private BigDecimal waitingLong = new BigDecimal("0"); |
| | | /** |
| | | * å å·¥æ¶é¿ |
| | | */ |
| | | @TableField(value = "processingLong") |
| | | private BigDecimal processingLong = new BigDecimal("0"); |
| | | /** |
| | | * æ¥è¦ |
| | | */ |
| | | @TableField(value = "erroringLong") |
| | | private BigDecimal erroringLong = new BigDecimal("0"); |
| | | /** |
| | | * å
³æºæ¶é¿ |
| | | */ |
| | | @TableField(value = "closedLong") |
| | | private BigDecimal closedLong = new BigDecimal("0"); |
| | | /** |
| | | * æ¥æ |
| | | */ |
| | | @TableField(value = "theDate") |
| | | private String theDate; |
| | | /** |
| | | * 忥æ¶é´ |
| | | */ |
| | | @TableField(value = "createTime") |
| | | private Date createTime = new Date(System.currentTimeMillis()); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.system.base.entity.JeecgEntity; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/10/18 16:13 |
| | | */ |
| | | @Data |
| | | @TableName("mdc_overall_equipment_efficiency") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "mdc_overall_equipment_efficiency对象", description = "设å¤ç»¼åæçOEE表") |
| | | public class MdcOverallEquipmentEfficiency extends JeecgEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 9185809666187247226L; |
| | | |
| | | /** |
| | | * 设å¤ç¼å· |
| | | */ |
| | | @Excel(name = "设å¤ç¼å·", width = 15) |
| | | @ApiModelProperty(value = "设å¤ç¼å·") |
| | | private String equipmentId; |
| | | /** |
| | | * 设å¤åç§° |
| | | */ |
| | | @Excel(name = "设å¤åç§°", width = 15) |
| | | @ApiModelProperty(value = "设å¤åç§°") |
| | | private String equipmentName; |
| | | /** |
| | | * 设å¤åå· |
| | | */ |
| | | @Excel(name = "设å¤åå·", width = 15) |
| | | @ApiModelProperty(value = "设å¤åå·") |
| | | private String equipmentModel; |
| | | /** |
| | | * æææ¥æ |
| | | */ |
| | | @Excel(name = "æææ¥æ", width = 15) |
| | | @ApiModelProperty(value = "æææ¥æ") |
| | | private String validDate; |
| | | /** |
| | | * çæ¬¡id |
| | | */ |
| | | @ApiModelProperty(value = "çæ¬¡id") |
| | | private String shiftSubId; |
| | | /** |
| | | * æ¯çå°æ¶ |
| | | */ |
| | | @Excel(name = "æ¯çå°æ¶", width = 15) |
| | | @ApiModelProperty(value = "æ¯çå°æ¶") |
| | | private BigDecimal shiftTimeCount; |
| | | /** |
| | | * å çæ¶é´ |
| | | */ |
| | | @Excel(name = "å çæ¶é´", width = 15) |
| | | @ApiModelProperty(value = "å çæ¶é´") |
| | | private BigDecimal overtime; |
| | | /** |
| | | * å®é
çäº§å¤©æ° |
| | | */ |
| | | @Excel(name = "å®é
ç产天æ°", width = 15) |
| | | @ApiModelProperty(value = "å®é
ç产天æ°") |
| | | private BigDecimal actualWorkDayCount; |
| | | /** |
| | | * æåº¦å®é
çäº§æ»æ¶é´ |
| | | */ |
| | | @Excel(name = "æåº¦å®é
çäº§æ»æ¶é´", width = 15) |
| | | @ApiModelProperty(value = "æåº¦å®é
çäº§æ»æ¶é´") |
| | | private BigDecimal monthActualWorkDayTimeCount; |
| | | /** |
| | | * æ
éåæºæ¶é¿(åé) |
| | | */ |
| | | @Excel(name = "æ
éåæºæ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "æ
éåæºæ¶é¿(åé)") |
| | | private BigDecimal breakdownDownDuration; |
| | | /** |
| | | * æ¢åè°è¯æ¶é¿(åé) |
| | | */ |
| | | @Excel(name = "æ¢åè°è¯æ¶é¿(åé)", width = 15) |
| | | @ApiModelProperty(value = "æ¢åè°è¯æ¶é¿(åé)") |
| | | private BigDecimal conversionDebugDuration; |
| | | /** |
| | | * ç©æç缺æ¶é¿(åé) |
| | | */ |
| | | @Excel(name = "ç©æç缺æ¶é¿(åé)", width = 15) |
| | | @ApiModelProperty(value = "ç©æç缺æ¶é¿(åé)") |
| | | private BigDecimal materialShortageDuration; |
| | | /** |
| | | * 计åçä»»å¡(åé) |
| | | */ |
| | | @Excel(name = "计åçä»»å¡(åé)", width = 15) |
| | | @ApiModelProperty(value = "计åçä»»å¡(åé)") |
| | | private BigDecimal plannedTaskDuration; |
| | | /** |
| | | * æ£éª(åé) |
| | | */ |
| | | @Excel(name = "æ£éª(åé)", width = 15) |
| | | @ApiModelProperty(value = "æ£éª(åé)") |
| | | private BigDecimal inspectDuration; |
| | | /** |
| | | * å
¶ä»(åé) |
| | | */ |
| | | @Excel(name = "å
¶ä»(åé)", width = 15) |
| | | @ApiModelProperty(value = "å
¶ä»(åé)") |
| | | private BigDecimal otherDuration; |
| | | /** |
| | | * 计åä¿å
» |
| | | */ |
| | | @Excel(name = "计åä¿å
»", width = 15) |
| | | @ApiModelProperty(value = "计åä¿å
»") |
| | | private BigDecimal plannedMaintenanceDuration; |
| | | /** |
| | | * ä¼è®®å¹è®æ¶é¿ |
| | | */ |
| | | @Excel(name = "ä¼è®®å¹è®æ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "ä¼è®®å¹è®æ¶é¿") |
| | | private BigDecimal conferenceTrainingDuration; |
| | | /** |
| | | * å
¶ä»ä¼æ¯æ¶é¿ |
| | | */ |
| | | @Excel(name = "å
¶ä»ä¼æ¯æ¶é¿", width = 15) |
| | | @ApiModelProperty(value = "å
¶ä»ä¼æ¯æ¶é¿") |
| | | private BigDecimal otherRestDuration; |
| | | /** |
| | | * è´è·æ¶é´ |
| | | */ |
| | | @Excel(name = "è´è·æ¶é´", width = 15) |
| | | @ApiModelProperty(value = "è´è·æ¶é´") |
| | | private BigDecimal loadTime; |
| | | /** |
| | | * æ¶é´å¼å¨ç |
| | | */ |
| | | @Excel(name = "æ¶é´å¼å¨ç", width = 15) |
| | | @ApiModelProperty(value = "æ¶é´å¼å¨ç") |
| | | private BigDecimal timeActuationRate; |
| | | /** |
| | | * å å·¥é¶ä»¶æ° |
| | | */ |
| | | @Excel(name = "å å·¥é¶ä»¶æ°", width = 15) |
| | | @ApiModelProperty(value = "å å·¥é¶ä»¶æ°") |
| | | private BigDecimal processQuantity; |
| | | /** |
| | | * æ åå å·¥æ¶é´(åé) |
| | | */ |
| | | @Excel(name = "æ åå å·¥æ¶é´(åé)", width = 15) |
| | | @ApiModelProperty(value = "æ åå å·¥æ¶é´(åé)") |
| | | private BigDecimal standardProcessDuration; |
| | | /** |
| | | * æ§è½å¼å¨ç |
| | | */ |
| | | @Excel(name = "æ§è½å¼å¨ç", width = 15) |
| | | @ApiModelProperty(value = "æ§è½å¼å¨ç") |
| | | private BigDecimal performanceRate; |
| | | /** |
| | | * åºåæ° |
| | | */ |
| | | @Excel(name = "åºåæ°", width = 15) |
| | | @ApiModelProperty(value = "åºåæ°") |
| | | private BigDecimal unqualifiedQuantity; |
| | | /** |
| | | * åæ ¼ç |
| | | */ |
| | | @Excel(name = "åæ ¼ç", width = 15) |
| | | @ApiModelProperty(value = "åæ ¼ç") |
| | | private BigDecimal passRate; |
| | | /** |
| | | * 设å¤ç»¼åæç |
| | | */ |
| | | @Excel(name = "设å¤ç»¼åæç", width = 15) |
| | | @ApiModelProperty(value = "设å¤ç»¼åæç") |
| | | private BigDecimal overallEquipmentEfficiency; |
| | | |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.entity; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | 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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.jeecg.common.system.base.entity.JeecgEntity; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Description: å å·¥æ°é表 |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.job; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.mdc.service.IMdcOverallEquipmentEfficiencyService; |
| | | 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; |
| | | |
| | | /** |
| | | * @Description: 宿¶è®¡ç®è®¾å¤ç»¼åæçOEEä»»å¡ |
| | | * @author: LiuS |
| | | * @create: 2023-07-24 10:26 |
| | | */ |
| | | @PersistJobDataAfterExecution |
| | | @DisallowConcurrentExecution |
| | | @Slf4j |
| | | public class RunningOverallEquipmentEfficiencyJob implements Job { |
| | | |
| | | @Resource |
| | | private IQuartzJobService quartzJobService; |
| | | |
| | | @Resource |
| | | private ISysAnnouncementService sysAnnouncementService; |
| | | |
| | | @Resource |
| | | private ISysQuartzLogService sysQuartzLogService; |
| | | |
| | | @Resource |
| | | private IMdcOverallEquipmentEfficiencyService mdcOverallEquipmentEfficiencyService; |
| | | |
| | | @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("宿¶è®¡ç®è®¾å¤ç»¼åæçOEEä»»å¡ RunningOverallEquipmentEfficiencyJob start! æ¶é´:" + DateUtils.now()); |
| | | long startTime = System.currentTimeMillis(); |
| | | try { |
| | | mdcOverallEquipmentEfficiencyService.runningOverallEquipmentEfficiency(); |
| | | 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.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.jeecg.modules.mdc.entity.EquipmentRunningTrace; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/10/26 16:46 |
| | | */ |
| | | public interface EquipmentRunningTraceMapper extends BaseMapper<EquipmentRunningTrace> { |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.jeecg.modules.mdc.entity.EquipmentStatisticalInfo; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/10/24 14:05 |
| | | */ |
| | | public interface EquipmentStatisticalInfoMapper extends BaseMapper<EquipmentStatisticalInfo> { |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.entity.MdcDeviceCalendar; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.jeecg.modules.mdc.vo.MdcDeviceCalendarQueryVo; |
| | | import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | List<MdcDeviceCalendarVo> findAcquiesceShift(); |
| | | |
| | | List<String> computeActualWorkDayCount(@Param("shiftSubId") String shiftSubId, @Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | |
| | | List<String> findShiftSort(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | |
| | | Integer computeShiftTimeCount(@Param("shiftSubId") String shiftSubId, @Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | } |
| | |
| | | |
| | | /** |
| | | * listå表 |
| | | * |
| | | * @param mdcEquipmentOvertime |
| | | * @return |
| | | */ |
| | | List<MdcEquipmentOvertime> list(@Param("mdcEquipmentOvertime") MdcEquipmentOvertime mdcEquipmentOvertime); |
| | | |
| | | /** |
| | | * æ¥è¯¢å çæ¶é¿ |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | List<MdcEquipmentOvertime> computeOvertime(@Param("shiftSubId") String shiftSubId, @Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author: LiuS |
| | | * @create: 2023-07-24 11:23 |
| | |
| | | * @return |
| | | */ |
| | | MdcEquipmentStatisticalShiftInfo getMaxStaticsData(@Param("equipmentId") String equipmentid); |
| | | |
| | | BigDecimal findSpindleRunDuration(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate, @Param("shiftSubId") String shiftSubId); |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.entity.MdcNoplanClose; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: é计ååæºç»´æ¤è¡¨ |
| | | * @Author: Lius |
| | |
| | | */ |
| | | IPage<MdcNoplanClose> pageList(Page<MdcNoplanClose> page, @Param("mdcNoplanClose") MdcNoplanClose mdcNoplanClose); |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢é计ååæºç®¡çæå¤± |
| | | * |
| | | * @param equipmentId |
| | | * @param noplanType |
| | | * @param startDate |
| | | * @param endDate |
| | | * @return |
| | | */ |
| | | List<MdcNoplanClose> findNoplanTimeDuration(@Param("equipmentId") String equipmentId, @Param("noplanType") String noplanType, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/11/3 14:29 |
| | | */ |
| | | public interface MdcOverallEquipmentEfficiencyMapper extends BaseMapper<MdcOverallEquipmentEfficiency> { |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | IPage<MdcPassRate> pageList(Page<MdcPassRate> page, @Param("mdcPassRate") MdcPassRate mdcPassRate); |
| | | |
| | | /** |
| | | * 计ç®å å·¥æ°é |
| | | * |
| | | * @param equipmentId |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | Integer findProcessQuantity(@Param("equipmentId") String equipmentId, @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | |
| | | /** |
| | | * 计ç®åºåæ°é |
| | | * |
| | | * @param equipmentId |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | Integer findUnqualifiedQuantity(@Param("equipmentId") String equipmentId, @Param("startTime") String startTime, @Param("endTime") String 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.EquipmentRunningTraceMapper"> |
| | | |
| | | </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.EquipmentStatisticalInfoMapper"> |
| | | |
| | | </mapper> |
| | |
| | | WHERE t1.default_shift = 'true' |
| | | </select> |
| | | |
| | | <!--计ç®å®é
ç产天æ°--> |
| | | <select id="computeActualWorkDayCount" resultType="java.lang.String"> |
| | | SELECT DISTINCT |
| | | effective_date |
| | | FROM |
| | | mdc_device_calendar |
| | | WHERE |
| | | effective_date LIKE CONCAT(#{ validDate }, '%') |
| | | AND equipment_id = #{ equipmentId } |
| | | AND shift_sub_id = #{ shiftSubId } |
| | | </select> |
| | | |
| | | <!--æ¥è¯¢ç次åç±»--> |
| | | <select id="findShiftSort" resultType="java.lang.String"> |
| | | SELECT |
| | | DISTINCT shift_sub_id |
| | | FROM |
| | | mdc_device_calendar |
| | | WHERE |
| | | effective_date LIKE CONCAT(#{ validDate }, '%') |
| | | AND equipment_id = #{ equipmentId } |
| | | </select> |
| | | |
| | | <!--æ¥è¯¢ç次æ°é--> |
| | | <select id="computeShiftTimeCount" resultType="java.lang.Integer"> |
| | | SELECT |
| | | COUNT(*) |
| | | FROM |
| | | mdc_device_calendar |
| | | WHERE |
| | | effective_date LIKE CONCAT(#{ validDate }, '%') |
| | | AND equipment_id = #{ equipmentId } |
| | | AND shift_sub_id = #{ shiftSubId } |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </where> |
| | | order by t2.effective_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 |
| | | WHERE |
| | | mdc.effective_date LIKE CONCAT(#{ validDate }, '%') |
| | | AND mdc.equipment_id = #{ equipmentId } |
| | | AND mdc.shift_sub_id = #{ shiftSubId } |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="getMaxStaticsData" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo"> |
| | | SELECT TOP 1 * FROM mdc_equipment_statistical_shift_info WHERE equipment_id = #{equipmentId} ORDER BY the_date DESC |
| | | </select> |
| | | |
| | | <!--æ¥è¯¢ä¸»è½´è¿è¡æ¶é´--> |
| | | <select id="findSpindleRunDuration" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | SUM(process_long) |
| | | FROM |
| | | mdc_equipment_statistical_shift_info |
| | | WHERE |
| | | equipment_id = #{ equipmentId } |
| | | AND shift_sub_id = #{ shiftSubId } |
| | | AND the_date LIKE CONCAT(#{ validDate },'%') |
| | | </select> |
| | | </mapper> |
| | |
| | | </where> |
| | | ORDER BY start_time ASC |
| | | </select> |
| | | |
| | | |
| | | <select id="findNoplanTimeDuration" resultType="org.jeecg.modules.mdc.entity.MdcNoplanClose"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | mdc_noplan_close |
| | | WHERE |
| | | equipment_id = #{ equipmentId } |
| | | AND ( ( start_time BETWEEN #{ startDate } AND #{ endDate } ) OR ( end_time BETWEEN #{ startDate } AND #{ endDate } ) ) |
| | | AND noplan_type = #{ noplanType } |
| | | ORDER BY |
| | | start_time ASC |
| | | </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.MdcOverallEquipmentEfficiencyMapper"> |
| | | |
| | | </mapper> |
| | |
| | | </where> |
| | | ORDER BY equipment_name ASC, efficient_date DESC |
| | | </select> |
| | | |
| | | <!--计ç®å å·¥æ°é--> |
| | | <select id="findProcessQuantity" resultType="java.lang.Integer"> |
| | | SELECT |
| | | SUM( process_quantity ) |
| | | FROM |
| | | mdc_pass_rate |
| | | WHERE |
| | | equipment_id = #{ equipmentId } |
| | | AND efficient_date BETWEEN #{ startTime } AND #{endTime} |
| | | </select> |
| | | |
| | | <!--计ç®åºåæ°é--> |
| | | <select id="findUnqualifiedQuantity" resultType="java.lang.Integer"> |
| | | SELECT |
| | | SUM( unqualified_quantity ) |
| | | FROM |
| | | mdc_pass_rate |
| | | WHERE |
| | | equipment_id = #{ equipmentId } |
| | | AND efficient_date BETWEEN #{ startTime } AND #{endTime} |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mdc.entity.EquipmentRunningTrace; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/10/26 16:45 |
| | | */ |
| | | public interface IEquipmentRunningTraceService extends IService<EquipmentRunningTrace> { |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mdc.entity.EquipmentStatisticalInfo; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/10/24 14:04 |
| | | */ |
| | | public interface IEquipmentStatisticalInfoService extends IService<EquipmentStatisticalInfo> { |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.jeecg.modules.mdc.entity.MdcDeviceCalendar; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mdc.entity.MdcDeviceCalendar; |
| | | import org.jeecg.modules.mdc.vo.EquipmentCalendarVo; |
| | | import org.jeecg.modules.mdc.vo.MdcDeviceCalendarQueryVo; |
| | | import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Date; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | List<MdcDeviceCalendarVo> listByEquipmentAndDate(String equipmentid, List<String> stringDates); |
| | | |
| | | /** |
| | | * 计ç®å®é
çäº§å¤©æ° |
| | | * |
| | | * @param shiftSubId |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | BigDecimal computeActualWorkDayCount(String shiftSubId, String equipmentId, String validDate); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç次åç±» |
| | | * |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | List<String> findShiftSort(String equipmentId, String validDate); |
| | | |
| | | /** |
| | | * 计ç®ç次æ¶é´ |
| | | * |
| | | * @param shiftSubId |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | BigDecimal computeShiftTimeCount(String shiftSubId, String equipmentId, String validDate); |
| | | } |
| | |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Description: 设å¤å ç管ç |
| | |
| | | */ |
| | | ModelAndView exportXls(String userId, MdcEquipmentOvertime mdcEquipmentOvertime); |
| | | |
| | | /** |
| | | * 计ç®å çæ¶é´ |
| | | * |
| | | * @param shiftSubId |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | BigDecimal computeOvertime(String shiftSubId, String equipmentId, String validDate); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Description: 设å¤åæ¥ç次è¿è¡æ°æ®è¡¨ |
| | | * @author: LiuS |
| | |
| | | * @param dateTime |
| | | */ |
| | | void runningAllEquipmentShiftStatisticalProcess(String dateTime); |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸»è½´è¿è¡æ¶é´ |
| | | * |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @param shiftSubId |
| | | * @return |
| | | */ |
| | | BigDecimal findSpindleRunDuration(String equipmentId, String validDate, String shiftSubId); |
| | | |
| | | } |
| | |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Description: é计ååæºç»´æ¤è¡¨ |
| | |
| | | * @return |
| | | */ |
| | | ModelAndView exportXls(String userId, MdcNoplanClose mdcNoplanClose); |
| | | |
| | | BigDecimal findNoplanTimeDuration(String equipmentId, String validDate, String noplanType); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | /** |
| | | * @author: LiuS |
| | | * @create: 2023-10-18 09:25 |
| | | */ |
| | | public interface IMdcOverallEquipmentEfficiencyService { |
| | | |
| | | /** |
| | | * 计ç®è®¾å¤ç»¼åæçOEE |
| | | */ |
| | | void runningOverallEquipmentEfficiency(); |
| | | |
| | | } |
| | |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @Description: åæ ¼ç表 |
| | |
| | | * @return |
| | | */ |
| | | ModelAndView exportXls(String userId, MdcPassRate mdcPassRate); |
| | | |
| | | BigDecimal findProcessQuantity(String equipmentId, String validDate); |
| | | |
| | | BigDecimal findUnqualifiedQuantity(String equipmentId, String validDate); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.mdc.entity.EquipmentRunningTrace; |
| | | import org.jeecg.modules.mdc.mapper.EquipmentRunningTraceMapper; |
| | | import org.jeecg.modules.mdc.service.IEquipmentRunningTraceService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/10/26 16:45 |
| | | */ |
| | | @Service |
| | | public class EquipmentRunningTraceImpl extends ServiceImpl<EquipmentRunningTraceMapper, EquipmentRunningTrace> implements IEquipmentRunningTraceService { |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.mdc.entity.EquipmentStatisticalInfo; |
| | | import org.jeecg.modules.mdc.mapper.EquipmentStatisticalInfoMapper; |
| | | import org.jeecg.modules.mdc.service.IEquipmentStatisticalInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/10/24 14:04 |
| | | */ |
| | | @Service |
| | | public class EquipmentStatisticalInfoServiceImpl extends ServiceImpl<EquipmentStatisticalInfoMapper, EquipmentStatisticalInfo> implements IEquipmentStatisticalInfoService { |
| | | } |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.*; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 设å¤å·¥ä½æ¥å表 |
| | |
| | | List<MdcDeviceCalendarVo> result = new ArrayList<>(); |
| | | try { |
| | | //æ¥è¯¢é»è®¤çå¶ |
| | | List<MdcDeviceCalendarVo> acquiesceShift = this.baseMapper.findAcquiesceShift(); |
| | | // List<MdcDeviceCalendarVo> acquiesceShift = this.baseMapper.findAcquiesceShift(); |
| | | |
| | | for (String stringDate : stringDates) { |
| | | List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = this.baseMapper.listByEquipmentAndDate(equipmentId, stringDate); |
| | | if (mdcDeviceCalendarVos != null && !mdcDeviceCalendarVos.isEmpty()) { |
| | | result.addAll(mdcDeviceCalendarVos); |
| | | } else { |
| | | acquiesceShift.forEach(mdcDeviceCalendarVo -> { |
| | | mdcDeviceCalendarVo.setEquipmentId(equipmentId); |
| | | mdcDeviceCalendarVo.setEffectiveDate(stringDate); |
| | | }); |
| | | // 设置é»è®¤çå¶ |
| | | result.addAll(acquiesceShift); |
| | | } |
| | | // else { |
| | | // acquiesceShift.forEach(mdcDeviceCalendarVo -> { |
| | | // mdcDeviceCalendarVo.setEquipmentId(equipmentId); |
| | | // mdcDeviceCalendarVo.setEffectiveDate(stringDate); |
| | | // }); |
| | | // // 设置é»è®¤çå¶ |
| | | // result.addAll(acquiesceShift); |
| | | // } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 计ç®å®é
çäº§å¤©æ° |
| | | * |
| | | * @param shiftSubId |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal computeActualWorkDayCount(String shiftSubId, String equipmentId, String validDate) { |
| | | validDate = validDate.replaceAll("-", ""); |
| | | List<String> validDateList = this.baseMapper.computeActualWorkDayCount(shiftSubId, equipmentId, validDate); |
| | | return new BigDecimal(validDateList.size()); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç次åç±» |
| | | * |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<String> findShiftSort(String equipmentId, String validDate) { |
| | | validDate = validDate.replaceAll("-", ""); |
| | | return this.baseMapper.findShiftSort(equipmentId, validDate); |
| | | } |
| | | |
| | | /** |
| | | * 计ç®ç次æ¶é´ |
| | | * |
| | | * @param shiftSubId |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal computeShiftTimeCount(String shiftSubId, String equipmentId, String validDate) { |
| | | Integer shiftCount = this.baseMapper.computeShiftTimeCount(shiftSubId, equipmentId, validDate); |
| | | return new BigDecimal(shiftCount).multiply(new BigDecimal("8")).multiply(new BigDecimal("60")); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; |
| | | import org.jeecg.modules.mdc.entity.MdcNoplanClose; |
| | | import org.jeecg.modules.mdc.mapper.MdcEquipmentOvertimeMapper; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentOvertimeService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | |
| | | |
| | | 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.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | |
| | | //è·åå½åç»å½ç¨æ· |
| | | //update-begin---author:wangshuai ---date:20211227 forï¼[JTC-116]导åºäººåæ»äº------------ |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("å ç管çåè¡¨æ°æ®", "导åºäºº:"+user.getRealname(), "å ç管ç")); |
| | | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("å ç管çåè¡¨æ°æ®", "导åºäºº:" + user.getRealname(), "å ç管ç")); |
| | | //update-end---author:wangshuai ---date:20211227 forï¼[JTC-116]导åºäººåæ»äº------------ |
| | | mv.addObject(NormalExcelConstants.DATA_LIST, mdcEquipmentOvertimes); |
| | | return mv; |
| | | } |
| | | |
| | | /** |
| | | * 计ç®å çæ¶é´ï¼åéï¼ |
| | | * |
| | | * @param shiftSubId |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal computeOvertime(String shiftSubId, String equipmentId, String validDate) { |
| | | List<MdcEquipmentOvertime> list = this.baseMapper.computeOvertime(shiftSubId, equipmentId, validDate); |
| | | 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)); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.modules.mdc.dto.EquipmentMachingDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentRunningSectionDto; |
| | | import org.jeecg.modules.mdc.entity.*; |
| | |
| | | import org.jeecg.modules.mdc.util.TimeFieldUtils; |
| | | import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentRunningSectionVo; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Resource |
| | | private IEquipmentWorkLineService equipmentWorkLineService; |
| | | |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | |
| | | @Resource |
| | | private IEquipmentRunningTraceService equipmentRunningTraceService; |
| | | |
| | | @Override |
| | | public List<MdcEquipmentRunningSectionDto> logList(MdcEquipmentRunningSectionVo equipmentRunningSectionVo) { |
| | |
| | | //save errorList |
| | | super.saveBatch(errorList); |
| | | } |
| | | List<DictModel> dictList = sysDictService.queryDictItemsByCode("data_synchronization_flag"); |
| | | if (dictList != null && !dictList.isEmpty() && "0".equals(dictList.get(0).getValue())) { |
| | | this.dataSynchronizationHandler(list, errorList); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®åæ¥å¤ç |
| | | * @param list |
| | | * @param errorList |
| | | */ |
| | | private void dataSynchronizationHandler(List<MdcEquipmentRunningSection> list, List<MdcEquipmentRunningSection> errorList) { |
| | | // æ°æ®è½¬æ¢ |
| | | List<EquipmentRunningTrace> equipList = new ArrayList<>(); |
| | | if (list != null && !list.isEmpty()) { |
| | | list.forEach(item -> { |
| | | EquipmentRunningTrace equipmentRunningSection = new EquipmentRunningTrace(); |
| | | equipmentRunningSection.setEquipment(item.getEquipmentId()); |
| | | equipmentRunningSection.setAlarm(item.getAlarm()); |
| | | equipmentRunningSection.setCreateTime(item.getCreateTime()); |
| | | equipmentRunningSection.setDuration(item.getDuration()); |
| | | equipmentRunningSection.setEndTime(item.getEndTime()); |
| | | equipmentRunningSection.setStartTime(item.getStartTime()); |
| | | equipmentRunningSection.setStatus(item.getStatus()); |
| | | equipmentRunningSection.setSequencenumber(item.getSequenceNumber()); |
| | | equipList.add(equipmentRunningSection); |
| | | }); |
| | | } |
| | | if (errorList != null && !errorList.isEmpty()) { |
| | | errorList.forEach(item -> { |
| | | EquipmentRunningTrace equipmentRunningSection = new EquipmentRunningTrace(); |
| | | equipmentRunningSection.setEquipment(item.getEquipmentId()); |
| | | equipmentRunningSection.setAlarm(item.getAlarm()); |
| | | equipmentRunningSection.setCreateTime(item.getCreateTime()); |
| | | equipmentRunningSection.setDuration(item.getDuration()); |
| | | equipmentRunningSection.setEndTime(item.getEndTime()); |
| | | equipmentRunningSection.setStartTime(item.getStartTime()); |
| | | equipmentRunningSection.setStatus(item.getStatus()); |
| | | equipmentRunningSection.setSequencenumber(item.getSequenceNumber()); |
| | | equipList.add(equipmentRunningSection); |
| | | }); |
| | | } |
| | | equipmentRunningTraceService.saveBatch(equipList); |
| | | } |
| | | |
| | | /** |
| | | * è·å设å¤è¿è¡è®°å½ææ©çæ°æ® |
| | | */ |
| | | @Override |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.modules.mdc.entity.Equipment; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; |
| | | import org.jeecg.modules.mdc.entity.MdcSystemParameters; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.modules.mdc.entity.*; |
| | | import org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalInfoMapper; |
| | | import org.jeecg.modules.mdc.service.IEquipmentService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentRunningSectionService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalInfoService; |
| | | import org.jeecg.modules.mdc.service.IMdcSystemParametersService; |
| | | import org.jeecg.modules.mdc.service.*; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private IMdcSystemParametersService mdcSystemParametersService; |
| | | |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | |
| | | @Resource |
| | | private IEquipmentStatisticalInfoService equipmentStatisticalInfoService; |
| | | |
| | | /** |
| | | * 计ç®è®¾å¤åæ¥è¿è¡æ°æ® |
| | |
| | | } |
| | | if (!result.isEmpty()) { |
| | | this.saveBatch(result); |
| | | List<DictModel> dictList = sysDictService.queryDictItemsByCode("data_synchronization_flag"); |
| | | if (dictList != null && !dictList.isEmpty() && "0".equals(dictList.get(0).getValue())) { |
| | | List<EquipmentStatisticalInfo> list = this.dataHandle(result); |
| | | equipmentStatisticalInfoService.saveBatch(list); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private List<EquipmentStatisticalInfo> dataHandle(List<MdcEquipmentStatisticalInfo> list) { |
| | | List<EquipmentStatisticalInfo> result = new ArrayList<>(); |
| | | list.forEach(item -> { |
| | | EquipmentStatisticalInfo equipmentStatisticalInfo = new EquipmentStatisticalInfo(); |
| | | equipmentStatisticalInfo.setEquipment(item.getEquipmentId()); |
| | | equipmentStatisticalInfo.setTheDate(item.getTheDate()); |
| | | equipmentStatisticalInfo.setClosedLong(item.getCloseLong()); |
| | | equipmentStatisticalInfo.setOpeningLong(item.getOpenLong()); |
| | | equipmentStatisticalInfo.setErroringLong(item.getErrorLong()); |
| | | equipmentStatisticalInfo.setProcessingLong(item.getProcessLong()); |
| | | equipmentStatisticalInfo.setWaitingLong(item.getWaitLong()); |
| | | result.add(equipmentStatisticalInfo); |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | private List<MdcEquipmentStatisticalInfo> equipmentStatisticalProcess(Equipment equipment, String dateTime) { |
| | | Date initDate = null; |
| | | //åæåçç»è®¡æ°æ® |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | } |
| | | if (!result.isEmpty()) { |
| | | this.saveBatch(result); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸»è½´è¿è¡æ¶é´ |
| | | * |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @param shiftSubId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public BigDecimal findSpindleRunDuration(String equipmentId, String validDate, String shiftSubId) { |
| | | validDate = validDate.replaceAll("-", ""); |
| | | BigDecimal duration = this.baseMapper.findSpindleRunDuration(equipmentId, validDate, shiftSubId); |
| | | if (duration != null && duration.compareTo(BigDecimal.ZERO) != 0) { |
| | | return duration.divide(new BigDecimal("60"), 0, RoundingMode.HALF_UP); |
| | | } else { |
| | | return new BigDecimal("0"); |
| | | } |
| | | } |
| | | |
| | |
| | | MdcEquipmentStatisticalShiftInfo shiftInfo = mdcRateEquipment(equipmentid, dates.getStartDate(), dates.getEndDate()); |
| | | return shiftInfo; |
| | | } else { |
| | | if (repairList.size() == 1 ) { |
| | | if (repairList.size() == 1) { |
| | | long start = repairList.get(0).getStartTime().getTime(); |
| | | long end = repairList.get(0).getEndTime().getTime(); |
| | | if ( start > dates.getStart() && end < dates.getEnd() ) { |
| | | if (start > dates.getStart() && end < dates.getEnd()) { |
| | | MdcDateVo d1 = new MdcDateVo(); |
| | | d1.setStartTime(dates.getStartDate()); |
| | | d1.setEndTime(repairList.get(0).getStartTime()); |
| | |
| | | d2.setStartTime(repairList.get(0).getEndTime()); |
| | | d2.setEndTime(dates.getEndDate()); |
| | | dateList.add(d2); |
| | | } else if (start == dates.getStart() && end < dates.getEnd()){ |
| | | } else if (start == dates.getStart() && end < dates.getEnd()) { |
| | | MdcDateVo d2 = new MdcDateVo(); |
| | | d2.setStartTime(repairList.get(0).getEndTime()); |
| | | d2.setEndTime(dates.getEndDate()); |
| | |
| | | } |
| | | } else { |
| | | long s = dates.getStartDate().getTime(); |
| | | for (int i = 0 ; i < repairList.size(); i ++) { |
| | | for (int i = 0; i < repairList.size(); i++) { |
| | | long start = repairList.get(i).getStartTime().getTime(); |
| | | long end = repairList.get(i).getEndTime().getTime(); |
| | | |
| | | if (start > s ) { |
| | | if (start > s) { |
| | | MdcDateVo d = new MdcDateVo(); |
| | | d.setStartTime(dates.getStartDate()); |
| | | d.setEndTime(repairList.get(i).getStartTime()); |
| | |
| | | } else if (start == s) { |
| | | dates.setStartDate(repairList.get(i).getEndTime()); |
| | | } |
| | | if(i == repairList.size() -1 ) { |
| | | if(dates.getStartDate().getTime() >= end) { |
| | | if (i == repairList.size() - 1) { |
| | | if (dates.getStartDate().getTime() >= end) { |
| | | MdcDateVo d = new MdcDateVo(); |
| | | d.setStartTime(repairList.get(i).getEndTime()); |
| | | d.setEndTime(dates.getEndDate()); |
| | |
| | | if (runningSections == null || runningSections.isEmpty()) { |
| | | runningSections = mdcEquipmentRunningSectionService.listRunningSectionFromLog(equipmentid, startDate.getTime(), endDate.getTime()); |
| | | } |
| | | if(runningSections == null || runningSections.isEmpty()) { |
| | | if (runningSections == null || runningSections.isEmpty()) { |
| | | runningSections = new ArrayList<>(); |
| | | } |
| | | List<MdcEquipmentRunningSection> sectionErrors = mdcEquipmentRunningSectionService.listEquipmentRunningSectionError(equipmentid, startDate.getTime(), endDate.getTime()); |
| | |
| | | |
| | | /*æ
éæ¶é´ errs => å
³æºæ°æ® + æ¥è¦æ°æ® */ |
| | | BigDecimal faultLong = new BigDecimal("0"); |
| | | faultLong = faultLongInfo(errs); |
| | | faultLong = faultLongInfo(errs); |
| | | |
| | | //æ¥è¦æ°æ® |
| | | List<MdcEquipmentRunningSection> alarms = errs.stream().filter(section -> section.getStatus() == 22).collect(Collectors.toList()); |
| | |
| | | //TODO |
| | | return null; |
| | | } |
| | | Long startMdc = mdcDate.getStartTime().getTime(); |
| | | Long endMdc = mdcDate.getEndTime().getTime(); |
| | | Long startMdc = mdcDate.getStartTime().getTime(); |
| | | Long endMdc = mdcDate.getEndTime().getTime(); |
| | | if (sRun != null && !sRun.isEmpty()) { |
| | | for (int i = 0 ; i < sRun.size() ; i ++) { |
| | | for (int i = 0; i < sRun.size(); i++) { |
| | | Long start = sRun.get(i).getStartTime().getTime(); |
| | | Long end = sRun.get(i).getEndTime().getTime(); |
| | | if (startMdc <= start ) { |
| | | sRun.get(i).setStartTime( sRun.get(i).getStartTime()); |
| | | Long end = sRun.get(i).getEndTime().getTime(); |
| | | if (startMdc <= start) { |
| | | sRun.get(i).setStartTime(sRun.get(i).getStartTime()); |
| | | } else { |
| | | sRun.get(i).setStartTime(mdcDate.getStartTime()); |
| | | } |
| | | if (endMdc >= end) { |
| | | sRun.get(i).setEndTime( sRun.get(i).getEndTime()); |
| | | sRun.get(i).setEndTime(sRun.get(i).getEndTime()); |
| | | } else { |
| | | sRun.get(i).setEndTime(mdcDate.getEndTime()); |
| | | } |
| | | Long sen = DateUtils.differentSecond( sRun.get(i).getStartTime(), |
| | | Long sen = DateUtils.differentSecond(sRun.get(i).getStartTime(), |
| | | sRun.get(i).getEndTime()); |
| | | if (sen <= 0) { |
| | | sRun.remove(i); |
| | | i--; |
| | | } else { |
| | | sRun.get(i).setDuration(sen); |
| | | sRun.get(i).setStartLong( sRun.get(i).getStartTime().getTime()); |
| | | sRun.get(i).setEndLong( sRun.get(i).getEndTime().getTime()); |
| | | sRun.get(i).setStartLong(sRun.get(i).getStartTime().getTime()); |
| | | sRun.get(i).setEndLong(sRun.get(i).getEndTime().getTime()); |
| | | } |
| | | } |
| | | } |
| | | //é¨åæ°æ®æ¯ç»´ä¿® 1ãè¿è¡ç¶æä¸æ¥è¦æ
åµ |
| | | List<MdcEquipmentRunningSection> faultRun = new ArrayList<>(); |
| | | //å¶åº¦æ¶é´æ®µå
æ¥è¦æ°æ® |
| | | if (errors != null && !errors.isEmpty() ) { |
| | | for (int i = 0 ; i < errors.size() ; i ++) { |
| | | if (errors != null && !errors.isEmpty()) { |
| | | for (int i = 0; i < errors.size(); i++) { |
| | | Long start = errors.get(i).getStartTime().getTime(); |
| | | Long end = errors.get(i).getEndTime().getTime(); |
| | | if (startMdc <= start ) { |
| | | errors.get(i).setStartTime( errors.get(i).getStartTime()); |
| | | Long end = errors.get(i).getEndTime().getTime(); |
| | | if (startMdc <= start) { |
| | | errors.get(i).setStartTime(errors.get(i).getStartTime()); |
| | | } else { |
| | | errors.get(i).setStartTime(mdcDate.getStartTime()); |
| | | } |
| | | if (endMdc >= end) { |
| | | errors.get(i).setEndTime( errors.get(i).getEndTime()); |
| | | errors.get(i).setEndTime(errors.get(i).getEndTime()); |
| | | } else { |
| | | errors.get(i).setEndTime(mdcDate.getEndTime()); |
| | | } |
| | | Long sen = DateUtils.differentSecond( errors.get(i).getStartTime(), |
| | | Long sen = DateUtils.differentSecond(errors.get(i).getStartTime(), |
| | | errors.get(i).getEndTime()); |
| | | if (sen <= 0) { |
| | | errors.remove(i); |
| | | i--; |
| | | } else { |
| | | errors.get(i).setDuration(sen); |
| | | errors.get(i).setStartLong( errors.get(i).getStartTime().getTime()); |
| | | errors.get(i).setEndLong( errors.get(i).getEndTime().getTime()); |
| | | errors.get(i).setStartLong(errors.get(i).getStartTime().getTime()); |
| | | errors.get(i).setEndLong(errors.get(i).getEndTime().getTime()); |
| | | } |
| | | } |
| | | |
| | | //æè¿è¡ä¸åå¨çæ¥è¦å餿 |
| | | for (MdcEquipmentRunningSection se : sRun) { |
| | | long runStart = se.getStartTime().getTime(); |
| | | long runEnd = se.getEndTime().getTime(); |
| | | long runEnd = se.getEndTime().getTime(); |
| | | if (se.getStatus() == 3) { |
| | | if (errors != null && !errors.isEmpty() ) { |
| | | if (errors != null && !errors.isEmpty()) { |
| | | //å¤çæ¥è¦æ°æ® |
| | | for (int i = 0 ; i < errors.size(); i ++ ) { |
| | | for (int i = 0; i < errors.size(); i++) { |
| | | long errStart = errors.get(i).getStartTime().getTime(); |
| | | long errEnd = errors.get(i).getEndTime().getTime(); |
| | | // æ¥è¦å¼å§ å°äº è¿è¡å¼å§ æ¥è¦ç»æ å°äºè¿è¡ç»æ æ¥è¦ç»æ å¤§äº è¿è¡å¼å§ |
| | | if ( errStart < runStart && errEnd <= runEnd && errEnd > runStart ) { |
| | | if (errStart < runStart && errEnd <= runEnd && errEnd > runStart) { |
| | | errors.get(i).setEndTime(se.getStartTime()); |
| | | Long sen = DateUtils.differentSecond(errors.get(i).getStartTime(), |
| | | errors.get(i).getEndTime()); |
| | |
| | | errors.get(i).setEndLong(errors.get(i).getEndTime().getTime()); |
| | | } |
| | | // æ¥è¦å¼å§ å¤§äº è¿è¡å¼å§ ï¼ æ¥è¦å¼å§ å°äº è¿è¡ç»æ ï¼æ¥è¦ç»æ å¤§äº è¿è¡ç»æ |
| | | else if (errStart >= runStart && errStart < runEnd && errEnd > runEnd ) { |
| | | else if (errStart >= runStart && errStart < runEnd && errEnd > runEnd) { |
| | | errors.get(i).setStartTime(se.getEndTime()); |
| | | Long sen = DateUtils.differentSecond(errors.get(i).getStartTime(), |
| | | errors.get(i).getEndTime()); |
| | |
| | | } |
| | | // æ¥è¦å¼å§ å¤§äº è¿è¡å¼å§ ï¼ æ¥è¦å¼å§ å°äº è¿è¡ç»æ ï¼æ¥è¦ç»æ å¤§äº è¿è¡å¼å§ï¼æ¥è¦ç»æ å°äº è¿è¡ç»æ |
| | | else if (errStart >= runStart && errStart < runEnd && |
| | | errEnd > runStart && errEnd <= runEnd ){ |
| | | errEnd > runStart && errEnd <= runEnd) { |
| | | errors.remove(i); |
| | | i--; |
| | | } |
| | | //妿è¶
åºèå´ |
| | | else if (errStart <= runStart && errStart < runEnd && |
| | | errEnd > runStart && errEnd >= runEnd ) { |
| | | errEnd > runStart && errEnd >= runEnd) { |
| | | MdcEquipmentRunningSection errOne = new MdcEquipmentRunningSection(); |
| | | errOne.setEndTime(errors.get(i).getEndTime()); |
| | | |
| | |
| | | errOne.setEndLong(errOne.getEndTime().getTime()); |
| | | if (sen <= 0) { |
| | | errors.remove(i); |
| | | errors.add(i,errOne); |
| | | errors.add(i, errOne); |
| | | } else { |
| | | errors.add(i+1,errOne); |
| | | errors.add(i + 1, errOne); |
| | | i++; |
| | | } |
| | | } else { |
| | |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentRepair; |
| | | import org.jeecg.modules.mdc.entity.MdcNoplanClose; |
| | | import org.jeecg.modules.mdc.entity.MdcTorqueConfig; |
| | | import org.jeecg.modules.mdc.mapper.MdcNoplanCloseMapper; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.service.IMdcNoplanCloseService; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.time.Duration; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | |
| | | //è·åå½åç»å½ç¨æ· |
| | | //update-begin---author:wangshuai ---date:20211227 forï¼[JTC-116]导åºäººåæ»äº------------ |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("é计ååæºç»´æ¤åè¡¨æ°æ®", "导åºäºº:"+user.getRealname(), "é计ååæºç»´æ¤")); |
| | | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("é计ååæºç»´æ¤åè¡¨æ°æ®", "导åºäºº:" + user.getRealname(), "é计ååæºç»´æ¤")); |
| | | //update-end---author:wangshuai ---date:20211227 forï¼[JTC-116]导åºäººåæ»äº------------ |
| | | mv.addObject(NormalExcelConstants.DATA_LIST, mdcNoplanCloses); |
| | | return mv; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal findNoplanTimeDuration(String equipmentId, String validDate, String noplanType) { |
| | | BigDecimal result = new BigDecimal("0"); |
| | | String startDate = DateUtils.format(DateUtils.toDate(validDate + "-01", DateUtils.STR_DATE), DateUtils.STR_DATE) + " 00:00:00"; |
| | | Date startTime = DateUtils.toDate(startDate, DateUtils.STR_DATE_TIME_SMALL); |
| | | String endDate = DateUtils.format(DateUtils.addMonth(1, DateUtils.toDate(startDate, DateUtils.STR_DATE_TIME_SMALL)), DateUtils.STR_DATE_TIME_SMALL); |
| | | Date endTime = DateUtils.toDate(endDate, DateUtils.STR_DATE_TIME_SMALL); |
| | | List<MdcNoplanClose> mdcNoplanCloseList = this.baseMapper.findNoplanTimeDuration(equipmentId, noplanType, startDate, endDate); |
| | | // æ¶é´ä¿®æ£ å¹¶è®¡ç® |
| | | if (mdcNoplanCloseList != null && !mdcNoplanCloseList.isEmpty()) { |
| | | for (MdcNoplanClose mdcNoplanClose : mdcNoplanCloseList) { |
| | | if (mdcNoplanClose.getStartTime().before(startTime)) { |
| | | mdcNoplanClose.setStartTime(startTime); |
| | | } |
| | | if (mdcNoplanClose.getEndTime().after(endTime)) { |
| | | mdcNoplanClose.setEndTime(endTime); |
| | | } |
| | | LocalDateTime localStartDate = LocalDateTime.ofInstant(mdcNoplanClose.getStartTime().toInstant(), ZoneId.systemDefault()); |
| | | LocalDateTime localEndDate = LocalDateTime.ofInstant(mdcNoplanClose.getEndTime().toInstant(), ZoneId.systemDefault()); |
| | | int minutes = Math.toIntExact(Duration.between(localStartDate, localEndDate).toMinutes()); |
| | | result = result.add(new BigDecimal(minutes)); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.mdc.constant.MdcConstant; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency; |
| | | import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; |
| | | import org.jeecg.modules.mdc.mapper.MdcOverallEquipmentEfficiencyMapper; |
| | | import org.jeecg.modules.mdc.service.*; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.YearMonth; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author: LiuS |
| | | * @create: 2023-10-18 09:25 |
| | | */ |
| | | @Service |
| | | public class MdcOverallEquipmentEfficiencyServiceImpl extends ServiceImpl<MdcOverallEquipmentEfficiencyMapper, MdcOverallEquipmentEfficiency> implements IMdcOverallEquipmentEfficiencyService { |
| | | |
| | | @Resource |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentOvertimeService mdcEquipmentOvertimeService; |
| | | |
| | | @Resource |
| | | private IMdcDeviceCalendarService mdcDeviceCalendarService; |
| | | |
| | | @Resource |
| | | private IMdcNoplanCloseService mdcNoplanCloseService; |
| | | |
| | | @Resource |
| | | private IMdcPlanCloseService mdcPlanCloseService; |
| | | |
| | | @Resource |
| | | private IMdcPassRateService mdcPassRateService; |
| | | |
| | | @Resource |
| | | private IMdcStandardProcessDurationService mdcStandardProcessDurationService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentStatisticalShiftInfoService mdcEquipmentStatisticalShiftInfoService; |
| | | |
| | | /** |
| | | * 计ç®è®¾å¤ç»¼åæçOEE |
| | | */ |
| | | @Override |
| | | public void runningOverallEquipmentEfficiency() { |
| | | /* |
| | | OEE = æ¶é´å¼å¨ç à æ§è½å¼å¨ç Ã åæ ¼åç |
| | | æ¶é´å¼å¨ç = ï¼è´è·æ¶é´ - é计ååæºæ¶é´ï¼ / è´è·æ¶é´ à 100% |
| | | æ§è½å¼å¨ç = åå¼å¨æ¶é´ / å¼å¨æ¶é´ à 100% |
| | | åæ ¼åç = å å·¥æ°é - ä¸åæ ¼æ°é / å å·¥æ°é |
| | | è´è·æ¶é´ = æ¥å工使¶é´ - 计ååæºæ¶é´ |
| | | é计ååæºæ¶é´ = è´è·æ¶é´ - 主轴è¿è½¬æ¶é´ |
| | | 工使¥åæ¶é´ = æ¥åæ¶é´ - æ³å®åæ¥ - å伿¥ + å çæ¶é´ |
| | | åå¼å¨æ¶é´ = æ åå å·¥æ¶é´ à å å·¥æ°é |
| | | */ |
| | | List<MdcOverallEquipmentEfficiency> result = new ArrayList<>(); |
| | | // è·åæææ¥æ æ ¼å¼ yyyy-MM |
| | | String validDate = YearMonth.now().minusMonths(1).toString(); |
| | | // è·å设å¤å表 |
| | | List<MdcEquipment> equipmentList = mdcEquipmentService.list(); |
| | | for (MdcEquipment mdcEquipment : equipmentList) { |
| | | String equipmentId = mdcEquipment.getEquipmentId(); |
| | | // æ¥è¯¢ç次åç±» |
| | | List<String> shiftSubIdList = mdcDeviceCalendarService.findShiftSort(equipmentId, validDate); |
| | | // æ
éåæºæ¶é¿ç»è®¡(åé) |
| | | BigDecimal breakdownDownDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.BREAKDOWN_DOWN); |
| | | // æ¢åè°è¯æ¶é¿ç»è®¡(åé) |
| | | BigDecimal conversionDebugDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.CONVERSION_DEBUG); |
| | | // ç©æç缺æ¶é¿ç»è®¡(åé) |
| | | BigDecimal materialShortageDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.MATERIAL_SHORTAGE); |
| | | // 计åç任塿¶é¿ç»è®¡(åé) |
| | | BigDecimal plannedTaskDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.PLANNED_TASK); |
| | | // æ£éªæ¶é¿ç»è®¡(åé) |
| | | BigDecimal inspectDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.INSPECT); |
| | | // å
¶ä»æ¶é¿ç»è®¡(åé) |
| | | BigDecimal otherDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.OTHER); |
| | | // 计åä¿å
»æ¶é¿ç»è®¡(åé) |
| | | BigDecimal plannedMaintenanceDuration = new BigDecimal("0"); |
| | | // ä¼è®®/å¹è®æ¶é¿ç»è®¡(åé) |
| | | BigDecimal conferenceTrainingDuration = new BigDecimal("0"); |
| | | // å
¶å®ä¼æ¯æ¶é¿ç»è®¡(åé) |
| | | BigDecimal otherRestDuration = new BigDecimal("0"); |
| | | if (shiftSubIdList != null && !shiftSubIdList.isEmpty()) { |
| | | for (String shiftSubId : shiftSubIdList) { |
| | | MdcOverallEquipmentEfficiency mdcOverallEquipmentEfficiency = new MdcOverallEquipmentEfficiency(); |
| | | // æ¶é´å¼å¨çè®¡ç® |
| | | mdcOverallEquipmentEfficiency.setEquipmentId(equipmentId); |
| | | mdcOverallEquipmentEfficiency.setEquipmentName(mdcEquipment.getEquipmentName()); |
| | | mdcOverallEquipmentEfficiency.setEquipmentModel(mdcEquipment.getEquipmentModel()); |
| | | mdcOverallEquipmentEfficiency.setValidDate(validDate); |
| | | // çæ¬¡ çæ¬¡æ¶é´ |
| | | mdcOverallEquipmentEfficiency.setShiftSubId(shiftSubId); |
| | | BigDecimal shiftTimeCount = mdcDeviceCalendarService.computeShiftTimeCount(shiftSubId, equipmentId, validDate); |
| | | mdcOverallEquipmentEfficiency.setShiftTimeCount(shiftTimeCount); |
| | | // 计ç®å çæ¶é´ |
| | | BigDecimal overtime = mdcEquipmentOvertimeService.computeOvertime(shiftSubId, equipmentId, validDate); |
| | | mdcOverallEquipmentEfficiency.setOvertime(overtime); |
| | | // 计ç®å®é
çäº§å¤©æ° |
| | | BigDecimal actualWorkDayCount = mdcDeviceCalendarService.computeActualWorkDayCount(shiftSubId, equipmentId, validDate); |
| | | mdcOverallEquipmentEfficiency.setActualWorkDayCount(actualWorkDayCount); |
| | | // æåº¦å®é
çäº§æ»æ¶é´(åé) |
| | | mdcOverallEquipmentEfficiency.setMonthActualWorkDayTimeCount(mdcOverallEquipmentEfficiency.getShiftTimeCount().add(overtime)); |
| | | // æ
éåæºæ¶é¿ç»è®¡(åé) |
| | | mdcOverallEquipmentEfficiency.setBreakdownDownDuration(breakdownDownDuration); |
| | | // æ¢åè°è¯æ¶é¿ç»è®¡(åé) |
| | | mdcOverallEquipmentEfficiency.setConversionDebugDuration(conversionDebugDuration); |
| | | // ç©æç缺æ¶é¿ç»è®¡(åé) |
| | | mdcOverallEquipmentEfficiency.setMaterialShortageDuration(materialShortageDuration); |
| | | // 计åç任塿¶é¿ç»è®¡(åé) |
| | | mdcOverallEquipmentEfficiency.setPlannedTaskDuration(plannedTaskDuration); |
| | | // æ£éªæ¶é¿ç»è®¡(åé) |
| | | mdcOverallEquipmentEfficiency.setInspectDuration(inspectDuration); |
| | | // å
¶ä»æ¶é¿ç»è®¡(åé) |
| | | mdcOverallEquipmentEfficiency.setOtherDuration(otherDuration); |
| | | // 计åä¿å
»æ¶é¿ç»è®¡(åé) |
| | | mdcOverallEquipmentEfficiency.setPlannedMaintenanceDuration(plannedMaintenanceDuration); |
| | | // ä¼è®®/å¹è®æ¶é¿ç»è®¡(åé) |
| | | mdcOverallEquipmentEfficiency.setConferenceTrainingDuration(conferenceTrainingDuration); |
| | | // å
¶å®ä¼æ¯æ¶é¿ç»è®¡(åé) |
| | | mdcOverallEquipmentEfficiency.setOtherRestDuration(otherRestDuration); |
| | | /* |
| | | è´è·æ¶é´(å°æ¶) = 工使¥åæ¶é´ - 计ååæºæ¶é´ |
| | | 工使¥åæ¶é´ = æ¥åæ¶é´ - æ³å®åæ¥ - å伿¥ + å çæ¶é´ |
| | | 计ååæºæ¶é´ = 计åä¿å
»æ¶é¿ + ä¼è®®/å¹è®æ¶é¿ + ä¼è®®/å¹è®æ¶é¿ |
| | | */ |
| | | // mdcOverallEquipmentEfficiency.getShiftTimeCount() - plannedMaintenanceDuration - conferenceTrainingDuration - otherRestDuration |
| | | // è´è·æ¶é´(åé) |
| | | BigDecimal loadTime = mdcOverallEquipmentEfficiency.getShiftTimeCount().subtract(plannedMaintenanceDuration).subtract(conferenceTrainingDuration).subtract(otherRestDuration); |
| | | mdcOverallEquipmentEfficiency.setLoadTime(loadTime.divide(new BigDecimal("60"), 1, RoundingMode.HALF_UP)); |
| | | // æ¶é´å¼å¨ç |
| | | BigDecimal timeActuationRate = BigDecimal.ZERO; |
| | | if (loadTime.compareTo(BigDecimal.ZERO) == 0) { |
| | | mdcOverallEquipmentEfficiency.setTimeActuationRate(BigDecimal.ZERO); |
| | | } else { |
| | | timeActuationRate = (loadTime.subtract(breakdownDownDuration).subtract(conversionDebugDuration).subtract(materialShortageDuration).subtract(plannedTaskDuration).subtract(inspectDuration).subtract(otherDuration)).divide(loadTime, 4, RoundingMode.HALF_UP); |
| | | mdcOverallEquipmentEfficiency.setTimeActuationRate(timeActuationRate); |
| | | } |
| | | // å å·¥é¶ä»¶æ°(ä»¶) processQuantity |
| | | BigDecimal processQuantity = mdcPassRateService.findProcessQuantity(equipmentId, validDate); |
| | | mdcOverallEquipmentEfficiency.setProcessQuantity(processQuantity); |
| | | // æ åå å·¥æ¶é´(åé) |
| | | MdcStandardProcessDuration mdcStandardProcessDuration = mdcStandardProcessDurationService.getOne(new LambdaQueryWrapper<MdcStandardProcessDuration>().eq(MdcStandardProcessDuration::getEquipmentId, equipmentId)); |
| | | if (mdcStandardProcessDuration != null) { |
| | | mdcOverallEquipmentEfficiency.setStandardProcessDuration(new BigDecimal(mdcStandardProcessDuration.getDuration()).multiply(processQuantity)); |
| | | } else { |
| | | mdcOverallEquipmentEfficiency.setStandardProcessDuration(BigDecimal.ZERO); |
| | | } |
| | | |
| | | // æ§è½å¼å¨ç = 主轴è¿è¡æ¶é´/è´è·æ¶é´ |
| | | // æ¥è¯¢ä¸»è½´è¿è¡æ¶é´(åé) |
| | | BigDecimal spindleRunDuration = mdcEquipmentStatisticalShiftInfoService.findSpindleRunDuration(equipmentId, validDate, shiftSubId); |
| | | if (spindleRunDuration.compareTo(BigDecimal.ZERO) != 0) { |
| | | mdcOverallEquipmentEfficiency.setPerformanceRate(spindleRunDuration.divide(loadTime, 4, RoundingMode.HALF_UP)); |
| | | } else { |
| | | mdcOverallEquipmentEfficiency.setPerformanceRate(BigDecimal.ZERO); |
| | | } |
| | | // åºåæ° unqualifiedQuantity |
| | | BigDecimal unqualifiedQuantity = mdcPassRateService.findUnqualifiedQuantity(equipmentId, validDate); |
| | | mdcOverallEquipmentEfficiency.setUnqualifiedQuantity(unqualifiedQuantity); |
| | | // åæ ¼ç |
| | | if (processQuantity.compareTo(BigDecimal.ZERO) == 0) { |
| | | mdcOverallEquipmentEfficiency.setPassRate(BigDecimal.ONE); |
| | | } else { |
| | | mdcOverallEquipmentEfficiency.setPassRate((processQuantity.subtract(unqualifiedQuantity)).divide(processQuantity, 4, RoundingMode.HALF_UP)); |
| | | } |
| | | // 设å¤ç»¼åæç = æ¶é´å¼å¨ç à æ§è½å¼å¨ç Ã åæ ¼åç |
| | | mdcOverallEquipmentEfficiency.setOverallEquipmentEfficiency(timeActuationRate.multiply(mdcOverallEquipmentEfficiency.getPerformanceRate()).multiply(mdcOverallEquipmentEfficiency.getPassRate())); |
| | | if (mdcOverallEquipmentEfficiency.getOverallEquipmentEfficiency().compareTo(BigDecimal.ZERO) == 0) { |
| | | mdcOverallEquipmentEfficiency.setOverallEquipmentEfficiency(BigDecimal.ONE); |
| | | } |
| | | result.add(mdcOverallEquipmentEfficiency); |
| | | } |
| | | } |
| | | } |
| | | super.saveBatch(result); |
| | | } |
| | | } |
| | |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcPassRate; |
| | | import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; |
| | | import org.jeecg.modules.mdc.mapper.MdcPassRateMapper; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.service.IMdcPassRateService; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | |
| | | mv.addObject(NormalExcelConstants.DATA_LIST, mdcPassRates); |
| | | return mv; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal findProcessQuantity(String equipmentId, String validDate) { |
| | | String startTime = DateUtils.format(DateUtils.toDate(validDate + "-01 00:00:00", DateUtils.STR_DATE_TIME_SMALL), DateUtils.STR_DATE_TIME_SMALL); |
| | | LocalDate localDate = LocalDate.of(Integer.parseInt(validDate.split("-")[0]), Integer.parseInt(validDate.split("-")[1]), Integer.parseInt("01")).plusMonths(1); |
| | | String endTime = DateUtils.format(DateUtils.toDate(localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " 00:00:00", DateUtils.STR_DATE_TIME_SMALL), DateUtils.STR_DATE_TIME_SMALL); |
| | | Integer result = this.baseMapper.findProcessQuantity(equipmentId, startTime, endTime); |
| | | return result == null ? new BigDecimal("0") : new BigDecimal(result); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal findUnqualifiedQuantity(String equipmentId, String validDate) { |
| | | String startTime = DateUtils.format(DateUtils.toDate(validDate + "-01 00:00:00", DateUtils.STR_DATE_TIME_SMALL), DateUtils.STR_DATE_TIME_SMALL); |
| | | LocalDate localDate = LocalDate.of(Integer.parseInt(validDate.split("-")[0]), Integer.parseInt(validDate.split("-")[1]), Integer.parseInt("01")).plusMonths(1); |
| | | String endTime = DateUtils.format(DateUtils.toDate(localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " 00:00:00", DateUtils.STR_DATE_TIME_SMALL), DateUtils.STR_DATE_TIME_SMALL); |
| | | Integer result = this.baseMapper.findUnqualifiedQuantity(equipmentId, startTime, endTime); |
| | | return result == null ? new BigDecimal("0") : new BigDecimal(result); |
| | | } |
| | | } |