| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.common.config.ConstSysConfig; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.sysconfig.service.SysConfigService; |
| | | import com.mes.sysdict.entity.SysDictData; |
| | | import com.mes.sysdict.service.SysDictDataService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Comparator; |
| | |
| | | @Autowired |
| | | private SysDictDataService sysDictDataService; |
| | | |
| | | @Autowired |
| | | private SysConfigService sysConfigService; |
| | | |
| | | private static final String ALONE_STATE = "0"; |
| | | |
| | | @Value("${mes.width}") |
| | | private Integer temperingWidth; |
| | | @Value("${mes.height}") |
| | | private Integer temperingHeight; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void temperingGlassBefore() { |
| | | Date startDate = new Date(); |
| | | log.info("本次任务开始执行时间:{}", startDate); |
| | |
| | | .sorted(Comparator.comparing(TemperingGlassInfo::getTemperingFeedSequence)).collect(Collectors.toList()); |
| | | //按照膜系获取玻璃材质 |
| | | SysDictData glassTypeSysDictData = sysDictDataService.getOne(new QueryWrapper<SysDictData>() |
| | | .eq(StringUtils.isNotBlank(temperingGlassList.get(0).getFilmsid()), "dict_label", temperingGlassList.get(0).getFilmsid())); |
| | | .eq(StringUtils.isNotBlank(temperingGlassList.get(0).getFilmsId()), "dict_label", temperingGlassList.get(0).getFilmsId())); |
| | | |
| | | double sumArea = temperingGlassList.stream().mapToDouble(e -> e.getWidth() * e.getHeight()).sum(); |
| | | double maxArea = temperingGlassList.stream().mapToDouble(e -> e.getWidth() * e.getHeight()).max().orElse(0.0); |
| | | double minArea = temperingGlassList.stream().mapToDouble(e -> e.getWidth() * e.getHeight()).min().orElse(0.0); |
| | | double areaDifference = (10000 * (maxArea - minArea) / maxArea); |
| | | Integer temperingHeight = sysConfigService.queryConfigValue(ConstSysConfig.TEMPERING_HEIGHT); |
| | | Integer temperingWidth = sysConfigService.queryConfigValue(ConstSysConfig.TEMPERING_HEIGHT); |
| | | double loadingRate = (int) (10000 * sumArea / (temperingHeight * temperingWidth)); |
| | | TemperingRecord temperingRecord = new TemperingRecord(); |
| | | temperingRecord.setEngineerId(maxGlassInfo.getEngineerId()); |
| | |
| | | log.info("本次任务结束时间:{},共耗时:{}ms", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void temperingGlassAfter() { |
| | | //暂不处理 |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | // @Scheduled(fixedDelay = 1000) |
| | | public void dealDamageTask() { |
| | | Date startDate = new Date(); |
| | | log.info("钢化破损玻璃清除任务开始执行时间:{}", startDate); |