| | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.yuanchu.mom.mapper.*; |
| | | import com.yuanchu.mom.pojo.Technology; |
| | | import com.yuanchu.mom.pojo.*; |
| | | import com.yuanchu.mom.pojo.dto.TechnologyDto; |
| | | import com.yuanchu.mom.service.TechnologyService; |
| | | 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> |
| | |
| | | |
| | | //右上角新增-->工艺路线-->选择工序 |
| | | @Override |
| | | public List<Map<String, Object>> chooseFather(Integer specificationsId) { |
| | | return technologyMapper.chooseFather(specificationsId); |
| | | public List<Map<String, Object>> chooseFather(Integer specificationsId,Integer version) { |
| | | return technologyMapper.chooseFather(specificationsId,version); |
| | | } |
| | | |
| | | //右上角新增-->工艺路线 |
| | | @Override |
| | | public void addTechnology(Integer specificationsId, TechnologyDto technologyDto) { |
| | | public String addTechnology(TechnologyDto technologyDto) { |
| | | /*校验是否添加重复*/ |
| | | if (ObjectUtils.isNotEmpty(technologyMapper.selectList(Wrappers.<Technology>query() |
| | | .eq("version", technologyDto.getVersion()) |
| | | .eq("state", 1) |
| | | .eq("specifications_id",technologyDto.getSpecificationsId()) |
| | | .eq("father", technologyDto.getFather()) |
| | | .eq("name", technologyDto.getName())))) { |
| | | return "重复添加!"; |
| | | } |
| | | Technology technology = new Technology(); |
| | | BeanUtils.copyProperties(technologyDto, technology); |
| | | technology.setSpecificationsId(specificationsId); |
| | | technologyMapper.insert(technology); |
| | | return "添加工艺【"+ technologyDto.getName() +"】成功"; |
| | | } |
| | | |
| | | //填写生产定额,鼠标移开保存 |
| | |
| | | technology.setId(id); |
| | | technology.setProductionQuota(productionQuota); |
| | | return technologyMapper.updateById(technology); |
| | | } |
| | | |
| | | //添加同一个型号工艺路线的版本 |
| | | @Override |
| | | public Integer addVersion(Integer specificationsId, Integer version) { |
| | | List<Technology> technologyList = technologyMapper.selectList(Wrappers.<Technology>query() |
| | | .eq("specifications_id", specificationsId) |
| | | .eq("version", version)); |
| | | for (Technology technology : technologyList) { |
| | | technology.setId(null); |
| | | //最新版本+! |
| | | technology.setVersion(technologyMapper.selectVerByTec(specificationsId).get(0) + 1); |
| | | } |
| | | saveBatch(technologyList); |
| | | return technologyList.get(0).getVersion(); |
| | | } |
| | | |
| | | //删除 |
| | |
| | | //批量删除生产工艺表 |
| | | 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); |
| | | } |
| | | } |