| | |
| | | throw new RuntimeException("参数不能为空"); |
| | | } |
| | | |
| | | // if (dto.isReportWork()) { |
| | | // // 更新逻辑 - 只更新数量 |
| | | // QueryWrapper<ProductionProductOutput> outputWrapper = new QueryWrapper<>(); |
| | | // outputWrapper.eq("product_main_id", dto.getId()); |
| | | // |
| | | // ProductionProductOutput output = productionProductOutputMapper.selectOne(outputWrapper); |
| | | // if (output == null) { |
| | | // throw new RuntimeException("产出记录不存在"); |
| | | // } |
| | | // |
| | | // // 只更新数量 |
| | | // if (dto.getQuantity() != null) { |
| | | // output.setQuantity(dto.getQuantity()); |
| | | // productionProductOutputMapper.updateById(output); |
| | | // } |
| | | // return true; |
| | | // } |
| | | if (dto.isReportWork()) { |
| | | // 更新逻辑 - 只更新数量 |
| | | QueryWrapper<ProductionProductOutput> outputWrapper = new QueryWrapper<>(); |
| | | outputWrapper.eq("product_main_id", dto.getProductMainId()); |
| | | |
| | | ProductionProductOutput output = productionProductOutputMapper.selectOne(outputWrapper); |
| | | if (output == null) { |
| | | throw new RuntimeException("产出记录不存在"); |
| | | } |
| | | |
| | | // 只更新数量 |
| | | if (dto.getQuantity() != null) { |
| | | output.setQuantity(dto.getQuantity()); |
| | | productionProductOutputMapper.updateById(output); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // 新增逻辑 |
| | | ProductionProductMain productionProductMain = new ProductionProductMain(); |
| | |
| | | UpdateWrapper<ProductWorkOrder> wrapper = new UpdateWrapper<>(); |
| | | wrapper.set("report_work", true) |
| | | .set("quantity",dto.getQuantity()) |
| | | .set("product_main_id",productionProductMain.getId()) |
| | | .eq("id", dto.getWorkOrderId()); |
| | | productWorkOrderMapper.update(null, wrapper); |
| | | } |
| | |
| | | qualityInspect.setProcess(productProcess.getName()); |
| | | qualityInspect.setInspectState(0); |
| | | qualityInspect.setInspectType(inspectType); |
| | | qualityInspect.setProductMainId(productionProductMain.getId()); |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | |
| | | qualityTestStandardMapper.selectList( |
| | |
| | | qualityInspectParamMapper.insert(param); |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 添加产出 |
| | | ProductionProductOutput productionProductOutput = new ProductionProductOutput(); |
| | | productionProductOutput.setProductMainId(productionProductMain.getId()); |
| | |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Boolean removeProductMain(ProductionProductMainDto dto) { |
| | | Long id = dto.getId(); |
| | | |
| | | // 删除质检参数和质检记录 |
| | | qualityInspectMapper.selectList( |
| | | new LambdaQueryWrapper<QualityInspect>() |
| | | .eq(QualityInspect::getProductMainId, id) |
| | | ).forEach(q -> { |
| | | qualityInspectParamMapper.delete( |
| | | new LambdaQueryWrapper<QualityInspectParam>() |
| | | .eq(QualityInspectParam::getInspectId, q.getId())); |
| | | qualityInspectMapper.deleteById(q.getId()); |
| | | }); |
| | | |
| | | // 删除产出记录 |
| | | productionProductOutputMapper.delete(new LambdaQueryWrapper<ProductionProductOutput>() |
| | | .eq(ProductionProductOutput::getProductMainId, id) |
| | | ); |
| | | |
| | | // 删除主表 |
| | | return productionProductMainMapper.deleteById(id) > 0; |
| | | } |
| | | } |