| | |
| | | import cn.hutool.core.date.DateUtil; |
| | | 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.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | |
| | | import com.yuanchu.limslaboratory.pojo.vo.InspectDetailVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.InspectionVo; |
| | | import com.yuanchu.limslaboratory.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | * @since 2023-08-03 13:03:36 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class InspectionServiceImpl extends ServiceImpl<InspectionMapper, Inspection> implements InspectionService { |
| | | |
| | | @Resource |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer addInspect(Integer id, InspectionVo inspectionVo) throws ApplicationException { |
| | | log.info(inspectionVo.toString()); |
| | | /*新增检验申请表*/ |
| | | Inspection inspection = Inspection.builder() |
| | | .startTime(inspectionVo.getStartTime()) |
| | |
| | | .num(inspectionVo.getNum()) |
| | | .unit(inspectionVo.getUnit()) |
| | | .supplier(inspectionVo.getSupplier()) |
| | | .specificationId(inspectionVo.getSpecificationId()) |
| | | .specificationsId(inspectionVo.getSpecificationId()) |
| | | .specifications(inspectionVo.getSpecifications()) |
| | | .formTime(inspectionVo.getFormTime()) |
| | | .inspectionId(inspection.getId()) |
| | |
| | | String required = Optional.ofNullable(p) |
| | | .map(Product::getRequired).orElse("空"); |
| | | if(Objects.equals("空",internal)||Objects.equals(required,"空")) { |
| | | throw new ApplicationException("500","项目版本不可用"); |
| | | throw new ApplicationException("项目版本不可用"); |
| | | } |
| | | }); |
| | | //将查询的项目信息构建成检验项目 |
| | |
| | | return inspectionProductMapper.update(null,inspectionProductUpdateWrapper)>0; |
| | | } |
| | | |
| | | @Override |
| | | public List<Material> getMaterielTypeIsOne() { |
| | | QueryWrapper<Material>queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda() |
| | | .select(Material::getName,Material::getId,Material::getCode) |
| | | .eq(Material::getType,1) |
| | | .eq(Material::getState,1); |
| | | return materialMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getSpecification(Integer id) { |
| | | return materialMapper.getTreeByMaterialId(id); |
| | | } |
| | | |
| | | /*根据样品名称,样品编号,型号规格获取型号id*/ |
| | | private Integer getSpecificationId(String name, String mcode, String specification) { |
| | | //获取物料id |