XiaoRuby
2023-09-07 088ceb9faf6f1d0d9f57bb9cd65f542337d40b7f
Merge remote-tracking branch 'origin/master'
已修改25个文件
493 ■■■■■ 文件已修改
inspect-server/src/main/java/com/yuanchu/mom/controller/FinishedInspectController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/mapper/InspectionItemMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/InspectionItemService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/FinishedInspectServiceImpl.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InspectionItemServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/ProcessInspectServiceImpl.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/FinishedInspectMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/ProcessInspectMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/controller/MaterialController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/controller/MbomController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/controller/ProductController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/controller/TechniqueController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/mapper/ProductMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/MaterialService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/MbomService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/ProductService.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/TechniqueService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/TechnologyService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/impl/MaterialServiceImpl.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/impl/MbomServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/impl/TechniqueServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/resources/mapper/ProductMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/FinishedInspectController.java
@@ -39,14 +39,6 @@
    @Autowired
    private FinishedInspectService finishedInspectService;
    @Autowired
    private UserService userService;
    @Autowired
    private SpecificationsService specificationsService;
    @Autowired
    private MaterialService materialService;
    @Autowired
    Jwt jwt;
@@ -94,14 +86,14 @@
    @ApiOperation(value = "分页查询成品检验单列表")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "pageNo", value = "条数/页", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "countSize", value = "条数/页", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "pageSize", value = "页数", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "result", value = "检验结果(为空=全部)", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "material", value = "产品名称", dataTypeClass = String.class)
    })
    @GetMapping("/list_page")
    public Result<?> list_page(Integer pageNo, Integer pageSize, Integer result, String material) {
        IPage<Map<String, Object>> page = finishedInspectService.selectFinishedInspectPage(new Page<Object>(pageNo, pageSize), result, material);
    public Result<?> list_page(Integer pageSize, Integer countSize, Integer result, String material) {
        IPage<Map<String, Object>> page = finishedInspectService.selectFinishedInspectPage(new Page<Object>(pageSize, countSize), result, material);
        Map<String, Object> map = new HashMap<>();
        map.put("total", page.getTotal());
        map.put("row", page.getRecords());
inspect-server/src/main/java/com/yuanchu/mom/mapper/InspectionItemMapper.java
@@ -21,7 +21,7 @@
    //获取该类型检验单id下的检验项目结果集
     List<Integer> getResult(Integer id, int type);
    List<InspectionItemDto> selectInspectionItem(Integer finishInspectId, Integer type);
    List<InspectionItemDto> selectInspectionItem(Integer id, Integer type);
}
inspect-server/src/main/java/com/yuanchu/mom/service/InspectionItemService.java
@@ -21,10 +21,10 @@
    /**
     * 新增按钮-->2、查询所有检验项目
     * @param finishInspectId
     * @param id
     * @return
     */
    List<InspectionItemDto> selectInspectionItem(Integer finishInspectId, Integer type);
    List<InspectionItemDto> selectInspectionItem(Integer id, Integer type);
    /**
     * 新增按钮-->2、检验项目-->失去焦点发起该请求
inspect-server/src/main/java/com/yuanchu/mom/service/impl/FinishedInspectServiceImpl.java
@@ -16,6 +16,7 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -34,15 +35,6 @@
    @Resource
    FinishedInspectMapper finishedInspectMapper;
    @Resource
    MaterialMapper materialMapper;
    @Resource
    StandardService standardService;
    @Resource
    SpecificationsService specificationsService;
    @Resource
    ManualTechnologyMapper manualTechnologyMapper;
@@ -87,17 +79,19 @@
        finishedInspectMapper.insert(finishedInspect);
        /*批量新增成品检验项目单*/
        //获取型号id
        Integer specificationId = getSpecificationId(finishedInspectVo.getMaterial(), finishedInspectVo.getMcode(), finishedInspectVo.getSpecificationsModel());
        //Integer specificationId = getSpecificationId(finishedInspectVo.getMaterial(), finishedInspectVo.getMcode(), finishedInspectVo.getSpecificationsModel());
        //根据生产订单id查询编制工序的最后一道工艺
        List<ManualTechnology> manualTechnologyList = manualTechnologyMapper.selAllByMoId(finishedInspectVo.getId());
        //获取最后一道工艺关联的工艺路线id
        Integer technologyId = manualTechnologyList.get(0).getTechnologyId();
        //查询标准BOM技术指标中该型号工艺下最新版本的检验项目
        Integer ver = productService.selectVerByPro(specificationId).get(0);//该型号下技术指标最新版本
        List<Product> productList = productService.selProByVerSpe(technologyId, ver);
        /*//查询标准BOM技术指标中该型号工艺下最新版本的检验项目
        Integer ver = productService.selectVerByPro(specificationId).get(0);//该型号下技术指标最新版本*/
        List<Product> productList = productService.selProByVerSpe(technologyId);
        List<InspectionItem> inspectionItemList = productList.stream().map(product -> {
            InspectionItem inspectionItem = new InspectionItem();
            BeanUtils.copyProperties(product, inspectionItem);
            inspectionItem.setCreateTime(new Date());
            inspectionItem.setUpdateTime(new Date());
            inspectionItem.setInspectId(finishedInspect.getId());
            inspectionItem.setType(2);//成品
            return inspectionItem;
@@ -183,76 +177,5 @@
        return finishedInspectMapper.selectFinishInspectsListById(id);
    }
    /*根据样品名称,样品编号,型号规格获取型号id*/
    private Integer getSpecificationId(String name, String mcode, String specification) {
        //获取物料id
        Material material = materialMapper.selectOne(Wrappers.<Material>query()
                .eq("name", name)
                .eq("code", mcode));
        if (Objects.isNull(material)) {
            return null;
        }
        //获取规格名称和型号名称
        String[] split = specification.split("-");
        String stName = split[0];
        String spName = split[1];
        //获取规格id
        Standard standard = standardService.getOne(Wrappers.<Standard>query()
                .eq("name", stName)
                .eq("material_id", material.getId()));
        //获取型号id
        Specifications specifications = specificationsService.getOne(Wrappers.<Specifications>query()
                .eq("name", spName)
                .eq("standard_id", standard.getId()));
        return specifications.getId();
    }
    /*判断检测值是否满足标准值和内控值的要求,如果不满足则检验结论为不合格*/
    private int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) {
        boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr);
        boolean isControlValueSatisfied = isValueSatisfied(controlValueStr, detectionValueStr);
        if (isStandardValueSatisfied && isControlValueSatisfied) {
            return 1;
        } else {
            return 0;
        }
    }
    private boolean isValueSatisfied(String valueStr, String detectionValueStr) {
        String substring = valueStr.substring(1, 2);
        if (substring.equals("=")) {
            String operator = valueStr.substring(0, 2);
            Double standardValue = Double.parseDouble(valueStr.substring(2));
            Double detectionValue = Double.parseDouble(detectionValueStr);
            switch (operator) {
                case ">=":
                    return detectionValue >= standardValue;
                case "<=":
                    return detectionValue <= standardValue;
                default:
                    return false;
            }
        } else {
            String operator = valueStr.substring(0, 1);
            Double standardValue = Double.parseDouble(valueStr.substring(1));
            Double detectionValue = Double.parseDouble(detectionValueStr);
            switch (operator) {
                case ">":
                    return detectionValue > standardValue;
                case "≥":
                    return detectionValue >= standardValue;
                case "≤":
                    return detectionValue <= standardValue;
                case "<":
                    return detectionValue < standardValue;
                case "=":
                    return detectionValue.equals(standardValue);
                default:
                    return false;
            }
        }
    }
}
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InspectionItemServiceImpl.java
@@ -38,8 +38,8 @@
    //新增按钮-->2、查询所有检验项目
    @Override
    public List<InspectionItemDto> selectInspectionItem(Integer finishInspectId, Integer type) {
        return inspectionItemMapper.selectInspectionItem(finishInspectId,type);
    public List<InspectionItemDto> selectInspectionItem(Integer id, Integer type) {
        return inspectionItemMapper.selectInspectionItem(id,type);
    }
inspect-server/src/main/java/com/yuanchu/mom/service/impl/ProcessInspectServiceImpl.java
@@ -13,6 +13,7 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -29,15 +30,6 @@
    @Resource
    ProcessInspectMapper processInspectMapper;
    @Resource
    MaterialMapper materialMapper;
    @Resource
    StandardService standardService;
    @Resource
    SpecificationsService specificationsService;
    @Resource
    ProductService productService;
@@ -67,14 +59,16 @@
        BeanUtils.copyProperties(processInspectVo, processInspect);
        processInspectMapper.insert(processInspect);
        /*批量新增过程检验项目表*/
        //获取型号id
        /*//获取型号id
        Integer specificationId = getSpecificationId(processInspectVo.getMaterial(), processInspectVo.getMaterialCode(), processInspectVo.getSpecificationsModel());
        //查询标准BOM技术指标中该型号工艺下最新版本的检验项目
        Integer ver = productService.selectVerByPro(specificationId).get(0);//该型号下技术指标最新版本
        List<Product> productList = productService.selProByVerSpe(processInspectVo.getTechnologyId(), ver);
        Integer ver = productService.selectVerByPro(specificationId).get(0);//该型号下技术指标最新版本*/
        List<Product> productList = productService.selProByVerSpe(processInspectVo.getTechnologyId());
        List<InspectionItem> inspectionItemList = productList.stream().map(product -> {
            InspectionItem inspectionItem = new InspectionItem();
            BeanUtils.copyProperties(product, inspectionItem);
            inspectionItem.setCreateTime(new Date());
            inspectionItem.setUpdateTime(new Date());
            inspectionItem.setInspectId(processInspect.getId());
            inspectionItem.setType(1);
            return inspectionItem;
@@ -130,76 +124,5 @@
        return processInspectMapper.selectProcessInspectsList(page,techfather,result,name);
    }
    /*根据样品名称,样品编号,型号规格获取型号id*/
    private Integer getSpecificationId(String name, String mcode, String specification) {
        //获取物料id
        Material material = materialMapper.selectOne(Wrappers.<Material>query()
                .eq("name", name)
                .eq("code", mcode));
        if (Objects.isNull(material)) {
            return null;
        }
        //获取规格名称和型号名称
        String[] split = specification.split("-");
        String stName = split[0];
        String spName = split[1];
        //获取规格id
        Standard standard = standardService.getOne(Wrappers.<Standard>query()
                .eq("name", stName)
                .eq("material_id", material.getId()));
        //获取型号id
        Specifications specifications = specificationsService.getOne(Wrappers.<Specifications>query()
                .eq("name", spName)
                .eq("standard_id", standard.getId()));
        return specifications.getId();
    }
    /*判断检测值是否满足标准值和内控值的要求,如果不满足则检验结论为不合格*/
    private int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) {
        boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr);
        boolean isControlValueSatisfied = isValueSatisfied(controlValueStr, detectionValueStr);
        if (isStandardValueSatisfied && isControlValueSatisfied) {
            return 1;
        } else {
            return 0;
        }
    }
    private boolean isValueSatisfied(String valueStr, String detectionValueStr) {
        String substring = valueStr.substring(1, 2);
        if (substring.equals("=")) {
            String operator = valueStr.substring(0, 2);
            Double standardValue = Double.parseDouble(valueStr.substring(2));
            Double detectionValue = Double.parseDouble(detectionValueStr);
            switch (operator) {
                case ">=":
                    return detectionValue >= standardValue;
                case "<=":
                    return detectionValue <= standardValue;
                default:
                    return false;
            }
        } else {
            String operator = valueStr.substring(0, 1);
            Double standardValue = Double.parseDouble(valueStr.substring(1));
            Double detectionValue = Double.parseDouble(detectionValueStr);
            switch (operator) {
                case ">":
                    return detectionValue > standardValue;
                case "≥":
                    return detectionValue >= standardValue;
                case "≤":
                    return detectionValue <= standardValue;
                case "<":
                    return detectionValue < standardValue;
                case "=":
                    return detectionValue.equals(standardValue);
                default:
                    return false;
            }
        }
    }
}
inspect-server/src/main/resources/mapper/FinishedInspectMapper.xml
@@ -39,7 +39,6 @@
        <result property="qualityTraceability" column="quality_traceability"/>
        <result property="specifications" column="specifications"/>
        <result property="unit" column="unit"/>
        <collection property="children" resultMap="threeMap" javaType="List"/>
    </resultMap>
    <select id="chooseMater" resultMap="oneMap">
        select s.proname prname,
