zss
2023-09-21 2dbc49184bd74845c8da694c20d6fd03d7ac87e0
standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java
@@ -1,16 +1,14 @@
package com.yuanchu.mom.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.mapper.TechnologyMapper;
import com.yuanchu.mom.pojo.Product;
import com.yuanchu.mom.pojo.dto.ProductDto;
import com.yuanchu.mom.service.ProductService;
import com.yuanchu.mom.mapper.ProductMapper;
import com.yuanchu.mom.utils.MyUtil;
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;
@@ -49,8 +47,8 @@
    //右上角新增-->技术指标-->选择工序,工艺
    @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);
    }
    //右上角新增-->技术指标-->选择项目父类
@@ -61,39 +59,29 @@
    //右上角新增-->技术指标
    @Override
    public void addProduct(Integer technologyId, ProductDto productDto) {
    public String addProduct(ProductDto productDto) {
        Product product = new Product();
        BeanUtils.copyProperties(productDto, product);
        product.setTechnologyId(technologyId);
        productMapper.insert(product);
        return "新增成功!";
    }
    //填写标准值与内控值,鼠标移开保存
    @Override
    public Integer write(Integer id, String required, String internal) {
    public String write(Integer id, String required, String internal) {
        Product product = new Product();
        product.setId(id);
        product.setRequired(required);
        product.setInternal(internal);
        return productMapper.updateById(product);
    }
    //添加同一个型号技术指标的版本
    @Override
    public Integer addVersion(Integer specificationsId,Integer version) {
        List<Product> productList = productMapper.selAllBySpeId(specificationsId,version);
        for (Product product : productList) {
            product.setId(null);
            //最新版本+1
            product.setVersion(productMapper.selectVerByPro(specificationsId).get(0)+1);
        }
        saveBatch(productList);
        return productList.get(0).getVersion();
        productMapper.updateById(product);
        return "保存成功!";
    }
    //删除
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void delProById(Integer id) {
        //删除技术指标
        Product product = new Product();
        product.setId(id);
        product.setState(0);
@@ -102,14 +90,16 @@
    //批量删除
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void delAllPro(String ids) {
        //批量删除技术指标
        productMapper.delAllPro(ids);
    }
    //查询标准BOM技术指标中该型号工艺下最新版本的检验项目
    //根据工艺路线id查询技术指标
    @Override
    public List<Product> selProByVerSpe(Integer technologyId, Integer ver) {
        return productMapper.selProByVerSpe(technologyId,ver);
    public List<Product> selProByVerSpe(Integer technologyId) {
        return productMapper.selProByVerSpe(technologyId);
    }
}