| | |
| | | import com.yuanchu.limslaboratory.pojo.vo.InspectDetailVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.InspectionVo; |
| | | import com.yuanchu.limslaboratory.service.*; |
| | | import com.yuanchu.limslaboratory.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.*; |
| | |
| | | @Resource |
| | | UserMapper userMapper; |
| | | |
| | | @Resource |
| | | ReportMapper reportMapper; |
| | | |
| | | /** |
| | | * 查询检验申请单列表 |
| | | * |
| | |
| | | * @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); |
| | |
| | | |
| | | //更新检验单检验结果 |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateInspectsById(Integer id) { |
| | | //更新检验单里面的检验状态和检验结论 |
| | | InspectDetailVo inspectDetailVo = selectInspectsListById(id); |
| | |
| | | .build(); |
| | | inspectionMapper.updateById(inspection); |
| | | //生成报告单 |
| | | Report report = new Report(); |
| | | //生成报告单号 |
| | | String code = MyUtil.getTimeSixNumberCode("BG","BG"); |
| | | //获取检验结论 |
| | | String conclusion = ""; |
| | | Inspection inspection1 = inspectionMapper.selectById(id); |
| | | if (inspection1.getInspectionStatus().equals(1)) { |
| | | conclusion = "合格"; |
| | | }else { |
| | | conclusion = "不合格"; |
| | | } |
| | | report.setCode(code); |
| | | report.setStatus(0); |
| | | report.setConclusion(conclusion); |
| | | report.setInspectionId(id); |
| | | reportMapper.insert(report); |
| | | |
| | | return true; |
| | | } |