| | |
| | | |
| | | @Override |
| | | public List<ProductTreeDto> selectProductList(ProductDto productDto) { |
| | | // æ¥è¯¢æ ¹èç¹ï¼parentId 为 nullï¼ |
| | | // 䏿¬¡æ§æ¥è¯¢æææ°æ® |
| | | LambdaQueryWrapper<Product> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.isNull(Product::getParentId); |
| | | |
| | | // 妿æäº§ååç§°æ¡ä»¶ï¼æ·»å å°æ¥è¯¢ä¸ |
| | | if (productDto.getProductName() != null && !productDto.getProductName().isEmpty()) { |
| | | queryWrapper.like(Product::getProductName, productDto.getProductName()); |
| | | } |
| | | List<Product> allProducts = productMapper.selectList(queryWrapper); |
| | | |
| | | // æ¥è¯¢æ ¹èç¹å表 |
| | | List<Product> rootProducts = productMapper.selectList(queryWrapper); |
| | | // å¨å
åä¸æå»ºæ ç»æ |
| | | return buildTree(allProducts); |
| | | } |
| | | |
| | | // 转æ¢ä¸ºæ èç¹å¹¶éå½æå»ºåæ |
| | | /** |
| | | * æå»ºæ ç»æ |
| | | * @param allProducts ææäº§åæ°æ® |
| | | * @return æ å½¢ç»æå表 |
| | | */ |
| | | private List<ProductTreeDto> buildTree(List<Product> allProducts) { |
| | | // æ parentId åç» |
| | | java.util.Map<Long, List<Product>> parentMap = new java.util.HashMap<>(); |
| | | List<Product> rootList = new ArrayList<>(); |
| | | |
| | | for (Product product : allProducts) { |
| | | if (product.getParentId() == null) { |
| | | rootList.add(product); |
| | | } else { |
| | | parentMap.computeIfAbsent(product.getParentId(), k -> new ArrayList<>()).add(product); |
| | | } |
| | | } |
| | | |
| | | // éå½æå»ºåèç¹ |
| | | List<ProductTreeDto> tree = new ArrayList<>(); |
| | | for (Product product : rootProducts) { |
| | | ProductTreeDto node = convertToTreeDto(product); |
| | | node.setChildren(buildChildrenNodes(product.getId())); |
| | | tree.add(node); |
| | | for (Product root : rootList) { |
| | | tree.add(buildNode(root, parentMap)); |
| | | } |
| | | return tree; |
| | | } |
| | | |
| | | /** |
| | | * éå½æå»ºèç¹åå
¶åèç¹ |
| | | * @param product 产åå®ä½ |
| | | * @param parentMap æparentIdåç»çmap |
| | | * @return æ èç¹ |
| | | */ |
| | | private ProductTreeDto buildNode(Product product, java.util.Map<Long, List<Product>> parentMap) { |
| | | ProductTreeDto node = convertToTreeDto(product); |
| | | List<Product> children = parentMap.get(product.getId()); |
| | | if (children != null && !children.isEmpty()) { |
| | | List<ProductTreeDto> childNodes = new ArrayList<>(); |
| | | for (Product child : children) { |
| | | childNodes.add(buildNode(child, parentMap)); |
| | | } |
| | | node.setChildren(childNodes); |
| | | } |
| | | return node; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | |
| | | // éå½æå»ºåèç¹ |
| | | private List<ProductTreeDto> buildChildrenNodes(Long parentId) { |
| | | // æ¥è¯¢å½åç¶èç¹çåèç¹ |
| | | LambdaQueryWrapper<Product> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(Product::getParentId, parentId); |
| | | List<Product> childProducts = productMapper.selectList(queryWrapper); |
| | | |
| | | // 转æ¢åèç¹å¹¶éå½æå»ºå®ä»¬çåæ |
| | | List<ProductTreeDto> children = new ArrayList<>(); |
| | | for (Product child : childProducts) { |
| | | ProductTreeDto childNode = convertToTreeDto(child); |
| | | childNode.setChildren(buildChildrenNodes(child.getId())); |
| | | children.add(childNode); |
| | | } |
| | | |
| | | return children; |
| | | } |
| | | |
| | | |
| | | // å° Product 转æ¢ä¸º ProductTreeDto |
| | | private ProductTreeDto convertToTreeDto(Product product) { |
| | | ProductTreeDto dto = new ProductTreeDto(); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class DeviceRepairDto { |
| | | |
| | | @ApiModelProperty("è®¾å¤æ¥ä¿®id") |
| | |
| | | @ApiModelProperty("设å¤åå·") |
| | | private String deviceModel; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®æ¶é´") |
| | | private Date repairTime; |
| | | |
| | | private String repairTimeStr; |
| | | @ApiModelProperty("æ¥ä¿®æ¶é´å¼å§") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime repairTimeStart; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®æ¶é´ç»æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime repairTimeEnd; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®äºº") |
| | | private String repairName; |
| | |
| | | |
| | | private String deviceModel; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®æ¶é´") |
| | | private Date repairTime; |
| | | @ApiModelProperty("æ¥ä¿®æ¶é´å¼å§") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime repairTimeStart; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®æ¶é´ç»æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime repairTimeEnd; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®äºº") |
| | | private String repairName; |
| | |
| | | deviceRepair.setRemark(deviceDefectRecord.getDefectDescription()); |
| | | //è·åå½åç»å½ç¨æ· |
| | | deviceRepair.setRepairName(SecurityUtils.getUsername()); |
| | | deviceRepair.setRepairTime(new Date()); |
| | | // deviceRepair.setRepairTime(new Date()); |
| | | deviceRepairMapper.insert(deviceRepair); |
| | | return deviceDefectRecordMapper.insert(deviceDefectRecord) > 0; |
| | | } else if (status.equals("ä¸è¬ç¼ºé·")) { |
| | |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | |
| | | private List<CommonFile> commonFileListAfter; //ç产å |
| | | private List<CommonFile> commonFileListBefore; //ç产å |
| | | |
| | | /** |
| | | * è¦æ±çæ§è¡æ¶é´ï¼æ¥èªå®æ¶ä»»å¡çnextExecutionTimeï¼ |
| | | */ |
| | | private LocalDateTime nextExecutionTime; |
| | | |
| | | /** |
| | | * ç¶æï¼EXPIRED-å·²è¿æï¼IN_PROGRESS-å·¡æ£ä¸ï¼PENDING-å¾
å·¡æ£ |
| | | */ |
| | | private String status; |
| | | |
| | | } |
| | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @ApiModelProperty(value = "å
³è宿¶ä»»å¡ID") |
| | | private Long timingTaskId; |
| | | |
| | | @ApiModelProperty(value = "çäº§åæ¯å¦åå¨å¼å¸¸") |
| | | private Boolean hasExceptionBefore; |
| | | |
| | | @ApiModelProperty(value = "çäº§ä¸æ¯å¦åå¨å¼å¸¸") |
| | | private Boolean hasExceptionAfter; |
| | | |
| | | @ApiModelProperty(value = "çäº§åæ¯å¦åå¨å¼å¸¸") |
| | | private Boolean hasExceptionIssue; |
| | | } |
| | |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.inspectiontask.dto.InspectionTaskDto; |
| | | import com.ruoyi.inspectiontask.mapper.InspectionTaskMapper; |
| | | import com.ruoyi.inspectiontask.mapper.TimingTaskMapper; |
| | | import com.ruoyi.inspectiontask.pojo.InspectionTask; |
| | | import com.ruoyi.inspectiontask.pojo.TimingTask; |
| | | import com.ruoyi.inspectiontask.service.InspectionTaskService; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | |
| | | |
| | | @Autowired |
| | | private CommonFileServiceImpl commonFileService; |
| | | |
| | | @Autowired |
| | | private TimingTaskMapper timingTaskMapper; |
| | | |
| | | @Override |
| | | public IPage<InspectionTaskDto> selectInspectionTaskList(Page<InspectionTask> page, InspectionTaskDto inspectionTaskDto) { |
| | |
| | | } |
| | | List<CommonFile> finalCommonFiles = commonFiles; |
| | | |
| | | // æ¹éæ¥è¯¢å®æ¶ä»»å¡è·ånextExecutionTime |
| | | List<Long> timingTaskIds = entityPage.getRecords().stream() |
| | | .map(InspectionTask::getTimingTaskId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | Map<Long, TimingTask> timingTaskMap = new HashMap<>(); |
| | | if (!timingTaskIds.isEmpty()) { |
| | | List<TimingTask> timingTasks = timingTaskMapper.selectBatchIds(timingTaskIds); |
| | | timingTaskMap = timingTasks.stream() |
| | | .collect(Collectors.toMap(TimingTask::getId, Function.identity())); |
| | | } |
| | | final Map<Long, TimingTask> finalTimingTaskMap = timingTaskMap; |
| | | final LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | List<InspectionTaskDto> dtoList = entityPage.getRecords().stream().map(inspectionTask -> { |
| | | InspectionTaskDto dto = new InspectionTaskDto(); |
| | | BeanUtils.copyProperties(inspectionTask, dto); // å¤å¶ä¸»å¯¹è±¡å±æ§ |
| | |
| | | .filter(commonFile -> commonFile.getCommonId().equals(taskId) && commonFile.getType().equals(FileNameType.INSPECTION_PRODUCTION_BEFORE.getValue())) |
| | | .collect(Collectors.toList())); |
| | | |
| | | // 计ç®ç¶æï¼å·²è¿æ > å·¡æ£ä¸ > å¾
å·¡æ£ |
| | | String status = calculateStatus(inspectionTask, finalTimingTaskMap, now); |
| | | dto.setStatus(status); |
| | | |
| | | // 设置nextExecutionTimeç¨äºå端å±ç¤º |
| | | if (inspectionTask.getTimingTaskId() != null) { |
| | | TimingTask timingTask = finalTimingTaskMap.get(inspectionTask.getTimingTaskId()); |
| | | if (timingTask != null) { |
| | | dto.setNextExecutionTime(timingTask.getNextExecutionTime()); |
| | | } |
| | | } |
| | | |
| | | return dto; |
| | | }).collect(Collectors.toList()); |
| | |
| | | return dto; |
| | | } |
| | | |
| | | /** |
| | | * 计ç®å·¡æ£ä»»å¡ç¶æ |
| | | * ä¼å
级ï¼å·²å®æå·¡æ£ > å·¡æ£ä¸(å·²è¿æ) > å·¡æ£ä¸ > å·²è¿æ > å¾
å·¡æ£ |
| | | * @param inspectionTask å·¡æ£ä»»å¡ |
| | | * @param timingTaskMap 宿¶ä»»å¡Map |
| | | * @param now å½åæ¶é´ |
| | | * @return ç¶æï¼COMPLETED-已宿巡æ£ï¼IN_PROGRESS_EXPIRED-å·¡æ£ä¸(å·²è¿æ)ï¼IN_PROGRESS-å·¡æ£ä¸ï¼EXPIRED-å·²è¿æï¼PENDING-å¾
å·¡æ£ |
| | | */ |
| | | private String calculateStatus(InspectionTask inspectionTask, Map<Long, TimingTask> timingTaskMap, LocalDateTime now) { |
| | | if(inspectionTask.getTimingTaskId() == null){ |
| | | return "EXPIRED"; |
| | | } |
| | | boolean isExpired = false; |
| | | // 夿æ¯å¦å·²è¿æ |
| | | if (inspectionTask.getTimingTaskId() != null) { |
| | | TimingTask timingTask = timingTaskMap.get(inspectionTask.getTimingTaskId()); |
| | | if (timingTask != null && timingTask.getNextExecutionTime() != null) { |
| | | isExpired = now.isAfter(timingTask.getNextExecutionTime()); |
| | | } |
| | | } |
| | | |
| | | // 1. 夿æ¯å¦å·²å®æå·¡æ£ï¼ä¸ä¸ªå¼å¸¸å段é½ä¸ä¸ºnullï¼ |
| | | if (inspectionTask.getHasExceptionBefore() != null |
| | | && inspectionTask.getHasExceptionAfter() != null |
| | | && inspectionTask.getHasExceptionIssue() != null) { |
| | | return "COMPLETED"; |
| | | } |
| | | |
| | | // 2. 夿æ¯å¦å·¡æ£ä¸ï¼ä»»ä¸å¼å¸¸å段ä¸ä¸ºnullï¼ |
| | | if (inspectionTask.getHasExceptionBefore() != null |
| | | || inspectionTask.getHasExceptionAfter() != null |
| | | || inspectionTask.getHasExceptionIssue() != null) { |
| | | return isExpired ? "IN_PROGRESS_EXPIRED" : "IN_PROGRESS"; |
| | | } |
| | | |
| | | // 3. å·²è¿æ |
| | | if (isExpired) { |
| | | return "EXPIRED"; |
| | | } |
| | | |
| | | // 4. å¾
å·¡æ£ |
| | | return "PENDING"; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addOrEditInspectionTask(InspectionTaskDto inspectionTaskDto) throws IOException { |
| | |
| | | inspectionTask.setFrequencyType(timingTask.getFrequencyType()); |
| | | inspectionTask.setFrequencyDetail(timingTask.getFrequencyDetail()); |
| | | inspectionTask.setTenantId(timingTask.getTenantId()); |
| | | inspectionTask.setTimingTaskId(timingTask.getId()); |
| | | |
| | | return inspectionTask; |
| | | } |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | |
| | | private Long deviceId; |
| | | |
| | | private String uuid; |
| | | |
| | | private ProductProcess productProcess;; |
| | | } |
| | |
| | | ProductProcessRoute productProcessRoute = createProductProcessRoute(productModelId, productOrderId, productBom.getId(), processRoute.getProcessRouteCode()); |
| | | |
| | | // 6. æ°å¢ç产工èºè·¯çº¿å表 |
| | | buildProductProcessRouteItems(processRouteAnticlockwiseDtos, productProcessRoute.getId(), productModelId,productOrderId); |
| | | buildProductProcessRouteItems(processRouteAnticlockwiseDtos, productProcessRoute.getId(), productModelId, productOrderId); |
| | | return processRoute.getId(); |
| | | } |
| | | |
| | |
| | | processRoute.setDescription(""); |
| | | this.save(processRoute); |
| | | |
| | | processRoute.setProcessRouteCode("GYLX." + String.format("%05d", processRoute.getId())); |
| | | processRoute.setProcessRouteCode("GYLX." + String.format("%09d", processRoute.getId())); |
| | | this.updateById(processRoute); |
| | | |
| | | return processRoute; |
| | |
| | | /** |
| | | * æå»ºç产工èºè·¯çº¿å项å表 |
| | | */ |
| | | private void buildProductProcessRouteItems(List<ProcessRouteAnticlockwiseDto> dtos, Long productRouteId, Long productModelId,Long productOrderId) { |
| | | private void buildProductProcessRouteItems(List<ProcessRouteAnticlockwiseDto> dtos, Long productRouteId, Long productModelId, Long productOrderId) { |
| | | ProductOrder byId = productOrderService.getById(productOrderId); |
| | | Integer num = 0; |
| | | for (ProcessRouteAnticlockwiseDto dto : dtos) { |
| | | ProductProcessRouteItem item = new ProductProcessRouteItem(); |
| | | item.setProductRouteId(productRouteId); |
| | | item.setProcessId(dto.getProcessId()); |
| | | item.setProductModelId(dto.getProductModelId()); |
| | | item.setProductModelId(productModelId); |
| | | item.setProcessRouteName(dto.getProcessRouteName()); |
| | | item.setProcessRouteOpenNum(dto.getProcessRouteOpenNum()); |
| | | item.setProcessRouteNum(dto.getProcessRouteNum()); |
| | | item.setProcessRouteAddNum(dto.getProcessRouteAddNum()); |
| | | item.setProcessRouteRequire(dto.getProcessRouteRequire()); |
| | | item.setDragSort(num++); |
| | | item.setIsQuality(dto.getProductProcess().getIsQuality() != null && dto.getProductProcess().getIsQuality()); |
| | | item.setUuid(dto.getUuid()); |
| | | productProcessRouteItemService.save(item); |
| | | ProductProcess productProcess = productProcessService.getById(item.getProcessId()); |
| | |
| | | productWorkOrder.setDeviceId(dto.getDeviceId()); |
| | | productWorkOrder.setUserIds(dto.getUserIds()); |
| | | productWorkOrder.setUserNames(dto.getUserNames()); |
| | | productWorkOrder.setWorkOrderNo(productWorkOrderService.generateProductWorkOrder( productProcess.getName(), byId.getNpsNo())); |
| | | productWorkOrder.setWorkOrderNo(productWorkOrderService.generateProductWorkOrder(productProcess.getName(), byId.getNpsNo())); |
| | | productWorkOrder.setStatus(1); |
| | | productWorkOrderService.save(productWorkOrder); |
| | | } |
| | |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.ProductBomService; |
| | | import com.ruoyi.production.service.ProductProcessRouteService; |
| | | import com.ruoyi.production.service.ProductProcessService; |
| | | import com.ruoyi.production.service.ProductionPrintOrderService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.jetbrains.annotations.Nullable; |
| | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private final ProductBomService productBomService; |
| | | |
| | | private final CustomerFollowUpFileService customerFollowUpFileService; |
| | | private final ProductProcessMapper productProcessMapper; |
| | | private final ProductProcessService productProcessService; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void save(SaveProductionPrintOrderDto dto) { |
| | | Assert.isFalse(CollUtil.isEmpty(dto.getProcessContent()),"æ
è³å°æ·»å 䏿¡å·¥åºä¿¡æ¯"); |
| | | ProductionPrintOrder productionPrintOrder = BeanUtil.copyProperties(dto, ProductionPrintOrder.class); |
| | | if(dto.getId() != null){ |
| | | if(dto.getProductOrderId() != null){ |
| | | // å
å é¤çäº§å·¥åæ°æ® |
| | | LambdaQueryWrapper<ProductWorkOrder> l1 = new LambdaQueryWrapper<>(); |
| | | l1.eq(ProductWorkOrder::getProductOrderId,dto.getProductOrderId()); |
| | |
| | | }); |
| | | MaterialInfoDto materialInfoDtoFirst = dto.getMaterialInfo().get(0); |
| | | // è°ç¨å·¥åºæ¹å¢ 彿° |
| | | // æ¥è¯¢å·¥åºä¿¡æ¯ |
| | | List<Long> processIds = dto.getProcessContent().stream().map(ProcessContentDto::getProcessId).collect(Collectors.toList()); |
| | | Map<Long, ProductProcess> productProcessMap = productProcessService.listByIds(processIds).stream().collect(Collectors.toMap(ProductProcess::getId, productProcess -> productProcess)); |
| | | List<ProcessRouteAnticlockwiseDto> processRouteAnticlockwiseDtos = processContentDtoList.stream().map(it -> { |
| | | ProcessRouteAnticlockwiseDto pdto = new ProcessRouteAnticlockwiseDto(); |
| | | pdto.setProcessId(it.getProcessId()); |
| | |
| | | pdto.setUserNames(it.getReportWorkerList().stream().map(SimplePersonDto::getUserName).collect(Collectors.joining(","))); |
| | | pdto.setDeviceId(it.getDeviceId()); |
| | | pdto.setUuid(it.getId()); |
| | | pdto.setProductProcess(productProcessMap.get(it.getProcessId())); |
| | | return pdto; |
| | | }).collect(Collectors.toList()); |
| | | |
| | |
| | | if (ObjectUtils.isNull(productOrder.getStartTime())) { |
| | | productOrder.setStartTime(now);//å¼å§æ¶é´ |
| | | } |
| | | if (productProcessRouteItem.getDragSort() == productProcessRouteItems.size()) { |
| | | if (productProcessRouteItem.getDragSort() >= productProcessRouteItems.size() -1 ) { |
| | | //å¦ææ¯æåä¸éå·¥åºæ¥å·¥ä¹åç产订å宿æ°é+ |
| | | productOrder.setCompleteQuantity(productOrder.getCompleteQuantity().add(productQty)); |
| | | if (productOrder.getCompleteQuantity().compareTo(productOrder.getQuantity()) >= 0) { |
| | |
| | | //对åºçè¿ç¨æ£æè
åºåæ£ |
| | | int inspectType = 1; |
| | | String process = productProcess.getName();//å·¥åº |
| | | if (productProcessRouteItem.getDragSort() == productProcessRouteItems.size()) { |
| | | if (productProcessRouteItem.getDragSort() == (productProcessRouteItems.size()-1)) { |
| | | //æåä¸éå·¥åºçæåºåæ£ |
| | | inspectType = 2; |
| | | process = null; |
| | |
| | | } |
| | | } else { |
| | | //ç´æ¥å
¥åº |
| | | stockUtils.addStock(productProcessRouteItem.getProductModelId(), productQty, StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(), productionProductMain.getId(), "-", "-", "-"); |
| | | if (productProcessRouteItem.getDragSort() == (productProcessRouteItems.size()-1)) { |
| | | //æåä¸éå·¥åºæä¼å
¥åº |
| | | stockUtils.addStock(productProcessRouteItem.getProductModelId(), productQty, StockInQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_IN.getCode(), productionProductMain.getId(), "-", "-", "-"); |
| | | } |
| | | } |
| | | |
| | | /*æ·»å çäº§æ ¸ç® åºåå·¥åºæ¯è®¡ä»¶è¿æ¯è®¡æ¶*/ |
| | |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.dto.QualityInspectExportDTO; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | * 导åºï¼æ§æ¥å£ï¼ä¿çå
¼å®¹ï¼ |
| | | * @param response |
| | | * @param qualityInspect |
| | | */ |
| | | @PostMapping("/export") |
| | | public void qualityInspectExport(HttpServletResponse response,QualityInspect qualityInspect) { |
| | | public void qualityInspectExport(HttpServletResponse response, QualityInspect qualityInspect) { |
| | | qualityInspectService.qualityInspectExport(response, qualityInspect); |
| | | } |
| | | |
| | | /** |
| | | * 导åºï¼æ°æ¥å£ï¼æ¯æéä¸å¯¼åºåæ£éªåæ°ï¼ |
| | | * @param response |
| | | * @param exportDTO |
| | | */ |
| | | @PostMapping("/exportNew") |
| | | public void qualityInspectExportNew(HttpServletResponse response, @RequestBody QualityInspectExportDTO exportDTO) { |
| | | qualityInspectService.qualityInspectExportNew(response, exportDTO); |
| | | } |
| | | |
| | | /** |
| | | * æäº¤ |
| | | * @param qualityInspect |
| | | * @return |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quality.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è´¨éæ£éªå¯¼åºè¯·æ±åæ° |
| | | */ |
| | | @Data |
| | | public class QualityInspectExportDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æ£éªç±»å(0:åæææ£éª;1:è¿ç¨æ£éª;2:åºåæ£éª) |
| | | */ |
| | | private Integer inspectType; |
| | | |
| | | /** |
| | | * éä¸çIDå表ï¼ä¸ºç©ºåå
¨é¨å¯¼åºï¼ |
| | | */ |
| | | private List<Long> ids; |
| | | |
| | | /** |
| | | * ä¾åºåï¼åæææ£éªçéï¼ |
| | | */ |
| | | private String supplier; |
| | | |
| | | /** |
| | | * å·¥åºï¼è¿ç¨æ£éªçéï¼ |
| | | */ |
| | | private String process; |
| | | |
| | | /** |
| | | * 产ååç§°ï¼åºåæ£éªçéï¼ |
| | | */ |
| | | private String productName; |
| | | |
| | | /** |
| | | * æ£æµæ¥æå¼å§ |
| | | */ |
| | | private String entryDateStart; |
| | | |
| | | /** |
| | | * æ£æµæ¥æç»æ |
| | | */ |
| | | private String entryDateEnd; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quality.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * è´¨éæ£éªå¯¼åºæ°æ®VOï¼æ¯ä¸ªæ£éªåæ°ä¸è¡ï¼ |
| | | */ |
| | | @Data |
| | | public class QualityInspectExportVO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * æ£æµæ¥æ |
| | | */ |
| | | private Date checkTime; |
| | | |
| | | /** |
| | | * éè´è®¢åå·/ç产工åå· |
| | | */ |
| | | private String orderNo; |
| | | |
| | | /** |
| | | * ä¾åºå/å·¥åº |
| | | */ |
| | | private String supplierOrProcess; |
| | | |
| | | /** |
| | | * æ£éªå |
| | | */ |
| | | private String checkName; |
| | | |
| | | /** |
| | | * 产ååç§° |
| | | */ |
| | | private String productName; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | private String model; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | private String unit; |
| | | |
| | | /** |
| | | * æ°é |
| | | */ |
| | | private BigDecimal quantity; |
| | | |
| | | /** |
| | | * æ£æµåä½ |
| | | */ |
| | | private String checkCompany; |
| | | |
| | | /** |
| | | * æ£æµç»æ |
| | | */ |
| | | private String checkResult; |
| | | |
| | | /** |
| | | * ææ |
| | | */ |
| | | private String parameterItem; |
| | | |
| | | /** |
| | | * ææ åä½ |
| | | */ |
| | | private String paramUnit; |
| | | |
| | | /** |
| | | * æ åå¼ |
| | | */ |
| | | private String standardValue; |
| | | |
| | | /** |
| | | * å
æ§å¼ |
| | | */ |
| | | private String controlValue; |
| | | |
| | | /** |
| | | * æ£éªå¼ |
| | | */ |
| | | private String testValue; |
| | | } |
| | |
| | | List<QualityInspect> qualityInspectExport(@Param("qualityInspect") QualityInspect qualityInspect); |
| | | |
| | | /** |
| | | * æ ¹æ®IDå表æ¥è¯¢æ£éªè®°å½ï¼ç¨äºå¯¼åºï¼ |
| | | */ |
| | | List<QualityInspect> qualityInspectExportByIds(@Param("ids") List<Long> ids, @Param("qualityInspect") QualityInspect qualityInspect); |
| | | |
| | | /** |
| | | * æ ¹æ®ç产主表IDæ¹éå é¤è¿ç¨æ£éª |
| | | */ |
| | | int deleteByProductMainIds(@Param("productMainIds") List<Long> productMainIds); |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.dto.QualityInspectExportDTO; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | |
| | | void qualityInspectExport(HttpServletResponse response, QualityInspect qualityInspect); |
| | | |
| | | /** |
| | | * å¯¼åºæ£éªè®°å½ï¼æ¯æéä¸å¯¼åºåå
¨é¨å¯¼åºï¼å
嫿£éªåæ°ï¼ |
| | | * @param response ååº |
| | | * @param exportDTO 导åºåæ° |
| | | */ |
| | | void qualityInspectExportNew(HttpServletResponse response, QualityInspectExportDTO exportDTO); |
| | | |
| | | QualityInspectDto getDetailById(Integer id); |
| | | |
| | | int submit(QualityInspect qualityInspect); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quality.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.quality.dto.QualityInspectExportDTO; |
| | | import com.ruoyi.quality.dto.QualityInspectExportVO; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.service.IQualityInspectParamService; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * è´¨éæ£éªå¯¼åºå¤çç±» |
| | | */ |
| | | @Component |
| | | public class QualityInspectExportHandle { |
| | | |
| | | @Resource |
| | | private QualityInspectMapper qualityInspectMapper; |
| | | |
| | | @Resource |
| | | private IQualityInspectParamService qualityInspectParamService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£éªè®°å½ï¼æ¯æéä¸å¯¼åºåå
¨é¨å¯¼åºï¼ |
| | | * @param exportDTO 导åºåæ° |
| | | * @return æ£éªè®°å½å表 |
| | | */ |
| | | public List<QualityInspect> queryInspectList(QualityInspectExportDTO exportDTO) { |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setInspectType(exportDTO.getInspectType()); |
| | | qualityInspect.setSupplier(exportDTO.getSupplier()); |
| | | qualityInspect.setProcess(exportDTO.getProcess()); |
| | | qualityInspect.setProductName(exportDTO.getProductName()); |
| | | qualityInspect.setEntryDateStart(exportDTO.getEntryDateStart()); |
| | | qualityInspect.setEntryDateEnd(exportDTO.getEntryDateEnd()); |
| | | |
| | | if (!CollectionUtils.isEmpty(exportDTO.getIds())) { |
| | | return qualityInspectMapper.qualityInspectExportByIds(exportDTO.getIds(), qualityInspect); |
| | | } else { |
| | | return qualityInspectMapper.qualityInspectExportByIds(null, qualityInspect); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æå»ºå¯¼åºæ°æ®ï¼æ¯ä¸ªæ£éªåæ°ä¸è¡ï¼ |
| | | * å䏿£éªè®°å½çå¤ä¸ªåæ°è¡ï¼åªå¨ç¬¬ä¸è¡æ¾ç¤ºå·¦ä¾§åºç¡ä¿¡æ¯ï¼åç»è¡ç空 |
| | | * @param qualityInspects æ£éªè®°å½å表 |
| | | * @param inspectType æ£éªç±»å |
| | | * @return å¯¼åºæ°æ®å表 |
| | | */ |
| | | public List<QualityInspectExportVO> buildExportData(List<QualityInspect> qualityInspects, Integer inspectType) { |
| | | if (CollectionUtils.isEmpty(qualityInspects)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | // è·åæææ£éªè®°å½çIDï¼æ¹éæ¥è¯¢æ£éªåæ° |
| | | List<Long> inspectIds = qualityInspects.stream().map(QualityInspect::getId).collect(Collectors.toList()); |
| | | List<QualityInspectParam> allParams = qualityInspectParamService.list( |
| | | Wrappers.<QualityInspectParam>lambdaQuery().in(QualityInspectParam::getInspectId, inspectIds) |
| | | ); |
| | | |
| | | // æinspectIdåç» |
| | | Map<Long, List<QualityInspectParam>> paramMap = allParams.stream() |
| | | .collect(Collectors.groupingBy(QualityInspectParam::getInspectId)); |
| | | |
| | | // æå»ºå¯¼åºæ°æ®ï¼æ¯ä¸ªæ£éªåæ°ä¸è¡ |
| | | List<QualityInspectExportVO> exportList = new ArrayList<>(); |
| | | for (QualityInspect inspect : qualityInspects) { |
| | | List<QualityInspectParam> params = paramMap.getOrDefault(inspect.getId(), new ArrayList<>()); |
| | | |
| | | if (params.isEmpty()) { |
| | | // æ²¡ææ£éªåæ°ï¼ä¹è¾åºä¸è¡ |
| | | QualityInspectExportVO vo = buildVO(inspect, null, inspectType, true); |
| | | exportList.add(vo); |
| | | } else { |
| | | // ææ£éªåæ°ï¼æ¯ä¸ªåæ°ä¸è¡ï¼ç¬¬ä¸è¡æ¾ç¤ºåºç¡ä¿¡æ¯ï¼åç»è¡å·¦ä¾§ç空 |
| | | boolean isFirst = true; |
| | | for (QualityInspectParam param : params) { |
| | | QualityInspectExportVO vo = buildVO(inspect, param, inspectType, isFirst); |
| | | exportList.add(vo); |
| | | isFirst = false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return exportList; |
| | | } |
| | | |
| | | /** |
| | | * æå»ºåè¡å¯¼åºæ°æ® |
| | | * @param inspect æ£éªè®°å½ |
| | | * @param param æ£éªåæ°ï¼å¯ä¸ºnullï¼ |
| | | * @param inspectType æ£éªç±»å |
| | | * @param showBaseInfo æ¯å¦æ¾ç¤ºå·¦ä¾§åºç¡ä¿¡æ¯ï¼å䏿£éªè®°å½çå¤è¡ï¼åªå¨ç¬¬ä¸è¡æ¾ç¤ºï¼ |
| | | */ |
| | | private QualityInspectExportVO buildVO(QualityInspect inspect, QualityInspectParam param, Integer inspectType, boolean showBaseInfo) { |
| | | QualityInspectExportVO vo = new QualityInspectExportVO(); |
| | | |
| | | // åªæç¬¬ä¸è¡æ¾ç¤ºå·¦ä¾§åºç¡ä¿¡æ¯ï¼åç»è¡ç空 |
| | | if (showBaseInfo) { |
| | | vo.setCheckTime(inspect.getCheckTime()); |
| | | vo.setCheckName(inspect.getCheckName()); |
| | | vo.setProductName(inspect.getProductName()); |
| | | vo.setModel(inspect.getModel()); |
| | | vo.setUnit(inspect.getUnit()); |
| | | vo.setQuantity(inspect.getQuantity()); |
| | | vo.setCheckCompany(inspect.getCheckCompany()); |
| | | vo.setCheckResult(inspect.getCheckResult()); |
| | | |
| | | // 设置订åå·åä¾åºå/å·¥åº |
| | | if (inspectType == 0) { |
| | | vo.setOrderNo(inspect.getPurchaseContractNo()); |
| | | vo.setSupplierOrProcess(inspect.getSupplier()); |
| | | } else if (inspectType == 1) { |
| | | vo.setOrderNo(inspect.getWorkOrderNo()); |
| | | vo.setSupplierOrProcess(inspect.getProcess()); |
| | | } else { |
| | | vo.setOrderNo(inspect.getWorkOrderNo()); |
| | | vo.setSupplierOrProcess(""); |
| | | } |
| | | } |
| | | |
| | | // 设置æ£éªåæ°ï¼æ¯è¡é½è¦æ¾ç¤ºï¼ |
| | | if (param != null) { |
| | | vo.setParameterItem(param.getParameterItem()); |
| | | vo.setParamUnit(param.getUnit()); |
| | | vo.setStandardValue(param.getStandardValue()); |
| | | vo.setControlValue(param.getControlValue()); |
| | | vo.setTestValue(param.getTestValue()); |
| | | } |
| | | |
| | | return vo; |
| | | } |
| | | |
| | | /** |
| | | * 导åºExcel |
| | | * @param response ååº |
| | | * @param exportList å¯¼åºæ°æ® |
| | | * @param inspectType æ£éªç±»å |
| | | */ |
| | | public void exportExcel(HttpServletResponse response, List<QualityInspectExportVO> exportList, Integer inspectType) { |
| | | try { |
| | | Workbook workbook = new XSSFWorkbook(); |
| | | Sheet sheet = workbook.createSheet(); |
| | | |
| | | // åå»ºæ ·å¼ |
| | | CellStyle headerStyle = createHeaderStyle(workbook); |
| | | CellStyle dataStyle = createDataStyle(workbook); |
| | | |
| | | // æå»ºè¡¨å¤´ |
| | | Row headerRow = sheet.createRow(0); |
| | | String[] headers = {"æ£æµæ¥æ", "订åå·", "ä¾åºå/å·¥åº", "æ£éªå", "产ååç§°", "è§æ ¼åå·", "åä½", "æ°é", "æ£æµåä½", "æ£æµç»æ", "ææ ", "ææ åä½", "æ åå¼", "å
æ§å¼", "æ£éªå¼"}; |
| | | for (int i = 0; i < headers.length; i++) { |
| | | Cell cell = headerRow.createCell(i); |
| | | cell.setCellValue(headers[i]); |
| | | cell.setCellStyle(headerStyle); |
| | | } |
| | | |
| | | // å¡«å
æ°æ® |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | int rowIndex = 1; |
| | | for (QualityInspectExportVO vo : exportList) { |
| | | Row dataRow = sheet.createRow(rowIndex++); |
| | | |
| | | createCell(dataRow, 0, vo.getCheckTime() != null ? sdf.format(vo.getCheckTime()) : "", dataStyle); |
| | | createCell(dataRow, 1, vo.getOrderNo() != null ? vo.getOrderNo() : "", dataStyle); |
| | | createCell(dataRow, 2, vo.getSupplierOrProcess() != null ? vo.getSupplierOrProcess() : "", dataStyle); |
| | | createCell(dataRow, 3, vo.getCheckName() != null ? vo.getCheckName() : "", dataStyle); |
| | | createCell(dataRow, 4, vo.getProductName() != null ? vo.getProductName() : "", dataStyle); |
| | | createCell(dataRow, 5, vo.getModel() != null ? vo.getModel() : "", dataStyle); |
| | | createCell(dataRow, 6, vo.getUnit() != null ? vo.getUnit() : "", dataStyle); |
| | | createCell(dataRow, 7, vo.getQuantity() != null ? vo.getQuantity().toString() : "", dataStyle); |
| | | createCell(dataRow, 8, vo.getCheckCompany() != null ? vo.getCheckCompany() : "", dataStyle); |
| | | createCell(dataRow, 9, vo.getCheckResult() != null ? vo.getCheckResult() : "", dataStyle); |
| | | createCell(dataRow, 10, vo.getParameterItem() != null ? vo.getParameterItem() : "", dataStyle); |
| | | createCell(dataRow, 11, vo.getParamUnit() != null ? vo.getParamUnit() : "", dataStyle); |
| | | createCell(dataRow, 12, vo.getStandardValue() != null ? vo.getStandardValue() : "", dataStyle); |
| | | createCell(dataRow, 13, vo.getControlValue() != null ? vo.getControlValue() : "", dataStyle); |
| | | createCell(dataRow, 14, vo.getTestValue() != null ? vo.getTestValue() : "", dataStyle); |
| | | } |
| | | |
| | | // 设置å宽 |
| | | for (int i = 0; i < headers.length; i++) { |
| | | sheet.setColumnWidth(i, 15 * 256); |
| | | } |
| | | |
| | | // å¯¼åºæä»¶å |
| | | String fileName = getFileName(inspectType); |
| | | |
| | | // è¾åº |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xlsx", "UTF-8")); |
| | | OutputStream os = response.getOutputStream(); |
| | | workbook.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | workbook.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥: " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åå»ºè¡¨å¤´æ ·å¼ |
| | | */ |
| | | private CellStyle createHeaderStyle(Workbook workbook) { |
| | | CellStyle style = workbook.createCellStyle(); |
| | | style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); |
| | | style.setFillPattern(FillPatternType.SOLID_FOREGROUND); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setBorderBottom(BorderStyle.THIN); |
| | | style.setBorderTop(BorderStyle.THIN); |
| | | style.setBorderLeft(BorderStyle.THIN); |
| | | style.setBorderRight(BorderStyle.THIN); |
| | | Font font = workbook.createFont(); |
| | | font.setBold(true); |
| | | style.setFont(font); |
| | | return style; |
| | | } |
| | | |
| | | /** |
| | | * åå»ºæ°æ®æ ·å¼ |
| | | */ |
| | | private CellStyle createDataStyle(Workbook workbook) { |
| | | CellStyle style = workbook.createCellStyle(); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setBorderBottom(BorderStyle.THIN); |
| | | style.setBorderTop(BorderStyle.THIN); |
| | | style.setBorderLeft(BorderStyle.THIN); |
| | | style.setBorderRight(BorderStyle.THIN); |
| | | return style; |
| | | } |
| | | |
| | | /** |
| | | * å建åå
æ ¼å¹¶è®¾ç½®å¼ |
| | | */ |
| | | private void createCell(Row row, int colIndex, String value, CellStyle style) { |
| | | Cell cell = row.createCell(colIndex); |
| | | cell.setCellValue(value); |
| | | cell.setCellStyle(style); |
| | | } |
| | | |
| | | /** |
| | | * è·åå¯¼åºæä»¶å |
| | | */ |
| | | private String getFileName(Integer inspectType) { |
| | | if (inspectType == null) { |
| | | return "æ£éªå¯¼åº"; |
| | | } |
| | | switch (inspectType) { |
| | | case 0: |
| | | return "åæææ£éªå¯¼åº"; |
| | | case 1: |
| | | return "è¿ç¨æ£éªå¯¼åº"; |
| | | case 2: |
| | | return "åºåæ£éªå¯¼åº"; |
| | | default: |
| | | return "æ£éªå¯¼åº"; |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.dto.QualityInspectExportDTO; |
| | | import com.ruoyi.quality.dto.QualityInspectExportVO; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardMapper; |
| | | import com.ruoyi.quality.mapper.QualityUnqualifiedMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.pojo.QualityUnqualified; |
| | | import com.ruoyi.quality.service.IQualityInspectParamService; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | |
| | | |
| | | private IQualityInspectParamService qualityInspectParamService; |
| | | |
| | | private QualityTestStandardMapper qualityTestStandardMapper; |
| | | |
| | | private QualityUnqualifiedMapper qualityUnqualifiedMapper; |
| | | |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | |
| | | private ProcurementRecordService procurementRecordService; |
| | | private QualityInspectExportHandle qualityInspectExportHandle; |
| | | |
| | | @Override |
| | | public int add(QualityInspectDto qualityInspectDto) { |
| | |
| | | return qualityInspectDto; |
| | | } |
| | | |
| | | //æäº¤ |
| | | @Override |
| | | public int submit(QualityInspect inspect) { |
| | | QualityInspect qualityInspect = qualityInspectMapper.selectById(inspect.getId()); |
| | | //æäº¤åå¿
须夿æ¯å¦åæ ¼ |
| | | if (ObjectUtils.isNull(qualityInspect.getCheckResult())) { |
| | | throw new RuntimeException("请å
夿æ¯å¦åæ ¼"); |
| | | } |
| | | /*夿ä¸åæ ¼*/ |
| | | if (qualityInspect.getCheckResult().equals("ä¸åæ ¼")) { |
| | | QualityUnqualified qualityUnqualified = new QualityUnqualified(); |
| | | BeanUtils.copyProperties(qualityInspect, qualityUnqualified); |
| | |
| | | qualityUnqualifiedMapper.insert(qualityUnqualified); |
| | | } else { |
| | | //åæ ¼ç´æ¥å
¥åº |
| | | stockUtils.addStock(qualityInspect.getProductModelId(), qualityInspect.getQuantity(), StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode(), qualityInspect.getId(), "-", "-", "-"); |
| | | if (qualityInspect.getInspectType() == 2 || qualityInspect.getInspectType() == 0) { |
| | | stockUtils.addStock(qualityInspect.getProductModelId(), qualityInspect.getQuantity(), StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode(), qualityInspect.getId(), "-", "-", "-"); |
| | | } |
| | | } |
| | | qualityInspect.setInspectState(1);//å·²æäº¤ |
| | | return qualityInspectMapper.updateById(qualityInspect); |
| | | } |
| | | |
| | | /*çææ£éªæ¥å*/ |
| | | @Override |
| | | public void down(HttpServletResponse response, QualityInspect qualityInspect) { |
| | | QualityInspect inspect = qualityInspectMapper.selectById(qualityInspect.getId()); |
| | |
| | | |
| | | try { |
| | | response.setContentType("application/msword"); |
| | | String fileName = URLEncoder.encode( |
| | | "æ£éªæ¥å", "UTF-8"); |
| | | String fileName = URLEncoder.encode("æ£éªæ¥å", "UTF-8"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
| | | response.setHeader("Content-disposition", |
| | | "attachment;filename=" + fileName + ".docx"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".docx"); |
| | | OutputStream os = response.getOutputStream(); |
| | | template.write(os); |
| | | os.flush(); |
| | |
| | | util.exportExcel(response, qualityInspects, "åºåæ£éªå¯¼åº"); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæ£éªè®°å½ï¼æ¯æéä¸å¯¼åºåå
¨é¨å¯¼åºï¼å
嫿£éªåæ°ï¼ |
| | | * æ¯ä¸ªæ£éªåæ°ä¸è¡ï¼ä¸ä¸ªæ£éªè®°å½å±å¼æå¤è¡ï¼ |
| | | */ |
| | | @Override |
| | | public void qualityInspectExportNew(HttpServletResponse response, QualityInspectExportDTO exportDTO) { |
| | | // 1. æ¥è¯¢æ£éªè®°å½ |
| | | List<QualityInspect> qualityInspects = qualityInspectExportHandle.queryInspectList(exportDTO); |
| | | if (CollectionUtils.isEmpty(qualityInspects)) { |
| | | throw new RuntimeException("没æå¯å¯¼åºçæ°æ®"); |
| | | } |
| | | |
| | | // 2. æå»ºå¯¼åºæ°æ®ï¼æ¯ä¸ªæ£éªåæ°ä¸è¡ï¼ |
| | | List<QualityInspectExportVO> exportList = qualityInspectExportHandle.buildExportData(qualityInspects, exportDTO.getInspectType()); |
| | | |
| | | // 3. 导åºExcel |
| | | qualityInspectExportHandle.exportExcel(response, exportList, exportDTO.getInspectType()); |
| | | } |
| | | |
| | | } |
| | |
| | | </resultMap> |
| | | |
| | | <select id="listPage" resultMap="RulesRegulationsManagementDTOMap"> |
| | | select rrm.*, su.user_name as create_user_name |
| | | select rrm.*, su.nick_name as create_user_name |
| | | from rules_regulations_management rrm |
| | | left join sys_user su on rrm.create_user = su.user_id |
| | | <where> |
| | |
| | | <select id="queryPage" resultType="com.ruoyi.device.dto.DeviceRepairDto"> |
| | | select dr.id, |
| | | dr.device_ledger_id, |
| | | dr.repair_time, |
| | | dr.repair_name, |
| | | dr.remark, |
| | | dr.repair_project, |
| | | dr.repair_time_start as repairTimeStart, |
| | | dr.repair_time_end as repairTimeEnd, |
| | | dr.maintenance_name, |
| | | dr.maintenance_time, |
| | | dr.maintenance_result, |
| | |
| | | <if test="deviceRepairDto.maintenanceName != null"> |
| | | and dr.maintenance_name like concat('%',#{deviceRepairDto.maintenanceName},'%') |
| | | </if> |
| | | |
| | | <if test="deviceRepairDto.repairTimeStr != null and deviceRepairDto.repairTimeStr != '' "> |
| | | and dr.repair_time like concat('%',#{deviceRepairDto.repairTimeStr},'%') |
| | | <if test="deviceRepairDto.repairTimeStart != null"> |
| | | and dr.repair_time_start >= #{deviceRepairDto.repairTimeStart} |
| | | </if> |
| | | <if test="deviceRepairDto.repairTimeEnd != null"> |
| | | and dr.repair_time_end <= #{deviceRepairDto.repairTimeEnd} |
| | | </if> |
| | | <if test="deviceRepairDto.maintenanceTimeStr != null and deviceRepairDto.maintenanceTimeStr != '' "> |
| | | and dr.maintenance_time like concat('%',#{deviceRepairDto.maintenanceTimeStr},'%') |
| | | </if> |
| | | </where> |
| | | order by dr.status asc, dr.create_time desc |
| | | </select> |
| | | <select id="detailById" resultType="com.ruoyi.device.dto.DeviceRepairDto"> |
| | | select dr.id, |
| | | dr.device_ledger_id, |
| | | dr.repair_time, |
| | | dr.repair_name, |
| | | dr.remark, |
| | | dr.repair_project, |
| | | dr.repair_time_start as repairTimeStart, |
| | | dr.repair_time_end as repairTimeEnd, |
| | | dr.maintenance_name, |
| | | dr.maintenance_time, |
| | | dr.maintenance_result, |
| | |
| | | ROUND(pwo.complete_quantity / pwo.plan_quantity * 100, 2) AS completionStatus, |
| | | sum(ppo.scrap_qty) scrapQty, |
| | | pp.device_id, |
| | | pp.device_name |
| | | pp.device_name, |
| | | t8.product_name as final_product_model |
| | | FROM |
| | | product_work_order pwo |
| | | LEFT JOIN product_process_route_item ppri ON ppri.id = pwo.product_process_route_item_id |
| | |
| | | LEFT JOIN product_process pp ON pp.id = ppri.process_id |
| | | LEFT JOIN product_model pm ON pm.id = ppri.product_model_id |
| | | LEFT JOIN product p ON p.id = pm.product_id |
| | | left join product_model t7 on t7.id = po.product_model_id |
| | | left join product as t8 on t7.product_id = t8.id |
| | | WHERE pwo.id = #{id} |
| | | GROUP BY pwo.id, pwo.product_process_route_item_id, pwo.create_time, pwo.update_time, pwo.work_order_no, pwo.plan_start_time, pwo.plan_end_time, pwo.actual_start_time, pwo.actual_end_time, pwo.status, pwo.tenant_id, pwo.plan_quantity, pwo.product_order_id, pwo.complete_quantity, |
| | | pp.device_id, |
| | |
| | | sl.sales_contract_no |
| | | </select> |
| | | <select id="listVat" resultType="com.ruoyi.purchase.dto.VatDto"> |
| | | select * |
| | | from (SELECT |
| | | COALESCE(a1.month, a2.month) AS month, |
| | | IFNULL(a1.tax_amount, 0) AS j_tax_amount, |
| | | IFNULL(a2.x_tax_amount, 0) AS x_tax_amount |
| | | FROM ( |
| | | -- 第ä¸ä¸ªæ¥è¯¢ï¼æ¥èª invoice_ledger çç¨é¢ |
| | | SELECT |
| | | DATE_FORMAT(il.invoice_date, '%Y-%m') AS month, |
| | | ROUND(SUM(pr.invoice_amount - pr.invoice_amount / (1 + pr.tax_rate / 100)), 2) AS tax_amount |
| | | FROM invoice_ledger il |
| | | LEFT JOIN invoice_registration_product pr ON pr.id = il.invoice_registration_product_id |
| | | WHERE il.invoice_no IS NOT NULL |
| | | AND invoice_type = 'å¢ä¸ç¥¨' |
| | | AND DATE_FORMAT(il.invoice_date, '%Y-%m') IS NOT NULL -- æ°å¢ï¼è¿æ»¤month为NULLçæ
|
| | | GROUP BY DATE_FORMAT(il.invoice_date, '%Y-%m') |
| | | ) a1 |
| | | LEFT JOIN ( |
| | | -- 第äºä¸ªæ¥è¯¢ï¼æ¥èª ticket_registration çç¨é¢ |
| | | SELECT |
| | | DATE_FORMAT(a.issue_date, '%Y-%m') AS month, |
| | | SUM(a.invoice_amount) AS x_tax_amount |
| | | FROM ( |
| | | SELECT DISTINCT pr.id, |
| | | tr.issue_date, |
| | | ROUND(pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS un_tickets_price, |
| | | ROUND(pr.tickets_amount - pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS invoice_amount |
| | | FROM product_record pr |
| | | LEFT JOIN purchase_ledger pl ON pl.id = pr.purchase_ledger_id |
| | | LEFT JOIN sales_ledger sl ON sl.id = pl.sales_ledger_id |
| | | LEFT JOIN ticket_registration tr ON tr.purchase_ledger_id = pl.id |
| | | LEFT JOIN product_model pm ON pm.id = pr.product_model_id |
| | | WHERE type = 2 |
| | | AND tr.invoice_number IS NOT NULL |
| | | ) a |
| | | GROUP BY DATE_FORMAT(a.issue_date, '%Y-%m') |
| | | ) a2 ON a1.month = a2.month |
| | | <!-- select *--> |
| | | <!-- from (SELECT--> |
| | | <!-- COALESCE(a1.month, a2.month) AS month,--> |
| | | <!-- IFNULL(a1.tax_amount, 0) AS j_tax_amount,--> |
| | | <!-- IFNULL(a2.x_tax_amount, 0) AS x_tax_amount--> |
| | | <!-- FROM (--> |
| | | <!-- -- 第ä¸ä¸ªæ¥è¯¢ï¼æ¥èª invoice_ledger çç¨é¢--> |
| | | <!-- SELECT--> |
| | | <!-- DATE_FORMAT(il.invoice_date, '%Y-%m') AS month,--> |
| | | <!-- ROUND(SUM(pr.invoice_amount - pr.invoice_amount / (1 + pr.tax_rate / 100)), 2) AS tax_amount--> |
| | | <!-- FROM invoice_ledger il--> |
| | | <!-- LEFT JOIN invoice_registration_product pr ON pr.id = il.invoice_registration_product_id--> |
| | | <!-- WHERE il.invoice_no IS NOT NULL--> |
| | | <!-- AND invoice_type = 'å¢ä¸ç¥¨'--> |
| | | <!-- AND DATE_FORMAT(il.invoice_date, '%Y-%m') IS NOT NULL -- æ°å¢ï¼è¿æ»¤month为NULLçæ
--> |
| | | <!-- GROUP BY DATE_FORMAT(il.invoice_date, '%Y-%m')--> |
| | | <!-- ) a1--> |
| | | <!-- LEFT JOIN (--> |
| | | <!-- -- 第äºä¸ªæ¥è¯¢ï¼æ¥èª ticket_registration çç¨é¢--> |
| | | <!-- SELECT--> |
| | | <!-- DATE_FORMAT(a.issue_date, '%Y-%m') AS month,--> |
| | | <!-- SUM(a.invoice_amount) AS x_tax_amount--> |
| | | <!-- FROM (--> |
| | | <!-- SELECT DISTINCT pr.id,--> |
| | | <!-- tr.issue_date,--> |
| | | <!-- ROUND(pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS un_tickets_price,--> |
| | | <!-- ROUND(pr.tickets_amount - pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS invoice_amount--> |
| | | <!-- FROM product_record pr--> |
| | | <!-- LEFT JOIN purchase_ledger pl ON pl.id = pr.purchase_ledger_id--> |
| | | <!-- LEFT JOIN sales_ledger sl ON sl.id = pl.sales_ledger_id--> |
| | | <!-- LEFT JOIN ticket_registration tr ON tr.purchase_ledger_id = pl.id--> |
| | | <!-- LEFT JOIN product_model pm ON pm.id = pr.product_model_id--> |
| | | <!-- WHERE type = 2--> |
| | | <!-- AND tr.invoice_number IS NOT NULL--> |
| | | <!-- ) a--> |
| | | <!-- GROUP BY DATE_FORMAT(a.issue_date, '%Y-%m')--> |
| | | <!-- ) a2 ON a1.month = a2.month--> |
| | | |
| | | UNION ALL |
| | | <!-- UNION ALL--> |
| | | |
| | | SELECT |
| | | COALESCE(a1.month, a2.month) AS month, |
| | | IFNULL(a1.tax_amount, 0) AS tax_amount, |
| | | IFNULL(a2.x_tax_amount, 0) AS x_tax_amount |
| | | FROM ( |
| | | -- 第äºä¸ªæ¥è¯¢ï¼æ¥èª ticket_registration çç¨é¢ï¼åè¿æ¥è¡¥å
¨æ²¡æå¹é
å°çï¼ |
| | | SELECT |
| | | DATE_FORMAT(a.issue_date, '%Y-%m') AS month, |
| | | SUM(a.invoice_amount) AS x_tax_amount |
| | | FROM ( |
| | | SELECT DISTINCT pr.id, |
| | | tr.issue_date, |
| | | ROUND(pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS un_tickets_price, |
| | | ROUND(pr.tickets_amount - pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS invoice_amount |
| | | FROM product_record pr |
| | | LEFT JOIN purchase_ledger pl ON pl.id = pr.purchase_ledger_id |
| | | LEFT JOIN sales_ledger sl ON sl.id = pl.sales_ledger_id |
| | | LEFT JOIN ticket_registration tr ON tr.purchase_ledger_id = pl.id |
| | | LEFT JOIN product_model pm ON pm.id = pr.product_model_id |
| | | WHERE type = 2 |
| | | AND tr.invoice_number IS NOT NULL |
| | | ) a |
| | | GROUP BY DATE_FORMAT(a.issue_date, '%Y-%m') |
| | | ) a2 |
| | | LEFT JOIN ( |
| | | -- 第ä¸ä¸ªæ¥è¯¢ï¼æ¥èª invoice_ledger çç¨é¢ |
| | | SELECT |
| | | DATE_FORMAT(il.invoice_date, '%Y-%m') AS month, |
| | | ROUND(SUM(pr.invoice_amount - pr.invoice_amount / (1 + pr.tax_rate / 100)), 2) AS tax_amount |
| | | FROM invoice_ledger il |
| | | LEFT JOIN invoice_registration_product pr ON pr.id = il.invoice_registration_product_id |
| | | WHERE il.invoice_no IS NOT NULL |
| | | AND invoice_type = 'å¢ä¸ç¥¨' |
| | | AND DATE_FORMAT(il.invoice_date, '%Y-%m') IS NOT NULL -- æ°å¢ï¼è¿æ»¤month为NULLçæ
|
| | | GROUP BY DATE_FORMAT(il.invoice_date, '%Y-%m') |
| | | ) a1 ON a1.month = a2.month |
| | | WHERE a1.month IS NULL |
| | | ORDER BY month |
| | | )as a |
| | | <!-- SELECT--> |
| | | <!-- COALESCE(a1.month, a2.month) AS month,--> |
| | | <!-- IFNULL(a1.tax_amount, 0) AS tax_amount,--> |
| | | <!-- IFNULL(a2.x_tax_amount, 0) AS x_tax_amount--> |
| | | <!-- FROM (--> |
| | | <!-- -- 第äºä¸ªæ¥è¯¢ï¼æ¥èª ticket_registration çç¨é¢ï¼åè¿æ¥è¡¥å
¨æ²¡æå¹é
å°çï¼--> |
| | | <!-- SELECT--> |
| | | <!-- DATE_FORMAT(a.issue_date, '%Y-%m') AS month,--> |
| | | <!-- SUM(a.invoice_amount) AS x_tax_amount--> |
| | | <!-- FROM (--> |
| | | <!-- SELECT DISTINCT pr.id,--> |
| | | <!-- tr.issue_date,--> |
| | | <!-- ROUND(pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS un_tickets_price,--> |
| | | <!-- ROUND(pr.tickets_amount - pr.tickets_amount / (1 + pr.tax_rate / 100), 2) AS invoice_amount--> |
| | | <!-- FROM product_record pr--> |
| | | <!-- LEFT JOIN purchase_ledger pl ON pl.id = pr.purchase_ledger_id--> |
| | | <!-- LEFT JOIN sales_ledger sl ON sl.id = pl.sales_ledger_id--> |
| | | <!-- LEFT JOIN ticket_registration tr ON tr.purchase_ledger_id = pl.id--> |
| | | <!-- LEFT JOIN product_model pm ON pm.id = pr.product_model_id--> |
| | | <!-- WHERE type = 2--> |
| | | <!-- AND tr.invoice_number IS NOT NULL--> |
| | | <!-- ) a--> |
| | | <!-- GROUP BY DATE_FORMAT(a.issue_date, '%Y-%m')--> |
| | | <!-- ) a2--> |
| | | <!-- LEFT JOIN (--> |
| | | <!-- -- 第ä¸ä¸ªæ¥è¯¢ï¼æ¥èª invoice_ledger çç¨é¢--> |
| | | <!-- SELECT--> |
| | | <!-- DATE_FORMAT(il.invoice_date, '%Y-%m') AS month,--> |
| | | <!-- ROUND(SUM(pr.invoice_amount - pr.invoice_amount / (1 + pr.tax_rate / 100)), 2) AS tax_amount--> |
| | | <!-- FROM invoice_ledger il--> |
| | | <!-- LEFT JOIN invoice_registration_product pr ON pr.id = il.invoice_registration_product_id--> |
| | | <!-- WHERE il.invoice_no IS NOT NULL--> |
| | | <!-- AND invoice_type = 'å¢ä¸ç¥¨'--> |
| | | <!-- AND DATE_FORMAT(il.invoice_date, '%Y-%m') IS NOT NULL -- æ°å¢ï¼è¿æ»¤month为NULLçæ
--> |
| | | <!-- GROUP BY DATE_FORMAT(il.invoice_date, '%Y-%m')--> |
| | | <!-- ) a1 ON a1.month = a2.month--> |
| | | <!-- WHERE a1.month IS NULL--> |
| | | <!-- ORDER BY month--> |
| | | <!-- )as a--> |
| | | <!-- <where>--> |
| | | <!-- a.month is not null--> |
| | | <!-- <if test="month != null">--> |
| | | <!-- and a.month = #{month}--> |
| | | <!-- </if>--> |
| | | <!-- </where>--> |
| | | select * from ( |
| | | SELECT |
| | | month, |
| | | SUM(sales_tax_amount) AS j_tax_amount, |
| | | SUM(purchase_tax_amount) AS x_tax_amount |
| | | FROM ( |
| | | SELECT |
| | | DATE_FORMAT(entry_date, '%Y-%m') AS month, |
| | | ROUND(SUM(contract_amount * 0.13), 2) AS sales_tax_amount, |
| | | 0 AS purchase_tax_amount |
| | | FROM sales_ledger |
| | | WHERE entry_date IS NOT NULL |
| | | GROUP BY DATE_FORMAT(entry_date, '%Y-%m') |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | DATE_FORMAT(entry_date, '%Y-%m') AS month, |
| | | 0 AS sales_tax_amount, |
| | | ROUND(SUM(contract_amount * 0.26), 2) AS purchase_tax_amount |
| | | FROM purchase_ledger |
| | | WHERE entry_date IS NOT NULL |
| | | GROUP BY DATE_FORMAT(entry_date, '%Y-%m') |
| | | ) t |
| | | GROUP BY month |
| | | ORDER BY month |
| | | ) a |
| | | <where> |
| | | a.month is not null |
| | | <if test="month != null"> |
| | | <if test="month != null and month != ''"> |
| | | and a.month = #{month} |
| | | </if> |
| | | </where> |
| | |
| | | <if test="qualityInspect.entryDateEnd != null and qualityInspect.entryDateEnd != '' "> |
| | | AND qi.check_time <= DATE_FORMAT(#{qualityInspect.entryDateEnd},'%Y-%m-%d') |
| | | </if> |
| | | ORDER BY qi.check_time DESC |
| | | ORDER BY |
| | | CASE WHEN qi.check_result IS NULL OR qi.check_result = '' THEN 0 ELSE 1 END, |
| | | inspect_state, |
| | | qi.check_time DESC, |
| | | qi.id DESC |
| | | </select> |
| | | |
| | | <select id="qualityInspectExport" resultType="com.ruoyi.quality.pojo.QualityInspect"> |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="qualityInspectExportByIds" resultType="com.ruoyi.quality.pojo.QualityInspect"> |
| | | SELECT |
| | | qi.*, |
| | | <choose> |
| | | <when test="qualityInspect.inspectType == 0"> |
| | | pl.purchase_contract_number as purchase_contract_no |
| | | </when> |
| | | <otherwise> |
| | | pwo.work_order_no |
| | | </otherwise> |
| | | </choose> |
| | | FROM quality_inspect qi |
| | | <choose> |
| | | <when test="qualityInspect.inspectType == 0"> |
| | | LEFT JOIN purchase_ledger pl ON pl.id = qi.purchase_ledger_id |
| | | </when> |
| | | <otherwise> |
| | | LEFT JOIN production_product_main ppm ON qi.product_main_id = ppm.id |
| | | LEFT JOIN product_work_order pwo ON ppm.work_order_id = pwo.id |
| | | </otherwise> |
| | | </choose> |
| | | WHERE qi.inspect_type=#{qualityInspect.inspectType} |
| | | <if test="ids != null and ids.size() > 0"> |
| | | AND qi.id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="qualityInspect.supplier != null and qualityInspect.supplier != '' "> |
| | | AND qi.supplier like concat('%',#{qualityInspect.supplier},'%') |
| | | </if> |
| | | <if test="qualityInspect.process != null and qualityInspect.process != '' "> |
| | | AND qi.process like concat('%',#{qualityInspect.process},'%') |
| | | </if> |
| | | <if test="qualityInspect.productName != null and qualityInspect.productName != '' "> |
| | | AND qi.product_name like concat('%',#{qualityInspect.productName},'%') |
| | | </if> |
| | | <if test="qualityInspect.entryDateStart != null and qualityInspect.entryDateStart != '' "> |
| | | AND qi.check_time >= DATE_FORMAT(#{qualityInspect.entryDateStart},'%Y-%m-d') |
| | | </if> |
| | | <if test="qualityInspect.entryDateEnd != null and qualityInspect.entryDateEnd != '' "> |
| | | AND qi.check_time <= DATE_FORMAT(#{qualityInspect.entryDateEnd},'%Y-%m-d') |
| | | </if> |
| | | ORDER BY qi.check_time DESC |
| | | </select> |
| | | |
| | | <delete id="deleteByProductMainIds"> |
| | | DELETE FROM quality_inspect |
| | | WHERE product_main_id IN |