| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionMaterialListMapper; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionProductListMapper; |
| | | import com.yuanchu.limslaboratory.mapper.PlanMapper; |
| | |
| | | import com.yuanchu.limslaboratory.service.InspectionService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | InspectionMaterialListMapper inspectionMaterialListMapper; |
| | | |
| | | @Resource |
| | | InspectionProductListMapper inspectionProductListMapper; |
| | | InspectionProductListService inspectionProductListService; |
| | | |
| | | //添加检验申请单 |
| | | @Override |
| | |
| | | |
| | | //作废申请检验单 |
| | | @Override |
| | | public boolean delInspectionByInsId(String inspectionId) { |
| | | //检验单作废 |
| | | public void delInspectionByInsId(String inspectionId) { |
| | | /*检验单作废*/ |
| | | Inspection inspection = inspectionMapper.selectById(inspectionId); |
| | | inspection.setState(0); |
| | | int judge1 = inspectionMapper.updateById(inspection); |
| | | //检验计划作废 |
| | | inspectionMapper.updateById(inspection); |
| | | /*检验计划作废*/ |
| | | UpdateWrapper<Plan> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.eq("inspection_id", inspectionId).set("state", 0); |
| | | planMapper.update(new Plan(),updateWrapper ); |
| | | //检验样品作废(根据报检单id删除样品信息) |
| | | planMapper.update(new Plan(), updateWrapper); |
| | | /*检验样品作废(根据报检单id删除样品信息)*/ |
| | | UpdateWrapper<InspectionMaterialList> wrapper1 = new UpdateWrapper<>(); |
| | | wrapper1.eq("inspection_id", inspectionId).set("state", 0); |
| | | int judge2 = inspectionMaterialListMapper.update(new InspectionMaterialList(), wrapper1); |
| | | return judge1 > 0 && judge2 > 0; |
| | | //检验样品中的检验项目作废 |
| | | inspectionMaterialListMapper.update(new InspectionMaterialList(), wrapper1); |
| | | /*检验样品中的检验项目作废*/ |
| | | //查出检验样品id |
| | | |
| | | LambdaQueryWrapper<InspectionMaterialList> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(InspectionMaterialList::getInspectionId,inspectionId); |
| | | List<InspectionMaterialList> inspectionMaterialLists = inspectionMaterialListMapper.selectList(queryWrapper); |
| | | for (InspectionMaterialList inspectionMaterialList : inspectionMaterialLists) { |
| | | UpdateWrapper<InspectionProductList> wrapper = new UpdateWrapper<>(); |
| | | wrapper.eq("inspection_material_list_id", inspectionMaterialList.getId()).set("state", 0); |
| | | inspectionProductListService.update(new InspectionProductList(), wrapper); |
| | | } |
| | | } |
| | | |
| | | //提交申请检验单 |
| | | @Override |
| | | public boolean subInspectionByInsId(String inspectionId) { |
| | | public void subInspectionByInsId(String inspectionId) { |
| | | Inspection inspection = inspectionMapper.selectById(inspectionId); |
| | | //状态改为已提交2 |
| | | inspection.setState(2); |
| | | int judge = inspectionMapper.updateById(inspection); |
| | | inspectionMapper.updateById(inspection); |
| | | //计划表新增 |
| | | Plan plan = Plan.builder().inspectionId(inspectionId).state(1).userId(inspection.getInspectUserId()).createTime(new Date()).build(); |
| | | planMapper.insert(plan); |
| | | return judge > 0; |
| | | } |
| | | } |