| | |
| | | return Result.success(insOrderPlanService.getRepetitionTag(id, laboratory, cableTag)); |
| | | } |
| | | |
| | | @ApiOperation("获取不合格数据") |
| | | @GetMapping("/getInsProductUnqualified") |
| | | public Result<?> getInsProductUnqualified(InsOrderPlanProductDto insOrderPlanProductDto) { |
| | | return Result.success(insOrderPlanService.getInsProductUnqualified(insOrderPlanProductDto)); |
| | | } |
| | | |
| | | @ApiOperation("新增不合格复测信息") |
| | | @PostMapping("/addUnqualifiedRetest") |
| | | public Result<?> addDisqualificationRetest(@RequestBody Map<String, Object> params) { |
| | | // 获取检验对象的id |
| | | List<Integer> ids = (List<Integer>) params.get("ids"); |
| | | return Result.success(insOrderPlanService.addDisqualificationRetest(ids)); |
| | | public Result<?> addDisqualificationRetest(@RequestBody List<InsProduct> insProductsList) { |
| | | return Result.success(insOrderPlanService.addDisqualificationRetest(insProductsList)); |
| | | } |
| | | |
| | | @ApiOperation("获取不合格复测数据") |
| | | @GetMapping("/getInsProductUnqualifiedRetest") |
| | | public Result<?> getInsProductUnqualifiedRetest(Integer id, Integer type, String laboratory, String cableTag, String rawMaterialTag, String retestTag) { |
| | | return Result.success(insOrderPlanService.getInsProductUnqualifiedRetest(id, type, laboratory, cableTag, rawMaterialTag, retestTag)); |
| | | public Result<?> getInsProductUnqualifiedRetest(InsOrderPlanProductDto insOrderPlanProductDto) { |
| | | return Result.success(insOrderPlanService.getInsProductUnqualifiedRetest(insOrderPlanProductDto)); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param param 模板内容 |
| | | * @param currentTable 当前模板id |
| | | * @param sampleId 当前样品id |
| | | * @param orderId 当前订单id |
| | | * @param sonLaboratory 子试验室 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "保存不合格复测检验内容") |
| | | @ApiOperation(value = "保存 不合格复测检验内容") |
| | | @PostMapping("/saveUnqualifiedContext") |
| | | public Result<?> saveUnqualifiedContext(String param, Integer currentTable, Integer sampleId, Integer orderId, String sonLaboratory) { |
| | | Map<String, Object> param2 = JSON.parseObject(param, Map.class); |
| | | insOrderPlanService.saveUnqualifiedContext(param2, currentTable, sampleId, orderId, sonLaboratory); |
| | | public Result<?> saveUnqualifiedContext(@RequestBody SaveInsContextDto saveInsContextDto) { |
| | | Map<String, Object> param2 = JSON.parseObject(saveInsContextDto.getParam(), Map.class); |
| | | insOrderPlanService.saveUnqualifiedContext(param2, saveInsContextDto.getCurrentTable(), saveInsContextDto.getSampleId(), saveInsContextDto.getOrderId(), saveInsContextDto.getSonLaboratory()); |
| | | return Result.success(); |
| | | } |
| | | |
| | |
| | | @ApiModelProperty("成品下单重复标识") |
| | | private String repetitionTag; |
| | | |
| | | @ApiModelProperty("不合格复测重复次数") |
| | | private String retestTag; |
| | | |
| | | } |
| | |
| | | * @param laboratory |
| | | * @return |
| | | */ |
| | | List<InsProduct> getInsProduct1(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("cableTag") String cableTag, @Param("repetitionTag") String repetitionTag, @Param("isDisqualification") String isDisqualification); |
| | | List<InsProduct> getInsProduct1(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("cableTag") String cableTag, @Param("repetitionTag") String repetitionTag); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param rawMaterialTag |
| | | * @return |
| | | */ |
| | | List<InsProduct> getInsProduct6(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("rawMaterialTag") String rawMaterialTag, @Param("isDisqualification") String isDisqualification); |
| | | List<InsProduct> getInsProduct6(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("rawMaterialTag") String rawMaterialTag); |
| | | |
| | | SampleVo getDetailById(@Param("sampleId") Integer sampleId); |
| | | |
| | |
| | | List<InsUnqualifiedRetestProduct> selectRetestProduct(@Param("ids") List<Integer> ids); |
| | | |
| | | // 样品 |
| | | List<InsProduct> getInsProductUnqualifiedRetest1(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("retestTag") String retestTag); |
| | | List<InsProduct> getInsProductUnqualifiedRetest1(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("cableTag") String cableTag, @Param("repetitionTag") String repetitionTag, @Param("retestTag") String retestTag); |
| | | |
| | | // 电缆配置 |
| | | List<InsProduct> getInsProductUnqualifiedRetest5(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("cableTag") String cableTag, @Param("retestTag") String retestTag); |
| | | |
| | | // 原材料下单 |
| | | List<InsProduct> getInsProductUnqualifiedRetest6(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("rawMaterialTag") String rawMaterialTag, @Param("retestTag") String retestTag); |
| | | List<InsProduct> getInsProductUnqualifiedRetest6(@Param("id") Integer id, @Param("laboratory") String laboratory, @Param("rawMaterialTag") String rawMaterialTag , @Param("retestTag") String retestTag); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | private Integer id; |
| | | //外键:ins_product表id |
| | | private Integer insProductId; |
| | | |
| | | @ApiModelProperty("项目参数id") |
| | | private Integer structureItemParameterId; |
| | | //检验项 |
| | | private String inspectionItem; |
| | | //检验项子类 |
| | |
| | | private String radius; |
| | | //电缆标识 |
| | | private String cableTag; |
| | | // 重复标识 |
| | | private String repetitionTag; |
| | | //原材料批量标识 |
| | | private String rawMaterialTag; |
| | | //复测次数标识 |
| | | private String retestTag; |
| | | //排序 |
| | | private Integer sort; |
| | | // 绑定值不参加展示, 只参加计算 |
| | | @ApiModelProperty(value = "是否是绑定值, 0否, 1是") |
| | | private Integer isBinding; |
| | | |
| | | @ApiModelProperty(value = "自关联(绑定id)") |
| | | private Integer bindingProductId; |
| | | } |
| | | |
| | |
| | | import com.ruoyi.inspect.pojo.InsProduct; |
| | | import com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo; |
| | | import com.ruoyi.inspect.vo.InsOrderPlanVO; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | List<Map<String, Object>> getRepetitionTag(Integer id, String laboratory, String cableTag); |
| | | |
| | | /** |
| | | * 获取不合格数据 |
| | | * @return |
| | | */ |
| | | List<InsProduct> getInsProductUnqualified(InsOrderPlanProductDto insOrderPlanProductDto); |
| | | |
| | | /** |
| | | * 新增不合格复测内容给 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | boolean addDisqualificationRetest(List<Integer> ids); |
| | | boolean addDisqualificationRetest(List<InsProduct> insProductsList); |
| | | |
| | | /** |
| | | * 获取不合格复测数据 |
| | | * @param id |
| | | * @param type |
| | | * @param laboratory |
| | | * @param cableTag |
| | | * @param rawMaterialTag |
| | | * @param retestTag |
| | | * @return |
| | | */ |
| | | List<InsProduct> getInsProductUnqualifiedRetest(Integer id, Integer type, String laboratory, String cableTag, String rawMaterialTag, String retestTag); |
| | | List<InsProduct> getInsProductUnqualifiedRetest(InsOrderPlanProductDto insOrderPlanProductDto); |
| | | |
| | | /** |
| | | * 保存不合格复测检验内容 |
| | |
| | | List<InsProduct> insProducts = new ArrayList<>(); |
| | | switch (dto.getType()) { |
| | | case 0: |
| | | insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), null); |
| | | //样品 |
| | | break; |
| | | case 4: |
| | | //电缆配置 |
| | | insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), null); |
| | | //委托 |
| | | insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag()); |
| | | break; |
| | | case 5: |
| | | //原材料下单 |
| | | insProducts = insSampleMapper.getInsProduct6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag(), null); |
| | | insProducts = insSampleMapper.getInsProduct6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag()); |
| | | break; |
| | | } |
| | | if (BeanUtil.isEmpty(insProducts)) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取不合格数据 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<InsProduct> getInsProductUnqualified(InsOrderPlanProductDto dto) { |
| | | List<InsProduct> insProducts = new ArrayList<>(); |
| | | switch (dto.getType()) { |
| | | case 0: |
| | | //样品 |
| | | insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), "1"); |
| | | break; |
| | | case 4: |
| | | //电缆配置 |
| | | insProducts = insSampleMapper.getInsProduct1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), "1"); |
| | | break; |
| | | case 5: |
| | | //原材料下单 |
| | | insProducts = insSampleMapper.getInsProduct6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag(), "1"); |
| | | break; |
| | | } |
| | | return insProducts; |
| | | } |
| | | |
| | | /** |
| | | * 新增不合格复测内容 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addDisqualificationRetest(List<Integer> ids) { |
| | | public boolean addDisqualificationRetest(List<InsProduct> insProductsList) { |
| | | List<Integer> ids = insProductsList.stream().map(InsProduct::getId).collect(Collectors.toList()); |
| | | |
| | | // 判断之前是否添加过 |
| | | Long count = insUnqualifiedRetestProductMapper.selectCount(Wrappers.<InsUnqualifiedRetestProduct>lambdaQuery() |
| | | .in(InsUnqualifiedRetestProduct::getInsProductId, ids)); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<InsProduct> getInsProductUnqualifiedRetest(Integer id, Integer type, String laboratory, String cableTag, String rawMaterialTag, String retestTag) { |
| | | public List<InsProduct> getInsProductUnqualifiedRetest(InsOrderPlanProductDto dto) { |
| | | |
| | | List<InsProduct> insProducts = new ArrayList<>(); |
| | | switch (type) { |
| | | switch (dto.getType()) { |
| | | case 0: |
| | | //样品 |
| | | insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest1(id, laboratory, retestTag); |
| | | break; |
| | | case 4: |
| | | //电缆配置 |
| | | insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest5(id, laboratory, cableTag, retestTag); |
| | | //委托 |
| | | insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest1(dto.getId(), dto.getLaboratory(), dto.getCableTag(), dto.getRepetitionTag(), dto.getRetestTag()); |
| | | break; |
| | | case 5: |
| | | //原材料下单 |
| | | insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest6(id, laboratory, rawMaterialTag, retestTag); |
| | | insProducts = insUnqualifiedRetestProductMapper.getInsProductUnqualifiedRetest6(dto.getId(), dto.getLaboratory(), dto.getRawMaterialTag(), dto.getRetestTag()); |
| | | break; |
| | | } |
| | | if (BeanUtil.isEmpty(insProducts)) { |
| | | return null; |
| | | } |
| | | InsOrder order = insOrderMapper.selectFirstSubmit(id); |
| | | InsOrder order = insOrderMapper.selectFirstSubmit(dto.getId()); |
| | | getTemplateThing(order, Collections.unmodifiableList(insProducts)); |
| | | return insProducts; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存不合格复测检验内容 |
| | | * @param currentTable |
| | | * @param orderId |
| | | * @param sonLaboratory |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveUnqualifiedContext(Map<String, Object> insContext, Integer currentTable, Integer currentSampleId, Integer orderId, String sonLaboratory) { |
| | |
| | | BeanUtil.copyProperties(oldResults.get(0), newResult); |
| | | } |
| | | newResult.setRetestProductId(Integer.parseInt(k)); |
| | | |
| | | /*校验一下result表*/ |
| | | if (oldResults.size() > 1) { |
| | | for (int i = 1; i < oldResults.size(); i++) { |
| | | insUnqualifiedRetestResultMapper.deleteById(oldResults.get(i)); |
| | | } |
| | | } |
| | | |
| | | //检验值 |
| | | if (jo.get("insValue") != null) { |
| | | JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(jo.get("insValue"))); |
| | |
| | | for (Object o : jsonArray2) { |
| | | JSONObject comValue = JSON.parseObject(JSON.toJSONString(o)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("r", JSON.toJSONString(comValue.get("r"))); |
| | | map.put("c", JSON.toJSONString(comValue.get("c"))); |
| | | map.put("v", JSON.parseObject(JSON.toJSONString(comValue.get("v"))).get("v")); |
| | | cv.add(map); |
| | | } |
| | |
| | | insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId())); |
| | | |
| | | |
| | | InsSample insSample = insSampleMapper.selectById(insProductMapper.selectById(insProduct.getId()).getInsSampleId()); |
| | | insSample.setInsState(1); |
| | | Long l = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId())); |
| | | Long l1 = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId()) |
| | | .and(wrapper -> wrapper |
| | | .isNotNull(InsProduct::getInsResult) |
| | | .or() |
| | | .ne(InsProduct::getInsResult, 2) |
| | | )); |
| | | if (Objects.equals(l, l1)) { |
| | | insSample.setInsState(2); |
| | | } |
| | | insSampleMapper.updateById(insSample); |
| | | /*校验一下result表*/ |
| | | List<InsUnqualifiedRetestResult> insProductResults = insUnqualifiedRetestResultMapper.selectList(Wrappers.<InsUnqualifiedRetestResult>lambdaQuery() |
| | | .eq(InsUnqualifiedRetestResult::getRetestProductId, insProduct.getId())); |
| | | .eq(InsUnqualifiedRetestResult::getRetestProductId, product.getId())); |
| | | if (insProductResults.size() > 1) { |
| | | for (int i = 1; i < insProductResults.size(); i++) { |
| | | insUnqualifiedRetestResultMapper.deleteById(insProductResults.get(i)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | }); |
| | | String sampleIdStr = insContext.keySet().stream().findFirst().orElse(null); |
| | | if (sampleIdStr != null) { |
| | | int count = insProductMapper.selectInsProductCountByOrderId(orderId); |
| | | if (count == 0) { |
| | | insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate() |
| | | .eq(InsOrderState::getInsOrderId, orderId) |
| | | .eq(InsOrderState::getLaboratory, sonLaboratory) |
| | | .set(InsOrderState::getInsState, 2)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | LEFT JOIN ins_product ip ON isa.id = ip.ins_sample_id |
| | | WHERE ip.state = 1 |
| | | AND isa.id = #{id} |
| | | and ip.is_binding != 1 |
| | | GROUP BY ip.inspection_item, |
| | | ip.inspection_item_subclass, |
| | | ip.inspection_item_class |
| | |
| | | <if test="repetitionTag != null and repetitionTag != ''"> |
| | | and ip.repetition_tag = #{repetitionTag} |
| | | </if> |
| | | <if test="isDisqualification != null and isDisqualification != ''"> |
| | | and ip.ins_result = 0 |
| | | </if> |
| | | order by sort asc |
| | | </select> |
| | | |
| | |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | and ip.raw_material_tag = #{rawMaterialTag} |
| | | <if test="isDisqualification != null and isDisqualification != ''"> |
| | | and ip.ins_result = 0 |
| | | </if> |
| | | order by sort asc |
| | | </select> |
| | | |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="getInsProducSql"> |
| | | ip.id ip_id, |
| | | ip.id ip_id, |
| | | inspection_item, |
| | | inspection_item_en, |
| | | inspection_item_class, |
| | |
| | | ip.method_s, |
| | | ip.tell, |
| | | ip.dic, |
| | | ip.cable_tag |
| | | ip.sort, |
| | | ip.cable_tag, |
| | | ip.structure_item_parameter_id |
| | | </sql> |
| | | |
| | | <select id="selectRetestProduct" resultType="com.ruoyi.inspect.pojo.InsUnqualifiedRetestProduct"> |
| | |
| | | select <include refid="getInsProducSql"/> |
| | | from ins_unqualified_retest_product ip |
| | | left join ins_unqualified_retest_result ipr on ip.id = ipr.retest_product_id |
| | | where ins_sample_id = #{id} |
| | | and state = 1 |
| | | and ip.son_laboratory = #{laboratory} |
| | | and ins_fiber_id is null |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | and ip.cable_tag is null |
| | | and ip.retest_tag = #{retestTag} |
| | | </select> |
| | | <select id="getInsProductUnqualifiedRetest5" resultMap="product"> |
| | | select <include refid="getInsProducSql"/> |
| | | from ins_unqualified_retest_product ip |
| | | left join ins_unqualified_retest_result ipr on ip.id = ipr.retest_product_id |
| | | where ins_sample_id = #{id} |
| | | and state = 1 |
| | | and ip.son_laboratory = #{laboratory} |
| | | and ins_fiber_id is null |
| | | and ins_fibers_id is null |
| | | and standard_method_list_id is not null |
| | | and ip.cable_tag = #{cableTag} |
| | | /* 电缆配置标识 */ |
| | | <if test="cableTag == null or cableTag == ''"> |
| | | and ip.cable_tag is null |
| | | </if> |
| | | <if test="cableTag != null and cableTag != ''"> |
| | | and ip.cable_tag = #{cableTag} |
| | | </if> |
| | | /* 重复值标识 */ |
| | | <if test="repetitionTag == null or repetitionTag == ''"> |
| | | and ip.repetition_tag is null |
| | | </if> |
| | | <if test="repetitionTag != null and repetitionTag != ''"> |
| | | and ip.repetition_tag = #{repetitionTag} |
| | | </if> |
| | | and ip.retest_tag = #{retestTag} |
| | | order by sort asc |
| | | </select> |
| | | |
| | | <select id="getInsProductUnqualifiedRetest6" resultMap="product"> |
| | | select <include refid="getInsProducSql"/> |
| | | from ins_unqualified_retest_product ip |
| | |
| | | and standard_method_list_id is not null |
| | | and ip.raw_material_tag = #{rawMaterialTag} |
| | | and ip.retest_tag = #{retestTag} |
| | | order by sort asc |
| | | </select> |
| | | </mapper> |