| | |
| | | public Result chooseVer(String name, String mcode, String specifications) { |
| | | return Result.success(inspectionService.chooseVer(name, mcode, specifications)); |
| | | } |
| | | @ApiOperation(value = "新增检验单-->选择检验项目版本-->查看该版本下我们要做的项目要求") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "name", value = "产品名称", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "mcode", value = "产品编号", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "specifications", value = "规格型号", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "version", value = "版本(默认最新版本)", dataTypeClass = Integer.class,required = true ), |
| | | @ApiImplicitParam(name = "experiment", value = "试验项目(委托专属)", dataTypeClass = String.class ) |
| | | }) |
| | | @GetMapping("/lookProByVer") |
| | | public Result lookProByVer(String name, String mcode, String specifications,Integer version,String experiment) { |
| | | return Result.success(inspectionService.lookProByVer(name, mcode, specifications,version,experiment)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "新增检验单") |
| | |
| | | @ApiImplicitParam(name = "pageSize", value = "每一页数量", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "materialCoding", value = "材料编码", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "materialName", value = "材料名称", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "condition", value = "状态", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "type", value = "状态", dataTypeClass = Integer.class), |
| | | @ApiImplicitParam(name = "createTime", value = "来料日期", dataTypeClass = String.class) |
| | | }) |
| | | @GetMapping("/selectAll") |
| | | public Result<?> selectRawMaterial(Integer pageSize, Integer pageNo, String materialCoding, String materialName, Integer condition, String createTime) { |
| | | IPage<RawMaterial> iPage = rawMaterialService.selectRawMaterial(materialCoding, materialName, condition, createTime, new Page<Objects>(pageNo, pageSize)); |
| | | public Result<?> selectRawMaterial(Integer pageSize, Integer pageNo, String materialCoding, String materialName, Integer type, String createTime) { |
| | | IPage<RawMaterial> iPage = rawMaterialService.selectRawMaterial(materialCoding, materialName, type, createTime, new Page<Objects>(pageNo, pageSize)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("row", iPage.getRecords()); |
| | | map.put("total", iPage.getTotal()); |
| | |
| | | */ |
| | | public interface RawMaterialMapper extends BaseMapper<RawMaterial> { |
| | | |
| | | IPage<RawMaterial> selectRawMaterial(String materialCoding, String materialName, Integer condition, String createTime, Page<Objects> page); |
| | | IPage<RawMaterial> selectRawMaterial(String materialCoding, String materialName, Integer type, String createTime, Page<Objects> page); |
| | | |
| | | |
| | | List<RawMaterial> selectRawmaAll(); |
| | | List<Map<String, Object>> selectRawmaAll(); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "报检日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private LocalDateTime inspectionDate; |
| | | private Date inspectionDate; |
| | | |
| | | @ApiModelProperty(value = "检验人") |
| | | private String surveyor; |
| | | |
| | | @ApiModelProperty(value = "检验日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private LocalDateTime dateSurvey; |
| | | private Date dateSurvey; |
| | | |
| | | @ApiModelProperty(value = "状态0:待检测;1:已检测") |
| | | private Integer condition; |
| | | private Integer type; |
| | | |
| | | // @TableLogic(value = "1", delval = "0") |
| | | @ApiModelProperty(value = "逻辑删除 正常>=1,删除<=0", hidden = true) |
| | |
| | | private Date createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @ApiModelProperty(value = "更新时间", hidden = true) |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty(value = "乐观锁", hidden = true) |
| | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | //新增检验单 |
| | | @Data |
| | | public class InspectionVo implements Serializable { |
| | | |
| | | //如果是原材料则id是选择原材料报检库中的id;如果是委托则id是选择委托报检库中委托样品的id |
| | | @JsonSerialize |
| | | private Integer id; |
| | | |
| | | /** |
| | | *检验类型 0:原材料;1:产品;2:半成品; |
| | |
| | | **/ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @NotBlank(message = "来料日期不能为空") |
| | | @NotNull(message = "来料日期不能为空") |
| | | private Date formTime; |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @NotBlank(message = "检验开始时间不能为空") |
| | | @NotNull(message = "检验开始时间不能为空") |
| | | private Date startTime; |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @NotBlank(message = "检验结束时间不能为空") |
| | | @NotNull(message = "检验结束时间不能为空") |
| | | private Date endTime; |
| | | |
| | | //试验项目 |
| | | @NotBlank(message = "试验项目不能为空") |
| | | //试验项目(委托专属) |
| | | @JsonSerialize |
| | | private String experiment; |
| | | |
| | | //版本(委托专属) |
| | | @JsonSerialize |
| | | @NotNull(message = "检验项目版本不能为空") |
| | | private Integer version; |
| | | } |
| | |
| | | IPage<Map<String, Object>> selectInspectsList(Page<Object> page, String message); |
| | | |
| | | /** |
| | | * 新增检验单-->选择检验项目版本 |
| | | * @param name |
| | | * @param mcode |
| | | * @param specifications |
| | | * @return |
| | | */ |
| | | List<Integer> chooseVer(String name, String mcode, String specifications); |
| | | |
| | | /** |
| | | * 新增检验单-->选择检验项目版本-->查看该版本下我们要做的项目要求 |
| | | * @param name |
| | | * @param mcode |
| | | * @param specifications |
| | | * @param version |
| | | * @return |
| | | */ |
| | | List<Map<String,Object>> lookProByVer(String name, String mcode, String specifications, Integer version,String experiment); |
| | | |
| | | /** |
| | | * 新增检验申请表 |
| | | * @param id |
| | | * @param |
| | |
| | | */ |
| | | String chooseUseProId(Integer id, Integer userProId); |
| | | |
| | | /** |
| | | * 新增检验单-->选择检验项目版本 |
| | | * @param name |
| | | * @param mcode |
| | | * @param specifications |
| | | * @return |
| | | */ |
| | | List<Map<String,Object>> chooseVer(String name, String mcode, String specifications); |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | public interface RawMaterialService extends IService<RawMaterial> { |
| | | |
| | | IPage<RawMaterial> selectRawMaterial(String materialCoding, String materialName, Integer condition, String createTime, Page<Objects> page); |
| | | IPage<RawMaterial> selectRawMaterial(String materialCoding, String materialName, Integer type, String createTime, Page<Objects> page); |
| | | |
| | | /** |
| | | * 查询原材料检验 |
| | | * |
| | | * @return |
| | | */ |
| | | List<RawMaterial> selectRawmaAll(); |
| | | List<Map<String, Object>> selectRawmaAll(); |
| | | |
| | | |
| | | } |
| | |
| | | @Resource |
| | | UserMapper userMapper; |
| | | |
| | | @Resource |
| | | RawMaterialMapper rawMaterialMapper; |
| | | |
| | | @Resource |
| | | LinkDetectionMapper linkDetectionMapper; |
| | | |
| | | |
| | | /** |
| | | * 查询检验申请单列表 |
| | |
| | | return inspectionMapper.selectInspectsList(page, message); |
| | | } |
| | | |
| | | //新增检验单-->选择检验项目版本 |
| | | @Override |
| | | public List<Integer> chooseVer(String name, String mcode, String specifications) { |
| | | Integer specificationId = getSpecificationId(name, mcode, specifications); |
| | | return productMapper.chooseVersion(specificationId); |
| | | } |
| | | |
| | | //新增检验单-->选择检验项目版本-->查看该版本下我们要做的项目要求 |
| | | @Override |
| | | public List<Map<String, Object>> lookProByVer(String name, String mcode, String specifications, Integer version, String experiment) { |
| | | Integer specificationId = getSpecificationId(name, mcode, specifications); |
| | | /*如果试验项目为空则是成品检验或者原材料检验则是展示该版本的所有项目检验要求参数*/ |
| | | if (ObjectUtils.isEmpty(experiment)) { |
| | | return productMapper.pageProductInformation(specificationId, version); |
| | | } |
| | | /*如果不为空则是委托检验,只展示我们要检验的项目要求参数*/ |
| | | //获取试验项目信息(结构,导线外径) |
| | | List<String> experiments = Arrays.stream(experiment.split(",")).collect(Collectors.toList()); |
| | | //根据型号id和项目信息查询项目信息 |
| | | List<Map<String, Object>> products = new ArrayList<>(); |
| | | for (String exper : experiments) { |
| | | List<Map<String, Object>> list = productMapper.selFath(specificationId, exper, version); |
| | | if (ObjectUtils.isEmpty(list)) { |
| | | Map<String, Object> project = productMapper.selNam(specificationId, exper, version); |
| | | products.add(project); |
| | | } |
| | | products.addAll(list); |
| | | } |
| | | return products; |
| | | } |
| | | |
| | | /** |
| | | * 新增检验申请表 |
| | | * |
| | | * @param id |
| | | * @param id 用户id |
| | | * @param |
| | | * @return |
| | | */ |
| | |
| | | .userId(id) |
| | | .build(); |
| | | inspectionMapper.insert(inspection); |
| | | /*如果是原材料检验,新增之后要更改原材料报检的状态和检验人,检验日期*/ |
| | | if (inspectionVo.getType()==0) { |
| | | RawMaterial rawMaterial = new RawMaterial(); |
| | | rawMaterial.setId(inspectionVo.getId()); |
| | | rawMaterial.setType(1); |
| | | rawMaterial.setSurveyor(userMapper.selectById(id).getName()); |
| | | rawMaterialMapper.updateById(rawMaterial); |
| | | } |
| | | /*如果是委托检验,新增之后要更改委托报检的状态*/ |
| | | else if (inspectionVo.getType()==2){ |
| | | LinkDetection linkDetection = new LinkDetection(); |
| | | linkDetection.setId(inspectionVo.getId()); |
| | | linkDetection.setInspectionStatus(2); |
| | | linkDetectionMapper.updateById(linkDetection); |
| | | } |
| | | /*新增检验样品表*/ |
| | | InspectionMaterial inspectionMaterial = InspectionMaterial.builder() |
| | | .code(inspectionVo.getMcode()) |
| | |
| | | /*新增检验项目表*/ |
| | | //根据样品名称编号以及型号规格获取型号id |
| | | Integer specificationId = getSpecificationId(inspectionVo.getName(), inspectionVo.getMcode(), inspectionVo.getSpecifications()); |
| | | //如果试验项目字段不为空 |
| | | //如果试验项目字段不为空则按该字段的项目进行匹配 |
| | | if (ObjectUtils.isNotEmpty(inspectionVo.getExperiment())) { |
| | | //获取试验项目信息(结构,导线外径) |
| | | List<String> experiments = Arrays.stream(inspectionVo.getExperiment().split(",")).collect(Collectors.toList()); |
| | |
| | | for (String experiment : experiments) { |
| | | List<Product> productList1 = productMapper.selectList(Wrappers.<Product>query() |
| | | .eq("specifications_id", specificationId) |
| | | .eq("father", experiment)); |
| | | .eq("father", experiment) |
| | | .eq("version", inspectionVo.getVersion())); |
| | | if (ObjectUtils.isEmpty(productList1)) { |
| | | Product product = productMapper.selectOne(Wrappers.<Product>query() |
| | | .eq("specifications_id", specificationId) |
| | | .isNull("father") |
| | | .eq("name", experiment)); |
| | | .eq("name", experiment) |
| | | .eq("version", inspectionVo.getVersion())); |
| | | products.add(product); |
| | | } else products.addAll(productList1); |
| | | } |
| | | |
| | | //将查询的项目信息构建成检验项目 |
| | | ArrayList<InspectionProduct> list = new ArrayList<>(); |
| | | for (Product product : products) { |
| | |
| | | .build(); |
| | | list.add(rawInsProduct); |
| | | } |
| | | |
| | | //检验项目批量添加 |
| | | inspectionProductService.saveBatch(list); |
| | | return inspection.getId(); |
| | | } |
| | | //todo:未完 |
| | | return null; |
| | | //如果试验项目为空则按照型号id在标准库里面全部匹配 |
| | | List<Product> productList = productMapper.selectList(Wrappers.<Product>query().eq("specifications_id", specificationId)); |
| | | //将查询的项目信息构建成检验项目 |
| | | ArrayList<InspectionProduct> list = new ArrayList<>(); |
| | | for (Product product : productList) { |
| | | InspectionProduct rawInsProduct = InspectionProduct.builder() |
| | | .name(product.getName()) |
| | | .unit(product.getUnit()) |
| | | .required(product.getRequired()) |
| | | .internal(product.getInternal()) |
| | | .inspectionMaterialId(inspectionMaterial.getId()) |
| | | .build(); |
| | | list.add(rawInsProduct); |
| | | } |
| | | //检验项目批量添加 |
| | | inspectionProductService.saveBatch(list); |
| | | return inspection.getId(); |
| | | } |
| | | |
| | | //根据检验单id查询原材料检验单详情 |
| | |
| | | inspectionProductMapper.updateById(inspectionProduct); |
| | | return "保存成功!"; |
| | | } |
| | | |
| | | |
| | | //新增检验单-->选择检验项目版本 |
| | | @Override |
| | | public List<Map<String, Object>> chooseVer(String name, String mcode, String specifications) { |
| | | Integer specificationId = getSpecificationId(name, mcode, specifications); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /*根据样品名称,样品编号,型号规格获取型号id*/ |
| | | private Integer getSpecificationId(String name, String mcode, String specification) { |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.yuanchu.limslaboratory.mapper.*; |
| | | import com.yuanchu.limslaboratory.pojo.*; |
| | | import com.yuanchu.limslaboratory.service.PlanService; |
| | |
| | | |
| | | @Resource |
| | | InspectionMapper inspectionMapper; |
| | | |
| | | @Resource |
| | | InspectionMaterialMapper inspectionMaterialMapper; |
| | | |
| | | @Resource |
| | | LinkDetectionMapper linkDetectionMapper; |
| | | |
| | | //查询检验计划 |
| | | @Override |
| | |
| | | Inspection inspection = new Inspection(); |
| | | inspection.setId(id); |
| | | inspection.setInspectionStatus(0); |
| | | //更新检验单 |
| | | inspectionMapper.updateById(inspection); |
| | | } else if (count == results.size()) { |
| | | Inspection inspection = new Inspection(); |
| | |
| | | report.setStatus(0); |
| | | report.setConclusion(conclusion); |
| | | report.setInspectionId(id); |
| | | //新增检验报告 |
| | | reportMapper.insert(report); |
| | | return "上报成功!"; |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<RawMaterial> selectRawMaterial(String materialCoding, String materialName, Integer condition, String createTime, Page<Objects> page) { |
| | | return rawMaterialMapper.selectRawMaterial(materialCoding, materialName, condition, createTime, page); |
| | | public IPage<RawMaterial> selectRawMaterial(String materialCoding, String materialName, Integer type, String createTime, Page<Objects> page) { |
| | | return rawMaterialMapper.selectRawMaterial(materialCoding, materialName, type, createTime, page); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<RawMaterial> selectRawmaAll() { |
| | | public List<Map<String, Object>> selectRawmaAll() { |
| | | return rawMaterialMapper.selectRawmaAll(); |
| | | } |
| | | |
| | |
| | | </select> |
| | | |
| | | <select id="selectLinkAll" resultType="java.util.Map"> |
| | | SELECT DATE_FORMAT(l.`inspection_time`, '%Y-%m-%d') formTime, |
| | | SELECT d.id , |
| | | DATE_FORMAT(l.`inspection_time`, '%Y-%m-%d') formTime, |
| | | l.`entrusted` supplier, |
| | | d.`sample_number` mcode, |
| | | d.`sample_name` name, |
| | |
| | | lims_laboratory.link_detection d |
| | | WHERE l.`id` = d.`link_basic_id` |
| | | AND l.`state` = 1 |
| | | and inspection_status = 1 |
| | | </select> |
| | | </mapper> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.yuanchu.limslaboratory.mapper.RawMaterialMapper"> |
| | | |
| | | <select id="selectRawMaterial" resultType="com.yuanchu.limslaboratory.pojo.RawMaterial"> |
| | | SELECT * |
| | | FROM raw_material r |
| | |
| | | <if test="materialName != null and materialName != ''"> |
| | | AND r.`material_name` LIKE CONCAT('%',#{materialName},'%') |
| | | </if> |
| | | <if test="condition != null and condition != ''"> |
| | | AND r.`condition` = #{condition} |
| | | <if test="type != null and type != ''"> |
| | | AND r.`type` = #{type} |
| | | </if> |
| | | <if test="createTime != null and createTime != ''"> |
| | | AND DATE_FORMAT(r.`create_time`,'%Y-%m-%d') = #{createTime} |
| | | </if> |
| | | </select> |
| | | <select id="selectRawmaAll" resultType="com.yuanchu.limslaboratory.pojo.RawMaterial"> |
| | | select * from lims_laboratory.raw_material where state=1 |
| | | <select id="selectRawmaAll" resultType="java.util.Map"> |
| | | select id, |
| | | supplier_name supplier, |
| | | material_coding mcode, |
| | | material_name name, |
| | | specifications_models specifications, |
| | | unit, |
| | | quantity num, |
| | | DATE_FORMAT(inspection_date, '%Y-%m-%d') startTime, |
| | | DATE_FORMAT(date_survey, '%Y-%m-%d') endTime, |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') formTime |
| | | from lims_laboratory.raw_material |
| | | where state = 1 |
| | | and type = 0 |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "标准项目ID", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "required", value = "标准值", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "internal", value = "内控值", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "internal", value = "内控值", dataTypeClass = String.class, required = true) |
| | | |
| | | }) |
| | |
| | | |
| | | //查询该型号下的所有试验项目(父类) |
| | | List<Map<String,Object>> chooseProject(Integer modelId); |
| | | |
| | | //根据项目父类,型号id,版本查询二级详情 |
| | | List<Map<String, Object>> selFath(Integer specificationId, String exper, Integer version); |
| | | |
| | | //根据项目父类为空,项目名,型号id,版本查询 |
| | | Map<String, Object> selNam(Integer specificationId, String exper, Integer version); |
| | | } |
| | |
| | | public Integer addVersion(Integer specificationsId) { |
| | | List<Product> productList = productMapper.selectList(Wrappers.<Product>query().eq("specifications_id", specificationsId)); |
| | | for (Product product : productList) { |
| | | product.setId(null); |
| | | product.setVersion(product.getVersion()+1); |
| | | product.setSpecifications_id(specificationsId); |
| | | } |
| | | saveBatch(productList); |
| | | return productList.get(0).getVersion(); |
| | |
| | | where state = 1 |
| | | and specifications_id = #{modelId} |
| | | </select> |
| | | |
| | | <!--根据项目父类,型号id,版本查询二级详情--> |
| | | <select id="selFath" resultMap="pageProductInformationMap"> |
| | | select id, |
| | | name, |
| | | father, |
| | | unit, |
| | | required, |
| | | internal, |
| | | version |
| | | from lims_laboratory.product |
| | | where state = 1 |
| | | and specifications_id = #{specificationId} |
| | | and version = #{version} |
| | | and father = #{exper} |
| | | </select> |
| | | |
| | | <!--根据项目父类为空,项目名,型号id,版本查询--> |
| | | <select id="selNam" resultType="java.util.Map"> |
| | | select id, |
| | | name, |
| | | unit, |
| | | required, |
| | | internal, |
| | | version |
| | | from lims_laboratory.product |
| | | where state = 1 |
| | | and specifications_id = #{specificationId} |
| | | and version = #{version} |
| | | and name = #{exper} |
| | | and father is null |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | @ApiModelProperty(value = "角色id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "角色名") |
| | | private String name; |
| | |
| | | private Integer version; |
| | | |
| | | @ApiModelProperty(value = "关联 角色id") |
| | | private Integer roleId; |
| | | private Long roleId; |
| | | |
| | | @ApiModelProperty(value = "关联 企业id") |
| | | private Integer enterpriseId; |
| | |
| | | private String account; |
| | | |
| | | @ApiModelProperty(value = "0:无权限;1:有权限", example = "1", required = true) |
| | | private Integer role_id; |
| | | private Long role_id; |
| | | |
| | | @ApiModelProperty(value = "年龄", example = "23") |
| | | private Integer age; |
| | |
| | | private String account; |
| | | |
| | | @ApiModelProperty(value = "0:无权限;1:有权限", example = "1", required = true) |
| | | private Integer role_id; |
| | | private Long role_id; |
| | | |
| | | @ApiModelProperty(value = "年龄", example = "23") |
| | | private Integer age; |