inspect-server/src/main/resources/mapper/ProcessInspectMapper.xml
@@ -110,7 +110,7 @@
        <if test="techfather!=null and techfather!=''">
            and techfather like  concat('%',#{techfather},'%')
        </if>
        <if test="material!=null and material!=''">
        <if test="name!=null and name!=''">
            and material like  concat('%',#{name},'%')
        </if>
        <if test="result!=null ">
standard-server/src/main/java/com/yuanchu/mom/controller/MaterialController.java
@@ -95,4 +95,15 @@
        return Result.fail("没有该类型!");
    }
    @ApiOperation("添加同一个型号工艺路线,技术指标,物料清单,生产工艺的版本")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "version", value = "当前版本", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/addVersion")
    public Result<?> addVersion(Integer specificationsId ,Integer version) {
        Integer version1 = materialService.addVersion(specificationsId,version);
        return Result.success("添加型号"+specificationsId+"的版本"+version1+"成功");
    }
}
standard-server/src/main/java/com/yuanchu/mom/controller/MbomController.java
@@ -63,17 +63,6 @@
        return Result.fail("更新失败");
    }
    @ApiOperation("添加同一个型号物料清单的版本")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "version", value = "当前版本", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/addVersion")
    public Result<?> addVersion(Integer specificationsId ,Integer version) {
        Integer version1 = mbomService.addVersion(specificationsId,version);
        return Result.success("添加型号"+specificationsId+"的物料清单版本"+version1+"成功");
    }
    @ApiOperation(value = "删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "物料清单id", dataTypeClass = Integer.class,required = true)
standard-server/src/main/java/com/yuanchu/mom/controller/ProductController.java
@@ -58,22 +58,7 @@
    })
    @PostMapping("/write")
    public Result<?> write(Integer id, String required, String internal) {
        Integer write = productService.write(id, required, internal);
        if (write >= 1){
            return Result.success("更新成功");
        }
        return Result.fail("更新失败");
    }
    @ApiOperation("添加同一个型号技术指标的版本")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "version", value = "当前版本", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/addVersion")
    public Result<?> addVersion(Integer specificationsId ,Integer version) {
        Integer version1 = productService.addVersion(specificationsId,version);
        return Result.success("添加型号"+specificationsId+"的技术指标版本"+version1+"成功");
        return Result.success(productService.write(id, required, internal));
    }
    @ApiOperation(value = "删除")
