| | |
| | | import com.ruoyi.basic.service.StandardTemplateService; |
| | | import com.ruoyi.common.constant.DictDataConstants; |
| | | import com.ruoyi.common.constant.InsOrderTypeConstants; |
| | | import com.ruoyi.common.constant.MenuJumpPathConstants; |
| | | import com.ruoyi.common.core.domain.entity.Custom; |
| | | import com.ruoyi.common.core.domain.entity.InformationNotification; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | |
| | | import com.ruoyi.system.service.InformationNotificationService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.xwpf.usermodel.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private InsOrderStateMapper insOrderStateMapper; |
| | | @Resource |
| | | private InsProductMapper insProductMapper; |
| | | @Resource |
| | | private ShiftTimeMapper shiftTimeMapper; |
| | | @Resource |
| | | private PerformanceShiftMapper performanceShiftMapper; |
| | | |
| | | @Value("${wordUrl}") |
| | | private String wordUrl; |
| | | @Value("${twoCode}") |
| | | private String twoCode; |
| | | @Resource |
| | | private InsReportMapper insReportMapper; |
| | | @Resource |
| | |
| | | private InsOrderFactoryVerifyMapper insOrderFactoryVerifyMapper; |
| | | @Resource |
| | | private InsOrderFactoryVerifyItemService insOrderFactoryVerifyItemService; |
| | | @Value("${file.licenseUrl}") |
| | | private String licenseUrl; |
| | | |
| | | @Resource |
| | | private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper; |
| | | @Resource |
| | |
| | | |
| | | @Override |
| | | public IPage<InsOrderPlanVO> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { |
| | | // todo: 仅看自己或者实验室 |
| | | //获取当前人所属实验室id |
| | | |
| | | String laboratory = null; |
| | | |
| | | String userName = null; |
| | | Integer userId = null; |
| | | if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) { |
| | | userId = SecurityUtils.getUserId().intValue(); |
| | | userName = userMapper.selectById(userId).getName(); |
| | | // 检测管理人员全查,非检测管理人员只查看自己的 |
| | | InsOrderPlanQueryDto insOrderPlanQueryDto = new InsOrderPlanQueryDto(); |
| | | insOrderPlanQueryDto.setCheckUserFlag(SecurityUtils.hasRole("inspector")); |
| | | insOrderPlanQueryDto.setTestAdminFlag(SecurityUtils.hasRole("testadmin")); |
| | | // 判断是否触发只查看自己 |
| | | if(null != insOrderPlanDTO.getUserId()){ |
| | | insOrderPlanQueryDto.setViewMySelfFlag(true); |
| | | insOrderPlanDTO.setUserId(null); |
| | | } |
| | | Integer isCheck = insOrderPlanDTO.getIsCheck(); |
| | | insOrderPlanDTO.setIsCheck(null); |
| | | String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室 |
| | | insOrderPlanQueryDto.setUserId(SecurityUtils.getUserId().intValue()); |
| | | IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, |
| | | QueryWrappers.queryWrappers(insOrderPlanDTO), |
| | | userName, |
| | | userId, |
| | | sonLaboratory, |
| | | laboratory, |
| | | isCheck); |
| | | QueryWrappers.queryWrappers(insOrderPlanDTO),insOrderPlanQueryDto); |
| | | return insOrderPage; |
| | | } |
| | | |
| | |
| | | |
| | | // 查询厂家密度 |
| | | String supplierDensity = ""; |
| | | SampleProductDto sampleProductDto = list.get(0); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | SampleProductDto sampleProductDto = list.get(0); |
| | | |
| | | // 判断有没有绑定型号 |
| | | String modelValue = insSampleMapper.selectSupplierDensityModel(sampleProductDto.getSample(), |
| | | order.getProduction(), |
| | | sampleProductDto.getModel()); |
| | | if (StringUtils.isNotBlank(modelValue)) { |
| | | supplierDensity = modelValue; |
| | | } else { |
| | | supplierDensity = insSampleMapper.selectSupplierDensity(sampleProductDto.getSample(), |
| | | order.getProduction()); |
| | | // 判断有没有绑定型号 |
| | | String modelValue = insSampleMapper.selectSupplierDensityModel(sampleProductDto.getSample(), |
| | | order.getProduction(), |
| | | sampleProductDto.getModel()); |
| | | if (StringUtils.isNotBlank(modelValue)) { |
| | | supplierDensity = modelValue; |
| | | } else { |
| | | supplierDensity = insSampleMapper.selectSupplierDensity(sampleProductDto.getSample(), |
| | | order.getProduction()); |
| | | } |
| | | } |
| | | map.put("supplierDensity", supplierDensity); |
| | | return map; |
| | |
| | | insContext.forEach((k, v) -> { |
| | | JSONObject jo = JSON.parseObject(JSON.toJSONString(v)); |
| | | InsProduct insProduct = new InsProduct(); |
| | | insProduct.setId(Integer.parseInt(k)); |
| | | insProduct.setId(Long.valueOf(Integer.parseInt(k))); |
| | | InsProduct product = insProductMapper.selectById(insProduct.getId()); |
| | | if (currentTable.equals(product.getTemplateId()) && currentSampleId.equals(product.getInsSampleId())) { |
| | | List<InsProductResult> oldResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() |
| | |
| | | |
| | | insProduct.setUpdateUser(userId); |
| | | insProductMapper.updateById(insProduct); |
| | | insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId())); |
| | | insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), Math.toIntExact(insProduct.getId()))); |
| | | |
| | | insSample.setInsState(1); |
| | | Long l = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | |
| | | int count = 0; |
| | | for (InsProduct product : insProducts) { |
| | | count++; |
| | | str += "<br/>" + count + ":" + product.getInspectionItem() + " " + product.getInspectionItemSubclass() + "<br/>"; |
| | | |
| | | str += (count != 0 ? "\n" : "") + count + ":" + |
| | | product.getInspectionItemClass() + " " + |
| | | product.getInspectionItem() + " " + |
| | | product.getInspectionItemSubclass(); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(str)) { |
| | | throw new ErrorException("<strong>存在待检验的项目:</strong><br/>" + str); |
| | | throw new ErrorException("存在待检验的项目:" + str); |
| | | } |
| | | } |
| | | |
| | |
| | | info.setSenderId(userId); |
| | | info.setConsigneeId(verifyUser); |
| | | info.setViewStatus(false); |
| | | info.setJumpPath("b1-inspect-orderPlan-review"); |
| | | info.setJumpPath(MenuJumpPathConstants.INSPECTION_REVIEW); |
| | | informationNotificationService.addInformationNotification(info); |
| | | |
| | | // 6.复核人--新增检验单相关负责人 |
| | |
| | | |
| | | // 7.校验一下result表(避免出现多个检验项结果) |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | List<Integer> ips = insProducts.stream().map(InsProduct::getId).distinct().collect(Collectors.toList()); |
| | | for (Integer ip : ips) { |
| | | List<Long> ips = insProducts.stream().map(InsProduct::getId).distinct().collect(Collectors.toList()); |
| | | for (Long ip : ips) { |
| | | List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, ip)); |
| | | if (insProductResults.size() > 1) { |
| | |
| | | InsOrderRates insOrderRates = new InsOrderRates(); |
| | | insOrderRates.setInsOrderId(orderId); |
| | | insOrderRates.setInsSampleId(insProduct.getInsSampleId()); |
| | | insOrderRates.setInsProductId(insProduct.getId()); |
| | | insOrderRates.setInsProductId(Math.toIntExact(insProduct.getId())); |
| | | insOrderRates.setSampleCode(insProduct.getSampleCode()); |
| | | insOrderRates.setEntrustCode(order.getEntrustCode()); |
| | | insOrderRates.setInspectionItemClass(insProduct.getInspectionItemClass()); |
| | |
| | | // 检测依据 |
| | | Set<String> standardMethod = new HashSet<>(); |
| | | StringBuilder standardMethod2 = new StringBuilder(); |
| | | standardMethod.add(baseMapper.getStandardMethodCode(insSample.getStandardMethodListId())); |
| | | // TODO 检验的对象的检验标准由一个多个 数据类型由int变字符串 需要重写写这块逻辑 |
| | | // standardMethod.add(baseMapper.getStandardMethodCode(insSample.getStandardMethodListId())); |
| | | for (String s : standardMethod) { |
| | | standardMethod2.append("、").append(s); |
| | | } |
| | |
| | | samples.forEach(a -> { |
| | | Map<Integer, String> map2 = new HashMap<>(); |
| | | models.add(a.getModel()); |
| | | String standardMethodCode = baseMapper.getStandardMethodCode(a.getStandardMethodListId()); |
| | | // TODO 检验的对象的检验标准由一个多个 数据类型由int变字符串 需要重写写这块逻辑 |
| | | // String standardMethodCode = baseMapper.getStandardMethodCode(a.getStandardMethodListId()); |
| | | String standardMethodCode = ""; |
| | | if (StrUtil.isNotBlank(a.getSpecialStandardMethod())) { |
| | | standardMethodCode = standardMethodCode + "+" + a.getSpecialStandardMethod(); |
| | | } |
| | |
| | | FileOutputStream os = null; |
| | | try { |
| | | //凭证 不然切换后有水印 |
| | | InputStream is = Files.newInputStream(new File(licenseUrl).toPath()); |
| | | InputStream is = new ClassPathResource("/lib/license.xml").getInputStream(); |
| | | License license = new License(); |
| | | license.setLicense(is); |
| | | if (!license.getIsLicensed()) { |