¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.common.typehandlers; |
| | | |
| | | |
| | | import java.sql.CallableStatement; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.sql.Timestamp; |
| | | |
| | | import org.apache.ibatis.type.BaseTypeHandler; |
| | | import org.apache.ibatis.type.JdbcType; |
| | | import org.apache.ibatis.type.MappedJdbcTypes; |
| | | import org.apache.ibatis.type.MappedTypes; |
| | | |
| | | @MappedTypes(value = Timestamp.class) |
| | | @MappedJdbcTypes(value = {JdbcType.BIGINT,JdbcType.INTEGER}) |
| | | public class NullableSqlTimestampTypeHandler extends BaseTypeHandler<Timestamp>{ |
| | | |
| | | @Override |
| | | public void setNonNullParameter(PreparedStatement ps, int i, Timestamp parameter, JdbcType jdbcType) |
| | | throws SQLException { |
| | | ps.setTimestamp(i, parameter); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public Timestamp getNullableResult(ResultSet rs, String columnName) throws SQLException { |
| | | Timestamp val = rs.getTimestamp(columnName); |
| | | if(rs.wasNull()) { |
| | | return null; |
| | | }else { |
| | | return val; |
| | | } |
| | | //return rs.getTimestamp(columnName); |
| | | } |
| | | |
| | | @Override |
| | | public Timestamp getNullableResult(ResultSet rs, int columnIndex) throws SQLException { |
| | | Timestamp val = rs.getTimestamp(columnIndex); |
| | | if(rs.wasNull()) { |
| | | return null; |
| | | }else { |
| | | return val; |
| | | } |
| | | //return rs.getTimestamp(columnIndex); |
| | | } |
| | | |
| | | @Override |
| | | public Timestamp getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { |
| | | Timestamp val = cs.getTimestamp(columnIndex); |
| | | if(cs.wasNull()) { |
| | | return null; |
| | | }else { |
| | | return val; |
| | | } |
| | | //return cs.getTimestamp(columnIndex); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.qianwen.smartman.modules.mdc.service.IOutputStatisticsService; |
| | | import com.qianwen.smartman.modules.mdc.vo.StatisticsAnalysisQueryVO; |
| | | import com.qianwen.smartman.modules.mdc.vo.StatisticsVO; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | @ApiResource({"blade-mdc/output"}) |
| | | @RestController |
| | | public class OutputStatisticsController extends BladeController { |
| | | private final IOutputStatisticsService outputStatisticsService; |
| | | |
| | | @Autowired |
| | | private IOutputStatisticsService outputStatisticsService; |
| | | /* |
| | | public OutputStatisticsController(final IOutputStatisticsService outputStatisticsService) { |
| | | this.outputStatisticsService = outputStatisticsService; |
| | | } |
| | | }*/ |
| | | |
| | | @PostMapping({""}) |
| | | @ApiOperation(ExcelConstant.OUTPUT_ACCOUNT) |
| | |
| | | this.feedbackService = feedbackService; |
| | | } |
| | | |
| | | /** |
| | | * ç¶æè®°å½åè½ä¸çæä¸å¤©çç¶ææ°æ® |
| | | * @param statusRecordDateSelectVO |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @ApiOperationSupport(order = 1) |
| | | @PostResource({"/status-record-by-date"}) |
| | | @ApiOperation(value = "æ ¹æ®æ¥ææ¥è¯¢ç¶æè®°å½", notes = "ä¼ å
¥statusRecordDateSelectVO") |
| | |
| | | this.superAggregateStateService = superAggregateStateService; |
| | | } |
| | | |
| | | /** |
| | | * ç¨æ¶åæç»è®¡ |
| | | * @param query |
| | | * @param stationVO |
| | | * @return |
| | | */ |
| | | @PostMapping({"/work-stations"}) |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation("æå¤è®¾å¤ç»è®¡ç¨æ¶") |
| | |
| | | |
| | | public class SuperAggregateOutput extends SuperAggregate { |
| | | private static final long serialVersionUID = 1074211007569731042L; |
| | | private Timestamp ts; |
| | | private Timestamp preTs; |
| | | |
| | | private Timestamp time; |
| | | private Timestamp preTime; |
| | | private Long output; |
| | | private Long curOutput; |
| | | private Long preOutput; |
| | |
| | | } else if (!this$employeeId.equals(other$employeeId)) { |
| | | return false; |
| | | } |
| | | Object this$ts = getTs(); |
| | | Object other$ts = other.getTs(); |
| | | Object this$ts = getTime(); |
| | | Object other$ts = other.getTime(); |
| | | if (this$ts == null) { |
| | | if (other$ts != null) { |
| | | return false; |
| | |
| | | } else if (!this$ts.equals(other$ts)) { |
| | | return false; |
| | | } |
| | | Object this$preTs = getPreTs(); |
| | | Object other$preTs = other.getPreTs(); |
| | | Object this$preTs = getPreTime(); |
| | | Object other$preTs = other.getPreTime(); |
| | | if (this$preTs == null) { |
| | | if (other$preTs != null) { |
| | | return false; |
| | |
| | | int result4 = (result3 * 59) + ($preOutput == null ? 43 : $preOutput.hashCode()); |
| | | Object $employeeId = getEmployeeId(); |
| | | int result5 = (result4 * 59) + ($employeeId == null ? 43 : $employeeId.hashCode()); |
| | | Object $ts = getTs(); |
| | | Object $ts = getTime(); |
| | | int result6 = (result5 * 59) + ($ts == null ? 43 : $ts.hashCode()); |
| | | Object $preTs = getPreTs(); |
| | | Object $preTs = getPreTime(); |
| | | int result7 = (result6 * 59) + ($preTs == null ? 43 : $preTs.hashCode()); |
| | | Object $program = getProgram(); |
| | | int result8 = (result7 * 59) + ($program == null ? 43 : $program.hashCode()); |
| | |
| | | return (result9 * 59) + ($productName == null ? 43 : $productName.hashCode()); |
| | | } |
| | | |
| | | public void setTs(final Timestamp ts) { |
| | | this.ts = ts; |
| | | public void setTime(final Timestamp time) { |
| | | this.time = time; |
| | | } |
| | | |
| | | public void setPreTs(final Timestamp preTs) { |
| | | this.preTs = preTs; |
| | | public void setPreTs(final Timestamp preTime) { |
| | | this.preTime = preTime; |
| | | } |
| | | |
| | | public void setOutput(final Long output) { |
| | |
| | | |
| | | @Override // org.springblade.modules.mdc.entity.SuperAggregate |
| | | public String toString() { |
| | | return "SuperAggregateOutput(ts=" + getTs() + ", preTs=" + getPreTs() + ", output=" + getOutput() + ", curOutput=" + getCurOutput() + ", preOutput=" + getPreOutput() + ", program=" + getProgram() + ", productCode=" + getProductCode() + ", productName=" + getProductName() + ", employeeId=" + getEmployeeId() + ")"; |
| | | return "SuperAggregateOutput(ts=" + getTime() + ", preTs=" + getPreTime() + ", output=" + getOutput() + ", curOutput=" + getCurOutput() + ", preOutput=" + getPreOutput() + ", program=" + getProgram() + ", productCode=" + getProductCode() + ", productName=" + getProductName() + ", employeeId=" + getEmployeeId() + ")"; |
| | | } |
| | | |
| | | public SuperAggregateOutput() { |
| | | } |
| | | |
| | | public SuperAggregateOutput(final Timestamp ts, final Timestamp preTs, final Long output, final Long curOutput, final Long preOutput, final String program, final String productCode, final String productName, final Long employeeId) { |
| | | this.ts = ts; |
| | | this.preTs = preTs; |
| | | public SuperAggregateOutput(final Timestamp time, final Timestamp preTime, final Long output, final Long curOutput, final Long preOutput, final String program, final String productCode, final String productName, final Long employeeId) { |
| | | this.time = time; |
| | | this.preTime = preTime; |
| | | this.output = output; |
| | | this.curOutput = curOutput; |
| | | this.preOutput = preOutput; |
| | |
| | | this.employeeId = employeeId; |
| | | } |
| | | |
| | | public Timestamp getTs() { |
| | | return this.ts; |
| | | public Timestamp getTime() { |
| | | return this.time; |
| | | } |
| | | |
| | | public Timestamp getPreTs() { |
| | | return this.preTs; |
| | | public Timestamp getPreTime() { |
| | | return this.preTime; |
| | | } |
| | | |
| | | public Long getOutput() { |
| | |
| | | package com.qianwen.smartman.modules.mdc.entity; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.Date; |
| | | |
| | | import org.apache.commons.lang.builder.ToStringBuilder; |
| | | |
| | | public class SuperAggregateState extends SuperAggregate { |
| | | private Timestamp time; |
| | | private Timestamp startTime; |
| | | private Timestamp endTime; |
| | | |
| | | private Long endL; |
| | | private Date endD; |
| | | /** |
| | | * ééçæé´/æ¶é¿ãåä½ç§? |
| | | */ |
| | |
| | | return (result10 * 59) + ($endTime == null ? 43 : $endTime.hashCode()); |
| | | } |
| | | |
| | | public Timestamp getTime() { |
| | | public Long getEndL() { |
| | | return endL; |
| | | } |
| | | |
| | | public void setEndL(Long endL) { |
| | | this.endL = endL; |
| | | } |
| | | |
| | | public Date getEndD() { |
| | | return endD; |
| | | } |
| | | |
| | | public void setEndD(Date endD) { |
| | | this.endD = endD; |
| | | } |
| | | |
| | | public Timestamp getTime() { |
| | | return time; |
| | | } |
| | | |
| | |
| | | |
| | | @Override // org.springblade.modules.mdc.entity.SuperAggregate |
| | | public String toString() { |
| | | return "SuperAggregateState(startTime=" + getStartTime() + ", endTime=" + getEndTime() + ", durationCollect=" + getDurationCollect() + ", valueCollect=" + getValueCollect() + ", wcs=" + getWcs() + ", rps=" + getRps() + ", isDeleted=" + getIsDeleted() + ", isPlan=" + getIsPlan() + ", employeeId=" + getEmployeeId() + ", feedbackId=" + getFeedbackId() + ")"; |
| | | return ToStringBuilder.reflectionToString(this); |
| | | //return "SuperAggregateState(startTime=" + getStartTime() + ", endTime=" + getEndTime() + ", durationCollect=" + getDurationCollect() + ", valueCollect=" + getValueCollect() + ", wcs=" + getWcs() + ", rps=" + getRps() + ", isDeleted=" + getIsDeleted() + ", isPlan=" + getIsPlan() + ", employeeId=" + getEmployeeId() + ", feedbackId=" + getFeedbackId() + ")"; |
| | | } |
| | | |
| | | public SuperAggregateState() { |
| | |
| | | import com.qianwen.smartman.common.constant.ExcelConstant; |
| | | |
| | | public enum OpenTypeEnums { |
| | | /** |
| | | * "mdc_open_type" |
| | | */ |
| | | PARAM_KEY_TYPE("mdc_open_type"), |
| | | /** |
| | | * "mdc_open_shift" |
| | | */ |
| | | PARAM_KEY_SHIFT("mdc_open_shift"), |
| | | TIME_USED_ANALYSIS(ExcelConstant.TIME_USED), |
| | | RUNNING("è¿è¡ç"), |
| | |
| | | package com.qianwen.smartman.modules.mdc.mapper; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput; |
| | | |
| | | @DS("tdengine") |
| | | @DS("iotdb") |
| | | @InterceptorIgnore(tenantLine = "true") |
| | | public interface SuperAggregateOutputMapper { |
| | | List<SuperAggregateOutput> getOutputDataByNaturalDate(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | /** |
| | | * èªç¶æ¥äº§é |
| | | * @param workstationIds |
| | | * @param startDate |
| | | * @param endDate |
| | | * @return |
| | | */ |
| | | List<SuperAggregateOutput> getOutputDataByNaturalDate(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); |
| | | |
| | | List<SuperAggregateOutput> getOutputDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | /** |
| | | * æ ¹æ®èµ·æ¢æ¥æï¼è·åäº§éæ°æ® |
| | | * @param workstationIds |
| | | * @param startFatoryDate |
| | | * @param endFatoryDate |
| | | * @return |
| | | */ |
| | | List<SuperAggregateOutput> getOutputDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startFatoryDate") int startFatoryDate, @Param("endFatoryDate") int endFatoryDate); |
| | | |
| | | List<SuperAggregateOutput> getOutputDataByWorkstationAndFactoryDate(@Param("workstationId") Long workstationId, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import com.qianwen.smartman.common.constant.FmsConstant; |
| | | import com.qianwen.smartman.modules.mdc.entity.SuperAggregateState; |
| | | |
| | | @DS("tdengine") |
| | | //@DS("tdengine") |
| | | @DS("iotdb") |
| | | @InterceptorIgnore(tenantLine = FmsConstant.AUTOMATIC) |
| | | public interface SuperAggregateStateFeedbackMapper { |
| | | List<SuperAggregateState> getStatusDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | /** |
| | | * æçäº§æ¥æè·ååé¦ç¶æè¡¨çç¶ææ°æ®,æ¥æåæ°é½è¯¥ä¸ºLocalDateTime |
| | | * @param workstationIds |
| | | * @param startDate |
| | | * @param endDate |
| | | * @return |
| | | */ |
| | | List<SuperAggregateState> getStatusDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startFactoryDate") int startFactoryDate, @Param("endFactoryDate") int endFactoryDate); |
| | | //List<SuperAggregateState> getStatusDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | List<SuperAggregateState> getStatusData(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | /** |
| | | * è·ååé¦ç¶æè¡¨çç¶ææ°æ®,æ¥æåæ°é½è¯¥ä¸ºLocalDateTime |
| | | * @param workstationIds |
| | | * @param startDate |
| | | * @param endDate |
| | | * @return |
| | | */ |
| | | List<SuperAggregateState> getStatusData(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); |
| | | } |
| | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | List<StatusAnalysisWorkstationVO> statusByWorkstationByNull(@Param("workstationId") String workstationId, @Param("startTime") String startTime); |
| | | |
| | | List<SuperAggregateState> dateState(@Param("factoryDate") String factoryDate, @Param("ids") List<Long> ids); |
| | | /** |
| | | * æ¥è¯¢æå®å·¥ä½ç¬¦åfactoryDateçæ°æ® ç¨æ¶åæ |
| | | * @param factoryDate |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | List<SuperAggregateState> dateState(@Param("factoryDate") int factoryDate, @Param("ids") List<Long> ids); |
| | | |
| | | /** |
| | | * æ¥è¯¢æå®å·¥ä½ç¬¦åææçæ°æ® ç¨æ¶åæ |
| | | * @param ids |
| | | * @param year |
| | | * @param week |
| | | * @return |
| | | */ |
| | | List<SuperAggregateState> weekState(@Param("ids") List<Long> ids, @Param("year") Integer year, @Param("week") Integer week); |
| | | |
| | | /** |
| | | * æ¥è¯¢æå®å·¥ä½ç¬¦å年份åæä»½çæ°æ® ç¨æ¶åæ |
| | | * @param ids |
| | | * @param year |
| | | * @param month |
| | | * @return |
| | | */ |
| | | List<SuperAggregateState> yearState(@Param("ids") List<Long> ids, @Param("year") Integer year, @Param("month") Integer month); |
| | | |
| | | List<SuperAggregateState> shiftState(@Param("ids") List<Long> workStationIds, @Param("factoryDate") String factoryDate, @Param("shiftIndex") Integer shiftIndex, @Param("calendarCode") String calendarCode); |
| | | /** |
| | | * æ¥è¯¢æå®å·¥ä½ç¬¦åçæ¬¡åfactoryDateçæ°æ®ï¼ç¨æ¶åæä¸ä½¿ç¨ |
| | | * @param workStationIds |
| | | * @param factoryDate |
| | | * @param shiftIndex |
| | | * @param calendarCode |
| | | * @return |
| | | */ |
| | | List<SuperAggregateState> shiftState(@Param("ids") List<Long> workStationIds, @Param("factoryDate") Integer factoryDate, @Param("shiftIndex") Integer shiftIndex, @Param("calendarCode") String calendarCode); |
| | | |
| | | List<StatusAnalysisWorkstationVO> statusByWorkstationList(@Param("workstationIdList") List<Long> workstationIdList, @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | |
| | |
| | | |
| | | List<SuperAggregateState> getStatusByFactory(@Param("factoryDate") Integer factoryDate, @Param("shiftIndex") Integer shiftIndex, @Param("workstationIds") List<Long> workstationIds); |
| | | |
| | | List<SuperAggregateState> getStatusData(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | /** |
| | | * æ¥è¯¢ç¶ææ°æ® |
| | | * @param workstationIds æå®çå·¥ä½idéå |
| | | * @param startDate å¼å§æ¶é´ |
| | | * @param endDate æªè³æ¶é´ |
| | | * @return æ°æ®å表 |
| | | */ |
| | | List<SuperAggregateState> getStatusData(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); |
| | | |
| | | /** |
| | | * æ ¹æ®å·¥ä½idåè¡¨åæ¶é´èç¹è·åç¶ææ°æ®yys,é¦é¡µç¨¼å¨çæ¶ä½¿ç¨ç |
| | |
| | | */ |
| | | List<SuperAggregateState> getStatusDataByTimeSection(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); |
| | | |
| | | List<SuperAggregateState> getStatusDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | /** |
| | | * æ ¹æ®å·¥åæ¥æè·åèåç¶ææ°æ® |
| | | * @param workstationIds |
| | | * @param startDate |
| | | * @param endDate |
| | | * @return |
| | | */ |
| | | List<SuperAggregateState> getStatusDataByFactoryDate(@Param("workstationIds") List<Long> workstationIds, @Param("startFactoryDate") int startFactoryDate, @Param("endFactoryDate") int endFactoryDate); |
| | | |
| | | List<SuperAggregateState> getStatusDataByFactoryDateAndWorkstationId(@Param("workstationId") Long workstationId, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | |
| | | import com.qianwen.smartman.modules.report.vo.WorkstaionAlarmByShiftReportVO; |
| | | import com.qianwen.smartman.modules.report.vo.WorkstaionAlarmByTimeReportVO; |
| | | |
| | | @DS("tdengine") |
| | | @DS("iotdb") |
| | | @InterceptorIgnore(tenantLine = FmsConstant.AUTOMATIC) |
| | | public interface SuperAlarmMapper extends BaseMapper<SuperAlarm> { |
| | | /** |
| | | * æ¥è¯¢åè¦åé¡µæ°æ® |
| | | * @param workstationId |
| | | * @param start |
| | | * @param end |
| | | * @return |
| | | */ |
| | | List<AlarmAnalysisWorkstationVO> alarmByWorkstation(@Param("workstationId") String workstationId, @Param("start") Integer start, @Param("end") Integer end); |
| | | |
| | | /** |
| | | * æ¥è¯¢åè¦æ°æ®æ¡æ° |
| | | * @param workstationId |
| | | * @return |
| | | */ |
| | | Integer alarmByWorkstationTotal(@Param("workstationId") String workstationId); |
| | | |
| | | void createTable(Long workstationId); |
| | |
| | | import com.qianwen.smartman.modules.mdc.vo.StatisticsVO; |
| | | |
| | | public interface IOutputStatisticsService { |
| | | /** |
| | | * 产éç»è®¡ |
| | | * @param statisticsAnalysisQueryVO |
| | | * @param query |
| | | * @return |
| | | */ |
| | | StatisticsVO outputStatistics(StatisticsAnalysisQueryVO statisticsAnalysisQueryVO, Query query); |
| | | |
| | | BladeFile export(StatisticsAnalysisQueryVO analysisQueryVO); |
| | |
| | | |
| | | List<ChartDataVO> getTimeDistribution(StatusRecordDetailSelectVO statusRecordDetailSelectVO); |
| | | |
| | | /** |
| | | * æ¥è¯¢è®¾å¤æçï¼å¨å·¥ä½æ°æ®çé¢ï¼è®¾å¤æçç»è®¡å¾ï¼ï¼ç¹å»æä¸ä¸ªæºå¨çæ¶åè°ç¨ |
| | | * @param statusRecordDetailSelectVO æ¥è¯¢åæ° |
| | | * @return |
| | | */ |
| | | List<ChartDataVO> getEquipmentEfficiency(StatusRecordDetailSelectVO statusRecordDetailSelectVO); |
| | | |
| | | List<StatusRecordShiftIndexChartVO> getShiftIndexStatusRecordChart(StatusRecordDetailSelectVO statusRecordDetailSelectVO); |
| | | |
| | | /** |
| | | * æ¥è¯¢çæ¬¡ç¶æè®°å½è¡¨æ ¼ |
| | | * @param statusRecordDetailSelectVO |
| | | * @return |
| | | */ |
| | | List<HashMap<String, String>> getShiftIndexStatusRecordTable(StatusRecordDetailSelectVO statusRecordDetailSelectVO); |
| | | |
| | | BladeFile exportStatusRecord(StatusRecordExcelVO vo); |
| | |
| | | import com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum; |
| | | |
| | | public interface ISuperAggregateOutputService { |
| | | /** |
| | | * äº§éæ°æ® |
| | | * @param workstationIds |
| | | * @param statisticalMethod |
| | | * @param startDate |
| | | * @param endDate |
| | | * @return |
| | | */ |
| | | List<SuperAggregateOutput> getOutputData(List<Long> workstationIds, StatisticalMethodEnum statisticalMethod, LocalDate startDate, LocalDate endDate); |
| | | |
| | | List<SuperAggregateOutput> queryPerfByDay(Long workstationId, String startTime, String endTime, Long employeeId); |
| | |
| | | import com.qianwen.smartman.modules.mdc.vo.StatusTimeTopVO; |
| | | |
| | | public interface ISuperAggregateStateService { |
| | | /** |
| | | * æ ¹æ®æ¥æè·åå·¥ä½ç¶ææ°æ® |
| | | * @param workstationIds |
| | | * @param statisticalMethod |
| | | * @param startDate |
| | | * @param endDate |
| | | * @return |
| | | */ |
| | | List<SuperAggregateState> getStatusData(List<Long> workstationIds, StatisticalMethodEnum statisticalMethod, LocalDate startDate, LocalDate endDate); |
| | | |
| | | List<SuperAggregateState> getStatusDataWithFeedback(List<Long> workstationIds, StatisticalMethodEnum statisticalMethod, LocalDate startDate, LocalDate endDate); |
| | |
| | | import com.qianwen.smartman.modules.mdc.vo.excel.TimeUsedExcelVO; |
| | | |
| | | public interface ITimeUsedAnalysisService { |
| | | /** |
| | | * ç¨æ¶åæç»è®¡ |
| | | * @param stationVO |
| | | * @param query |
| | | * @return |
| | | */ |
| | | TimeUsedAnalysisWorkstationVO timeUsedStatisticsByWorkstation(TimeUsedStatisticsByWorkstationVO stationVO, Query query); |
| | | |
| | | WorkstationBandShiftVO queryWorkStationShiftIndexName(QueryShiftIndexNameVO vo); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public StatisticsVO outputStatistics(StatisticsAnalysisQueryVO statisticsAnalysisQueryVO, Query query) { |
| | | List<String> workStationIdList = statisticsAnalysisQueryVO.getWorkStationIdList(); |
| | | if (Func.isEmpty(workStationIdList)) { |
| | |
| | | List<StatusRecordDateVO> result = new ArrayList<>(); |
| | | List<WorkstationInfoVO> workstationList = statusRecordDateSelectVO.getWorkstationInfoList(); |
| | | if (Func.isEmpty(workstationList)) { |
| | | workstationList = (List<WorkstationInfoVO>)this.workstationService.list(Wrappers.<Workstation>lambdaQuery().eq(Workstation::getType, WorkstationTypeEnum.MACHINE.getCode()).eq(BaseEntity::getStatus, CommonConstant.ENABLE)).stream().map(s -> { |
| | | workstationList = this.workstationService.list(Wrappers.<Workstation>lambdaQuery().eq(Workstation::getType, WorkstationTypeEnum.MACHINE.getCode()).eq(BaseEntity::getStatus, CommonConstant.ENABLE)).stream().map(s -> { |
| | | WorkstationInfoVO workstationInfoVO = new WorkstationInfoVO(); |
| | | workstationInfoVO.setId(s.getId()); |
| | | workstationInfoVO.setName(s.getName()); |
| | |
| | | } |
| | | page.setTotal(workstationList.size()); |
| | | List<WorkstationInfoVO> workstationList2 = workstationList.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()); |
| | | List<Long> workstationIdList = workstationList2.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | List<Long> workstationIdList = workstationList2.stream().map(WorkstationInfoVO::getId).collect(Collectors.toList()); |
| | | |
| | | List<SuperAggregateState> superAggregateStateList = this.superAggregateStateService.getStatusData(workstationIdList, null, statusRecordDateSelectVO.getDate(), statusRecordDateSelectVO.getDate()); |
| | | Map<Long, List<SuperAggregateState>> workstationStatusMap = superAggregateStateList.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | })); |
| | | Map<Long, List<SuperAggregateState>> workstationStatusMap = superAggregateStateList.stream().collect(Collectors.groupingBy(SuperAggregateState::getWorkstationId)); |
| | | workstationList2.forEach(x -> { |
| | | StatusRecordDateVO statusRecord = new StatusRecordDateVO().setWorkstationInfo(x).setStatusRecordList(StatusRecordConvert.INSTANCE.convert(workstationStatusMap.get(x.getId()))); |
| | | result.add(statusRecord); |
| | |
| | | HashMap<String, String> hashMap = new HashMap<>(16); |
| | | hashMap.put("shiftIndex", x.getShiftIndex() + ""); |
| | | hashMap.put("shiftIndexName", x.getShiftIndexName()); |
| | | List<SuperAggregateState> shiftIndexStatusList = shiftIndexStatusMap.get(x.getShiftIndex()); |
| | | List<SuperAggregateState> shiftIndexStatusList = shiftIndexStatusMap.get(x.getShiftIndex());//null |
| | | if (Func.isNotEmpty(shiftIndexStatusList)) { |
| | | hashMap.put("oee", EifficiencyUtils.calculationResults(shiftIndexStatusList, ProductivityTypeEnum.OEE) + ""); |
| | | hashMap.put("fault", EifficiencyUtils.calculationResults(shiftIndexStatusList, ProductivityTypeEnum.ALARM) + ""); |
| | |
| | | |
| | | import cn.hutool.core.date.LocalDateTimeUtil; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.util.List; |
| | | import com.qianwen.smartman.common.constant.DateConstant; |
| | | import com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput; |
| | |
| | | public List<SuperAggregateOutput> getOutputData(List<Long> workstationIds, StatisticalMethodEnum statisticalMethodEnum, LocalDate startDate, LocalDate endDate) { |
| | | List<SuperAggregateOutput> superAggregateOutputList; |
| | | if (StatisticalMethodEnum.SHIFT.equals(statisticalMethodEnum) || StatisticalMethodEnum.DAY.equals(statisticalMethodEnum) || StatisticalMethodEnum.WEEK.equals(statisticalMethodEnum) || StatisticalMethodEnum.MONTH.equals(statisticalMethodEnum)) { |
| | | superAggregateOutputList = this.baseMapper.getOutputDataByFactoryDate(workstationIds, LocalDateTimeUtil.format(startDate, "yyyyMMdd"), LocalDateTimeUtil.format(endDate, "yyyyMMdd")); |
| | | superAggregateOutputList = this.baseMapper.getOutputDataByFactoryDate(workstationIds, Integer.parseInt(LocalDateTimeUtil.format(startDate, "yyyyMMdd")) , Integer.parseInt(LocalDateTimeUtil.format(endDate, "yyyyMMdd"))); |
| | | |
| | | } else { |
| | | superAggregateOutputList = this.baseMapper.getOutputDataByNaturalDate(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME)); |
| | | //好åçé¢ä¸æ²¡æè°ç¨ |
| | | //superAggregateOutputList = this.baseMapper.getOutputDataByNaturalDate(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME)); |
| | | LocalDateTime startTime = LocalDateTime.of(startDate, LocalTime.MIN); |
| | | LocalDateTime endTime = LocalDateTime.of(endDate.plusDays(1L), LocalTime.MIN); |
| | | superAggregateOutputList = this.baseMapper.getOutputDataByNaturalDate(workstationIds, startTime,endTime ); |
| | | } |
| | | return superAggregateOutputList; |
| | | } |
| | |
| | | import java.sql.Timestamp; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.DateConstant; |
| | | import com.qianwen.smartman.common.utils.LocalDateTimeUtils; |
| | | import com.qianwen.smartman.common.utils.LocalDateUtil; |
| | | import com.qianwen.smartman.modules.cps.entity.Workstation; |
| | | import com.qianwen.smartman.modules.cps.service.IWorkstationService; |
| | | import com.qianwen.smartman.modules.mdc.entity.SuperAggregate; |
| | |
| | | public List<SuperAggregateState> getStatusData(List<Long> workstationIds, StatisticalMethodEnum statisticalMethod, LocalDate startDate, LocalDate endDate) { |
| | | List<SuperAggregateState> statusDataList; |
| | | if (StatisticalMethodEnum.SHIFT.equals(statisticalMethod) || StatisticalMethodEnum.DAY.equals(statisticalMethod) || StatisticalMethodEnum.WEEK.equals(statisticalMethod) || StatisticalMethodEnum.MONTH.equals(statisticalMethod)) { |
| | | statusDataList = this.baseMapper.getStatusDataByFactoryDate(workstationIds, LocalDateTimeUtil.format(startDate, "yyyyMMdd"), LocalDateTimeUtil.format(endDate, "yyyyMMdd")); |
| | | statusDataList = this.baseMapper.getStatusDataByFactoryDate(workstationIds, Integer.parseInt(LocalDateTimeUtil.format(startDate, "yyyyMMdd")), Integer.parseInt(LocalDateTimeUtil.format(endDate, "yyyyMMdd"))); |
| | | } else { |
| | | statusDataList = this.baseMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME)); |
| | | //statusDataList = this.baseMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME)); |
| | | LocalDateTime startTime = LocalDateTime.of(startDate, LocalTime.MIN); |
| | | LocalDateTime endTime = LocalDateTime.of(endDate.plusDays(1L), LocalTime.MIN); |
| | | //statusDataList = this.baseMapper.getStatusData(workstationIds, startDate,endDate.plusDays(1L)); |
| | | statusDataList = this.baseMapper.getStatusData(workstationIds, startTime,endTime); |
| | | } |
| | | return buildDuration(statusDataList); |
| | | } |
| | |
| | | @Override |
| | | public List<SuperAggregateState> getStatusDataWithFeedback(List<Long> workstationIds, StatisticalMethodEnum statisticalMethod, LocalDate startDate, LocalDate endDate) { |
| | | //稼å¨çæ¥è¯¢ |
| | | |
| | | //LocalDate startTime = LocalDateTime, LocalDate endDate |
| | | |
| | | List<SuperAggregateState> statusDataList; |
| | | if (StatisticalMethodEnum.SHIFT.equals(statisticalMethod) || StatisticalMethodEnum.DAY.equals(statisticalMethod) || StatisticalMethodEnum.WEEK.equals(statisticalMethod) || StatisticalMethodEnum.MONTH.equals(statisticalMethod)) { |
| | | statusDataList = this.aggregateStateFeedbackMapper.getStatusDataByFactoryDate(workstationIds, LocalDateTimeUtil.format(startDate, "yyyyMMdd"), LocalDateTimeUtil.format(endDate, "yyyyMMdd")); |
| | | //statusDataList = this.aggregateStateFeedbackMapper.getStatusDataByFactoryDate(workstationIds, LocalDateTimeUtil.format(startDate, "yyyyMMdd"), LocalDateTimeUtil.format(endDate, "yyyyMMdd")); |
| | | int startFactoryDate = Integer.parseInt(LocalDateTimeUtil.format(startDate, "yyyyMMdd")); |
| | | int endFactoryDate = Integer.parseInt(LocalDateTimeUtil.format(endDate, "yyyyMMdd")); |
| | | statusDataList = this.aggregateStateFeedbackMapper.getStatusDataByFactoryDate(workstationIds, startFactoryDate, endFactoryDate); |
| | | } else { |
| | | statusDataList = this.aggregateStateFeedbackMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME)); |
| | | //statusDataList = this.aggregateStateFeedbackMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startDate, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endDate.plusDays(1L), DateConstant.PATTERN_DATE_TIME)); |
| | | LocalDateTime startTime = LocalDateTime.of(startDate, LocalTime.MIN); |
| | | LocalDateTime endTime = LocalDateTime.of(endDate.plusDays(1L), LocalTime.MIN); |
| | | statusDataList = this.aggregateStateFeedbackMapper.getStatusData(workstationIds, startTime,endTime); |
| | | } |
| | | return buildDuration(statusDataList); |
| | | } |
| | | |
| | | @Override |
| | | public List<SuperAggregateState> getStatusByCondition(List<Long> workstationIds, LocalDateTime startTime, LocalDateTime endTime) { |
| | | List<SuperAggregateState> statusDataList = this.baseMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME)); |
| | | //List<SuperAggregateState> statusDataList = this.baseMapper.getStatusData(workstationIds, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME)); |
| | | List<SuperAggregateState> statusDataList = this.baseMapper.getStatusData(workstationIds, startTime,endTime); |
| | | return buildDuration(statusDataList); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public List<StatusTimeTopVO> getStatusTimeByWcs(List<Long> workstationIds, LocalDateTime startTime, LocalDateTime endTime, Integer status, Integer top) { |
| | | List<StatusTimeTopVO> voList = new ArrayList<>(); |
| | | |
| | | Map<Long, Workstation> workstationMap = this.workstationService.list(Wrappers.<Workstation>lambdaQuery() |
| | | .eq(Workstation::getStatus, CommonConstant.ENABLE)).stream().collect(Collectors.toMap(Workstation::getId, Function.identity())); |
| | | /* |
| | |
| | | }, Function.identity()));*/ |
| | | //List<SuperAggregateState> equipmentStatusDuration = this.baseMapper.getEquipmentStatusDuration(workstationIds, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME), status); |
| | | |
| | | Date startTimeD = LocalDateUtil.localDateTimeToDate(startTime); |
| | | startTimeD = new Date(124,8,2); |
| | | Date endTimeD = LocalDateUtil.localDateTimeToDate(endTime); |
| | | endTimeD = new Date(124,8,3); |
| | | // Date startTimeD = LocalDateUtil.localDateTimeToDate(startTime); |
| | | //startTimeD = new Date(124,8,2); |
| | | //Date endTimeD = LocalDateUtil.localDateTimeToDate(endTime); |
| | | //endTimeD = new Date(124,8,3); |
| | | |
| | | LocalDateTime startTime2 = LocalDateTime.of(2024, 9, 2, 1, 0); |
| | | LocalDateTime endTime2 = LocalDateTime.of(2024, 9, 3, 1, 0); |
| | | List<SuperAggregateState> equipmentStatusDuration = this.baseMapper.getEquipmentStatusDuration(workstationIds, startTime2, endTime2, status); |
| | | |
| | | List<SuperAggregateState> equipmentStatusDuration = this.baseMapper.getEquipmentStatusDuration(workstationIds, startTime, endTime, status); |
| | | |
| | | List<SuperAggregateState> equipmentStatusDuration2 = FilterOffUtils.filterOffDay(equipmentStatusDuration, OpenTypeEnums.TIME_USED_ANALYSIS); |
| | | Map<Long, Long> timeMap = buildDuration(startTime2, equipmentStatusDuration2).stream().collect(Collectors.groupingBy(SuperAggregate::getWorkstationId, Collectors.summingLong(SuperAggregateState::getDurationCollect))).entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(top.intValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, java.util.LinkedHashMap::new)); |
| | | Map<Long, Long> timeMap = buildDuration(startTime, equipmentStatusDuration2).stream().collect(Collectors.groupingBy(SuperAggregate::getWorkstationId, Collectors.summingLong(SuperAggregateState::getDurationCollect))).entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(top.intValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, java.util.LinkedHashMap::new)); |
| | | //yangysæ¹äºbuildDurationï¼å»æäºstartTimeåæ° |
| | | //Map<Long, Long> timeMap = buildDuration(equipmentStatusDuration2,ChronoUnit.SECONDS).stream().collect(Collectors.groupingBy(SuperAggregate::getWorkstationId, Collectors.summingLong(SuperAggregateState::getDurationCollect))).entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).limit(top.intValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, java.util.LinkedHashMap::new)); |
| | | /* |
| | |
| | | |
| | | @Override |
| | | public List<SuperAggregateState> getOeeAnalysis(List<Long> workStationIdList, LocalDateTime startTime, LocalDateTime endTime) { |
| | | Date startTimeD = LocalDateUtil.localDateTimeToDate(startTime); |
| | | Date endTimeD = LocalDateUtil.localDateTimeToDate(endTime); |
| | | //Date startTimeD = LocalDateUtil.localDateTimeToDate(startTime); |
| | | //Date endTimeD = LocalDateUtil.localDateTimeToDate(endTime); |
| | | //List<SuperAggregateState> statusDataList = this.baseMapper.getEquipmentStatusDuration(workStationIdList, LocalDateTimeUtil.format(startTime, DateConstant.PATTERN_DATE_TIME), LocalDateTimeUtil.format(endTime, DateConstant.PATTERN_DATE_TIME), null); |
| | | List<SuperAggregateState> statusDataList = this.baseMapper.getEquipmentStatusDuration(workStationIdList, startTime, endTime, null); |
| | | return buildDuration(startTime, FilterOffUtils.filterOffDay(statusDataList, OpenTypeEnums.OEE)); |
| | |
| | | private List<SuperAggregateState> buildDuration(List<SuperAggregateState> statusDataShift) { |
| | | Date now = DateUtil.now(); |
| | | statusDataShift.forEach(x -> { |
| | | if (Func.isEmpty(x.getEndTime()) || x.getEndTime().toLocalDateTime().getYear()==1970) { |
| | | if (Func.isEmpty(x.getEndTime()) ) {//|| x.getEndTime().toLocalDateTime().getYear()==1970 |
| | | x.setEndTime(new Timestamp(now.getTime())); |
| | | } |
| | | x.setDurationCollect(LocalDateTimeUtils.betweenTwoTime(x.getStartTime().toLocalDateTime(), x.getEndTime().toLocalDateTime(), ChronoUnit.MILLIS)); |
| | | System.out.println(x); |
| | | //System.out.println(x); |
| | | }); |
| | | return statusDataShift; |
| | | } |
| | | |
| | | /** |
| | | * 设置æ¶é´å·® |
| | | * @param statusDataShift |
| | | * @param chUnit |
| | | * @return |
| | | */ |
| | | private List<SuperAggregateState> buildDuration(List<SuperAggregateState> statusDataShift, ChronoUnit chUnit) { |
| | | Date now = DateUtil.now(); |
| | | statusDataShift.forEach(x -> { |
| | | if (Func.isEmpty(x.getEndTime()) || x.getEndTime().toLocalDateTime().getYear()==1970) { |
| | | x.setEndTime(new Timestamp(now.getTime())); |
| | | } |
| | | x.setDurationCollect(LocalDateTimeUtils.betweenTwoTime(x.getStartTime().toLocalDateTime(), x.getEndTime().toLocalDateTime(), chUnit)); |
| | | System.out.println("s="+x); |
| | | }); |
| | | return statusDataShift; |
| | | } |
| | | |
| | | |
| | | private List<SuperAggregateState> buildDuration(LocalDateTime startTime, List<SuperAggregateState> statusDataShift) { |
| | | Date now = DateUtil.now(); |
| | |
| | | } |
| | | if (x.getStartTime().toLocalDateTime().isBefore(startTime)) { |
| | | x.setStartTime(Timestamp.valueOf(startTime)); |
| | | x.setTime(Timestamp.valueOf(startTime));//è¿ä¸ªæèµ·ä½ç¨ï¼getStartTimeè·åçæ¯time |
| | | } |
| | | x.setDurationCollect(LocalDateTimeUtils.betweenTwoTime(x.getStartTime().toLocalDateTime(), x.getEndTime().toLocalDateTime(), ChronoUnit.MILLIS)); |
| | | System.out.println(x); |
| | | //System.out.println(x); |
| | | }); |
| | | return statusDataShift; |
| | | } |
| | |
| | | res.setTotal(Long.valueOf(total)); |
| | | break; |
| | | default: |
| | | //æç次ç»è®¡ |
| | | res = buildTimeUsedAnalysisShift(ids, queryTime, stationVO.getShiftIndex(), query); |
| | | break; |
| | | } |
| | |
| | | return Integer.parseInt(c.getCode()); |
| | | }).collect(Collectors.toSet()); |
| | | |
| | | List<SuperAggregateState> stateList = this.baseMapper.dateState(DateUtil.format(queryTime, "yyyyMMdd"), ids); |
| | | List<SuperAggregateState> stateList = this.baseMapper.dateState(Integer.parseInt(DateUtil.format(queryTime, "yyyyMMdd")) , ids); |
| | | Map<Long, Map<Integer, Long>> map = buildStateMap(wcsSet, stateList); |
| | | for (Workstation workstation : workstations) { |
| | | workStationDetails.add(NameIdDTO.builder().id(workstation.getId()).name(workstation.getName() + "\n" + workstation.getCode()).build()); |
| | |
| | | LinkedHashMap<String, List<Workstation>> calendarMap = workstationPages.getRecords().stream().collect(Collectors.groupingBy(Workstation::getCalendarCode, LinkedHashMap::new, Collectors.toList())); |
| | | calendarMap.forEach((calendarCode, workStationsList) -> { |
| | | List<Long> workStationIds = workStationsList.stream().map(Workstation::getId).collect(Collectors.toList()); |
| | | List<SuperAggregateState> stateList = this.baseMapper.shiftState(workStationIds, DateUtil.format(queryTime, "yyyyMMdd"), shiftIndex, calendarCode); |
| | | List<SuperAggregateState> stateList = this.baseMapper.shiftState(workStationIds, Integer.parseInt(DateUtil.format(queryTime, "yyyyMMdd")), shiftIndex, calendarCode); |
| | | Map<Long, Map<Integer, Long>> map = buildStateMap(wcsSet, stateList); |
| | | Iterator<Workstation> it = workStationsList.iterator(); |
| | | while (it.hasNext()) { |
| | |
| | | Set<Integer> wcsList = listGlobalWcs().stream().map(c -> { |
| | | return Integer.valueOf(Integer.parseInt(c.getCode())); |
| | | }).collect(Collectors.toSet()); |
| | | List<SuperAggregateState> stateEndTimeNotNullList = this.baseMapper.dateState(DateUtil.format(queryTime, "yyyyMMdd"), Lists.newArrayList(workstationIds)); |
| | | List<SuperAggregateState> stateEndTimeNotNullList = this.baseMapper.dateState(Integer.parseInt(DateUtil.format(queryTime, "yyyyMMdd")) , Lists.newArrayList(workstationIds)); |
| | | Map<Integer, Long> map = buildStateGroupMap(wcsList, FilterOffUtils.filterOffDay(stateEndTimeNotNullList, OpenTypeEnums.TIME_USED_ANALYSIS)); |
| | | Map<Integer, Long> countResults = mergeMap(map, wcsList); |
| | | log.info("groupDay:{}", countResults); |
| | |
| | | IPage<AlarmAnalysisWorkstationVO> page = Condition.getPage(query); |
| | | List<AlarmAnalysisWorkstationVO> result; |
| | | try { |
| | | result = this.superAlarmMapper.alarmByWorkstation(workstationId, Integer.valueOf((query.getCurrent().intValue() - 1) * query.getSize().intValue()), query.getSize()); |
| | | result = this.superAlarmMapper.alarmByWorkstation(workstationId, Integer.valueOf((query.getCurrent() - 1) * query.getSize()), query.getSize()); |
| | | total = this.superAlarmMapper.alarmByWorkstationTotal(workstationId); |
| | | } catch (Exception e) { |
| | | log.error("æ¥è¯¢æ¥è¦å¼å¸¸",e); |
| | | result = new ArrayList<>(); |
| | | total = 0; |
| | | } |
| | |
| | | t.setWcs(-1); |
| | | return t; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | String key = String.join(":", workstationId + "", statusTime.toString()); |
| | | if (statusTime.compareTo((ChronoLocalDate) LocalDate.now()) == 0) { |
| | | List<StatusRecordVO> statusRecordVOList = groupStatusRecordWithFeedback(statusTime, workstationId, statusRecordList, cancelList); |
| | |
| | | /** |
| | | * è¿æ»¤ä¼æ¯æ¥ï¼ |
| | | * @param <R> |
| | | * @param data ç¶ææ°æ®å表 |
| | | * @param data èåç¶ææ°æ®å表 |
| | | * @param openTypeEnums RUNNING/ALARM/OEEç |
| | | * @return |
| | | */ |
| | |
| | | if (Func.isEmpty(data)) { |
| | | return data; |
| | | } |
| | | boolean filterType = whetherToFilter(OpenTypeEnums.PARAM_KEY_TYPE, openTypeEnums);//mdc_open_type |
| | | boolean filterShift = whetherToFilter(OpenTypeEnums.PARAM_KEY_SHIFT, openTypeEnums);//mdc_open_shift |
| | | //boolean filterType = whetherToFilter(OpenTypeEnums.PARAM_KEY_TYPE, openTypeEnums);//mdc_open_typeï¼æ¯å¦è¿æ»¤è¯¥ç±»å |
| | | //boolean filterShift = whetherToFilter(OpenTypeEnums.PARAM_KEY_SHIFT, openTypeEnums);//mdc_open_shiftï¼æ¯å¦è¿æ»¤çå¶ |
| | | //è¿éç®åï¼ä¸è¿æ»¤äºï¼æ°æ®å¨winæå¡å¨æï¼blade_boot_blade_param-0418bak.sqlæï¼æ¯ä¸ªjsonæ°ç» |
| | | boolean filterType = false; |
| | | boolean filterShift = false; |
| | | if (!filterType && !filterShift) { |
| | | return data; |
| | | } |
| | | return data.stream().filter(item -> { |
| | | return (filterType && item.getShiftTimeType().equals(2)) ? false : true; |
| | | return (filterType && item.getShiftTimeType().equals(2)) ? false : true;//2:伿¯æ¶é´æ®µï¼è¿éæ¯å»æä¼æ¯çç¶ææ°æ® |
| | | }).filter(item2 -> { |
| | | return !filterShift || item2.getShiftIndex().intValue() > 0; |
| | | }).collect(Collectors.toList()); |
| | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.sql.Timestamp; |
| | | |
| | | public class AlarmAnalysisWorkstationVO implements Serializable { |
| | | private static final long serialVersionUID = -530938150418043787L; |
| | | |
| | | @ApiModelProperty("æ¥è¦æ¶é´") |
| | | private Timestamp time; |
| | | |
| | | @ApiModelProperty("æ¥è¦ä»£ç ") |
| | | private String alarmCode; |
| | | @ApiModelProperty("æ¥è¦ä¿¡æ¯") |
| | | private String alarmMsg; |
| | | @ApiModelProperty("æ¥è¦æ¶é´") |
| | | private String alarmTime; |
| | | |
| | | |
| | | |
| | | public static class AlarmAnalysisWorkstationVOBuilder { |
| | |
| | | return (result2 * 59) + ($alarmTime == null ? 43 : $alarmTime.hashCode()); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "AlarmAnalysisWorkstationVO(alarmCode=" + getAlarmCode() + ", alarmMsg=" + getAlarmMsg() + ", alarmTime=" + getAlarmTime() + ")"; |
| | | } |
| | |
| | | public String getAlarmTime() { |
| | | return this.alarmTime; |
| | | } |
| | | |
| | | public Timestamp getTime() { |
| | | return time; |
| | | } |
| | | |
| | | public void setTime(Timestamp time) { |
| | | this.time = time; |
| | | } |
| | | |
| | | } |
| | |
| | | ArrayList arrayList2 = new ArrayList(); |
| | | if (CommonConstant.VERSION_NUM.equals(type)) { |
| | | map = (Map) outputList2.stream().filter(o -> { |
| | | return Func.isNotEmpty(o.getTs()); |
| | | return Func.isNotEmpty(o.getTime()); |
| | | }).collect(Collectors.groupingBy(o2 -> { |
| | | return o2.getTs().toLocalDateTime().getDayOfMonth() + "-" + o2.getTs().toLocalDateTime().getHour(); |
| | | return o2.getTime().toLocalDateTime().getDayOfMonth() + "-" + o2.getTime().toLocalDateTime().getHour(); |
| | | }, Collectors.summingLong((v0) -> { |
| | | return v0.getOutput(); |
| | | }))); |
| | | } else { |
| | | map = (Map) outputList2.stream().filter(o3 -> { |
| | | return o3.getTs() != null; |
| | | return o3.getTime() != null; |
| | | }).collect(Collectors.groupingBy(o4 -> { |
| | | return DateUtil.format(o4.getTs(), DateConstant.PATTERN_DATE); |
| | | return DateUtil.format(o4.getTime(), DateConstant.PATTERN_DATE); |
| | | }, Collectors.summingLong((v0) -> { |
| | | return v0.getOutput(); |
| | | }))); |
| | |
| | | return v0.getWorkstationId(); |
| | | })).forEach((id, aggregateOutputs) -> { |
| | | Map<String, Long> collectMap = aggregateOutputs.stream().collect(Collectors.groupingBy(aggregate -> { |
| | | return (String) categoriesFormat.apply(aggregate.getTs().toLocalDateTime()); |
| | | return (String) categoriesFormat.apply(aggregate.getTime().toLocalDateTime()); |
| | | }, Collectors.summingLong((v0) -> { |
| | | return v0.getOutput(); |
| | | }))); |
| | |
| | | mybatis-plus: |
| | | tenant-model: false |
| | | mapper-locations: classpath:com/qianwen/**/mapper/*Mapper.xml |
| | | type-handlers-package: com.qianwen.smartman.common.typehandlers |
| | | #oracleç¯å¢mapperæ å° |
| | | # mapper-locations: classpath:com/qianwen/**/mapperOracle/*Mapper.xml,classpath:com/qianwen/**/mapper/*Mapper.xml |
| | | #å®ä½æ«æï¼å¤ä¸ªpackageç¨éå·æè
åå·åé |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.qianwen.smartman.modules.mdc.mapper.SuperAggregateOutputMapper"> |
| | | |
| | | <select id="getOutputDataByNaturalDate" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput"> |
| | | select ts as startTime, |
| | | pre_ts as endTime, |
| | | output, |
| | | cur_output as curOutput, |
| | | pre_output as preOutput, |
| | | calendar_code as calendarCode, |
| | | factory_year as factoryYear, |
| | | factory_month as factoryMonth, |
| | | factory_week as factoryWeek, |
| | | factory_date as factoryDate, |
| | | shift_index as shiftIndex, |
| | | shift_time_type as shiftTimeType, |
| | | program, |
| | | product_code as productCode, |
| | | product_name as productName, |
| | | workstation_id as workstationId |
| | | from iot_data.super_aggregate_output |
| | | where ts <![CDATA[>=]]> #{startDate} and ts <![CDATA[<]]> #{endDate} |
| | | AND output <![CDATA[>=]]> 0 |
| | | <if test="workstationIds != null and workstationIds.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="workstationIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="getOutputDataByFactoryDate" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput"> |
| | | select ts as startTime, |
| | | pre_ts as endTime, |
| | | output, |
| | | cur_output as curOutput, |
| | | pre_output as preOutput, |
| | | calendar_code as calendarCode, |
| | | factory_year as factoryYear, |
| | | factory_month as factoryMonth, |
| | | factory_week as factoryWeek, |
| | | factory_date as factoryDate, |
| | | shift_index as shiftIndex, |
| | | shift_time_type as shiftTimeType, |
| | | program, |
| | | product_code as productCode, |
| | | product_name as productName, |
| | | workstation_id as workstationId |
| | | from iot_data.super_aggregate_output |
| | | where output <![CDATA[>=]]> 0 |
| | | and factory_date <![CDATA[>=]]> #{startDate} and factory_date <![CDATA[<=]]> #{endDate} |
| | | <if test="workstationIds != null and workstationIds.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="workstationIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="getOutputDataByWorkstationAndFactoryDate" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput"> |
| | |
| | | and output > 0 |
| | | and factory_month = #{month} |
| | | </select> |
| | | |
| | | |
| | | <!-- sqlä¿®æ¹å¼å§ --> |
| | | <!-- ååä¸ï¼programåå·²ä¸çå®é
ä¸é½æ²¡æ --> |
| | | <sql id="aggregateOutputColumns"> |
| | | pre_time as preTime, |
| | | output, |
| | | cur_output as curOutput, |
| | | pre_output as preOutput, |
| | | calendar_code as calendarCode, |
| | | factory_year as factoryYear, |
| | | factory_month as factoryMonth, |
| | | factory_week as factoryWeek, |
| | | factory_date as factoryDate, |
| | | shift_index as shiftIndex, |
| | | shift_time_type as shiftTimeType, |
| | | program, |
| | | product_code as productCode, |
| | | product_name as productName, |
| | | workstation_id as workstationId |
| | | </sql> |
| | | |
| | | <select id="getOutputDataByFactoryDate" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput"> |
| | | select <include refid="aggregateOutputColumns"/> |
| | | from root.f2.aggregate_output_* |
| | | where output <![CDATA[>=]]> 0 |
| | | and factory_date <![CDATA[>=]]> #{startFatoryDate} and factory_date <![CDATA[<=]]> #{endFatoryDate} |
| | | <if test="workstationIds != null and workstationIds.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="workstationIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | align by device |
| | | </select> |
| | | |
| | | <select id="getOutputDataByNaturalDate" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput"> |
| | | select <include refid="aggregateOutputColumns"/> |
| | | from root.f2.aggregate_output_* |
| | | where time <![CDATA[>=]]> #{startDate} and time <![CDATA[<]]> #{endDate} |
| | | AND output <![CDATA[>=]]> 0 |
| | | <if test="workstationIds != null and workstationIds.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="workstationIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | align by device |
| | | </select> |
| | | </mapper> |
| | | |
| | |
| | | </sql> |
| | | |
| | | |
| | | <select id="getStatusDataByFactoryDate" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select ts as startTime, |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <!-- ä¿®æ¹sqlå¼å§ --> |
| | | |
| | | <sql id="aggregateStateColumnSql"> |
| | | end_time as endTime, |
| | | duration_collect, |
| | | value_collect, |
| | | duration_collect as durationCollect, |
| | | value_collect as valueCollect, |
| | | calendar_code as calendarCode, |
| | | factory_year as factoryYear, |
| | | factory_month as factoryMonth, |
| | |
| | | shift_time_type as shiftTimeType, |
| | | wcs, |
| | | rps, |
| | | is_deleted as isDeleted, |
| | | workstation_id as workstationId, |
| | | is_plan as isPlan, |
| | | feedback_id as feedbackId |
| | | from iot_data.super_aggregate_state_with_feedback |
| | | where factory_date <![CDATA[>=]]> #{startDate} and factory_date <![CDATA[<=]]> #{endDate} |
| | | and wcs > 0 and is_deleted = false |
| | | <if test="workstationIds != null and workstationIds.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="workstationIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getStatusData" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | is_plan as isPlan |
| | | </sql> |
| | | |
| | | <!-- ç±äºè¡¨æ°æ®ä¸æ ·ï¼iot_data.super_aggregate_state_with_feedbackï¼ï¼æä»¬ä¹æ²¡æåé¦ï¼æä»¥ææ¶é½æ¥ä¸ä¸ªè¡¨ --> |
| | | <select id="getStatusData" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select |
| | | <include refid="superAggregateStateColumnSql"/> |
| | | from iot_data.super_aggregate_state_with_feedback |
| | | where is_deleted = 0 |
| | | and wcs > 0 and is_deleted = false |
| | | and ts <![CDATA[>=]]> #{startDate} and ts <![CDATA[<=]]> #{endDate} |
| | | <include refid="aggregateStateColumnSql"/> |
| | | from root.f2.aggregate_state_* |
| | | where is_deleted = false |
| | | and wcs > 0 |
| | | and time <![CDATA[>=]]> #{startDate} and time <![CDATA[<=]]> #{endDate} |
| | | <if test="workstationIds != null and workstationIds.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="workstationIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | align by device |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <select id="getStatusDataByFactoryDate" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select |
| | | <include refid="aggregateStateColumnSql"/> |
| | | from root.f2.aggregate_state_* |
| | | where factory_date <![CDATA[>=]]> #{startFactoryDate} and factory_date <![CDATA[<=]]> #{endFactoryDate} |
| | | and wcs > 0 and is_deleted = false |
| | | <if test="workstationIds != null and workstationIds.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="workstationIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | align by device |
| | | </select> |
| | | </mapper> |
| | | |
| | |
| | | |
| | | </select> |
| | | |
| | | <select id="dateState" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select ts as startTime, |
| | | end_time as endTime, |
| | | duration_collect, |
| | | value_collect, |
| | | calendar_code as calendarCode, |
| | | factory_year as factoryYear, |
| | | factory_month as factoryMonth, |
| | | factory_week as factoryWeek, |
| | | factory_date as factoryDate, |
| | | shift_index as shiftIndex, |
| | | shift_time_type as shiftTimeType, |
| | | wcs, |
| | | rps, |
| | | is_deleted as isDeleted, |
| | | workstation_id as workstationId, |
| | | is_plan as isPlan |
| | | from iot_data.super_aggregate_state |
| | | where is_deleted = 0 |
| | | and wcs > 0 |
| | | and factory_date = #{factoryDate} |
| | | <if test="ids != null and ids.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="weekState" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select ts as startTime, |
| | | end_time as endTime, |
| | | duration_collect, |
| | | value_collect, |
| | | calendar_code as calendarCode, |
| | | factory_year as factoryYear, |
| | | factory_month as factoryMonth, |
| | | factory_week as factoryWeek, |
| | | factory_date as factoryDate, |
| | | shift_index as shiftIndex, |
| | | shift_time_type as shiftTimeType, |
| | | wcs, |
| | | rps, |
| | | is_deleted as isDeleted, |
| | | workstation_id as workstationId, |
| | | is_plan as isPlan |
| | | from iot_data.super_aggregate_state |
| | | where factory_year = #{year} |
| | | and factory_week = #{week} |
| | | and is_deleted = 0 |
| | | and wcs > 0 |
| | | <if test="ids != null and ids.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="yearState" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select ts as startTime, |
| | | end_time as endTime, |
| | | duration_collect, |
| | | value_collect, |
| | | calendar_code as calendarCode, |
| | | factory_year as factoryYear, |
| | | factory_month as factoryMonth, |
| | | factory_week as factoryWeek, |
| | | factory_date as factoryDate, |
| | | shift_index as shiftIndex, |
| | | shift_time_type as shiftTimeType, |
| | | wcs, |
| | | rps, |
| | | is_deleted as isDeleted, |
| | | workstation_id as workstationId, |
| | | is_plan as isPlan |
| | | from iot_data.super_aggregate_state |
| | | where factory_year = #{year} |
| | | and factory_month = #{month} |
| | | and is_deleted = 0 |
| | | and wcs > 0 |
| | | <if test="ids != null and ids.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="shiftState" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select ts as startTime, |
| | | end_time as endTime, |
| | | duration_collect, |
| | | value_collect, |
| | | calendar_code as calendarCode, |
| | | factory_year as factoryYear, |
| | | factory_month as factoryMonth, |
| | | factory_week as factoryWeek, |
| | | factory_date as factoryDate, |
| | | shift_index as shiftIndex, |
| | | shift_time_type as shiftTimeType, |
| | | wcs, |
| | | rps, |
| | | is_deleted as isDeleted, |
| | | workstation_id as workstationId, |
| | | is_plan as isPlan |
| | | from iot_data.super_aggregate_state |
| | | where factory_date = #{factoryDate} |
| | | and wcs > 0 |
| | | and shift_index = #{shiftIndex} |
| | | and calendar_code = #{calendarCode} |
| | | and is_deleted = 0 |
| | | <if test="ids != null and ids.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="deviceStatusStatisticsList" |
| | | resultType="com.qianwen.smartman.modules.mdc.vo.DeviceStatusStatisticsVO"> |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getStatusData" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select |
| | | <include refid="superAggregateStateColumnSql"/> |
| | | from iot_data.super_aggregate_state |
| | | where is_deleted = 0 |
| | | and wcs > 0 |
| | | and ts <![CDATA[>=]]> #{startDate} and ts <![CDATA[<]]> #{endDate} |
| | | <if test="workstationIds != null and workstationIds.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="workstationIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <sql id="superAggregateStateColumnSql"> |
| | | ts as startTime, |
| | |
| | | |
| | | |
| | | |
| | | <select id="getStatusDataByFactoryDate" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select ts as startTime, |
| | | end_time as endTime, |
| | | duration_collect, |
| | | value_collect, |
| | | calendar_code as calendarCode, |
| | | factory_year as factoryYear, |
| | | factory_month as factoryMonth, |
| | | factory_week as factoryWeek, |
| | | factory_date as factoryDate, |
| | | shift_index as shiftIndex, |
| | | shift_time_type as shiftTimeType, |
| | | wcs, |
| | | rps, |
| | | workstation_id as workstationId, |
| | | is_plan as isPlan |
| | | from iot_data.super_aggregate_state |
| | | where factory_date <![CDATA[>=]]> #{startDate} and factory_date <![CDATA[<=]]> #{endDate} |
| | | and rps > 0 |
| | | and wcs > 0 |
| | | and is_deleted = false |
| | | <if test="workstationIds != null and workstationIds.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="workstationIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | <!-- è°æ´çsqlå¼å§ --> |
| | | <sql id="aggregateStateColumnSql"> |
| | | |
| | | end_time as endTime, |
| | | duration_collect as durationCollect, |
| | | value_collect as valueCollect, |
| | |
| | | workstation_id as workstationId, |
| | | is_plan as isPlan |
| | | </sql> |
| | | |
| | | |
| | | <!-- 忥æ¯union2个sqlï¼ç°å¨åå¹¶æªä¸ä¸ª --> |
| | | <!-- |
| | | OK: where ((time <![CDATA[<]]> #{startDate} and end_time <![CDATA[>=]]> #{startDate.time}) or (time <![CDATA[>=]]> #{startDate} and time <![CDATA[<=]]> #{endDate.time})) |
| | |
| | | </if> |
| | | align by device |
| | | </select> |
| | | |
| | | <select id="getStatusData" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select |
| | | <include refid="aggregateStateColumnSql"/> |
| | | from root.f2.aggregate_state_* |
| | | where is_deleted = false |
| | | and wcs > 0 |
| | | and time <![CDATA[>=]]> #{startDate} and time <![CDATA[<]]> #{endDate} |
| | | <if test="workstationIds != null and workstationIds.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="workstationIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | align by device |
| | | </select> |
| | | |
| | | <select id="getStatusDataByFactoryDate" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select <include refid="aggregateStateColumnSql"/> |
| | | from root.f2.aggregate_state_* |
| | | where factory_date <![CDATA[>=]]> #{startFactoryDate} and factory_date <![CDATA[<=]]> #{endFactoryDate} |
| | | and rps > 0 |
| | | and wcs > 0 |
| | | and is_deleted = false |
| | | <if test="workstationIds != null and workstationIds.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="workstationIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | align by device |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢æç次çç¶ææ°æ®ï¼å¨ç¨æ¶åæä¸ä½¿ç¨ and calendar_code = #{calendarCode,jdbcType=VARCHAR} --> |
| | | <select id="shiftState" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select <include refid="aggregateStateColumnSql"/> |
| | | from root.f2.aggregate_state_* |
| | | where factory_date = #{factoryDate} |
| | | and wcs > 0 |
| | | and shift_index = #{shiftIndex} |
| | | and calendar_code = '${calendarCode}' |
| | | and is_deleted = false |
| | | <if test="ids != null and ids.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | align by device |
| | | </select> |
| | | |
| | | <select id="weekState" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select <include refid="aggregateStateColumnSql"/> |
| | | from root.f2.aggregate_state_* |
| | | where factory_year = #{year} |
| | | and factory_week = #{week} |
| | | and is_deleted = false |
| | | and wcs > 0 |
| | | <if test="ids != null and ids.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | align by device |
| | | </select> |
| | | |
| | | <select id="yearState" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select <include refid="aggregateStateColumnSql"/> |
| | | from root.f2.aggregate_state_* |
| | | where factory_year = #{year} |
| | | and factory_month = #{month} |
| | | and is_deleted = false |
| | | and wcs > 0 |
| | | <if test="ids != null and ids.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | align by device |
| | | </select> |
| | | |
| | | <select id="dateState" |
| | | resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState"> |
| | | select <include refid="aggregateStateColumnSql"/> |
| | | from root.f2.aggregate_state_* |
| | | where is_deleted = false |
| | | and wcs > 0 |
| | | and factory_date = #{factoryDate} |
| | | <if test="ids != null and ids.size() > 0"> |
| | | AND workstation_id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | align by device |
| | | </select> |
| | | </mapper> |
| | | |
| | |
| | | ) |
| | | </update> |
| | | |
| | | <select id="alarmByWorkstation" resultType="com.qianwen.smartman.modules.mdc.vo.AlarmAnalysisWorkstationVO"> |
| | | select code as alarmCode, |
| | | message as alarmMsg, |
| | | ts as alarmTime |
| | | from iot_data.super_alarm |
| | | where workstation_id = #{workstationId} |
| | | order by ts desc |
| | | limit #{start}, #{end} |
| | | </select> |
| | | |
| | | |
| | | <select id="alarmByWorkstationTotal" resultType="java.lang.Integer"> |
| | | select count(*) |
| | | from iot_data.super_alarm |
| | | where workstation_id = #{workstationId} |
| | | </select> |
| | | |
| | | |
| | | <select id="countAlarm" resultType="java.lang.Long"> |
| | | select * count(*) |
| | |
| | | </select> |
| | | |
| | | |
| | | |
| | | <!-- sqlä¿®æ¹å¼å§ --> |
| | | |
| | | <!-- åå§limit limit #{start}, #{end} ï¼å®é
ä¸endåºè¯¥æ¯pageSize--> |
| | | <select id="alarmByWorkstation" resultType="com.qianwen.smartman.modules.mdc.vo.AlarmAnalysisWorkstationVO"> |
| | | select code as alarmCode, |
| | | message as alarmMsg |
| | | from root.f2.alarm_* |
| | | where workstation_id = #{workstationId} |
| | | order by time desc |
| | | limit #{end} offset #{start} |
| | | align by device |
| | | </select> |
| | | |
| | | <select id="alarmByWorkstationTotal" resultType="java.lang.Integer"> |
| | | select count(workstation_id) |
| | | from root.f2.alarm_* |
| | | where workstation_id = #{workstationId} |
| | | |
| | | </select> |
| | | </mapper> |
| | | |