| | |
| | | package com.mes.edgstoragecage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.query.MPJLambdaQueryWrapper; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageMapper; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageMapper; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Autowired |
| | | UpPattenUsageMapper upPattenUsageMapper; |
| | | |
| | | @Override |
| | | public EdgStorageCage selectNearestEmpty(int currentSlot) { |
| | | return this.selectJoinOne(EdgStorageCage.class,new MPJLambdaWrapper<EdgStorageCage>() |
| | | .selectAll(EdgStorageCage.class) |
| | | .leftJoin(EdgStorageCageDetails.class,on->on |
| | | .eq(EdgStorageCageDetails::getSlot,EdgStorageCage::getSlot) |
| | | .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)) |
| | | .isNull(EdgStorageCageDetails::getSlot) |
| | | .last("order by abs(slot - 4) asc limit 1") |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * 查询笼内空格 |
| | | * @return |
| | |
| | | return baseMapper.selectJoinList(EdgStorageCage.class,new MPJLambdaWrapper<EdgStorageCage>() |
| | | .selectAll(EdgStorageCage.class) |
| | | .leftJoin(EdgStorageCageDetails.class,on->on |
| | | .eq(EdgStorageCageDetails::getDeviceId,EdgStorageCage::getDeviceId) |
| | | .eq(EdgStorageCageDetails::getSlot,EdgStorageCage::getSlot)) |
| | | .eq(EdgStorageCageDetails::getSlot,EdgStorageCage::getSlot) |
| | | .eq(EdgStorageCageDetails::getState,"100")) |
| | | .isNull(EdgStorageCageDetails::getSlot) |
| | | .last("order by abs(slot - 4) asc") |
| | | ); |
| | | |
| | | // return baseMapper.selectJoinMaps(JoinWrappers.lambda(EdgStorageCage.class).selectAll(EdgStorageCage.class) |
| | | // .select(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight,EdgStorageCageDetails::getGlassId) |
| | | // .leftJoin(EdgStorageCageDetails.class,on->on |
| | | // .eq(EdgStorageCageDetails::getDeviceId,EdgStorageCage::getDeviceId) |
| | | // .eq(EdgStorageCageDetails::getSlot,EdgStorageCage::getSlot)) |
| | | // .isNull(EdgStorageCageDetails::getSlot) |
| | | // ); |
| | | |
| | | // return baseMapper.selectJoinMaps(new MPJQueryWrapper<EdgStorageCage>().selectAll(EdgStorageCage.class) |
| | | // .select("escd.glass_id","escd.flow_card_id","escd.width","escd.height") |
| | | // .leftJoin("edg_storage_cage_details escd on t.device_id=escd.device_id and t.slot=escd.slot") |
| | | // .isNull("escd.slot") |
| | | // ); |
| | | } |
| | | |
| | | /** |