| | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | @DS("salve_hangzhoumes") |
| | | public class TemperingGlassInfoServiceImpl extends MPJBaseServiceImpl<TemperingGlassInfoMapper, TemperingGlassInfo> implements TemperingGlassInfoService { |
| | | @Autowired |
| | | @Resource |
| | | TemperingGlassInfoMapper temperingMapper; |
| | | |
| | | @Override |
| | | public List<TemperingGlassInfo> selectWaitingGlass() { |
| | | //获取等待进炉中的玻璃信息 |
| | | QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("Top 1 *").in("state",1,0); |
| | | TemperingGlassInfo glass=temperingMapper.selectOne(wrapper); |
| | | if(glass!=null) { |
| | | wrapper.select("Top 1 *").in("state", 1, 0).orderByDesc("id"); |
| | | |
| | | TemperingGlassInfo glass = temperingMapper.selectOne(wrapper); |
| | | if (glass != null) { |
| | | this.update(new LambdaUpdateWrapper<TemperingGlassInfo>().set(TemperingGlassInfo::getState, 2).in(TemperingGlassInfo::getState, 0, 1) |
| | | .and(e -> e.ne(TemperingGlassInfo::getEngineerId, glass.getEngineerId()) |
| | | .or(e1 -> e1.eq(TemperingGlassInfo::getEngineerId, glass.getEngineerId()) |
| | | .ne(TemperingGlassInfo::getTemperingLayoutId, glass.getTemperingLayoutId())))); |
| | | QueryWrapper<TemperingGlassInfo> glassinfo = new QueryWrapper<>(); |
| | | glassinfo.eq("engineer_id", glass.getEngineerId()) |
| | | .eq("tempering_layout_id", glass.getTemperingLayoutId()); |
| | | //return temperingMapper.selectList(glassinfo); |
| | | return temperingMapper.selectByEngineerIdAndLayoutId(glass.getEngineerId(),glass.getTemperingLayoutId()); |
| | | }else { |
| | | return temperingMapper.selectByEngineerIdAndLayoutId(glass.getEngineerId(), glass.getTemperingLayoutId()); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | |
| | | // .eq("engineer_id", temperingGlassInfo.getEngineerId()) |
| | | // .orderByAsc("tempering_layout_id","tempering_feed_sequence"); |
| | | // return temperingMapper.selectList(wrapper); |
| | | return temperingMapper.selectByEngineerIdAndLayoutId(temperingGlassInfo.getEngineerId(),temperingGlassInfo.getTemperingLayoutId()); |
| | | return temperingMapper.selectByEngineerIdAndLayoutId(temperingGlassInfo.getEngineerId(), temperingGlassInfo.getTemperingLayoutId()); |
| | | |
| | | } |
| | | |
| | |
| | | public List<TemperingGlassInfo> selectOutGlass() { |
| | | //获取出炉中的玻璃信息 |
| | | QueryWrapper<TemperingGlassInfo> wrap = new QueryWrapper<>(); |
| | | wrap.select("Top 1 *").eq("state",3); |
| | | TemperingGlassInfo glass=temperingMapper.selectOne(wrap); |
| | | wrap.select("Top 1 *").eq("state", 3); |
| | | TemperingGlassInfo glass = temperingMapper.selectOne(wrap); |
| | | //根据工程号和版图获取数据 |
| | | if(glass != null) { |
| | | return temperingMapper.selectByEngineerIdAndLayoutId(glass.getEngineerId(),glass.getTemperingLayoutId()); |
| | | if (glass != null) { |
| | | return temperingMapper.selectByEngineerIdAndLayoutId(glass.getEngineerId(), glass.getTemperingLayoutId()); |
| | | } |
| | | return null; |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | |
| | | wapper.select("Top 1 *").eq("state", 4) |
| | | .orderByDesc("tempering_layout_id,engineer_id"); |
| | | //根据最大的版图id显示钢化后的版图信息 |
| | | TemperingGlassInfo glassinfo= temperingMapper.selectOne(wapper); |
| | | TemperingGlassInfo glassinfo = temperingMapper.selectOne(wapper); |
| | | if (glassinfo == null) { |
| | | return null; // 直接返回null,表示没有找到符合条件的记录 |
| | | } |
| | | return temperingMapper.selectByEngineerIdAndLayoutId(glassinfo.getEngineerId(),glassinfo.getTemperingLayoutId()); |
| | | return temperingMapper.selectByEngineerIdAndLayoutId(glassinfo.getEngineerId(), glassinfo.getTemperingLayoutId()); |
| | | |
| | | } |
| | | |
| | |
| | | public List<TemperingGlassInfo> selectLayoutId() { |
| | | QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("tempering_layout_id,engineer_id,max(id) as id") |
| | | .eq("state",2) |
| | | .eq("state", 2) |
| | | .groupBy("tempering_layout_id,engineer_id") |
| | | .orderByAsc("id"); |
| | | return temperingMapper.selectList(wrapper); |
| | |
| | | public Integer updateTemperingState(TemperingGlassInfo temperingGlassInfo) { |
| | | if (temperingMapper.updateTemperingGlassInfo(temperingGlassInfo) > 0) { |
| | | return 200; |
| | | }else { |
| | | } else { |
| | | return 100; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<TemperingGlassInfo> selectGlassInfoById(Integer id) |
| | | { |
| | | List<TemperingGlassInfo> result=null; |
| | | public List<TemperingGlassInfo> selectGlassInfoById(Integer id) { |
| | | List<TemperingGlassInfo> result = null; |
| | | QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("Top 1 *").in("state",1,0).eq("tempering_layout_id",id); |
| | | TemperingGlassInfo glass=temperingMapper.selectOne(wrapper); |
| | | if(glass!=null) { |
| | | wrapper.select("Top 1 *").in("state", 1, 0).eq("tempering_layout_id", id); |
| | | TemperingGlassInfo glass = temperingMapper.selectOne(wrapper); |
| | | if (glass != null) { |
| | | QueryWrapper<TemperingGlassInfo> glassinfo = new QueryWrapper<>(); |
| | | glassinfo.eq("engineer_id", glass.getEngineerId()) |
| | | .eq("tempering_layout_id", id) |
| | | .orderByDesc("tempering_layout_id") |
| | | .orderByAsc("tempering_feed_sequence"); |
| | | .orderByAsc("tempering_feed_sequence"); |
| | | return temperingMapper.selectList(glassinfo); |
| | | // result= temperingMapper.selectByEngineerIdAndLayoutId(glass.getEngineerId(),glass.getTemperingLayoutId()); |
| | | } |