From 79307172cb39dad68ce93106eb986fec2fc8fb60 Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期二, 15 四月 2025 22:43:43 +0800 Subject: [PATCH] 修改耐丝配置文件 --- inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java | 155 +++++++++++++-------------------------------------- 1 files changed, 41 insertions(+), 114 deletions(-) diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java index ae86eed..fd03462 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java @@ -10,14 +10,11 @@ import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; -import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; import com.ruoyi.basic.mapper.StandardProductListMapper; @@ -28,6 +25,7 @@ import com.ruoyi.common.core.domain.entity.User; import com.ruoyi.common.numgen.NumberGenerator; import com.ruoyi.common.utils.*; +import com.ruoyi.common.utils.api.IfsApiUtils; import com.ruoyi.framework.exception.ErrorException; import com.ruoyi.inspect.dto.*; import com.ruoyi.inspect.mapper.*; @@ -37,11 +35,8 @@ import com.ruoyi.inspect.service.InsProductService; import com.ruoyi.inspect.service.InsSampleService; import com.ruoyi.inspect.vo.InsOrderPrintingVo; -import com.ruoyi.inspect.vo.SampleDefectsFatherVo; -import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours; import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary; import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursTemporaryService; -import com.ruoyi.system.mapper.CustomMapper; import com.ruoyi.system.mapper.UserMapper; import lombok.AllArgsConstructor; import org.apache.commons.lang3.StringUtils; @@ -160,9 +155,21 @@ spotCheckQuarterItemMapper.updateById(spotCheckQuarterItem); } - // 鍒涘缓宸ユ椂鏆傚瓨 // 缂撳瓨鏍峰搧id, 缂栧彿map +// addWorkingHoursTemporary(userId, insSamples, ids, order); + + return 1; + } + + /** + * 鍒涘缓宸ユ椂鏆傚瓨 + * @param userId + * @param insSamples + * @param ids + * @param order + */ + private void addWorkingHoursTemporary(Integer userId, List<InsSample> insSamples, List<Integer> ids, InsOrder order) { Map<Integer, String> sampleMap = insSamples.stream().collect(Collectors.toMap(InsSample::getId, InsSample::getSampleCode)); List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() .in(InsProduct::getInsSampleId, ids) @@ -194,8 +201,6 @@ return auxiliaryOutputWorkingHours; }).collect(Collectors.toList()); auxiliaryOutputWorkingHoursTemporaryService.saveBatch(outputWorkingHours); - - return 1; } public static String getWeek(String dayStr) { @@ -442,6 +447,9 @@ if (StringUtils.isBlank(product.getAsk()) || StringUtils.isBlank(product.getTell())) { throw new ErrorException("鏈夋楠岄」鐨勮姹傚�兼垨瑕佹眰鎻忚堪涓虹┖, 璇峰厛鍘绘爣鍑嗗簱閰嶇疆瑕佹眰鍊兼垨瑕佹眰鎻忚堪"); } + if (StringUtils.isBlank(product.getSonLaboratory())) { + throw new ErrorException("鏈夋楠岄」鐨勭殑瀛愬疄楠屽涓虹粦瀹�, 璇峰厛缁戝畾瀛愬疄楠屽"); + } insProductMapper.insert(product); } } @@ -493,7 +501,7 @@ } // 鐢熸垚缂栧彿 String no = numberGenerator.generateNumberWithPrefix(3, - "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), + "JCZX/NS-" + code + LimsDateUtil.resetDate(LocalDateTime.now()), InsOrder::getEntrustCode); // 鍒ゆ柇鏄惁鏄搴︽楠�, 鏄搴︽楠屽彇娑堝師鏉愭枡瀛e害妫�楠屼笅鍗� if (InsOrderTypeConstants.QUARTERLY_TEST.equals(order.getOrderType())) { @@ -557,112 +565,12 @@ return productDto2IPage; } - @Override - public IPage<CostStatisticsDto> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto) { - String dates = costStatisticsDto.getDates(); - String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); - costStatisticsDto.setDates(null); - - //todo:浠呯湅鑷繁 - - IPage<CostStatisticsDto> dtoIPage = insOrderMapper.selectCostStatistics(page, QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); - List<CostStatisticsDto> collect = dtoIPage.getRecords().stream().map(dto -> { - Set<String> uniqueTags = new HashSet<>(); - if (dto.getInspectionItem().contains(",")) { - for (String s : dto.getInspectionItem().split(",")) { - uniqueTags.add(s.split("@")[0]); - } - } else { - uniqueTags.add(dto.getInspectionItem().split("@")[0]); - } - dto.setInspectionItem(uniqueTags.toString()); - return dto; - }).collect(Collectors.toList()); - dtoIPage.setRecords(collect); - return dtoIPage; - } - - @Override - public Map<String, Object> costStatistics2(CostStatisticsDto costStatisticsDto) { - Map<String, Object> map = new HashMap<>(); - String dates = costStatisticsDto.getDates(); - String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); - costStatisticsDto.setDates(null); - List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); - double totalPrice = costStatisticsDtos.stream() - .filter(dto -> dto.getPrice() != null) // 杩囨护鎺変环鏍间负 null 鐨勫璞� - .mapToDouble(value -> value.getPrice().doubleValue() * value.getNum()) - .sum(); - map.put("total", totalPrice); - return map; - } - - @Override - public Map<String, Object> selectSampleDefects(Page page, String inspectionItems, String orderNumber) { - List<SampleDefectsFatherVo> sampleDefectsFatherVos = insOrderMapper.selectSampleDefects(page, inspectionItems, orderNumber); - Map<String, Object> map = new HashMap<>(); - map.put("records", sampleDefectsFatherVos); - Long aLong = insOrderMapper.getCount(inspectionItems, orderNumber); - map.put("total", aLong); - return map; - } @Override public int updateStatus(Integer id) { return insOrderMapper.updateStatus(id); } - - @Override - public void export(CostStatisticsDto costStatisticsDto, HttpServletResponse response) throws IOException { - //鏌ヨ瀵煎嚭鐨勮垂鐢ㄧ粺璁℃暟鎹� - String dates = costStatisticsDto.getDates(); - String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); - costStatisticsDto.setDates(null); - List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); - costStatisticsDtos = costStatisticsDtos.stream().map(dto -> { - Set<String> uniqueTags = new HashSet<>(); - if (dto.getInspectionItem().contains(",")) { - for (String s : dto.getInspectionItem().split(",")) { - uniqueTags.add(s.split("@")[0]); - } - } else { - uniqueTags.add(dto.getInspectionItem().split("@")[0]); - } - dto.setInspectionItem(uniqueTags.toString()); - return dto; - }).collect(Collectors.toList()); - - response.setContentType("application/vnd.ms-excel"); - response.setCharacterEncoding("UTF-8"); - // 杩欓噷URLEncoder.encode鍙互闃叉涓枃涔辩爜 褰撶劧鍜宔asyexcel娌℃湁鍏崇郴 - String fileName = URLEncoder.encode("鏍峰搧璐圭敤缁熻瀵煎嚭", "UTF-8"); - response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); - Map<String, List<CostStatisticsDto>> groupByCompany = - costStatisticsDtos.stream().filter(e -> StrUtil.isNotEmpty(e.getCompany())) - .collect(Collectors.groupingBy(CostStatisticsDto::getCompany)); - try { - // 鏂板缓ExcelWriter - // 鏂板缓ExcelWriter - ExcelWriter excelWriter = - EasyExcel.write(response.getOutputStream()) - .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) - .build(); - for (Map.Entry<String, List<CostStatisticsDto>> companyDataEntry : groupByCompany.entrySet()) { - String sheetName = companyDataEntry.getKey(); - List<CostStatisticsDto> dataList = companyDataEntry.getValue(); - WriteSheet mainSheet = EasyExcel.writerSheet(sheetName) - .head(CostStatisticsDto.class) - .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) - .build(); - excelWriter.write(dataList, mainSheet); - } - // 鍏抽棴娴� - excelWriter.finish(); - } catch (IOException e) { - throw new RuntimeException("瀵煎嚭澶辫触"); - } - } /** * 鑾峰彇ifs搴撳瓨淇℃伅 @@ -746,7 +654,7 @@ ifsInventoryQuantity.setIsSource(1); ifsInventoryQuantity.setState(0); - IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>() + Long count = ifsInventoryQuantityMapper.selectCount(new LambdaQueryWrapper<IfsInventoryQuantity>() .eq(IfsInventoryQuantity::getOrderNo, ifsInventoryQuantity.getOrderNo()) .eq(IfsInventoryQuantity::getLineNo, ifsInventoryQuantity.getLineNo()) .eq(IfsInventoryQuantity::getReleaseNo, ifsInventoryQuantity.getReleaseNo()) @@ -758,8 +666,7 @@ .eq(IfsInventoryQuantity::getWaivDevRejNo, ifsInventoryQuantity.getWaivDevRejNo()) .eq(IfsInventoryQuantity::getActivitySeq, ifsInventoryQuantity.getActivitySeq()) ); - if(Objects.isNull(one)) { - + if(count == 0) { ifsInventoryQuantity.setIsFirst(0); // 鏌ヨ浜т笟閾炬娴嬫暟鎹� String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(), @@ -1034,7 +941,8 @@ // 鏌ヨ鏍囧噯鏍� List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery() .eq(StandardProductList::getStandardMethodListId, insProduct.getStandardMethodListId()) - .eq(StandardProductList::getTree, tree)); + .eq(StandardProductList::getTree, tree) + .orderByAsc(StandardProductList::getSort)); for (StandardProductList standardProductList : standardProductLists) { standardProductList.setId(null); } @@ -1059,6 +967,7 @@ product.setCreateUser(null); product.setUpdateTime(null); product.setUpdateUser(null); + product.setSection(null); product.setInsSampleId(omitOrderProductDto.getInsSampleId()); if (StringUtils.isBlank(product.getCableTag())) { product.setCableTag(null); @@ -1125,6 +1034,24 @@ } } + /** + * 淇敼鏍峰搧鍨嬪彿 + * @param insSample + */ + @Override + public void updateSampleModel(InsSample insSample) { + // 鍒ゆ柇褰撳墠璁㈠崟鏄惁鐢熸垚浜嗘姤鍛�, 鐢熸垚浜嗘姤鍛婁笉鑳戒慨鏀瑰崟鍙� + Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery() + .eq(InsReport::getInsOrderId, insSample.getInsOrderId())); + if (count > 0 ) { + throw new ErrorException("褰撳墠璁㈠崟宸茬粡鐢熸垚浜嗘姤鍛婁笉鑳戒慨鏀圭紪鍙�"); + } + + insSampleService.update(Wrappers.<InsSample>lambdaUpdate() + .eq(InsSample::getId, insSample.getId()) + .set(InsSample::getModel, insSample.getModel())); + } + } -- Gitblit v1.9.3