| | |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import com.yuanchu.limslaboratory.service.*; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Resource |
| | | UserMapper userMapper; |
| | | |
| | | |
| | | /** |
| | | * 查询检验申请单列表 |
| | | * |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer addInspect(Integer id, InspectionVo inspectionVo) { |
| | | /*新增检验申请表*/ |
| | | Inspection inspection = Inspection.builder() |
| | |
| | | |
| | | //根据检验单id查询原材料检验单详情 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public InspectDetailVo selectInspectsListById(Integer id) { |
| | | /*将检验单基本信息查询出来并封装到RawInspectVo对象中*/ |
| | | Inspection inspection = inspectionMapper.selectById(id); |
| | |
| | | return inspectDetailVo; |
| | | } |
| | | |
| | | //更新检验单检验结果 |
| | | //作废检验单 |
| | | @Override |
| | | public boolean updateInspectsById(Integer id) { |
| | | //更新检验单里面的检验状态和检验结论 |
| | | InspectDetailVo inspectDetailVo = selectInspectsListById(id); |
| | | Inspection inspection = Inspection.builder() |
| | | .id(id) |
| | | .inspectionStatus(inspectDetailVo.getInspectionStatus()) |
| | | .build(); |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String delInspect(Integer id) { |
| | | /*作废检验单*/ |
| | | Inspection inspection = new Inspection(); |
| | | inspection.setId(id); |
| | | inspection.setState(0); |
| | | inspectionMapper.updateById(inspection); |
| | | //生成报告单 |
| | | |
| | | return true; |
| | | /*作废检验样品*/ |
| | | InspectionMaterial inspectionMaterial = inspectionMaterialMapper.selectOne(Wrappers.<InspectionMaterial>query().eq("inspection_id", id)); |
| | | inspectionMaterial.setState(0); |
| | | inspectionMaterialMapper.updateById(inspectionMaterial); |
| | | /*作废检验项目*/ |
| | | inspectionProductMapper.updat(inspectionMaterial.getId()); |
| | | return "作废成功!"; |
| | | } |
| | | |
| | | |
| | | } |
| | | |