XiaoRuby
2023-09-24 20956b0f05f81ca47cf6c3e8f9b3b426e9cfd035
inspect-server/src/main/java/com/yuanchu/mom/service/impl/ProcessInspectServiceImpl.java
@@ -32,7 +32,7 @@
    ProcessInspectMapper processInspectMapper;
    @Resource
    ProductService productService;
    ManualProductService manualProductService;
    @Resource
    InspectionItemMapper inspectionItemMapper;
@@ -59,14 +59,10 @@
        BeanUtils.copyProperties(processInspectVo, processInspect);
        processInspectMapper.insert(processInspect);
        /*批量新增过程检验项目表*/
        /*//获取型号id
        Integer specificationId = getSpecificationId(processInspectVo.getMaterial(), processInspectVo.getMaterialCode(), processInspectVo.getSpecificationsModel());
        //查询标准BOM技术指标中该型号工艺下最新版本的检验项目
        Integer ver = productService.selectVerByPro(specificationId).get(0);//该型号下技术指标最新版本*/
        List<Product> productList = productService.selProByVerSpe(processInspectVo.getTechId());
        List<InspectionItem> inspectionItemList = productList.stream().map(product -> {
        List<ManualProduct> manualProductList = manualProductService.selByMtid(processInspectVo.getMtId());
        List<InspectionItem> inspectionItemList = manualProductList.stream().map(manualProduct -> {
            InspectionItem inspectionItem = new InspectionItem();
            BeanUtils.copyProperties(product, inspectionItem);
            BeanUtils.copyProperties(manualProduct, inspectionItem);
            inspectionItem.setCreateTime(new Date());
            inspectionItem.setUpdateTime(new Date());
            inspectionItem.setInspectId(processInspect.getId());
@@ -80,10 +76,10 @@
    //上报(更新检验状态)
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String updateProcessInspectsById(Integer id) {
    public String updateProcessInspectsById(Integer id,Integer number) {
        /*更新检验单里面的检验结论*/
        //先判断检验结果
        List<Integer> results = inspectionItemMapper.getResult(id,1);
        List<Integer> results = inspectionItemMapper.getResult(id, 1);
        int count = 0;
        for (Integer result : results) {
            if (result != null && result == 1) {
@@ -103,7 +99,8 @@
        /*如果检验结论为不合格,则需要新增不合格检验单*/
        if (processInspect.getResult() == 0) {
            InspectUnaccepted processUnaccepted = InspectUnaccepted.builder()
                    .reason(processInspect.getMaterial() +processInspect.getTechname()+ "不合格")  //暂且定义为产品名称+工艺不合格
                    .reason(processInspect.getMaterial() + processInspect.getTechname() + "不合格")  //暂且定义为产品名称+工艺不合格
                    .number(number)
                    .rawInspectId(id)
                    .type(2)        //类型为过程检验
                    .build();
@@ -121,7 +118,7 @@
    //分页查询过程检验单列表
    @Override
    public IPage<Map<String, Object>> selectProcessInspectsList(Page<Object> page, String techfather, Integer result, String name) {
        return processInspectMapper.selectProcessInspectsList(page,techfather,result,name);
        return processInspectMapper.selectProcessInspectsList(page, techfather, result, name);
    }
}