standard-server/src/main/java/com/yuanchu/mom/controller/TechniqueController.java
@@ -65,17 +65,6 @@
        return Result.success("添加生产工艺成功");
    }
    @ApiOperation("添加同一个型号生产工艺的版本")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "version", value = "当前版本", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/addVersion")
    public Result<?> addVersion(Integer specificationsId,Integer version ) {
        Integer version1 = techniqueService.addVersion(specificationsId,version);
        return Result.success("添加型号"+specificationsId+"的生产工艺版本"+version1+"成功");
    }
    @ApiOperation(value = "删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "生产工艺id", dataTypeClass = Integer.class,required = true)
standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java
@@ -69,16 +69,6 @@
        return Result.fail("更新失败");
    }
    @ApiOperation("添加同一个型号工艺路线的版本")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "version", value = "当前版本", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/addVersion")
    public Result<?> addVersion(Integer specificationsId ,Integer version) {
        Integer version1 = technologyService.addVersion(specificationsId,version);
        return Result.success("添加型号"+specificationsId+"的工艺路线版本"+version1+"成功");
    }
    @ApiOperation(value = "删除")
    @ApiImplicitParams(value = {
standard-server/src/main/java/com/yuanchu/mom/mapper/ProductMapper.java
@@ -39,8 +39,8 @@
    //根据技术指标id批量删除
    void delAllPro(String ids);
    //查询标准BOM技术指标中该型号工艺下最新版本的检验项目
    List<Product> selProByVerSpe(Integer technologyId, Integer ver);
    //查询标准BOM技术指标中该型号工艺下的检验项目
    List<Product> selProByVerSpe(Integer technologyId);
}
standard-server/src/main/java/com/yuanchu/mom/service/MaterialService.java
@@ -29,4 +29,11 @@
    String addMaterial(MaterialDto materialDto);
    /**
     * 添加同一个型号工艺路线,技术指标,物料清单,生产工艺的版本
     * @param specificationsId
     * @param version
     * @return
     */
    Integer addVersion(Integer specificationsId, Integer version);
}
standard-server/src/main/java/com/yuanchu/mom/service/MbomService.java
@@ -52,12 +52,6 @@
     */
    Integer write(Integer id, Integer num);
    /**
     * 添加同一个型号物料清单的版本
     * @param specificationsId
     * @return
     */
    Integer addVersion(Integer specificationsId,Integer version);
    /**
     * 删除
standard-server/src/main/java/com/yuanchu/mom/service/ProductService.java
@@ -64,14 +64,7 @@
     * @param internal
     * @return
     */
    Integer write(Integer id, String required, String internal);
    /**
     * 添加同一个型号技术指标的版本
     * @param specificationsId
     * @return
     */
    Integer addVersion(Integer specificationsId,Integer version);
    String write(Integer id, String required, String internal);
    /**
     * 删除
@@ -86,10 +79,9 @@
    void delAllPro(String ids);
    /**
     * 查询标准BOM技术指标中该型号工艺下最新版本的检验项目
     * 查询标准BOM技术指标中该型号工艺下的检验项目
     * @param technologyId
     * @param ver
     * @return
     */
    List<Product> selProByVerSpe(Integer technologyId, Integer ver);
    List<Product> selProByVerSpe(Integer technologyId);
}
standard-server/src/main/java/com/yuanchu/mom/service/TechniqueService.java
@@ -59,13 +59,6 @@
    void addTechnique(Integer technologyId, TechniqueDto techniqueDto);
    /**
     * 添加同一个型号生产工艺的版本
     * @param specificationsId
     * @return
     */
    Integer addVersion(Integer specificationsId,Integer version);
    /**
     * 删除
     * @param id
     */
