| | |
| | | import com.ruoyi.basic.service.StandardMethodListService; |
| | | import com.ruoyi.basic.service.StandardProductListSupplierAskService; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.basic.service.StandardProductListService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.aspectj.weaver.ast.Var; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | private ProductPartMapper productPartMapper; |
| | | |
| | | private StructureTestObjectPartMapper structureTestObjectPartMapper; |
| | | private StructureTestObjectPartMapper structureTestObjectPartMapper; |
| | | |
| | | @Autowired |
| | | private StandardMethodListService standardMethodListService; |
| | | |
| | | @Autowired |
| | | private StructureItemParameterMapper structureItemParameterMapper; |
| | | |
| | | @Autowired |
| | | private ModelMapper modelMapper; |
| | | |
| | | @Autowired |
| | | private StandardProductListBackupRelMapper standardProductListBackupRelMapper; |
| | | |
| | | @Autowired |
| | | private StandardProductListUpdateRecordMapper standardProductListUpdateRecordMapper; |
| | | |
| | | @Autowired |
| | | private StandardProductListUpdateRecordRelMapper standardProductListUpdateRecordRelMapper; |
| | | |
| | | @Autowired |
| | | private StandardProductListSupplierAskService standardProductListSupplierAskService; |
| | | |
| | | @Autowired |
| | | private StandardProductListSupplierAskBackupRelMapper standardProductListSupplierAskBackupRelMapper; |
| | | private StandardProductListSupplierAskBackupRelMapper standardProductListSupplierAskBackupRelMapper; |
| | | |
| | | @Autowired |
| | | private StandardMethodMapper standardMethodMapper; |
| | | |
| | | |
| | |
| | | public int upStandardProductList(StandardProductList list) { |
| | | // æ ¹æ®id æ¥è¯¢å°åå§å¼ |
| | | StandardProductList standardProductList = standardProductListMapper.selectById(list.getId()); |
| | | if(ObjectUtils.isEmpty(standardProductList)){ |
| | | if (ObjectUtils.isEmpty(standardProductList)) { |
| | | throw new RuntimeException("æ´æ°å¤±è´¥,æªæ¥æ¾å°æ£æ¥é¡¹"); |
| | | } |
| | | // 夿å½åç¶æ 妿æ¯å®¡æ ¸ä¸ |
| | | if(StandardProductListChcekTypeEnums.CHECK_ING.getCode().equals(list.getCheckStatus())){ |
| | | if (StandardProductListChcekTypeEnums.CHECK_ING.getCode().equals(list.getCheckStatus())) { |
| | | throw new RuntimeException("å®¡æ ¸ä¸ä¸æ¯æä¿®æ¹"); |
| | | } |
| | | // 夿æ£éªé¡¹æ¯å¦ä¸ºæ¯å¦å§æè¦æ± æ¯çè¯ä¸éè¦åå¤ä»½åç¶æä¿®æ¹ç´æ¥æ´æ° |
| | | StructureItemParameter structureItemParameter = structureItemParameterMapper.selectById(standardProductList.getStructureItemParameterId()); |
| | | if(!ObjectUtils.isEmpty(structureItemParameter) && "1".equals(structureItemParameter.getDelegateRequestFlag())){ |
| | | if (!ObjectUtils.isEmpty(structureItemParameter) && "1".equals(structureItemParameter.getDelegateRequestFlag())) { |
| | | return standardProductListMapper.updateById(list); |
| | | } |
| | | // 夿æ¯å¦ä¸ºçæçä¿®æ¹å¦ææ¯ä¸åå¤ä»½ |
| | | if(null != list.getState()){ |
| | | if (null != list.getState()) { |
| | | return standardProductListMapper.updateById(list); |
| | | } |
| | | // æ¥è¯¢ææ°ç䏿¬¡å
³èå¤ä»½ 妿åå¨è¯´ææªå®¡æ ¸å®ç»§ç»ä¿®æ¹äºãä¸åæ°æ®å¤çã |
| | | StandardProductListBackupRel standardProductListBackupRel = standardProductListBackupRelMapper.selectById(list.getId()); |
| | | if(ObjectUtils.isEmpty(standardProductListBackupRel)){ |
| | | if (ObjectUtils.isEmpty(standardProductListBackupRel)) { |
| | | StandardProductListBackupRel productListBackupRel = new StandardProductListBackupRel(); |
| | | BeanUtils.copyProperties(standardProductList, productListBackupRel); |
| | | standardProductListBackupRelMapper.insert(productListBackupRel); |
| | |
| | | standardProductListDto.setStandardMethodListIds(insSample.getStandardMethodListIds()); |
| | | standardProductListDto.setState(insSample.getState()); |
| | | List<StandardProductList> list = new ArrayList<>(); |
| | | if(CollectionUtils.isEmpty(standardProductListDto.getStandardMethodListIds())) { |
| | | if (CollectionUtils.isEmpty(standardProductListDto.getStandardMethodListIds())) { |
| | | return list; |
| | | } |
| | | list = standardProductListMapper.standardProductListNoPage(standardProductListDto); |
| | |
| | | } |
| | | |
| | | ProductPart productPart = productPartMapper.selectOne(new LambdaQueryWrapper<ProductPart>().eq(ProductPart::getPartNo, insSample.getPartNo())); |
| | | if (productPart != null){ |
| | | if (StringUtils.isNotEmpty(productPart.getInspectionItem())){ |
| | | if (productPart != null) { |
| | | if (StringUtils.isNotEmpty(productPart.getInspectionItem())) { |
| | | String inspectionItem = productPart.getInspectionItem(); |
| | | list = list.stream() |
| | | .filter(standardProductList -> inspectionItem.equals(standardProductList.getInspectionItem())) |
| | |
| | | } |
| | | |
| | | StructureTestObjectPart structureTestObjectPart = structureTestObjectPartMapper.selectOne(new LambdaQueryWrapper<StructureTestObjectPart>().eq(StructureTestObjectPart::getPartNo, insSample.getPartNo())); |
| | | if (structureTestObjectPart != null){ |
| | | if (StringUtils.isNotEmpty(structureTestObjectPart.getInspectionItem())){ |
| | | if (structureTestObjectPart != null) { |
| | | if (StringUtils.isNotEmpty(structureTestObjectPart.getInspectionItem())) { |
| | | String inspectionItem = structureTestObjectPart.getInspectionItem(); |
| | | list = list.stream() |
| | | .filter(standardProductList -> inspectionItem.equals(standardProductList.getInspectionItem())) |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param str å¤å®å
¬å¼ |
| | | * @param model åå· |
| | | * @param standardCores è¯æ° |
| | | * @param conductorMaterial å¯¼ä½æè´¨ |
| | | * @param conductorType 导ä½ç±»å |
| | | * @param str å¤å®å
¬å¼ |
| | | * @param model åå· |
| | | * @param standardCores è¯æ° |
| | | * @param conductorMaterial å¯¼ä½æè´¨ |
| | | * @param conductorType 导ä½ç±»å |
| | | * @param insSample |
| | | * @return |
| | | */ |
| | | private boolean getIsIf(String str, String model, String standardCores, String conductorMaterial, String conductorType,InsSampleReceiveDto insSample) { |
| | | private boolean getIsIf(String str, String model, String standardCores, String conductorMaterial, String conductorType, InsSampleReceiveDto insSample) { |
| | | Matcher matcher = Pattern.compile("\\d+(\\.\\d+)?").matcher(model); |
| | | String model2 = ""; |
| | | while (matcher.find()) { |
| | |
| | | boolean existWorkShopFlag = standardMethodListService.existWorkShop(tree); |
| | | // æ¼æ¥æ |
| | | String[] trees = tree.split(" - "); |
| | | if(trees == null && trees.length < 4){ |
| | | if (trees == null && trees.length < 4) { |
| | | return map; |
| | | } |
| | | // 车é´å±çº§å¤ä¸å±çº§ |
| | | if(existWorkShopFlag){ |
| | | if (existWorkShopFlag) { |
| | | switch (trees.length) { |
| | | case 7: |
| | | sampleType = trees[4]; |
| | |
| | | checkItemQueryTree.append("[").append("\"").append(trees[4]).append("\"").append("]"); |
| | | break; |
| | | } |
| | | }else { |
| | | } else { |
| | | switch (trees.length) { |
| | | case 6: |
| | | sampleType = trees[3]; |
| | |
| | | break; |
| | | } |
| | | } |
| | | if(StringUtils.isEmpty(checkItemQueryTree.toString())){ |
| | | if (StringUtils.isEmpty(checkItemQueryTree.toString())) { |
| | | return map; |
| | | } |
| | | // 夿æ¯å¦ä¸ºå§æè¦æ±æ å |
| | | StandardMethod standardMethod = standardMethodMapper.selectById(id); |
| | | if(ObjectUtils.isEmpty(standardMethod)){ |
| | | if (ObjectUtils.isEmpty(standardMethod)) { |
| | | return map; |
| | | } |
| | | StructureItemParameterDto structureItemParameterDto = new StructureItemParameterDto(); |
| | | if(standardMethod.getName().equals("å§æè¦æ±")){ |
| | | if (standardMethod.getName().equals("å§æè¦æ±")) { |
| | | structureItemParameterDto.setDelegateRequestFlag("1"); |
| | | }else { |
| | | } else { |
| | | structureItemParameterDto.setDelegateRequestFlag("0"); |
| | | } |
| | | structureItemParameterDto.setTree(checkItemQueryTree.toString()); |
| | |
| | | // æ ¹æ®æ£éªå¯¹è±¡/äº§åæ¥è¯¢æ£éªé¡¹ |
| | | List<StructureItemParameter> structureItemParameterList = structureItemParameterMapper.selectItemParameterBySample(structureItemParameterDto); |
| | | // 妿æ¯äº§åçæ£æ¥é¡¹ä¸ºç©ºå䏿¨ |
| | | if(CollectionUtils.isEmpty(structureItemParameterList)){ |
| | | if (CollectionUtils.isEmpty(structureItemParameterList)) { |
| | | String query = "[\"" + sampleType + "\"]"; |
| | | structureItemParameterDto.setTree(query); |
| | | structureItemParameterList = structureItemParameterMapper.selectItemParameterBySample(structureItemParameterDto); |
| | |
| | | boolean existFlag = false; |
| | | // 夿æ¯å¦å·²ç»å® |
| | | for (StandardProductList productList : standardProductList) { |
| | | if(structureItemParameter.getId().equals(productList.getStructureItemParameterId())) { |
| | | if (structureItemParameter.getId().equals(productList.getStructureItemParameterId())) { |
| | | BeanUtils.copyProperties(productList, addStandProductList); |
| | | existFlag = true; |
| | | break; |
| | | } |
| | | } |
| | | // 妿æªç»å® |
| | | if(!existFlag){ |
| | | if (!existFlag) { |
| | | BeanUtils.copyProperties(structureItemParameter, addStandProductList); |
| | | addStandProductList.setTell(structureItemParameter.getAskTell()); |
| | | addStandProductList.setStructureItemParameterId(structureItemParameter.getId()); |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹æ ååºåºé´ |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | |
| | | public boolean updateSection(StandardProductList list) { |
| | | // æ ¹æ®id æ¥è¯¢å°åå§å¼ |
| | | StandardProductList standardProductList = standardProductListMapper.selectById(list.getId()); |
| | | if(ObjectUtils.isEmpty(standardProductList)){ |
| | | if (ObjectUtils.isEmpty(standardProductList)) { |
| | | throw new RuntimeException("æ´æ°å¤±è´¥,æªæ¥æ¾å°æ£æ¥é¡¹"); |
| | | } |
| | | // 夿å½åç¶æ 妿æ¯å®¡æ ¸ä¸ |
| | | if(StandardProductListChcekTypeEnums.CHECK_ING.getCode().equals(list.getCheckStatus())){ |
| | | if (StandardProductListChcekTypeEnums.CHECK_ING.getCode().equals(list.getCheckStatus())) { |
| | | throw new RuntimeException("å®¡æ ¸ä¸ä¸æ¯æä¿®æ¹"); |
| | | } |
| | | // æ¥è¯¢ææ°ç䏿¬¡å
³èå¤ä»½ 妿åå¨è¯´ææªå®¡æ ¸å®ç»§ç»ä¿®æ¹äºãä¸åæ°æ®å¤çã |
| | | StandardProductListBackupRel standardProductListBackupRel = standardProductListBackupRelMapper.selectById(list.getId()); |
| | | if(ObjectUtils.isEmpty(standardProductListBackupRel)){ |
| | | if (ObjectUtils.isEmpty(standardProductListBackupRel)) { |
| | | StandardProductListBackupRel productListBackupRel = new StandardProductListBackupRel(); |
| | | BeanUtils.copyProperties(standardProductList, productListBackupRel); |
| | | standardProductListBackupRelMapper.insert(productListBackupRel); |
| | |
| | | |
| | | /** |
| | | * æ ååºææ½ |
| | | * |
| | | * @param resetTreeDragDTO |
| | | */ |
| | | @Override |
| | |
| | | resetTreeDragDTO.getTree()); |
| | | |
| | | // ä»ä¸å¾ä¸ |
| | | } else if (beginIndex > endIndex){ |
| | | } else if (beginIndex > endIndex) { |
| | | standardProductListMapper.updateSortDown(beginIndex, |
| | | endIndex, |
| | | methodId, |
| | |
| | | |
| | | /** |
| | | * æ£éªé¡¹è¦æ±å¼å¯¹æ¯ |
| | | * |
| | | * @param copyDto |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ£éªé¡¹å¤å¶å¯¹æ¯ä¸ä¸ª |
| | | * |
| | | * @param dto |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ£éªé¡¹å¤å¶æåº |
| | | * |
| | | * @param copyDto |
| | | * @return |
| | | */ |
| | |
| | | public void productListSubmit(StandardProductListUpdateRecord standardProductListUpdateRecord) { |
| | | // æ¥è¯¢ææå¾
å®¡æ ¸çæ°æ® |
| | | QueryWrapper<StandardProductList> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("check_status",StandardProductListChcekTypeEnums.WAIT_CHECK.getCode()); |
| | | queryWrapper.eq("check_status", StandardProductListChcekTypeEnums.WAIT_CHECK.getCode()); |
| | | List<StandardProductList> unCheckStandardProductListArray = standardProductListMapper.selectList(queryWrapper); |
| | | if(CollectionUtils.isEmpty(unCheckStandardProductListArray)){ |
| | | if (CollectionUtils.isEmpty(unCheckStandardProductListArray)) { |
| | | throw new RuntimeException("ææ ä¿®æ¹æ°æ®"); |
| | | } |
| | | List<Long> standardProductListIds = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | // ä¿®æ¹æ åæ ä¸æ£æ¥é¡¹ç¶æä¸ºå®¡æ ¸ä¸ |
| | | standardProductListMapper.updateProductListCheckStatus(standardProductListIds,StandardProductListChcekTypeEnums.CHECK_ING.getCode()); |
| | | standardProductListMapper.updateProductListCheckStatus(standardProductListIds, StandardProductListChcekTypeEnums.CHECK_ING.getCode()); |
| | | } |
| | | |
| | | /** |
| | | * æ åæ ä¸æ£éªé¡¹å®¡æ ¸ |
| | | * |
| | | * @param standardProductListUpdateRecord |
| | | */ |
| | | @Override |
| | |
| | | public void productListCheck(StandardProductListUpdateRecord standardProductListUpdateRecord) { |
| | | // æ¥è¯¢ææå®¡æ ¸ä¸çæ°æ® |
| | | QueryWrapper<StandardProductList> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("check_status",StandardProductListChcekTypeEnums.CHECK_ING.getCode()); |
| | | queryWrapper.eq("check_status", StandardProductListChcekTypeEnums.CHECK_ING.getCode()); |
| | | List<StandardProductList> standardProductListArray = standardProductListMapper.selectList(queryWrapper); |
| | | if(CollectionUtils.isEmpty(standardProductListArray)){ |
| | | if (CollectionUtils.isEmpty(standardProductListArray)) { |
| | | return; |
| | | } |
| | | List<Long> standardProductListIds = new ArrayList<>(); |
| | |
| | | standardProductListIds.add(standardProductList.getId()); |
| | | } |
| | | // å®¡æ ¸éè¿ |
| | | if(StandardProductListChcekTypeEnums.PASS_CHECK.getCode().equals(standardProductListUpdateRecord.getCheckStatus())){ |
| | | if (StandardProductListChcekTypeEnums.PASS_CHECK.getCode().equals(standardProductListUpdateRecord.getCheckStatus())) { |
| | | // ä¿®æ¹ç¶æ |
| | | standardProductListMapper.updateProductListCheckStatus(standardProductListIds,StandardProductListChcekTypeEnums.PASS_CHECK.getCode()); |
| | | standardProductListMapper.updateProductListCheckStatus(standardProductListIds, StandardProductListChcekTypeEnums.PASS_CHECK.getCode()); |
| | | } |
| | | // å®¡æ ¸æªéè¿ |
| | | if(StandardProductListChcekTypeEnums.NO_PASS_CHECK.getCode().equals(standardProductListUpdateRecord.getCheckStatus())){ |
| | | if (StandardProductListChcekTypeEnums.NO_PASS_CHECK.getCode().equals(standardProductListUpdateRecord.getCheckStatus())) { |
| | | // æ¥è¯¢æææ åæ ä¸çæ£éªé¡¹ç®å¤ä»½æ°æ® |
| | | List<StandardProductListBackupRel> standardProductListBackupRelList = standardProductListBackupRelMapper.selectBatchIds(standardProductListIds); |
| | | // åæ»æ åæ ä¸çæ£éªé¡¹ç®æ°æ® |
| | |
| | | } |
| | | // åæ»æ£éªé¡¹ç®åå®¶å¯åº¦ç»å®è¡¨æ°æ® |
| | | QueryWrapper<StandardProductListSupplierAskBackupRel> supplierAskBackupRelQueryWrapper = new QueryWrapper<>(); |
| | | supplierAskBackupRelQueryWrapper.in("product_list_id",standardProductListIds); |
| | | supplierAskBackupRelQueryWrapper.in("product_list_id", standardProductListIds); |
| | | List<StandardProductListSupplierAskBackupRel> standardProductListSupplierAskBackupRelList = standardProductListSupplierAskBackupRelMapper.selectList(supplierAskBackupRelQueryWrapper); |
| | | if(!CollectionUtils.isEmpty(standardProductListSupplierAskBackupRelList)){ |
| | | if (!CollectionUtils.isEmpty(standardProductListSupplierAskBackupRelList)) { |
| | | QueryWrapper<StandardProductListSupplierAsk> deleteWrapper = new QueryWrapper<>(); |
| | | deleteWrapper.in("product_list_id",standardProductListIds); |
| | | deleteWrapper.in("product_list_id", standardProductListIds); |
| | | standardProductListSupplierAskMapper.delete(deleteWrapper); |
| | | ArrayList<StandardProductListSupplierAsk> supplierAskRollBackList = new ArrayList<>(); |
| | | for (StandardProductListSupplierAskBackupRel standardProductListSupplierAskBackupRel : standardProductListSupplierAskBackupRelList) { |
| | |
| | | @Override |
| | | public boolean existCheckingRecord() { |
| | | QueryWrapper<StandardProductListUpdateRecord> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("check_status",StandardProductListChcekTypeEnums.CHECK_ING.getCode()); |
| | | queryWrapper.eq("check_status", StandardProductListChcekTypeEnums.CHECK_ING.getCode()); |
| | | List<StandardProductListUpdateRecord> standardProductListUpdateRecordList = standardProductListUpdateRecordMapper.selectList(queryWrapper); |
| | | if(CollectionUtils.isEmpty(standardProductListUpdateRecordList)){ |
| | | if (CollectionUtils.isEmpty(standardProductListUpdateRecordList)) { |
| | | return false; |
| | | }else { |
| | | } else { |
| | | return true; |
| | | } |
| | | } |