| | |
| | | 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; |
| | |
| | | |
| | | //(4级)新增-->型号 |
| | | @Override |
| | | public void addSpecifications(SpecificationsDto specificationsDto) { |
| | | @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 -> { |
| | | String specificationsName = specifications.getName(); |
| | | return specificationsName; |
| | | }).collect(Collectors.toList()); |
| | | if (specificationsNameList.contains(specificationsDto.getSpecifications())){ |
| | | return "该标准下有该型号"; |
| | | } |
| | | /*新增型号表*/ |
| | | Specifications specifications = new Specifications(); |
| | | specifications.setStandardId(specificationsDto.getId()); |
| | |
| | | /*新增标准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()); |
| | |
| | | } |
| | | } |
| | | techniqueService.saveBatch(techniqueList); |
| | | } |
| | | |
| | | /** |
| | | * 检验模块-->QMS管理-->成品检验-->新增(需要规格型号的Id与名称) |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> selectSpecificationIdAndName(Integer materialId) { |
| | | List<Map<String, Object>> maps = specificationsMapper.selectSpecificationIdAndName(materialId); |
| | | return maps; |
| | | return "添加型号【"+ specificationsDto.getSpecifications() +"】成功!"; |
| | | } |
| | | |
| | | } |