standard-server/src/main/java/com/yuanchu/mom/service/TechnologyService.java
@@ -59,13 +59,6 @@
    Integer write(Integer id, Integer productionQuota);
    /**
     * 添加同一个型号工艺路线的版本
     * @param specificationsId
     * @return
     */
    Integer addVersion(Integer specificationsId,Integer version);
    /**
     * 删除
     * @param id
     */
standard-server/src/main/java/com/yuanchu/mom/service/impl/MaterialServiceImpl.java
@@ -61,6 +61,18 @@
    @Resource
    DeviceMapper deviceMapper;
    @Resource
    TechnologyMapper technologyMapper;
    @Resource
    ProductMapper productMapper;
    @Resource
    MbomMapper mbomMapper;
    @Resource
    TechniqueMapper techniqueMapper;
    //标准MOM-->左侧五级树展示
    @Override
    public List<Map<String, Object>> selectTreeByMaterial() {
@@ -72,10 +84,13 @@
    @Transactional(rollbackFor = Exception.class)
    public String addMaterial(MaterialDto materialDto) {
        //校验添加物料是否重复
        if (materialMapper.selectOne(Wrappers.<Material>query()
        List<Material> materialList = materialMapper.selectList(Wrappers.<Material>query()
                .eq("type", materialDto.getType())
                .eq("father", materialDto.getFather())).getName().equals(materialDto.getName())) {
                .eq("father", materialDto.getFather()));
        for (Material material : materialList) {
            if (material.getName().equals(materialDto.getName())) {
            return "该类型产品大类下有该产品名称";
            }
        }
        /*新增物料表*/
        Material material = new Material();
@@ -163,6 +178,78 @@
    }
    //添加同一个型号工艺路线,技术指标,物料清单,生产工艺的版本
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Integer addVersion(Integer specificationsId, Integer version) {
        List<Technology> technologyList = technologyMapper.selectList(Wrappers.<Technology>query()
                .eq("specifications_id", specificationsId)
                .eq("version", version));
        /*上一个版本的工艺路线id集合*/
        List<Integer> techTemIds = technologyList.stream().map(Technology::getId).collect(Collectors.toList());
        for (Technology technology : technologyList) {
            technology.setId(null);
            //最新版本+1
            technology.setVersion(technologyMapper.selectVerByTec(specificationsId).get(0) + 1);
        }
        technologyService.saveBatch(technologyList);
        /*工艺路线的版本新增的同时该工艺路线下下的技术指标,生产工艺,物料清单都要新增*/
        //新增版本的工艺路线id集合
        List<Integer> technologyIds = technologyList.stream().map(Technology::getId).collect(Collectors.toList());
        //两者长度一定一样
        List<Product> productList = new ArrayList<>();
        for (int i = 0; i < technologyIds.size(); i++) {
            List<Product> products = productMapper.selectList(Wrappers.<Product>query().eq("technology_id", techTemIds.get(i)));
            for (Product pro : products) {
                Product product = new Product();
                product.setFather(pro.getFather());
                product.setName(pro.getName());
                product.setUnit(pro.getUnit());
                product.setRequired(pro.getRequired());
                product.setInternal(pro.getInternal());
                product.setVersion(pro.getVersion()+1);
                product.setTechnologyId(technologyIds.get(i));
                productList.add(product);
            }
        }
        productService.saveBatch(productList);
        /*新增标准BOM-->物料清单(批量添加)*/
        List<Mbom> mbomList = new ArrayList<>();
        for (int i = 0; i < technologyIds.size(); i++) {
            List<Mbom> mboms = mbomMapper.selectList(Wrappers.<Mbom>query().eq("technology_id", techTemIds.get(i)));
            for (Mbom mb : mboms) {
                Mbom mbom = new Mbom();
                mbom.setUnit(mb.getUnit());
                mbom.setName(mb.getName());
                mbom.setSupplier(mb.getSupplier());
                mbom.setQualityTraceability(mb.getQualityTraceability());
                mbom.setSpecifications(mb.getSpecifications());
                mbom.setVersion(mb.getVersion()+1);
                mbom.setNum(mb.getNum());
                mbom.setTechnologyId(technologyIds.get(i));
                mbomList.add(mbom);
            }
        }
        mbomService.saveBatch(mbomList);
        /*新增标准BOM-->生产工艺(批量添加)*/
        List<Technique> techniqueList = new ArrayList<>();
        for (int i = 0; i < technologyIds.size(); i++) {
            List<Technique> techniques = techniqueMapper.selectList(Wrappers.<Technique>query().eq("technology_id", techTemIds.get(i)));
            for (Technique teque : techniques) {
                Technique technique = new Technique();
                technique.setTechnologyId(technologyIds.get(i));
                technique.setDevice(teque.getDevice());
                technique.setProductFather(teque.getProductFather());
                technique.setProduct(teque.getProduct());
                technique.setUnit(teque.getUnit());
                technique.setVersion(teque.getVersion()+1);
                techniqueList.add(technique);
            }
        }
        techniqueService.saveBatch(techniqueList);
        return technologyList.get(0).getVersion();
    }
}
standard-server/src/main/java/com/yuanchu/mom/service/impl/MbomServiceImpl.java
@@ -64,19 +64,6 @@
        return mbomMapper.updateById(mbom);
    }
    //添加同一个型号物料清单的版本
    @Override
    public Integer addVersion(Integer specificationsId,Integer version) {
        List<Mbom> mbomList = mbomMapper.selAllBySpeId(specificationsId,version);
        for (Mbom mbom : mbomList) {
            mbom.setId(null);
            //最新版本+1
            mbom.setVersion(mbomMapper.selectVerByMbom(specificationsId).get(0) + 1);
        }
        saveBatch(mbomList);
        return mbomList.get(0).getVersion();
    }
    //删除
    @Override
    public void delMbomById(Integer id) {
standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java
@@ -70,25 +70,23 @@
    //填写标准值与内控值,鼠标移开保存
    @Override
    public Integer write(Integer id, String required, String internal) {
    public String write(Integer id, String required, String internal) {
        //校验标准值,内控值格式
            char inter = internal.charAt(0);
            char requ = required.charAt(0);
            if (inter != '>' && inter != '<' && inter != '=') {
                return "内控值输入格式有问题!";
            }
            if (requ != '>' && requ != '<' && requ != '=') {
                return "标准值输入格式有问题!";
            }
        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 "保存成功!";
    }
    //删除
@@ -108,8 +106,8 @@
    //查询标准BOM技术指标中该型号工艺下最新版本的检验项目
    @Override
    public List<Product> selProByVerSpe(Integer technologyId, Integer ver) {
        return productMapper.selProByVerSpe(technologyId,ver);
    public List<Product> selProByVerSpe(Integer technologyId) {
        return productMapper.selProByVerSpe(technologyId);
    }
}
standard-server/src/main/java/com/yuanchu/mom/service/impl/TechniqueServiceImpl.java
@@ -67,19 +67,6 @@
        techniqueMapper.insert(technique);
    }
    //添加同一个型号生产工艺的版本
    @Override
    public Integer addVersion(Integer specificationsId,Integer version) {
        List<Technique> techniqueList = techniqueMapper.selAllBySpeId(specificationsId,version);
        for (Technique technique : techniqueList) {
            technique.setId(null);
            //最新版本+1
            technique.setVersion(techniqueMapper.selectVerByTeq(specificationsId).get(0)+1);
        }
        saveBatch(techniqueList);
        return techniqueList.get(0).getVersion();
    }
    //删除
    @Override
    public void delTeqById(Integer id) {
standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java
@@ -4,17 +4,19 @@
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>
@@ -40,7 +42,16 @@
    MbomMapper mbomMapper;
    @Resource
    MbomService mbomService;
    @Resource
    TechniqueMapper techniqueMapper;
    @Resource
    ProductService productService;
    @Resource
    TechniqueService techniqueService;
    //根据型号id查询版本
@@ -69,6 +80,7 @@
    //右上角新增-->工艺路线
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void addTechnology(Integer specificationsId, TechnologyDto technologyDto) {
        Technology technology = new Technology();
        BeanUtils.copyProperties(technologyDto, technology);
@@ -83,21 +95,6 @@
        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();
    }
    //删除
standard-server/src/main/resources/mapper/ProductMapper.xml
@@ -93,7 +93,6 @@
        select *
        from mom_ocean.product
        where state = 1
          and version = #{ver}
          and technology_id = #{technologyId}
    </select>