| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.mapper.TechniqueMapper; |
| | | import com.yuanchu.mom.mapper.TechnologyMapper; |
| | | import com.yuanchu.mom.pojo.Product; |
| | | import com.yuanchu.mom.pojo.dto.ProductDto; |
| | |
| | | import com.yuanchu.mom.mapper.ProductMapper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | |
| | | @Resource |
| | | TechnologyMapper technologyMapper; |
| | | |
| | | @Resource |
| | | TechniqueMapper techniqueMapper; |
| | | |
| | | //根据型号id查询项目(技术指标) |
| | | @Override |
| | |
| | | |
| | | //右上角新增-->技术指标-->选择工序,工艺 |
| | | @Override |
| | | public List<Map<String, Object>> chooseTech(Integer specificationsId) { |
| | | return technologyMapper.chooseTech(specificationsId); |
| | | public List<Map<String, Object>> chooseTech(Integer specificationsId, Integer version) { |
| | | return technologyMapper.chooseTech(specificationsId, version); |
| | | } |
| | | |
| | | //右上角新增-->技术指标-->选择项目父类 |
| | |
| | | |
| | | //右上角新增-->技术指标 |
| | | @Override |
| | | public void addProduct(Integer technologyId, ProductDto productDto) { |
| | | public String addProduct(ProductDto productDto) { |
| | | Product product = new Product(); |
| | | String required = productDto.getRequired(); |
| | | String internal = productDto.getInternal(); |
| | | if (ObjectUtils.isNotEmpty(required)) { |
| | | char requ = required.charAt(0); |
| | | if (requ != '>' && requ != '<' && requ != '=') { |
| | | return "标准值输入格式有问题!"; |
| | | } |
| | | } |
| | | if (ObjectUtils.isNotEmpty(internal)) { |
| | | char inter = internal.charAt(0); |
| | | if (inter != '>' && inter != '<' && inter != '=') { |
| | | return "内控值输入格式有问题!"; |
| | | } |
| | | } |
| | | BeanUtils.copyProperties(productDto, product); |
| | | product.setTechnologyId(technologyId); |
| | | productMapper.insert(product); |
| | | return "新增成功!"; |
| | | } |
| | | |
| | | //填写标准值与内控值,鼠标移开保存 |
| | | @Override |
| | | public String write(Integer id, String required, String internal) { |
| | | //校验标准值,内控值格式 |
| | | if (ObjectUtils.isNotEmpty(internal)) { |
| | | char inter = internal.charAt(0); |
| | | char requ = required.charAt(0); |
| | | if (inter != '>' && inter != '<' && inter != '=') { |
| | | return "内控值输入格式有问题!"; |
| | | } |
| | | } |
| | | if (ObjectUtils.isNotEmpty(required)) { |
| | | char requ = required.charAt(0); |
| | | if (requ != '>' && requ != '<' && requ != '=') { |
| | | return "标准值输入格式有问题!"; |
| | | } |
| | | } |
| | | Product product = new Product(); |
| | | product.setId(id); |
| | | product.setRequired(required); |
| | |
| | | |
| | | //删除 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void delProById(Integer id) { |
| | | //删除技术指标 |
| | | Product product = new Product(); |
| | | product.setId(id); |
| | | product.setState(0); |
| | | productMapper.updateById(product); |
| | | //删除生产工艺 |
| | | techniqueMapper.delByProId(id); |
| | | } |
| | | |
| | | //批量删除 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void delAllPro(String ids) { |
| | | //批量删除技术指标 |
| | | productMapper.delAllPro(ids); |
| | | //删除生产工艺 |
| | | techniqueMapper.delAll(ids); |
| | | } |
| | | |
| | | //查询标准BOM技术指标中该型号工艺下最新版本的检验项目 |