| | |
| | | package com.mes.downstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; |
| | | |
| | | import com.mes.downstorage.mapper.DownStorageCageMapper; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | @Slf4j |
| | | @Service |
| | | public class DownStorageCageDetailsServiceImpl extends ServiceImpl<DownStorageCageDetailsMapper, DownStorageCageDetails> implements DownStorageCageDetailsService { |
| | | |
| | | @Autowired |
| | | @Autowired(required=false) |
| | | private DownStorageCageMapper downStorageCageMapper; |
| | | @Autowired |
| | | private DownStorageCageDetailsMapper downStorageCageDetailsMapper; |
| | | |
| | | @Override |
| | | public void addDownStorageCageDetails(DownStorageCageDetails details) { |
| | | this.save(details); |
| | |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() |
| | | .select("t.*") |
| | | .leftJoin("(SELECT t1.* FROM down_storage_cage_details t1 " |
| | | + "JOIN (SELECT flow_card_id, MAX(width) AS max_width FROM glass_info GROUP BY flow_card_id) t " |
| | | + "ON t1.flow_card_id = t.flow_card_id WHERE t1.width = t.max_width) t3" |
| | | + "JOIN (SELECT flow_card_id, MAX(width*height) AS max_width FROM glass_info GROUP BY flow_card_id) t " |
| | | + "ON t1.flow_card_id = t.flow_card_id WHERE t1.width*t1.height = t.max_width) t3" |
| | | + " ON t.glass_id = t3.glass_id") |
| | | .leftJoin("down_workstation t4 ON t3.flow_card_id = t4.flow_card_id") |
| | | .isNull(Boolean.parseBoolean("t.glass_id"), "SELECT glass_id FROM down_glass_info") |
| | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<DownStorageCageDetails> getCacheOut(int start, int end) { |
| | | log.info("根据传入的工位查询符合按照顺序和大小出片的小片"); |
| | | return downStorageCageMapper.selectJoinList( |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .leftJoin("down_workstation dw on escd.flow_card_id = dw.flow_card_id") |
| | | .leftJoin("glass_info gi on dw.flow_card_id = gi.flowcard_id and gi.flowcard_id=escd.flow_card_id ") |
| | | .isNotNull("escd.slot") |
| | | .between("dw.workstation_id", start, end) |
| | | .orderByDesc("escd.width") |
| | | .orderByDesc("escd.height") |
| | | ); |
| | | } |
| | | |
| | | |
| | | // @Override |
| | | // public List<DownStorageCageDetails> getCacheOut(int start, int end) { |
| | | // log.info("根据传入的工位查询符合按照顺序和大小出片的小片"); |
| | | // return downStorageCageMapper.selectJoinList( |
| | | // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | // .select("escd.*") |
| | | // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | // .leftJoin("down_workstation dw on escd.flow_card_id = dw.flow_card_id") |
| | | // .leftJoin("glass_info gi on dw.flow_card_id = gi.flowcard_id and gi.flowcard_id=escd.flow_card_id ") |
| | | // .isNotNull("escd.slot") |
| | | // .between("dw.workstation_id", start, end) |
| | | // .orderByDesc("escd.width") |
| | | // .orderByDesc("escd.height") |
| | | // ); |
| | | // } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<Map> getCacheInfo() { |
| | | log.info(" 查询笼子内信息"); |
| | | return downStorageCageMapper.selectJoinList( |
| | | Map.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .orderByAsc("t.slot") |
| | | ); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<DownStorageCageDetails> getCacheLeisure() { |
| | | log.info(" 查询笼子内空闲"); |
| | | List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList( |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .isNull("escd.slot") |
| | | |
| | | .orderByAsc("escd.slot") |
| | | ); |
| | | return list; |
| | | } |
| | | // @Override |
| | | // public List<DownStorageCageDetails> selectCacheEmpty2(){ |
| | | // return downStorageCageMapper.selectJoinList( |
| | | // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | // .select("escd.glass_id","escd.flow_card_id","escd.width","escd.height") |
| | | // .leftJoin("down_storage_cage_details escd on t.device_id=escd.device_id and t.slot=escd.slot") |
| | | // .isNull("escd.slot") |
| | | // ); |
| | | // } |
| | | |
| | | |
| | | @Override |
| | | public List<DownStorageCageDetails> getIsExistIntoCacheByflowcardid(String flowcardid, double width) { |
| | | log.info(" 查询可进此片玻璃的栅格号 找到空格"); |
| | | |
| | | return downStorageCageMapper.selectJoinList( |
| | | DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | .select("escd.*") |
| | | .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | .isNull("escd.slot") |
| | | .apply("t.remain_width - " + width + " > 0") |
| | | .orderByAsc("escd.sequence") |
| | | public List<Map<String, Object>> getCacheInfo() { |
| | | log.info("查询笼子内信息"); |
| | | return downStorageCageDetailsMapper.selectJoinMaps(JoinWrappers.lambda(DownStorageCageDetails.class) // 使用 JoinWrappers.lambda 创建联合查询 |
| | | .selectAll(DownStorageCageDetails.class) // 选择所有字段 |
| | | .eq(DownStorageCage::getSlot, DownStorageCageDetails::getSlot) // 设置关联条件 |
| | | .orderByAsc(DownStorageCage::getSlot) // 按 slot 字段升序排序 |
| | | ); |
| | | |
| | | } |
| | | |
| | | // |
| | | // @Override |
| | | // public List<Map> getCacheInfo() { |
| | | // log.info(" 查询笼子内信息"); |
| | | // return downStorageCageMapper.selectJoinList( |
| | | // Map.class, new MPJQueryWrapper<DownStorageCage>() |
| | | // .select("escd.*") |
| | | // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | // .orderByAsc("t.slot") |
| | | // ); |
| | | // |
| | | // } |
| | | |
| | | // @Override |
| | | // public List<DownStorageCageDetails> getCacheLeisure() { |
| | | // log.info(" 查询笼子内空闲"); |
| | | // List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList( |
| | | // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | // .select("escd.*") |
| | | // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | // .isNull("escd.slot") |
| | | // |
| | | // .orderByAsc("escd.slot") |
| | | // ); |
| | | // return list; |
| | | // } |
| | | |
| | | |
| | | // @Override |
| | | // public List<DownStorageCageDetails> getIsExistIntoCacheByflowcardid(String flowcardid, double width) { |
| | | // log.info(" 查询可进此片玻璃的栅格号 找到空格"); |
| | | // |
| | | // return downStorageCageMapper.selectJoinList( |
| | | // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() |
| | | // .select("escd.*") |
| | | // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") |
| | | // .isNull("escd.slot") |
| | | // .apply("t.remain_width - " + width + " > 0") |
| | | // .orderByAsc("escd.sequence") |
| | | // ); |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |