| | |
| | | package com.mes.downstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | |
| | | //import com.mes.device.PlcParameterObject; |
| | | import com.google.common.base.Functions; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; |
| | | import com.mes.downstorage.mapper.DownStorageCageMapper; |
| | |
| | | import com.mes.downstorage.service.DownStorageCageService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.entity.OptimizeDetail; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import net.sf.jsqlparser.statement.select.SelectItem; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //找到空格子 |
| | | @Override |
| | | public List<DownStorageCageDetails> selectCacheEmpty() { |
| | | return baseMapper.selectJoinList(DownStorageCageDetails.class, |
| | | return this.selectJoinList(DownStorageCageDetails.class, |
| | | JoinWrappers.lambda(DownStorageCage.class) |
| | | .selectAll(DownStorageCage.class) |
| | | .select(DownStorageCageDetails::getWidth, DownStorageCageDetails::getHeight, DownStorageCageDetails::getGlassId) |
| | | .leftJoin(DownStorageCageDetails.class, on -> on |
| | | .eq(DownStorageCageDetails::getDeviceId, DownStorageCage::getDeviceId) |
| | | .eq(DownStorageCageDetails::getSlot, DownStorageCage::getSlot) |
| | | .eq(DownStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | ) |
| | | .eq(DownStorageCageDetails::getState, Const.GLASS_STATE_IN)) |
| | | .isNull(DownStorageCageDetails::getSlot) |
| | | ); |
| | | } |
| | | |
| | | //找到空格子 |
| | | @Override |
| | | public DownStorageCage selectCacheEmpty(int currentSlot, boolean flag) { |
| | | List<DownStorageCage> emptyList = this.selectJoinList(DownStorageCage.class, |
| | | JoinWrappers.lambda(DownStorageCage.class) |
| | | .selectAll(DownStorageCage.class) |
| | | .leftJoin(DownStorageCageDetails.class, on -> on |
| | | .eq(DownStorageCageDetails::getDeviceId, DownStorageCage::getDeviceId) |
| | | .eq(DownStorageCageDetails::getSlot, DownStorageCage::getSlot) |
| | | .eq(DownStorageCageDetails::getState, Const.GLASS_STATE_IN)) |
| | | .isNull(DownStorageCageDetails::getSlot) |
| | | .last("order by abs(t.slot - " + currentSlot + ") asc limit 2") |
| | | ); |
| | | if (flag && CollectionUtil.isNotEmpty(emptyList)) { |
| | | return emptyList.get(0); |
| | | } |
| | | if (CollectionUtil.isEmpty(emptyList) || emptyList.size() == 1) { |
| | | return null; |
| | | } |
| | | return emptyList.get(0); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | ); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |