zss
2023-09-15 22899f74279a47f4ec79e1325f8489d948ced005
standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java
@@ -9,6 +9,7 @@
import com.yuanchu.mom.service.*;
import com.yuanchu.mom.utils.MyUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
@@ -62,6 +63,7 @@
    //(4级)新增-->型号
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String addSpecifications(SpecificationsDto specificationsDto) {
        //校验添加该标准下的型号是否重复
        List<String> specificationsNameList = specificationsMapper.selectList(Wrappers.<Specifications>query().eq("standard_id", specificationsDto.getId())).stream().map(specifications -> {
@@ -79,7 +81,17 @@
        /*新增标准BOM-->工艺路线(批量添加)*/
        //根据标准id查询物料大类
        Material material = materialMapper.selFath(specificationsDto.getId());
        List<TechnologyTemplate> technologyTemplateList = technologyTemplateMapper.selectList(Wrappers.<TechnologyTemplate>query().eq("type", material.getFather()));
        Integer type = null;
        if (material.getFather().equals("橡胶连接器")){
            type=0;
        }else if (material.getFather().equals("金属连接器")){
            type=1;
        }else if(material.getFather().equals("湿插拔电连接器")){
            type=2;
        }else if(material.getFather().equals("分支组件")){
            type=3;
        }else return "添加型号【" + specificationsDto.getSpecifications() + "】成功";
        List<TechnologyTemplate> technologyTemplateList = technologyTemplateMapper.selectList(Wrappers.<TechnologyTemplate>query().eq("type",type));
        List<Technology> technologyList = technologyTemplateList.stream().map(technologyTemplate -> {
            Technology technology = new Technology();
            technology.setSpecificationsId(specifications.getId());
@@ -144,15 +156,6 @@
        }
        techniqueService.saveBatch(techniqueList);
        return "添加型号【"+ specificationsDto.getSpecifications() +"】成功!";
    }
    /**
     * 检验模块-->QMS管理-->成品检验-->新增(需要规格型号的Id与名称)
     */
    @Override
    public List<Map<String, Object>> selectSpecificationIdAndName(Integer materialId) {
        List<Map<String, Object>> maps = specificationsMapper.selectSpecificationIdAndName(materialId);
        return maps;
    }
}