wuyouming666
2024-07-29 0add19748b6c8ac642048b45821833bc32a2444b
hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import com.mes.temperingglass.mapper.TemperingGlassInfoMapper;
import com.mes.temperingglass.service.TemperingGlassInfoService;
@@ -29,17 +30,24 @@
    public List<TemperingGlassInfo> selectWaitingGlass() {
        //获取等待进炉中的玻璃信息
        QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
        //wrapper.eq("state",1);
        wrapper.in("state",1,0,-1);
        return temperingMapper.selectList(wrapper);
        wrapper.select("Top 1 *").in("state",1,0);
        TemperingGlassInfo glass=temperingMapper.selectOne(wrapper);
        if(glass!=null) {
            QueryWrapper<TemperingGlassInfo> glassinfo = new QueryWrapper<>();
            glassinfo.eq("engineer_id", glass.getEngineerId())
                    .eq("tempering_layout_id", glass.getTemperingLayoutId());
            return temperingMapper.selectList(glassinfo);
        }else {
            return null;
        }
    }
    @Override
    public List<TemperingGlassInfo> selectIntoGlass(int layoutId) {
    public List<TemperingGlassInfo> selectIntoGlass(TemperingGlassInfo temperingGlassInfo) {
        //获取进炉中的玻璃信息
        QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
        wrapper.eq("state",2)
                .eq("tempering_layout_id", layoutId)
        wrapper.eq("tempering_layout_id", temperingGlassInfo.getTemperingLayoutId())
                .eq("engineer_id", temperingGlassInfo.getEngineerId())
                .orderByAsc("tempering_layout_id","tempering_feed_sequence");
        return temperingMapper.selectList(wrapper);
    }
@@ -47,10 +55,18 @@
    @Override
    public List<TemperingGlassInfo> selectOutGlass() {
        //获取出炉中的玻璃信息
        QueryWrapper<TemperingGlassInfo> wapper = new QueryWrapper<>();
        wapper.eq("state", 3)
                .orderByAsc("tempering_layout_id","tempering_feed_sequence");
        return temperingMapper.selectList(wapper);
        QueryWrapper<TemperingGlassInfo> wrap = new QueryWrapper<>();
        wrap.select("Top 1 *").eq("state",3);
        TemperingGlassInfo glass=temperingMapper.selectOne(wrap);
        //根据工程号和版图获取数据
        if(glass != null) {
            QueryWrapper<TemperingGlassInfo> wapper = new QueryWrapper<>();
            wapper.eq("engineer_id", glass.getEngineerId())
                    .eq("tempering_layout_id", glass.getTemperingLayoutId())
                    .orderByAsc("tempering_layout_id", "tempering_feed_sequence");
            return temperingMapper.selectList(wapper);
        }
            return  null;
    }
    @Override
@@ -58,14 +74,15 @@
        //获取过旋转台最大的钢化版图id
        QueryWrapper<TemperingGlassInfo> wapper = new QueryWrapper<>();
        wapper.select("Top 1 *").eq("state", 4)
                .orderByDesc("tempering_layout_id");
                .orderByDesc("tempering_layout_id,engineer_id");
        //根据最大的版图id显示钢化后的版图信息
        TemperingGlassInfo glassinfo= temperingMapper.selectOne(wapper);
        if (glassinfo == null) {
            return null;  // 直接返回null,表示没有找到符合条件的记录
        }
        QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
        wrapper.eq("tempering_layout_id",glassinfo.getTemperingLayoutId());
        wrapper.eq("tempering_layout_id",glassinfo.getTemperingLayoutId())
                .eq("engineer_id",glassinfo.getEngineerId());
        return  temperingMapper.selectList(wrapper);
    }
@@ -73,7 +90,7 @@
    @Override
    public List<TemperingGlassInfo> selectLayoutId() {
        QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
        wrapper.select("distinct tempering_layout_id")
        wrapper.select("distinct tempering_layout_id,engineer_id")
                .eq("state",2)
                .orderByAsc("tempering_layout_id");
        return temperingMapper.selectList(wrapper);
@@ -86,4 +103,17 @@
                .groupBy("state");
        return temperingMapper.selectList(wrapper);
    }
    @Override
    public Integer updateTemperingState(TemperingGlassInfo temperingGlassInfo) {
        UpdateWrapper<TemperingGlassInfo> wrapper = new UpdateWrapper<>();
        wrapper.eq("glass_id",temperingGlassInfo.getGlassId())
                .lt("state",5)
                .set("state", temperingGlassInfo.getState());;
        if (temperingMapper.update(null,wrapper) > 0) {
            return 200;
        }else {
            return 100;
        }
    }
}