zss
2023-09-11 19b596d3c05b1ca7ff80d8b802e7f6e03ad77dad
standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java
@@ -2,19 +2,25 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.yuanchu.mom.pojo.Technology;
import com.yuanchu.mom.mapper.TechnologyMapper;
import com.yuanchu.mom.service.TechnologyService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yuanchu.mom.mapper.*;
import com.yuanchu.mom.pojo.*;
import com.yuanchu.mom.pojo.dto.TechnologyDto;
import com.yuanchu.mom.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * <p>
 *  服务实现类
 * 服务实现类
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
@@ -26,6 +32,18 @@
    @Resource
    TechnologyMapper technologyMapper;
    @Resource
    DeviceMapper deviceMapper;
    @Resource
    ProductMapper productMapper;
    @Resource
    MbomMapper mbomMapper;
    @Resource
    TechniqueMapper techniqueMapper;
    //根据型号id查询版本
    @Override
@@ -35,7 +53,78 @@
    //右侧数据展示-->工艺路线
    @Override
    public List<Map<String, Object>> selectAllTec(Integer specificationsId, Integer version,String message) {
        return technologyMapper.selectAllTec(specificationsId,version,message);
    public List<Map<String, Object>> selectAllTec(Integer specificationsId, Integer version, String message) {
        return technologyMapper.selectAllTec(specificationsId, version, message);
    }
    //右上角新增-->工艺路线-->选择设备组
    @Override
    public List<Map<String, Object>> chooseDevice() {
        return deviceMapper.chooseDevGroup();
    }
    //右上角新增-->工艺路线-->选择工序
    @Override
    public List<Map<String, Object>> chooseFather(Integer specificationsId) {
        return technologyMapper.chooseFather(specificationsId);
    }
    //右上角新增-->工艺路线
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void addTechnology(Integer specificationsId, TechnologyDto technologyDto) {
        Technology technology = new Technology();
        BeanUtils.copyProperties(technologyDto, technology);
        technology.setSpecificationsId(specificationsId);
        technologyMapper.insert(technology);
    }
    //填写生产定额,鼠标移开保存
    @Override
    public Integer write(Integer id, Integer productionQuota) {
        Technology technology = new Technology();
        technology.setId(id);
        technology.setProductionQuota(productionQuota);
        return technologyMapper.updateById(technology);
    }
    //删除
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void delTechById(Integer id) {
        //删除工艺路线表
        Technology technology = new Technology();
        technology.setId(id);
        technology.setState(0);
        technologyMapper.updateById(technology);
        //删除技术指标表
        productMapper.delProByTecId(id);
        //删除物料清单表
        mbomMapper.delMbomByTecId(id);
        //删除生产工艺表
        techniqueMapper.delTeqByTecId(id);
    }
    //批量删除
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void delAllTech(String ids) {
        //批量删除工艺路线表
        technologyMapper.delAllTech(ids);
        //批量删除技术指标表
        productMapper.delAllByTechId(ids);
        //批量删除物料清单表
        mbomMapper.delAllByTecId(ids);
        //批量删除生产工艺表
        techniqueMapper.delAllByTecId(ids);
    }
    //选择设备组,鼠标移开保存
    @Override
    public Integer writeDevice(Integer id, String deviceGroup) {
        Technology technology = new Technology();
        technology.setId(id);
        technology.setDeviceGroup(deviceGroup);
        return technologyMapper.updateById(technology);
    }
}