| | |
| | | import com.mes.bigstorage.mapper.BigStorageCageMapper; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.common.config.ConstSysConfig; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.largenscreen.entity.PieChartVO; |
| | | import com.mes.sysconfig.service.SysConfigService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private GlassInfoService glassInfoService; |
| | | @Resource |
| | | private SysConfigService sysConfigService; |
| | | |
| | | @Value("${mes.glassGap}") |
| | | private Integer glassGap; |
| | | |
| | | @Value("${mes.slotWidth}") |
| | | private Integer slotWidth; |
| | | // @Value("${mes.glassGap}") |
| | | // private Integer glassGap; |
| | | // |
| | | // @Value("${mes.slotWidth}") |
| | | // private Integer slotWidth; |
| | | |
| | | //进片逻辑 |
| | | @Override |
| | |
| | | @Override |
| | | public void updateRemainWidth(int slot) { |
| | | log.info("获取该格子内玻璃信息,计算格子剩余宽度"); |
| | | double width = 5000; |
| | | double width = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH); |
| | | double glassGap = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_GLASS_GAP); |
| | | LambdaQueryWrapper<BigStorageCageDetails> bigStorageCageDetailsWrapper = new LambdaQueryWrapper(); |
| | | bigStorageCageDetailsWrapper |
| | | .eq(BigStorageCageDetails::getSlot, slot) |
| | |
| | | @Override |
| | | public List<Map<String, Object>> selectBigStorageCageUsage() { |
| | | QueryWrapper<BigStorageCage> wrapper = new QueryWrapper<>(); |
| | | double slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH); |
| | | wrapper.select("device_id,ROUND(1 - SUM(CASE WHEN remain_width = " + slotWidth + " THEN 1 ELSE 0 END) / COUNT(device_id), 2)*100 AS percentage,SUM(CASE WHEN remain_width = " + slotWidth + " THEN 1 ELSE 0 END) AS count") |
| | | .eq("enable_state", Const.SLOT_ON) |
| | | .groupBy("device_id"); |
| | |
| | | |
| | | @Override |
| | | public Boolean resetCage() { |
| | | double slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH); |
| | | bigStorageCageDetailsMapper.delete(Wrappers.<BigStorageCageDetails>lambdaQuery().eq(BigStorageCageDetails::getState, Const.GLASS_STATE_NEW)); |
| | | this.update(new LambdaUpdateWrapper<BigStorageCage>().set(BigStorageCage::getRemainWidth, slotWidth) |
| | | .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state in ( 100, 102, 103, 104)")); |
| | |
| | | return baseMapper.queryPieChart(); |
| | | } |
| | | |
| | | // @Override |
| | | // public List<Integer> queryFreeDeviceByNotUsed(double thickness) { |
| | | // return baseMapper.queryFreeDeviceByNotUsed(thickness); |
| | | // } |
| | | } |