Merge branch 'dev_new' of http://114.132.189.42:9002/r/lims-ruoyi-after into dev_new
| | |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | <!--æ¥è¡¨å¾è¡¨æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>report-server</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- minio --> |
| | | <dependency> |
| | | <groupId>io.minio</groupId> |
| | |
| | | <module>cnas-device</module> |
| | | <module>cnas-process</module> |
| | | <module>cnas-personnel</module> |
| | | <module>report-server</module> |
| | | </modules> |
| | | <packaging>pom</packaging> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>ruoyi</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.8.9</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>report-server</artifactId> |
| | | |
| | | <dependencies> |
| | | <!-- éç¨å·¥å
·--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- æ ¸å¿æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-framework</artifactId> |
| | | </dependency> |
| | | |
| | | <!--åºç¡æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>basic-server</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- ç³»ç»æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-system</artifactId> |
| | | </dependency> |
| | | |
| | | <!--ä¸å¡æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>inspect-server</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | </project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.report.dto.DashboardDto; |
| | | import com.ruoyi.report.service.DashboardService; |
| | | import com.ruoyi.report.vo.DashboardOverviewVo; |
| | | import com.ruoyi.report.vo.RankingVo; |
| | | import com.ruoyi.report.vo.TaskCalendarVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ°ååè¯é³çæ¿æ§å¶å¨ |
| | | */ |
| | | @RequestMapping("/report/dashboard") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api(tags = "æ°ååè¯é³çæ¿") |
| | | public class DashboardController { |
| | | |
| | | private DashboardService dashboardService; |
| | | |
| | | /** |
| | | * è·åçæ¿æ¦è§æ°æ® |
| | | */ |
| | | @ApiOperation(value = "è·åçæ¿æ¦è§æ°æ®") |
| | | @GetMapping("/overview") |
| | | public Result overview(DashboardDto dto) { |
| | | return Result.success(dashboardService.getOverview(dto)); |
| | | } |
| | | |
| | | /** |
| | | * åå²15å¤©æ°æ® |
| | | */ |
| | | @ApiOperation(value = "åå²15å¤©æ°æ®") |
| | | @GetMapping("/history15Days") |
| | | public Result history15Days(DashboardDto dto) { |
| | | return Result.success(dashboardService.getHistory15Days(dto)); |
| | | } |
| | | |
| | | /** |
| | | * æªæ¥15å¤©ä»»å¡ |
| | | */ |
| | | @ApiOperation(value = "æªæ¥15天任å¡") |
| | | @GetMapping("/future15Days") |
| | | public Result future15Days(DashboardDto dto) { |
| | | return Result.success(dashboardService.getFuture15Days(dto)); |
| | | } |
| | | |
| | | /** |
| | | * æäº¤æè¡ |
| | | */ |
| | | @ApiOperation(value = "æäº¤æè¡") |
| | | @GetMapping("/ranking") |
| | | public Result ranking(DashboardDto dto) { |
| | | return Result.success(dashboardService.getRanking(dto)); |
| | | } |
| | | |
| | | /** |
| | | * æ£éªç»æç»è®¡ |
| | | */ |
| | | @ApiOperation(value = "æ£éªç»æç»è®¡") |
| | | @GetMapping("/insResult") |
| | | public Result insResult(DashboardDto dto) { |
| | | return Result.success(dashboardService.getInsResult(dto)); |
| | | } |
| | | |
| | | /** |
| | | * è·åè¯é³ææ¥éå |
| | | */ |
| | | @ApiOperation(value = "è·åè¯é³ææ¥éå") |
| | | @GetMapping("/voiceQueue") |
| | | public Result voiceQueue() { |
| | | return Result.success(dashboardService.getVoiceQueue()); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.report.dto.NormalDistributionDto; |
| | | import com.ruoyi.report.service.NormalDistributionService; |
| | | import com.ruoyi.report.vo.NormalDistributionVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * æ£æåå¸å¾æ§å¶å¨ |
| | | */ |
| | | @RequestMapping("/chart/normalDistribution") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api(tags = "æ£æåå¸å¾") |
| | | public class NormalDistributionController { |
| | | |
| | | private NormalDistributionService normalDistributionService; |
| | | |
| | | /** |
| | | * æ£æåå¸åæ |
| | | */ |
| | | @ApiOperation(value = "æ£æåå¸åæ") |
| | | @PostMapping("/analyze") |
| | | public Result analyze(@RequestBody NormalDistributionDto dto) { |
| | | return Result.success(normalDistributionService.analyze(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 导åºåææ°æ® |
| | | */ |
| | | @ApiOperation(value = "导åºåææ°æ®") |
| | | @GetMapping("/export") |
| | | public void export(NormalDistributionDto dto, HttpServletResponse response) { |
| | | normalDistributionService.export(dto, response); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å¯éæ£æµé¡¹ |
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢å¯éæ£æµé¡¹") |
| | | @GetMapping("/itemNames") |
| | | public Result getItemNames(NormalDistributionDto dto) { |
| | | return Result.success(normalDistributionService.getItemNames(dto)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å¯éæ ·ååç§°å表 |
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢å¯éæ ·ååç§°å表") |
| | | @GetMapping("/projectList") |
| | | public Result getProjectList(NormalDistributionDto dto) { |
| | | return Result.success(normalDistributionService.getSampleNames(dto)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.report.dto.PassRateDto; |
| | | import com.ruoyi.report.service.PassRateService; |
| | | import com.ruoyi.report.vo.ParetoVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * åæ ¼çç»è®¡æ§å¶å¨ |
| | | */ |
| | | @RequestMapping("/chart/passRate") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api(tags = "åæ ¼çç»è®¡") |
| | | public class PassRateController { |
| | | |
| | | private PassRateService passRateService; |
| | | |
| | | /** |
| | | * åææåæ ¼ç |
| | | */ |
| | | @ApiOperation(value = "åææåæ ¼ç") |
| | | @GetMapping("/rawMaterial") |
| | | public Result rawMaterial(PassRateDto dto) { |
| | | return Result.success(passRateService.getRawMaterialPassRate(dto)); |
| | | } |
| | | |
| | | /** |
| | | * ä¾åºåä¸åæ ¼ç»è®¡ |
| | | */ |
| | | @ApiOperation(value = "ä¾åºåä¸åæ ¼ç»è®¡") |
| | | @GetMapping("/supplier") |
| | | public Result supplier(PassRateDto dto) { |
| | | return Result.success(passRateService.getSupplierUnqualified(dto)); |
| | | } |
| | | |
| | | /** |
| | | * å¸ç´¯æå¾æ°æ® |
| | | */ |
| | | @ApiOperation(value = "å¸ç´¯æå¾æ°æ®") |
| | | @GetMapping("/pareto") |
| | | public Result pareto(PassRateDto dto) { |
| | | return Result.success(passRateService.getPareto(dto)); |
| | | } |
| | | |
| | | /** |
| | | * å·¥åºåæ ¼ç |
| | | */ |
| | | @ApiOperation(value = "å·¥åºåæ ¼ç") |
| | | @GetMapping("/process") |
| | | public Result process(PassRateDto dto) { |
| | | return Result.success(passRateService.getProcessPassRate(dto)); |
| | | } |
| | | |
| | | /** |
| | | * æºå°ä¸åæ ¼ç»è®¡ |
| | | */ |
| | | @ApiOperation(value = "æºå°ä¸åæ ¼ç»è®¡") |
| | | @GetMapping("/machine") |
| | | public Result machine(PassRateDto dto) { |
| | | return Result.success(passRateService.getMachineUnqualified(dto)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.report.dto.DeviceRecordDto; |
| | | import com.ruoyi.report.service.ReportDeviceRecordService; |
| | | import com.ruoyi.report.vo.DeviceRecordVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 设å¤ä½¿ç¨è®°å½æ§å¶å¨ |
| | | */ |
| | | @RequestMapping("/report/deviceRecord") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api(tags = "设å¤ä½¿ç¨è®°å½æ¥è¡¨") |
| | | public class ReportDeviceRecordController { |
| | | |
| | | private ReportDeviceRecordService reportDeviceRecordService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢è®¾å¤ä½¿ç¨è®°å½ |
| | | */ |
| | | @ApiOperation(value = "å页æ¥è¯¢è®¾å¤ä½¿ç¨è®°å½") |
| | | @GetMapping("/page") |
| | | public Result page(DeviceRecordDto dto, Page page) { |
| | | return Result.success(reportDeviceRecordService.pageDeviceRecord(page, dto)); |
| | | } |
| | | |
| | | /** |
| | | * 设å¤ä½¿ç¨ç»è®¡ |
| | | */ |
| | | @ApiOperation(value = "设å¤ä½¿ç¨ç»è®¡") |
| | | @GetMapping("/statistics") |
| | | public Result statistics(DeviceRecordDto dto) { |
| | | return Result.success(reportDeviceRecordService.getStatistics(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 导åºè®°å½ |
| | | */ |
| | | @ApiOperation(value = "导åºè®°å½") |
| | | @GetMapping("/export") |
| | | public void export(DeviceRecordDto dto, HttpServletResponse response) { |
| | | reportDeviceRecordService.exportDeviceRecord(dto, response); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.report.dto.SampleProgressDto; |
| | | import com.ruoyi.report.service.SampleProgressService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ ·åè¿åº¦æ¥è¡¨æ§å¶å¨ |
| | | */ |
| | | @RequestMapping("/report/sampleProgress") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api(tags = "æ ·åè¿åº¦æ¥è¡¨") |
| | | public class SampleProgressController { |
| | | |
| | | private SampleProgressService sampleProgressService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ ·åè¿åº¦ |
| | | */ |
| | | @ApiOperation(value = "å页æ¥è¯¢æ ·åè¿åº¦") |
| | | @GetMapping("/page") |
| | | public Result page(SampleProgressDto dto, Page page) { |
| | | return Result.success(sampleProgressService.pageSampleProgress(page, dto)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ ·åè¿åº¦ç»è®¡ |
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢æ ·åè¿åº¦ç»è®¡") |
| | | @GetMapping("/statistics") |
| | | public Result statistics(SampleProgressDto dto) { |
| | | return Result.success(sampleProgressService.getStatistics(dto)); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæ ·åè¿åº¦æ¥è¡¨ |
| | | */ |
| | | @ApiOperation(value = "å¯¼åºæ ·åè¿åº¦æ¥è¡¨") |
| | | @GetMapping("/export") |
| | | public void export(SampleProgressDto dto, HttpServletResponse response) { |
| | | sampleProgressService.exportSampleProgress(dto, response); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢è¿åº¦å¯è§åæ°æ® |
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢è¿åº¦å¯è§åæ°æ®") |
| | | @GetMapping("/chart") |
| | | public Result getChartData(SampleProgressDto dto) { |
| | | return Result.success(sampleProgressService.getChartData(dto)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.report.dto.SampleRecordDto; |
| | | import com.ruoyi.report.service.SampleRecordService; |
| | | import com.ruoyi.report.vo.SampleRecordVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ ·å颿 ·è®°å½æ§å¶å¨ |
| | | */ |
| | | @RequestMapping("/report/sampleRecord") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api(tags = "æ ·å颿 ·è®°å½") |
| | | public class SampleRecordController { |
| | | |
| | | private SampleRecordService sampleRecordService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢é¢æ ·è®°å½ |
| | | */ |
| | | @ApiOperation(value = "å页æ¥è¯¢é¢æ ·è®°å½") |
| | | @GetMapping("/page") |
| | | public Result page(SampleRecordDto dto, Page page) { |
| | | return Result.success(sampleRecordService.pageSampleRecord(page, dto)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ ·åæµè½¬è®°å½ |
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢æ ·åæµè½¬è®°å½") |
| | | @GetMapping("/flow") |
| | | public Result flow(@RequestParam Long sampleId) { |
| | | return Result.success(sampleRecordService.getFlowRecord(sampleId)); |
| | | } |
| | | |
| | | /** |
| | | * 导åºè®°å½ |
| | | */ |
| | | @ApiOperation(value = "导åºè®°å½") |
| | | @GetMapping("/export") |
| | | public void export(SampleRecordDto dto, HttpServletResponse response) { |
| | | sampleRecordService.exportSampleRecord(dto, response); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.report.dto.SpcChartDto; |
| | | import com.ruoyi.report.service.SpcChartService; |
| | | import com.ruoyi.report.vo.SpcResultVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * SPCæ§å¶å¾æ§å¶å¨ |
| | | */ |
| | | @RequestMapping("/chart/spc") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api(tags = "SPCæ§å¶å¾") |
| | | public class SpcChartController { |
| | | |
| | | private SpcChartService spcChartService; |
| | | |
| | | /** |
| | | * SPCåæ |
| | | */ |
| | | @ApiOperation(value = "SPCåæ") |
| | | @PostMapping("/analyze") |
| | | public Result analyze(@RequestBody SpcChartDto dto) { |
| | | return Result.success(spcChartService.analyze(dto)); |
| | | } |
| | | |
| | | /** |
| | | * å¶ç¨è½ååæ |
| | | */ |
| | | @ApiOperation(value = "å¶ç¨è½ååæ") |
| | | @GetMapping("/capability") |
| | | public Result capability(SpcChartDto dto) { |
| | | return Result.success(spcChartService.getCapability(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 导åºåææ°æ® |
| | | */ |
| | | @ApiOperation(value = "导åºåææ°æ®") |
| | | @GetMapping("/export") |
| | | public void export(SpcChartDto dto, HttpServletResponse response) { |
| | | spcChartService.export(dto, response); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å¯éæ£æµé¡¹ |
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢å¯éæ£æµé¡¹") |
| | | @GetMapping("/itemNames") |
| | | public Result getItemNames(SpcChartDto dto) { |
| | | return Result.success(spcChartService.getItemNames(dto)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å¯éæ ·ååç§°å表 |
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢å¯éæ ·ååç§°å表") |
| | | @GetMapping("/projectList") |
| | | public Result getProjectList(SpcChartDto dto) { |
| | | return Result.success(spcChartService.getSampleNames(dto)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.report.dto.TestItemDataDto; |
| | | import com.ruoyi.report.service.TestItemDataService; |
| | | import com.ruoyi.report.vo.TestItemDataVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ£æµé¡¹ç®æ°æ®æ§å¶å¨ |
| | | */ |
| | | @RequestMapping("/report/testItemData") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api(tags = "æ£æµé¡¹ç®æ°æ®") |
| | | public class TestItemDataController { |
| | | |
| | | private TestItemDataService testItemDataService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ£æµé¡¹ç®æ°æ® |
| | | */ |
| | | @ApiOperation(value = "å页æ¥è¯¢æ£æµé¡¹ç®æ°æ®") |
| | | @GetMapping("/page") |
| | | public Result page(TestItemDataDto dto, Page page) { |
| | | return Result.success(testItemDataService.pageTestItemData(page, dto)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£æµé¡¹ç®è¯¦æ
|
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢æ£æµé¡¹ç®è¯¦æ
") |
| | | @GetMapping("/detail") |
| | | public Result detail(@RequestParam Long sampleId) { |
| | | return Result.success(testItemDataService.getDetail(sampleId)); |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®æ¨ªåæ¯è¾ |
| | | */ |
| | | @ApiOperation(value = "æ°æ®æ¨ªåæ¯è¾") |
| | | @PostMapping("/compare") |
| | | public Result compare(@RequestBody TestItemDataDto dto) { |
| | | return Result.success(testItemDataService.compare(dto)); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæ°æ® |
| | | */ |
| | | @ApiOperation(value = "å¯¼åºæ°æ®") |
| | | @GetMapping("/export") |
| | | public void export(TestItemDataDto dto, HttpServletResponse response) { |
| | | testItemDataService.exportTestItemData(dto, response); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£æµé¡¹åç§°å表 |
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢æ£æµé¡¹åç§°å表") |
| | | @GetMapping("/itemNames") |
| | | public Result getItemNames(TestItemDataDto dto) { |
| | | return Result.success(testItemDataService.getItemNames(dto)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.report.dto.WorkStatisticsDto; |
| | | import com.ruoyi.report.service.WorkStatisticsService; |
| | | import com.ruoyi.report.vo.WorkStatisticsVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * å·¥ä½ç»è®¡æ§å¶å¨ |
| | | */ |
| | | @RequestMapping("/chart/workStatistics") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api(tags = "å·¥ä½ç»è®¡") |
| | | public class WorkStatisticsController { |
| | | |
| | | private WorkStatisticsService workStatisticsService; |
| | | |
| | | /** |
| | | * æäººåç»è®¡ |
| | | */ |
| | | @ApiOperation(value = "æäººåç»è®¡") |
| | | @GetMapping("/byUser") |
| | | public Result byUser(WorkStatisticsDto dto) { |
| | | return Result.success(workStatisticsService.getByUser(dto)); |
| | | } |
| | | |
| | | /** |
| | | * åæ¶çç»è®¡ |
| | | */ |
| | | @ApiOperation(value = "åæ¶çç»è®¡") |
| | | @GetMapping("/timelyRate") |
| | | public Result timelyRate(WorkStatisticsDto dto) { |
| | | return Result.success(workStatisticsService.getTimelyRate(dto)); |
| | | } |
| | | |
| | | /** |
| | | * å·¥ä½è¶å¿å¾ |
| | | */ |
| | | @ApiOperation(value = "å·¥ä½è¶å¿å¾") |
| | | @GetMapping("/trend") |
| | | public Result trend(WorkStatisticsDto dto) { |
| | | return Result.success(workStatisticsService.getTrend(dto)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * çæ¿æ¥è¯¢DTO |
| | | */ |
| | | @Data |
| | | public class DashboardDto { |
| | | |
| | | @ApiModelProperty("å¼å§æ¶é´") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty("ç»ææ¶é´") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty("æ¶é´ç±»å(1:æ¬å¨/2:æ¬æ/3:æ¬å¹´)") |
| | | private String dateType; |
| | | |
| | | @ApiModelProperty("æ£éªç±»å") |
| | | private String orderType; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 设å¤ä½¿ç¨è®°å½æ¥è¯¢DTO |
| | | */ |
| | | @Data |
| | | public class DeviceRecordDto { |
| | | |
| | | @ApiModelProperty("设å¤ç¼å·") |
| | | private String deviceCode; |
| | | |
| | | @ApiModelProperty("设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @ApiModelProperty("å¼å§æ¶é´") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty("ç»ææ¶é´") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty("使ç¨äºº") |
| | | private String useUser; |
| | | |
| | | @ApiModelProperty("æ ·åç¼å·") |
| | | private String sampleCode; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * æ£æåå¸åææ¥è¯¢DTO |
| | | */ |
| | | @Data |
| | | public class NormalDistributionDto { |
| | | |
| | | @ApiModelProperty("æ£æµé¡¹åç§°") |
| | | private String itemName; |
| | | |
| | | @ApiModelProperty("æ ·ååç§°") |
| | | private String sampleName; |
| | | |
| | | @ApiModelProperty("å¼å§æ¶é´") |
| | | private String startDate; |
| | | |
| | | @ApiModelProperty("ç»ææ¶é´") |
| | | private String endDate; |
| | | |
| | | @ApiModelProperty("åç»æ°é") |
| | | private Integer binCount; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åæ ¼çç»è®¡æ¥è¯¢DTO |
| | | */ |
| | | @Data |
| | | public class PassRateDto { |
| | | |
| | | @ApiModelProperty("å¼å§æ¶é´") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty("ç»ææ¶é´") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty("æ¶é´ç±»å(1:æ¬å¨/2:æ¬æ/3:æ¬å¹´)") |
| | | private String dateType; |
| | | |
| | | @ApiModelProperty("æ£éªç±»å(1:åææ/2:åæå/3:æå)") |
| | | private String orderType; |
| | | |
| | | @ApiModelProperty("æ ·ååç§°") |
| | | private String sampleName; |
| | | |
| | | @ApiModelProperty("ä¾åºååç§°") |
| | | private String supplierName; |
| | | |
| | | @ApiModelProperty("å·¥åº") |
| | | private String process; |
| | | |
| | | @ApiModelProperty("æºå°") |
| | | private String machine; |
| | | |
| | | @ApiModelProperty("ä¸åæ ¼é¡¹ç®å表") |
| | | private List<String> itemNames; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * æ ·åè¿åº¦æ¥è¯¢DTO |
| | | */ |
| | | @Data |
| | | public class SampleProgressDto { |
| | | |
| | | @ApiModelProperty("å§æç¼å·/ç³è¯·åå·") |
| | | private String entrustCode; |
| | | |
| | | @ApiModelProperty("æ ·åç¼å·") |
| | | private String sampleCode; |
| | | |
| | | @ApiModelProperty("æ ·ååç§°") |
| | | private String sampleName; |
| | | |
| | | @ApiModelProperty("æ¥åç¼å·") |
| | | private String reportCode; |
| | | |
| | | @ApiModelProperty("å¼å§æ¶é´") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty("ç»ææ¶é´") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty("æ£æµç¶æ") |
| | | private Integer insState; |
| | | |
| | | @ApiModelProperty("客æ·åç§°") |
| | | private String custom; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * æ ·å颿 ·è®°å½æ¥è¯¢DTO |
| | | */ |
| | | @Data |
| | | public class SampleRecordDto { |
| | | |
| | | @ApiModelProperty("æ ·åç¼å·") |
| | | private String sampleCode; |
| | | |
| | | @ApiModelProperty("æ ·ååç§°") |
| | | private String sampleName; |
| | | |
| | | @ApiModelProperty("客æ·åç§°") |
| | | private String custom; |
| | | |
| | | @ApiModelProperty("å¼å§æ¶é´") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty("ç»ææ¶é´") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty("é¢ç¨äºº") |
| | | private String receiveUser; |
| | | |
| | | @ApiModelProperty("æ ·åID") |
| | | private Long sampleId; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * SPCåææ¥è¯¢DTO |
| | | */ |
| | | @Data |
| | | public class SpcChartDto { |
| | | |
| | | @ApiModelProperty("项ç®ID") |
| | | private Long projectId; |
| | | |
| | | @ApiModelProperty("æ£æµé¡¹åç§°") |
| | | private String itemName; |
| | | |
| | | @ApiModelProperty("å¼å§æ¶é´") |
| | | private String startDate; |
| | | |
| | | @ApiModelProperty("ç»ææ¶é´") |
| | | private String endDate; |
| | | |
| | | @ApiModelProperty("åç»å¤§å°") |
| | | private Integer subgroupSize; |
| | | |
| | | @ApiModelProperty("æ§å¶ä¸éUCL") |
| | | private BigDecimal ucl; |
| | | |
| | | @ApiModelProperty("æ§å¶ä¸éLCL") |
| | | private BigDecimal lcl; |
| | | |
| | | @ApiModelProperty("ç®æ å¼") |
| | | private BigDecimal targetValue; |
| | | |
| | | @ApiModelProperty("æ ·ååç§°") |
| | | private String sampleName; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ£æµé¡¹ç®æ°æ®æ¥è¯¢DTO |
| | | */ |
| | | @Data |
| | | public class TestItemDataDto { |
| | | |
| | | @ApiModelProperty("ç产订å") |
| | | private String productionOrder; |
| | | |
| | | @ApiModelProperty("æ¹æ¬¡å·") |
| | | private String batchNo; |
| | | |
| | | @ApiModelProperty("æ ·åç¼å·") |
| | | private String sampleCode; |
| | | |
| | | @ApiModelProperty("æ ·ååç§°") |
| | | private String sampleName; |
| | | |
| | | @ApiModelProperty("å¼å§æ¶é´") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty("ç»ææ¶é´") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty("æ£æµç¶æ") |
| | | private Integer insState; |
| | | |
| | | @ApiModelProperty("æ£æµé¡¹åç§°") |
| | | private String itemName; |
| | | |
| | | @ApiModelProperty("æ ·åIDå表(ç¨äºæ¯è¾)") |
| | | private List<Long> sampleIds; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * å·¥ä½ç»è®¡æ¥è¯¢DTO |
| | | */ |
| | | @Data |
| | | public class WorkStatisticsDto { |
| | | |
| | | @ApiModelProperty("å¼å§æ¶é´") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty("ç»ææ¶é´") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty("æ¶é´ç±»å(1:æ¬å¨/2:æ¬æ/3:æ¬å¹´)") |
| | | private String dateType; |
| | | |
| | | @ApiModelProperty("ç¨æ·ID") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty("é¨é¨ID") |
| | | private Long deptId; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.mapper; |
| | | |
| | | import com.ruoyi.report.dto.DashboardDto; |
| | | import com.ruoyi.report.vo.RankingVo; |
| | | import com.ruoyi.report.vo.TaskCalendarVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ°ååè¯é³çæ¿Mapper |
| | | */ |
| | | @Mapper |
| | | public interface DashboardMapper { |
| | | |
| | | /** |
| | | * è·åå¾
颿 ·åæ° |
| | | */ |
| | | Integer getWaitReceive(); |
| | | |
| | | /** |
| | | * è·åå¾
æ£æ ·åæ° |
| | | */ |
| | | Integer getWaitInspection(); |
| | | |
| | | /** |
| | | * è·åå¾
å®¡æ ¸æ ·åæ° |
| | | */ |
| | | Integer getWaitAudit(); |
| | | |
| | | /** |
| | | * è·åå¾
ç¼å¶æ¥åæ° |
| | | */ |
| | | Integer getWaitReport(); |
| | | |
| | | /** |
| | | * 仿¥æ°å¢æ ·å |
| | | */ |
| | | Integer getTodayNewSample(); |
| | | |
| | | /** |
| | | * 仿¥å®ææ ·å |
| | | */ |
| | | Integer getTodayFinished(); |
| | | |
| | | /** |
| | | * åå²Nå¤©æ°æ® |
| | | */ |
| | | List<TaskCalendarVo> getHistoryDays(@Param("days") Integer days, @Param("dto") DashboardDto dto); |
| | | |
| | | /** |
| | | * æªæ¥Nå¤©ä»»å¡ |
| | | */ |
| | | List<TaskCalendarVo> getFutureDays(@Param("days") Integer days, @Param("dto") DashboardDto dto); |
| | | |
| | | /** |
| | | * æäº¤æè¡(åå§è®°å½) |
| | | */ |
| | | List<RankingVo> getOriginalRecordRanking(@Param("dto") DashboardDto dto); |
| | | |
| | | /** |
| | | * æäº¤æè¡(æ¥å) |
| | | */ |
| | | List<RankingVo> getReportRanking(@Param("dto") DashboardDto dto); |
| | | |
| | | /** |
| | | * è¿30天æ£éªç»æ |
| | | */ |
| | | List<Map<String, Object>> getInsResultByDays(@Param("days") Integer days, @Param("orderType") String orderType); |
| | | |
| | | /** |
| | | * è·åè¯é³ææ¥éå |
| | | */ |
| | | List<Map<String, Object>> getVoiceQueue(); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.mapper; |
| | | |
| | | import com.ruoyi.report.dto.NormalDistributionDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ£æåå¸å¾Mapper |
| | | */ |
| | | @Mapper |
| | | public interface NormalDistributionMapper { |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£æµé¡¹æ°æ® |
| | | */ |
| | | List<Map<String, Object>> getItemData(@Param("dto") NormalDistributionDto dto); |
| | | |
| | | /** |
| | | * æ¥è¯¢å¯éæ£æµé¡¹ |
| | | */ |
| | | List<String> getItemNames(@Param("dto") NormalDistributionDto dto); |
| | | |
| | | /** |
| | | * æ¥è¯¢å¯éæ ·ååç§°å表 |
| | | */ |
| | | List<String> getSampleNames(@Param("dto") NormalDistributionDto dto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.mapper; |
| | | |
| | | import com.ruoyi.report.dto.PassRateDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * åæ ¼çç»è®¡Mapper |
| | | */ |
| | | @Mapper |
| | | public interface PassRateMapper { |
| | | |
| | | /** |
| | | * åææåæ ¼ç |
| | | */ |
| | | List<Map<String, Object>> getRawMaterialPassRate(@Param("dto") PassRateDto dto); |
| | | |
| | | /** |
| | | * ä¾åºåä¸åæ ¼ç»è®¡ |
| | | */ |
| | | List<Map<String, Object>> getSupplierUnqualified(@Param("dto") PassRateDto dto); |
| | | |
| | | /** |
| | | * ä¸åæ ¼é¡¹ç®ç»è®¡(ç¨äºå¸ç´¯æå¾) |
| | | */ |
| | | List<Map<String, Object>> getUnqualifiedItemStats(@Param("dto") PassRateDto dto); |
| | | |
| | | /** |
| | | * å·¥åºåæ ¼ç |
| | | */ |
| | | List<Map<String, Object>> getProcessPassRate(@Param("dto") PassRateDto dto); |
| | | |
| | | /** |
| | | * æºå°ä¸åæ ¼ç»è®¡ |
| | | */ |
| | | List<Map<String, Object>> getMachineUnqualified(@Param("dto") PassRateDto dto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.report.dto.DeviceRecordDto; |
| | | import com.ruoyi.report.vo.DeviceRecordVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 设å¤ä½¿ç¨è®°å½æ¥è¡¨Mapper |
| | | */ |
| | | @Mapper |
| | | public interface ReportDeviceRecordMapper { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢è®¾å¤ä½¿ç¨è®°å½ |
| | | */ |
| | | Page<DeviceRecordVo> pageDeviceRecord(Page page, @Param("dto") DeviceRecordDto dto); |
| | | |
| | | /** |
| | | * 设å¤ä½¿ç¨ç»è®¡ |
| | | */ |
| | | List<Map<String, Object>> getStatistics(@Param("dto") DeviceRecordDto dto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.report.dto.SampleProgressDto; |
| | | import com.ruoyi.report.vo.SampleProgressVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ ·åè¿åº¦æ¥è¡¨Mapper |
| | | */ |
| | | @Mapper |
| | | public interface SampleProgressMapper { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ ·åè¿åº¦ |
| | | */ |
| | | Page<SampleProgressVo> pageSampleProgress(Page page, @Param("dto") SampleProgressDto dto); |
| | | |
| | | /** |
| | | * è·åç»è®¡æ°æ® |
| | | */ |
| | | Map<String, Object> getStatistics(@Param("dto") SampleProgressDto dto); |
| | | |
| | | /** |
| | | * è·åå¾è¡¨æ°æ® |
| | | */ |
| | | List<Map<String, Object>> getChartData(@Param("dto") SampleProgressDto dto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.report.dto.SampleRecordDto; |
| | | import com.ruoyi.report.vo.SampleRecordVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ ·å颿 ·è®°å½Mapper |
| | | */ |
| | | @Mapper |
| | | public interface SampleRecordMapper { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢é¢æ ·è®°å½ |
| | | */ |
| | | Page<SampleRecordVo> pageSampleRecord(Page page, @Param("dto") SampleRecordDto dto); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ ·åæµè½¬è®°å½ |
| | | */ |
| | | List<SampleRecordVo> getFlowRecord(@Param("sampleId") Long sampleId); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.mapper; |
| | | |
| | | import com.ruoyi.report.dto.SpcChartDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * SPCæ§å¶å¾Mapper |
| | | */ |
| | | @Mapper |
| | | public interface SpcChartMapper { |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£æµé¡¹æ°æ® |
| | | */ |
| | | List<Map<String, Object>> getItemData(@Param("dto") SpcChartDto dto); |
| | | |
| | | /** |
| | | * æ¥è¯¢å¯éæ£æµé¡¹ |
| | | */ |
| | | List<String> getItemNames(@Param("dto") SpcChartDto dto); |
| | | |
| | | /** |
| | | * æ¥è¯¢å¯éæ ·ååç§°å表 |
| | | */ |
| | | List<String> getSampleNames(@Param("dto") SpcChartDto dto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.report.dto.TestItemDataDto; |
| | | import com.ruoyi.report.vo.TestItemDataVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ£æµé¡¹ç®æ°æ®Mapper |
| | | */ |
| | | @Mapper |
| | | public interface TestItemDataMapper { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ£æµé¡¹ç®æ°æ® |
| | | */ |
| | | Page<TestItemDataVo> pageTestItemData(Page page, @Param("dto") TestItemDataDto dto); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£æµé¡¹ç®è¯¦æ
|
| | | */ |
| | | List<TestItemDataVo> getDetail(@Param("sampleId") Long sampleId); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£æµé¡¹åç§°å表 |
| | | */ |
| | | List<String> getItemNames(@Param("dto") TestItemDataDto dto); |
| | | |
| | | /** |
| | | * æ ¹æ®æ ·åIDå表æ¥è¯¢æ£æµæ°æ® |
| | | */ |
| | | List<TestItemDataVo> listBySampleIds(@Param("sampleIds") List<Long> sampleIds); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.mapper; |
| | | |
| | | import com.ruoyi.report.dto.WorkStatisticsDto; |
| | | import com.ruoyi.report.vo.WorkStatisticsVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * å·¥ä½ç»è®¡Mapper |
| | | */ |
| | | @Mapper |
| | | public interface WorkStatisticsMapper { |
| | | |
| | | /** |
| | | * æäººåç»è®¡ |
| | | */ |
| | | List<WorkStatisticsVo> getByUser(@Param("dto") WorkStatisticsDto dto); |
| | | |
| | | /** |
| | | * åæ¶çç»è®¡ |
| | | */ |
| | | List<Map<String, Object>> getTimelyRate(@Param("dto") WorkStatisticsDto dto); |
| | | |
| | | /** |
| | | * å·¥ä½è¶å¿å¾ |
| | | */ |
| | | List<Map<String, Object>> getTrend(@Param("dto") WorkStatisticsDto dto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service; |
| | | |
| | | import com.ruoyi.report.dto.DashboardDto; |
| | | import com.ruoyi.report.vo.DashboardOverviewVo; |
| | | import com.ruoyi.report.vo.RankingVo; |
| | | import com.ruoyi.report.vo.TaskCalendarVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ°ååè¯é³çæ¿æå¡æ¥å£ |
| | | */ |
| | | public interface DashboardService { |
| | | |
| | | /** |
| | | * è·åçæ¿æ¦è§æ°æ® |
| | | */ |
| | | DashboardOverviewVo getOverview(DashboardDto dto); |
| | | |
| | | /** |
| | | * åå²15å¤©æ°æ® |
| | | */ |
| | | List<TaskCalendarVo> getHistory15Days(DashboardDto dto); |
| | | |
| | | /** |
| | | * æªæ¥15å¤©ä»»å¡ |
| | | */ |
| | | List<TaskCalendarVo> getFuture15Days(DashboardDto dto); |
| | | |
| | | /** |
| | | * æäº¤æè¡ |
| | | */ |
| | | List<RankingVo> getRanking(DashboardDto dto); |
| | | |
| | | /** |
| | | * æ£éªç»æç»è®¡ |
| | | */ |
| | | Map<String, Object> getInsResult(DashboardDto dto); |
| | | |
| | | /** |
| | | * è·åè¯é³ææ¥éå |
| | | */ |
| | | List<Map<String, Object>> getVoiceQueue(); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service; |
| | | |
| | | import com.ruoyi.report.dto.NormalDistributionDto; |
| | | import com.ruoyi.report.vo.NormalDistributionVo; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ£æåå¸å¾æå¡æ¥å£ |
| | | */ |
| | | public interface NormalDistributionService { |
| | | |
| | | /** |
| | | * æ£æåå¸åæ |
| | | */ |
| | | NormalDistributionVo analyze(NormalDistributionDto dto); |
| | | |
| | | /** |
| | | * 导åºåææ°æ® |
| | | */ |
| | | void export(NormalDistributionDto dto, HttpServletResponse response); |
| | | |
| | | /** |
| | | * æ¥è¯¢å¯éæ£æµé¡¹ |
| | | */ |
| | | List<String> getItemNames(NormalDistributionDto dto); |
| | | |
| | | /** |
| | | * æ¥è¯¢å¯éæ ·ååç§°å表 |
| | | */ |
| | | List<String> getSampleNames(NormalDistributionDto dto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service; |
| | | |
| | | import com.ruoyi.report.dto.PassRateDto; |
| | | import com.ruoyi.report.vo.ParetoVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * åæ ¼çç»è®¡æå¡æ¥å£ |
| | | */ |
| | | public interface PassRateService { |
| | | |
| | | /** |
| | | * åææåæ ¼ç |
| | | */ |
| | | List<Map<String, Object>> getRawMaterialPassRate(PassRateDto dto); |
| | | |
| | | /** |
| | | * ä¾åºåä¸åæ ¼ç»è®¡ |
| | | */ |
| | | List<Map<String, Object>> getSupplierUnqualified(PassRateDto dto); |
| | | |
| | | /** |
| | | * å¸ç´¯æå¾æ°æ® |
| | | */ |
| | | ParetoVo getPareto(PassRateDto dto); |
| | | |
| | | /** |
| | | * å·¥åºåæ ¼ç |
| | | */ |
| | | List<Map<String, Object>> getProcessPassRate(PassRateDto dto); |
| | | |
| | | /** |
| | | * æºå°ä¸åæ ¼ç»è®¡ |
| | | */ |
| | | List<Map<String, Object>> getMachineUnqualified(PassRateDto dto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.report.dto.DeviceRecordDto; |
| | | import com.ruoyi.report.vo.DeviceRecordVo; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 设å¤ä½¿ç¨è®°å½æ¥è¡¨æå¡æ¥å£ |
| | | */ |
| | | public interface ReportDeviceRecordService { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢è®¾å¤ä½¿ç¨è®°å½ |
| | | */ |
| | | Page<DeviceRecordVo> pageDeviceRecord(Page page, DeviceRecordDto dto); |
| | | |
| | | /** |
| | | * 设å¤ä½¿ç¨ç»è®¡ |
| | | */ |
| | | List<Map<String, Object>> getStatistics(DeviceRecordDto dto); |
| | | |
| | | /** |
| | | * 导åºè®°å½ |
| | | */ |
| | | void exportDeviceRecord(DeviceRecordDto dto, HttpServletResponse response); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.report.dto.SampleProgressDto; |
| | | import com.ruoyi.report.vo.SampleProgressVo; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ ·åè¿åº¦æ¥è¡¨æå¡æ¥å£ |
| | | */ |
| | | public interface SampleProgressService { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ ·åè¿åº¦ |
| | | */ |
| | | Page<SampleProgressVo> pageSampleProgress(Page page, SampleProgressDto dto); |
| | | |
| | | /** |
| | | * è·åç»è®¡æ°æ® |
| | | */ |
| | | Map<String, Object> getStatistics(SampleProgressDto dto); |
| | | |
| | | /** |
| | | * å¯¼åºæ¥è¡¨ |
| | | */ |
| | | void exportSampleProgress(SampleProgressDto dto, HttpServletResponse response); |
| | | |
| | | /** |
| | | * è·åå¾è¡¨æ°æ® |
| | | */ |
| | | Map<String, Object> getChartData(SampleProgressDto dto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.report.dto.SampleRecordDto; |
| | | import com.ruoyi.report.vo.SampleRecordVo; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ ·å颿 ·è®°å½æå¡æ¥å£ |
| | | */ |
| | | public interface SampleRecordService { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢é¢æ ·è®°å½ |
| | | */ |
| | | Page<SampleRecordVo> pageSampleRecord(Page page, SampleRecordDto dto); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ ·åæµè½¬è®°å½ |
| | | */ |
| | | List<SampleRecordVo> getFlowRecord(Long sampleId); |
| | | |
| | | /** |
| | | * 导åºè®°å½ |
| | | */ |
| | | void exportSampleRecord(SampleRecordDto dto, HttpServletResponse response); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service; |
| | | |
| | | import com.ruoyi.report.dto.SpcChartDto; |
| | | import com.ruoyi.report.vo.SpcResultVo; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * SPCæ§å¶å¾æå¡æ¥å£ |
| | | */ |
| | | public interface SpcChartService { |
| | | |
| | | /** |
| | | * SPCåæ |
| | | */ |
| | | SpcResultVo analyze(SpcChartDto dto); |
| | | |
| | | /** |
| | | * å¶ç¨è½ååæ |
| | | */ |
| | | SpcResultVo.Capability getCapability(SpcChartDto dto); |
| | | |
| | | /** |
| | | * 导åºåææ°æ® |
| | | */ |
| | | void export(SpcChartDto dto, HttpServletResponse response); |
| | | |
| | | /** |
| | | * æ¥è¯¢å¯éæ£æµé¡¹ |
| | | */ |
| | | List<String> getItemNames(SpcChartDto dto); |
| | | |
| | | /** |
| | | * æ¥è¯¢å¯éæ ·ååç§°å表 |
| | | */ |
| | | List<String> getSampleNames(SpcChartDto dto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.report.dto.TestItemDataDto; |
| | | import com.ruoyi.report.vo.TestItemDataVo; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ£æµé¡¹ç®æ°æ®æå¡æ¥å£ |
| | | */ |
| | | public interface TestItemDataService { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ£æµé¡¹ç®æ°æ® |
| | | */ |
| | | Page<TestItemDataVo> pageTestItemData(Page page, TestItemDataDto dto); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£æµé¡¹ç®è¯¦æ
|
| | | */ |
| | | List<TestItemDataVo> getDetail(Long sampleId); |
| | | |
| | | /** |
| | | * æ°æ®æ¨ªåæ¯è¾ |
| | | */ |
| | | Map<String, Object> compare(TestItemDataDto dto); |
| | | |
| | | /** |
| | | * å¯¼åºæ°æ® |
| | | */ |
| | | void exportTestItemData(TestItemDataDto dto, HttpServletResponse response); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£æµé¡¹åç§°å表 |
| | | */ |
| | | List<String> getItemNames(TestItemDataDto dto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service; |
| | | |
| | | import com.ruoyi.report.dto.WorkStatisticsDto; |
| | | import com.ruoyi.report.vo.WorkStatisticsVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * å·¥ä½ç»è®¡æå¡æ¥å£ |
| | | */ |
| | | public interface WorkStatisticsService { |
| | | |
| | | /** |
| | | * æäººåç»è®¡ |
| | | */ |
| | | List<WorkStatisticsVo> getByUser(WorkStatisticsDto dto); |
| | | |
| | | /** |
| | | * åæ¶çç»è®¡ |
| | | */ |
| | | List<Map<String, Object>> getTimelyRate(WorkStatisticsDto dto); |
| | | |
| | | /** |
| | | * å·¥ä½è¶å¿å¾ |
| | | */ |
| | | Map<String, Object> getTrend(WorkStatisticsDto dto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service.impl; |
| | | |
| | | import com.ruoyi.report.dto.DashboardDto; |
| | | import com.ruoyi.report.mapper.DashboardMapper; |
| | | import com.ruoyi.report.service.DashboardService; |
| | | import com.ruoyi.report.vo.DashboardOverviewVo; |
| | | import com.ruoyi.report.vo.RankingVo; |
| | | import com.ruoyi.report.vo.TaskCalendarVo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * æ°ååè¯é³çæ¿æå¡å®ç° |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class DashboardServiceImpl implements DashboardService { |
| | | |
| | | private DashboardMapper dashboardMapper; |
| | | |
| | | @Override |
| | | public DashboardOverviewVo getOverview(DashboardDto dto) { |
| | | DashboardOverviewVo vo = new DashboardOverviewVo(); |
| | | |
| | | // å¾
å¤çç»è®¡ |
| | | vo.setWaitReceive(dashboardMapper.getWaitReceive()); |
| | | vo.setWaitInspection(dashboardMapper.getWaitInspection()); |
| | | vo.setWaitAudit(dashboardMapper.getWaitAudit()); |
| | | vo.setWaitReport(dashboardMapper.getWaitReport()); |
| | | |
| | | // 仿¥ç»è®¡ |
| | | vo.setTodayNewSample(dashboardMapper.getTodayNewSample()); |
| | | vo.setTodayFinished(dashboardMapper.getTodayFinished()); |
| | | |
| | | // è¿30天æ£éªç»æ |
| | | vo.setRawMaterialResult(dashboardMapper.getInsResultByDays(30, "1")); |
| | | vo.setSemiFinishedResult(dashboardMapper.getInsResultByDays(30, "2")); |
| | | vo.setFinishedProductResult(dashboardMapper.getInsResultByDays(30, "3")); |
| | | |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public List<TaskCalendarVo> getHistory15Days(DashboardDto dto) { |
| | | return dashboardMapper.getHistoryDays(15, dto); |
| | | } |
| | | |
| | | @Override |
| | | public List<TaskCalendarVo> getFuture15Days(DashboardDto dto) { |
| | | return dashboardMapper.getFutureDays(15, dto); |
| | | } |
| | | |
| | | @Override |
| | | public List<RankingVo> getRanking(DashboardDto dto) { |
| | | // åå¹¶åå§è®°å½æè¡åæ¥åæè¡ |
| | | List<RankingVo> originalRanking = dashboardMapper.getOriginalRecordRanking(dto); |
| | | List<RankingVo> reportRanking = dashboardMapper.getReportRanking(dto); |
| | | |
| | | Map<Long, RankingVo> rankingMap = new HashMap<>(); |
| | | |
| | | // å¤çåå§è®°å½æè¡ |
| | | for (int i = 0; i < originalRanking.size(); i++) { |
| | | RankingVo vo = originalRanking.get(i); |
| | | vo.setRank(i + 1); |
| | | vo.setFinishCount(vo.getSubmitCount()); |
| | | rankingMap.put(vo.getUserId(), vo); |
| | | } |
| | | |
| | | // å¤çæ¥åæè¡ |
| | | for (RankingVo report : reportRanking) { |
| | | RankingVo existing = rankingMap.get(report.getUserId()); |
| | | if (existing != null) { |
| | | existing.setFinishCount(existing.getFinishCount() + report.getSubmitCount()); |
| | | } else { |
| | | report.setRank(0); |
| | | report.setFinishCount(report.getSubmitCount()); |
| | | rankingMap.put(report.getUserId(), report); |
| | | } |
| | | } |
| | | |
| | | // æåºå¹¶è®¾ç½®æå |
| | | List<RankingVo> result = new ArrayList<>(rankingMap.values()); |
| | | result.sort((a, b) -> b.getFinishCount().compareTo(a.getFinishCount())); |
| | | for (int i = 0; i < result.size(); i++) { |
| | | result.get(i).setRank(i + 1); |
| | | } |
| | | |
| | | return result.size() > 10 ? result.subList(0, 10) : result; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getInsResult(DashboardDto dto) { |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("rawMaterial", dashboardMapper.getInsResultByDays(30, "1")); |
| | | result.put("semiFinished", dashboardMapper.getInsResultByDays(30, "2")); |
| | | result.put("finishedProduct", dashboardMapper.getInsResultByDays(30, "3")); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getVoiceQueue() { |
| | | return dashboardMapper.getVoiceQueue(); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.report.dto.NormalDistributionDto; |
| | | import com.ruoyi.report.mapper.NormalDistributionMapper; |
| | | import com.ruoyi.report.service.NormalDistributionService; |
| | | import com.ruoyi.report.vo.NormalDistributionVo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æ£æåå¸å¾æå¡å®ç° |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class NormalDistributionServiceImpl implements NormalDistributionService { |
| | | |
| | | private NormalDistributionMapper normalDistributionMapper; |
| | | |
| | | @Override |
| | | public NormalDistributionVo analyze(NormalDistributionDto dto) { |
| | | // æ¥è¯¢æ°æ® |
| | | List<Map<String, Object>> itemData = normalDistributionMapper.getItemData(dto); |
| | | |
| | | if (CollectionUtil.isEmpty(itemData)) { |
| | | return null; |
| | | } |
| | | |
| | | if (itemData.size() < 10) { |
| | | throw new ErrorException("æ°æ®éä¸è¶³ï¼è³å°éè¦10ä¸ªæ°æ®ç¹"); |
| | | } |
| | | |
| | | // è·åæ°å¼å表 |
| | | List<BigDecimal> values = itemData.stream() |
| | | .map(m -> new BigDecimal((String) m.get("lastValue"))) |
| | | .sorted() |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 计ç®ç»è®¡é |
| | | BigDecimal min = values.get(0); |
| | | BigDecimal max = values.get(values.size() - 1); |
| | | BigDecimal sum = values.stream().reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal mean = sum.divide(new BigDecimal(values.size()), 10, RoundingMode.HALF_UP); |
| | | |
| | | // è®¡ç®æ åå·® |
| | | BigDecimal variance = BigDecimal.ZERO; |
| | | for (BigDecimal v : values) { |
| | | BigDecimal diff = v.subtract(mean); |
| | | variance = variance.add(diff.multiply(diff)); |
| | | } |
| | | variance = variance.divide(new BigDecimal(values.size() - 1), 10, RoundingMode.HALF_UP); |
| | | BigDecimal stdDev = sqrt(variance).setScale(6, RoundingMode.HALF_UP); |
| | | |
| | | // ç´æ¹å¾åç» |
| | | int binCount = dto.getBinCount() != null ? dto.getBinCount() : 10; |
| | | BigDecimal range = max.subtract(min); |
| | | BigDecimal binWidth = range.divide(new BigDecimal(binCount), 10, RoundingMode.HALF_UP); |
| | | |
| | | // 计ç®åç»è¾¹ç |
| | | List<BigDecimal> binEdges = new ArrayList<>(); |
| | | BigDecimal edge = min; |
| | | for (int i = 0; i <= binCount; i++) { |
| | | binEdges.add(edge.setScale(4, RoundingMode.HALF_UP)); |
| | | edge = edge.add(binWidth); |
| | | } |
| | | |
| | | // 计ç®é¢æ° |
| | | List<Integer> frequencies = new ArrayList<>(); |
| | | for (int i = 0; i < binCount; i++) { |
| | | BigDecimal lower = binEdges.get(i); |
| | | BigDecimal upper = binEdges.get(i + 1); |
| | | int count = 0; |
| | | for (BigDecimal v : values) { |
| | | if (v.compareTo(lower) >= 0 && (i == binCount - 1 ? v.compareTo(upper) <= 0 : v.compareTo(upper) < 0)) { |
| | | count++; |
| | | } |
| | | } |
| | | frequencies.add(count); |
| | | } |
| | | |
| | | // æ£æå叿²çº¿ |
| | | List<BigDecimal> normalX = new ArrayList<>(); |
| | | List<BigDecimal> normalY = new ArrayList<>(); |
| | | |
| | | // çææ²çº¿ç¹ |
| | | BigDecimal step = range.divide(new BigDecimal(100), 10, RoundingMode.HALF_UP); |
| | | BigDecimal x = min; |
| | | for (int i = 0; i <= 100; i++) { |
| | | normalX.add(x.setScale(4, RoundingMode.HALF_UP)); |
| | | |
| | | // æ£æåå¸å
¬å¼: f(x) = (1/(Ïâ(2Ï))) * e^(-(x-μ)^2/(2Ï^2)) |
| | | BigDecimal exponent = x.subtract(mean).pow(2) |
| | | .divide(stdDev.pow(2).multiply(new BigDecimal(2)), 10, RoundingMode.HALF_UP); |
| | | BigDecimal expValue = BigDecimal.valueOf(Math.exp(-exponent.doubleValue())); |
| | | BigDecimal coefficient = BigDecimal.ONE.divide( |
| | | stdDev.multiply(BigDecimal.valueOf(Math.sqrt(2 * Math.PI))), |
| | | 10, RoundingMode.HALF_UP); |
| | | BigDecimal y = coefficient.multiply(expValue) |
| | | .multiply(new BigDecimal(values.size())) |
| | | .multiply(binWidth) |
| | | .setScale(4, RoundingMode.HALF_UP); |
| | | normalY.add(y); |
| | | |
| | | x = x.add(step); |
| | | } |
| | | |
| | | // æå»ºç»æ |
| | | NormalDistributionVo vo = new NormalDistributionVo(); |
| | | vo.setBinEdges(binEdges); |
| | | vo.setFrequencies(frequencies); |
| | | vo.setNormalX(normalX); |
| | | vo.setNormalY(normalY); |
| | | vo.setMean(mean.setScale(4, RoundingMode.HALF_UP)); |
| | | vo.setStdDev(stdDev.setScale(4, RoundingMode.HALF_UP)); |
| | | vo.setMin(min.setScale(4, RoundingMode.HALF_UP)); |
| | | vo.setMax(max.setScale(4, RoundingMode.HALF_UP)); |
| | | vo.setSampleSize(values.size()); |
| | | |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public void export(NormalDistributionDto dto, HttpServletResponse response) { |
| | | List<Map<String, Object>> itemData = normalDistributionMapper.getItemData(dto); |
| | | |
| | | if (CollectionUtil.isEmpty(itemData)) { |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = "æ£æåå¸åææ°æ®_" + DateUtil.format(new Date(), "yyyyMMddHHmmss"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | |
| | | // æå»ºå¯¼åºæ°æ® |
| | | List<Map<String, Object>> exportData = new ArrayList<>(); |
| | | for (Map<String, Object> item : itemData) { |
| | | Map<String, Object> row = new HashMap<>(); |
| | | row.put("sampleCode", item.get("sampleCode")); |
| | | row.put("sampleName", item.get("sampleName")); |
| | | row.put("itemName", item.get("itemName")); |
| | | row.put("lastValue", item.get("lastValue")); |
| | | row.put("insTime", item.get("insTime")); |
| | | exportData.add(row); |
| | | } |
| | | |
| | | EasyExcel.write(response.getOutputStream()) |
| | | .sheet("æ£æåå¸åææ°æ®") |
| | | .doWrite(exportData); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getItemNames(NormalDistributionDto dto) { |
| | | return normalDistributionMapper.getItemNames(dto); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getSampleNames(NormalDistributionDto dto) { |
| | | return normalDistributionMapper.getSampleNames(dto); |
| | | } |
| | | |
| | | /** |
| | | * å¹³æ¹æ ¹è®¡ç® |
| | | */ |
| | | private BigDecimal sqrt(BigDecimal value) { |
| | | BigDecimal x = value; |
| | | BigDecimal tolerance = new BigDecimal("1E-10"); |
| | | BigDecimal guess = value.divide(BigDecimal.valueOf(2), MathContext.DECIMAL128); |
| | | |
| | | while (x.subtract(guess).abs().compareTo(tolerance) > 0) { |
| | | x = guess; |
| | | guess = x.add(value.divide(x, MathContext.DECIMAL128)).divide(new BigDecimal("2"), MathContext.DECIMAL128); |
| | | } |
| | | |
| | | return guess; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.ruoyi.report.dto.PassRateDto; |
| | | import com.ruoyi.report.mapper.PassRateMapper; |
| | | import com.ruoyi.report.service.PassRateService; |
| | | import com.ruoyi.report.vo.ParetoVo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * åæ ¼çç»è®¡æå¡å®ç° |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class PassRateServiceImpl implements PassRateService { |
| | | |
| | | private PassRateMapper passRateMapper; |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getRawMaterialPassRate(PassRateDto dto) { |
| | | processDateType(dto); |
| | | return passRateMapper.getRawMaterialPassRate(dto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getSupplierUnqualified(PassRateDto dto) { |
| | | processDateType(dto); |
| | | return passRateMapper.getSupplierUnqualified(dto); |
| | | } |
| | | |
| | | @Override |
| | | public ParetoVo getPareto(PassRateDto dto) { |
| | | processDateType(dto); |
| | | |
| | | List<Map<String, Object>> stats = passRateMapper.getUnqualifiedItemStats(dto); |
| | | |
| | | ParetoVo vo = new ParetoVo(); |
| | | List<String> categories = new ArrayList<>(); |
| | | List<Integer> values = new ArrayList<>(); |
| | | List<Double> cumulativePercent = new ArrayList<>(); |
| | | |
| | | if (stats.isEmpty()) { |
| | | vo.setCategories(categories); |
| | | vo.setValues(values); |
| | | vo.setCumulativePercent(cumulativePercent); |
| | | return vo; |
| | | } |
| | | |
| | | // è®¡ç®æ»æ° |
| | | int total = stats.stream() |
| | | .mapToInt(m -> ((Number) m.get("unqualifiedCount")).intValue()) |
| | | .sum(); |
| | | |
| | | // 计ç®ç´¯è®¡ç¾åæ¯ |
| | | BigDecimal cumulative = BigDecimal.ZERO; |
| | | for (Map<String, Object> stat : stats) { |
| | | categories.add((String) stat.get("itemName")); |
| | | int count = ((Number) stat.get("unqualifiedCount")).intValue(); |
| | | values.add(count); |
| | | |
| | | cumulative = cumulative.add(new BigDecimal(count)); |
| | | double percent = cumulative.divide(new BigDecimal(total), 4, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal(100)) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .doubleValue(); |
| | | cumulativePercent.add(percent); |
| | | } |
| | | |
| | | vo.setCategories(categories); |
| | | vo.setValues(values); |
| | | vo.setCumulativePercent(cumulativePercent); |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getProcessPassRate(PassRateDto dto) { |
| | | processDateType(dto); |
| | | return passRateMapper.getProcessPassRate(dto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getMachineUnqualified(PassRateDto dto) { |
| | | processDateType(dto); |
| | | return passRateMapper.getMachineUnqualified(dto); |
| | | } |
| | | |
| | | /** |
| | | * å¤çæ¶é´ç±»å |
| | | */ |
| | | private void processDateType(PassRateDto dto) { |
| | | if (dto.getStartTime() != null && dto.getEndTime() != null) { |
| | | return; |
| | | } |
| | | |
| | | String dateType = dto.getDateType(); |
| | | if (dateType == null || dateType.isEmpty()) { |
| | | dateType = "2"; // é»è®¤æ¬æ |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | switch (dateType) { |
| | | case "1": // æ¬å¨ |
| | | dto.setStartTime(DateUtil.format(DateUtil.beginOfWeek(now), "yyyy-MM-dd HH:mm:ss")); |
| | | dto.setEndTime(DateUtil.format(DateUtil.endOfWeek(now), "yyyy-MM-dd HH:mm:ss")); |
| | | break; |
| | | case "2": // æ¬æ |
| | | dto.setStartTime(DateUtil.format(DateUtil.beginOfMonth(now), "yyyy-MM-dd HH:mm:ss")); |
| | | dto.setEndTime(DateUtil.format(DateUtil.endOfMonth(now), "yyyy-MM-dd HH:mm:ss")); |
| | | break; |
| | | case "3": // æ¬å¹´ |
| | | dto.setStartTime(DateUtil.format(DateUtil.beginOfYear(now), "yyyy-MM-dd HH:mm:ss")); |
| | | dto.setEndTime(DateUtil.format(DateUtil.endOfYear(now), "yyyy-MM-dd HH:mm:ss")); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.report.dto.DeviceRecordDto; |
| | | import com.ruoyi.report.mapper.ReportDeviceRecordMapper; |
| | | import com.ruoyi.report.service.ReportDeviceRecordService; |
| | | import com.ruoyi.report.vo.DeviceRecordVo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 设å¤ä½¿ç¨è®°å½æ¥è¡¨æå¡å®ç° |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class ReportDeviceRecordServiceImpl implements ReportDeviceRecordService { |
| | | |
| | | private ReportDeviceRecordMapper reportDeviceRecordMapper; |
| | | |
| | | @Override |
| | | public Page<DeviceRecordVo> pageDeviceRecord(Page page, DeviceRecordDto dto) { |
| | | return reportDeviceRecordMapper.pageDeviceRecord(page, dto); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getStatistics(DeviceRecordDto dto) { |
| | | return reportDeviceRecordMapper.getStatistics(dto); |
| | | } |
| | | |
| | | @Override |
| | | public void exportDeviceRecord(DeviceRecordDto dto, HttpServletResponse response) { |
| | | try { |
| | | // æ¥è¯¢å
¨é¨æ°æ® |
| | | Page<DeviceRecordVo> page = new Page<>(); |
| | | page.setSize(Long.MAX_VALUE); |
| | | Page<DeviceRecordVo> result = reportDeviceRecordMapper.pageDeviceRecord(page, dto); |
| | | |
| | | List<DeviceRecordVo> records = result.getRecords(); |
| | | |
| | | // 设置ååºå¤´ |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = "设å¤ä½¿ç¨è®°å½_" + DateUtil.format(new Date(), "yyyyMMddHHmmss"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | |
| | | // 使ç¨EasyExcelå¯¼åº |
| | | EasyExcel.write(response.getOutputStream(), DeviceRecordVo.class) |
| | | .sheet("设å¤ä½¿ç¨è®°å½") |
| | | .doWrite(records); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.report.dto.SampleProgressDto; |
| | | import com.ruoyi.report.mapper.SampleProgressMapper; |
| | | import com.ruoyi.report.service.SampleProgressService; |
| | | import com.ruoyi.report.vo.SampleProgressVo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æ ·åè¿åº¦æ¥è¡¨æå¡å®ç° |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class SampleProgressServiceImpl implements SampleProgressService { |
| | | |
| | | private SampleProgressMapper sampleProgressMapper; |
| | | |
| | | @Override |
| | | public Page<SampleProgressVo> pageSampleProgress(Page page, SampleProgressDto dto) { |
| | | Page<SampleProgressVo> result = sampleProgressMapper.pageSampleProgress(page, dto); |
| | | // å¤çç¶æåç§°åè¿åº¦ç¾åæ¯ |
| | | List<SampleProgressVo> records = result.getRecords(); |
| | | for (SampleProgressVo vo : records) { |
| | | vo.setInsStateName(formatInsState(vo.getInsState())); |
| | | if (vo.getTotalItems() != null && vo.getTotalItems() > 0) { |
| | | int finished = vo.getFinishedItems() != null ? vo.getFinishedItems() : 0; |
| | | vo.setProgressPercent((finished * 100.0) / vo.getTotalItems()); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getStatistics(SampleProgressDto dto) { |
| | | Map<String, Object> statistics = sampleProgressMapper.getStatistics(dto); |
| | | if (statistics == null) { |
| | | statistics = new HashMap<>(); |
| | | statistics.put("waitInspection", 0); |
| | | statistics.put("inspecting", 0); |
| | | statistics.put("waitAudit", 0); |
| | | statistics.put("finished", 0); |
| | | } |
| | | return statistics; |
| | | } |
| | | |
| | | @Override |
| | | public void exportSampleProgress(SampleProgressDto dto, HttpServletResponse response) { |
| | | try { |
| | | // æ¥è¯¢å
¨é¨æ°æ® |
| | | Page<SampleProgressVo> page = new Page<>(); |
| | | page.setSize(Long.MAX_VALUE); |
| | | Page<SampleProgressVo> result = sampleProgressMapper.pageSampleProgress(page, dto); |
| | | |
| | | // å¤çæ°æ® |
| | | List<SampleProgressVo> records = result.getRecords(); |
| | | for (SampleProgressVo vo : records) { |
| | | vo.setInsStateName(formatInsState(vo.getInsState())); |
| | | if (vo.getTotalItems() != null && vo.getTotalItems() > 0) { |
| | | int finished = vo.getFinishedItems() != null ? vo.getFinishedItems() : 0; |
| | | vo.setProgressPercent((finished * 100.0) / vo.getTotalItems()); |
| | | } |
| | | } |
| | | |
| | | // 设置ååºå¤´ |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = "æ ·åè¿åº¦æ¥è¡¨_" + DateUtil.format(new Date(), "yyyyMMddHHmmss"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | |
| | | // 使ç¨EasyExcelå¯¼åº |
| | | EasyExcel.write(response.getOutputStream(), SampleProgressVo.class) |
| | | .sheet("æ ·åè¿åº¦") |
| | | .doWrite(records); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getChartData(SampleProgressDto dto) { |
| | | List<Map<String, Object>> chartData = sampleProgressMapper.getChartData(dto); |
| | | |
| | | Map<String, Object> result = new HashMap<>(); |
| | | List<String> dates = chartData.stream() |
| | | .map(m -> (String) m.get("date")) |
| | | .collect(Collectors.toList()); |
| | | List<Integer> totalCounts = chartData.stream() |
| | | .map(m -> ((Number) m.get("totalCount")).intValue()) |
| | | .collect(Collectors.toList()); |
| | | List<Integer> finishedCounts = chartData.stream() |
| | | .map(m -> ((Number) m.get("finishedCount")).intValue()) |
| | | .collect(Collectors.toList()); |
| | | |
| | | result.put("dates", dates); |
| | | result.put("totalCounts", totalCounts); |
| | | result.put("finishedCounts", finishedCounts); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ ¼å¼åæ£æµç¶æ |
| | | */ |
| | | private String formatInsState(Integer val) { |
| | | if (val == null) return ""; |
| | | Map<Integer, String> map = new HashMap<>(); |
| | | map.put(0, "å¾
æ£"); |
| | | map.put(1, "æ£éªä¸"); |
| | | map.put(2, "å·²æ£éª"); |
| | | map.put(3, "å¾
å®¡æ ¸"); |
| | | map.put(4, "å®¡æ ¸æªéè¿"); |
| | | map.put(5, "å®¡æ ¸éè¿"); |
| | | return map.getOrDefault(val, ""); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.report.dto.SampleRecordDto; |
| | | import com.ruoyi.report.mapper.SampleRecordMapper; |
| | | import com.ruoyi.report.service.SampleRecordService; |
| | | import com.ruoyi.report.vo.SampleRecordVo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * æ ·å颿 ·è®°å½æå¡å®ç° |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class SampleRecordServiceImpl implements SampleRecordService { |
| | | |
| | | private SampleRecordMapper sampleRecordMapper; |
| | | |
| | | @Override |
| | | public Page<SampleRecordVo> pageSampleRecord(Page page, SampleRecordDto dto) { |
| | | Page<SampleRecordVo> result = sampleRecordMapper.pageSampleRecord(page, dto); |
| | | // å¤çæä½ç±»ååç§° |
| | | List<SampleRecordVo> records = result.getRecords(); |
| | | for (SampleRecordVo vo : records) { |
| | | vo.setOperateTypeName(formatOperateType(vo.getOperateType())); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<SampleRecordVo> getFlowRecord(Long sampleId) { |
| | | List<SampleRecordVo> list = sampleRecordMapper.getFlowRecord(sampleId); |
| | | for (SampleRecordVo vo : list) { |
| | | vo.setOperateTypeName(formatOperateType(vo.getOperateType())); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public void exportSampleRecord(SampleRecordDto dto, HttpServletResponse response) { |
| | | try { |
| | | // æ¥è¯¢å
¨é¨æ°æ® |
| | | Page<SampleRecordVo> page = new Page<>(); |
| | | page.setSize(Long.MAX_VALUE); |
| | | Page<SampleRecordVo> result = sampleRecordMapper.pageSampleRecord(page, dto); |
| | | |
| | | // å¤çæ°æ® |
| | | List<SampleRecordVo> records = result.getRecords(); |
| | | for (SampleRecordVo vo : records) { |
| | | vo.setOperateTypeName(formatOperateType(vo.getOperateType())); |
| | | } |
| | | |
| | | // 设置ååºå¤´ |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = "æ ·å颿 ·è®°å½_" + DateUtil.format(new Date(), "yyyyMMddHHmmss"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | |
| | | // 使ç¨EasyExcelå¯¼åº |
| | | EasyExcel.write(response.getOutputStream(), SampleRecordVo.class) |
| | | .sheet("æ ·å颿 ·è®°å½") |
| | | .doWrite(records); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¼å¼åæä½ç±»å |
| | | */ |
| | | private String formatOperateType(String val) { |
| | | if (val == null) return ""; |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("in", "å
¥åº"); |
| | | map.put("out", "åºåº"); |
| | | map.put("move", "ç§»åº"); |
| | | map.put("receive", "é¢ç¨"); |
| | | map.put("return", "å½è¿"); |
| | | return map.getOrDefault(val, val); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.report.dto.SpcChartDto; |
| | | import com.ruoyi.report.mapper.SpcChartMapper; |
| | | import com.ruoyi.report.service.SpcChartService; |
| | | import com.ruoyi.report.vo.SpcResultVo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * SPCæ§å¶å¾æå¡å®ç° |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class SpcChartServiceImpl implements SpcChartService { |
| | | |
| | | private SpcChartMapper spcChartMapper; |
| | | |
| | | @Override |
| | | public SpcResultVo analyze(SpcChartDto dto) { |
| | | // æ¥è¯¢æ°æ® |
| | | List<Map<String, Object>> itemData = spcChartMapper.getItemData(dto); |
| | | |
| | | if (CollectionUtil.isEmpty(itemData)) { |
| | | return null; |
| | | } |
| | | |
| | | // è·åæ°å¼å表 |
| | | List<BigDecimal> values = itemData.stream() |
| | | .map(m -> new BigDecimal((String) m.get("lastValue"))) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // åç»å¤§å°ï¼é»è®¤ä¸º5 |
| | | int subgroupSize = dto.getSubgroupSize() != null ? dto.getSubgroupSize() : 5; |
| | | |
| | | // åç» |
| | | List<List<BigDecimal>> subgroups = new ArrayList<>(); |
| | | for (int i = 0; i < values.size(); i += subgroupSize) { |
| | | int end = Math.min(i + subgroupSize, values.size()); |
| | | if (end - i >= 2) { // è³å°éè¦2ä¸ªæ°æ®ç¹ |
| | | subgroups.add(values.subList(i, end)); |
| | | } |
| | | } |
| | | |
| | | if (subgroups.isEmpty()) { |
| | | throw new ErrorException("æ°æ®ä¸è¶³ä»¥è¿è¡SPCåæ"); |
| | | } |
| | | |
| | | // 计ç®X-baråR |
| | | List<BigDecimal> xBarData = new ArrayList<>(); |
| | | List<BigDecimal> rData = new ArrayList<>(); |
| | | List<String> sampleLabels = new ArrayList<>(); |
| | | |
| | | for (int i = 0; i < subgroups.size(); i++) { |
| | | List<BigDecimal> subgroup = subgroups.get(i); |
| | | BigDecimal sum = subgroup.stream().reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal mean = sum.divide(new BigDecimal(subgroup.size()), 10, RoundingMode.HALF_UP); |
| | | BigDecimal max = subgroup.stream().max(BigDecimal::compareTo).orElse(BigDecimal.ZERO); |
| | | BigDecimal min = subgroup.stream().min(BigDecimal::compareTo).orElse(BigDecimal.ZERO); |
| | | BigDecimal range = max.subtract(min); |
| | | |
| | | xBarData.add(mean.setScale(4, RoundingMode.HALF_UP)); |
| | | rData.add(range.setScale(4, RoundingMode.HALF_UP)); |
| | | sampleLabels.add("ç»" + (i + 1)); |
| | | } |
| | | |
| | | // è®¡ç®æ§å¶é |
| | | BigDecimal xBarMean = xBarData.stream().reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | .divide(new BigDecimal(xBarData.size()), 10, RoundingMode.HALF_UP); |
| | | BigDecimal rMean = rData.stream().reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | .divide(new BigDecimal(rData.size()), 10, RoundingMode.HALF_UP); |
| | | |
| | | // A2, D3, D4 å¸¸æ° (é对åç»å¤§å°) |
| | | BigDecimal A2 = getA2(subgroupSize); |
| | | BigDecimal D3 = getD3(subgroupSize); |
| | | BigDecimal D4 = getD4(subgroupSize); |
| | | |
| | | // X-bar æ§å¶é |
| | | BigDecimal xBarUcl = dto.getUcl() != null ? dto.getUcl() : |
| | | xBarMean.add(A2.multiply(rMean)).setScale(4, RoundingMode.HALF_UP); |
| | | BigDecimal xBarLcl = dto.getLcl() != null ? dto.getLcl() : |
| | | xBarMean.subtract(A2.multiply(rMean)).setScale(4, RoundingMode.HALF_UP); |
| | | |
| | | // R æ§å¶é |
| | | BigDecimal rUcl = D4.multiply(rMean).setScale(4, RoundingMode.HALF_UP); |
| | | BigDecimal rLcl = D3.multiply(rMean).setScale(4, RoundingMode.HALF_UP); |
| | | |
| | | // æå»ºç»æ |
| | | SpcResultVo result = new SpcResultVo(); |
| | | |
| | | SpcResultVo.ChartData xBarChart = new SpcResultVo.ChartData(); |
| | | xBarChart.setData(xBarData); |
| | | xBarChart.setUcl(xBarUcl); |
| | | xBarChart.setLcl(xBarLcl); |
| | | xBarChart.setCl(xBarMean.setScale(4, RoundingMode.HALF_UP)); |
| | | xBarChart.setSampleLabels(sampleLabels); |
| | | result.setXBar(xBarChart); |
| | | |
| | | SpcResultVo.ChartData rChart = new SpcResultVo.ChartData(); |
| | | rChart.setData(rData); |
| | | rChart.setUcl(rUcl); |
| | | rChart.setLcl(rLcl); |
| | | rChart.setCl(rMean.setScale(4, RoundingMode.HALF_UP)); |
| | | rChart.setSampleLabels(sampleLabels); |
| | | result.setRChart(rChart); |
| | | |
| | | // å¶ç¨è½å |
| | | SpcResultVo.Capability capability = calculateCapability(values, dto.getUcl(), dto.getLcl()); |
| | | result.setCapability(capability); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public SpcResultVo.Capability getCapability(SpcChartDto dto) { |
| | | List<Map<String, Object>> itemData = spcChartMapper.getItemData(dto); |
| | | |
| | | if (CollectionUtil.isEmpty(itemData)) { |
| | | return null; |
| | | } |
| | | |
| | | List<BigDecimal> values = itemData.stream() |
| | | .map(m -> new BigDecimal((String) m.get("lastValue"))) |
| | | .collect(Collectors.toList()); |
| | | |
| | | return calculateCapability(values, dto.getUcl(), dto.getLcl()); |
| | | } |
| | | |
| | | @Override |
| | | public void export(SpcChartDto dto, HttpServletResponse response) { |
| | | SpcResultVo result = analyze(dto); |
| | | |
| | | if (result == null) { |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = "SPCåææ°æ®_" + DateUtil.format(new Date(), "yyyyMMddHHmmss"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | |
| | | // æå»ºå¯¼åºæ°æ® |
| | | List<Map<String, Object>> exportData = new ArrayList<>(); |
| | | List<String> labels = result.getXBar().getSampleLabels(); |
| | | List<BigDecimal> xBarData = result.getXBar().getData(); |
| | | List<BigDecimal> rData = result.getRChart().getData(); |
| | | |
| | | for (int i = 0; i < labels.size(); i++) { |
| | | Map<String, Object> row = new HashMap<>(); |
| | | row.put("sampleLabel", labels.get(i)); |
| | | row.put("xBar", xBarData.get(i)); |
| | | row.put("r", rData.get(i)); |
| | | exportData.add(row); |
| | | } |
| | | |
| | | EasyExcel.write(response.getOutputStream()) |
| | | .sheet("SPCåææ°æ®") |
| | | .doWrite(exportData); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getItemNames(SpcChartDto dto) { |
| | | return spcChartMapper.getItemNames(dto); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getSampleNames(SpcChartDto dto) { |
| | | return spcChartMapper.getSampleNames(dto); |
| | | } |
| | | |
| | | /** |
| | | * 计ç®å¶ç¨è½å |
| | | */ |
| | | private SpcResultVo.Capability calculateCapability(List<BigDecimal> values, BigDecimal ucl, BigDecimal lcl) { |
| | | if (ucl == null || lcl == null) { |
| | | return null; |
| | | } |
| | | |
| | | SpcResultVo.Capability capability = new SpcResultVo.Capability(); |
| | | |
| | | // 计ç®åå¼åæ åå·® |
| | | BigDecimal sum = values.stream().reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal mean = sum.divide(new BigDecimal(values.size()), 10, RoundingMode.HALF_UP); |
| | | |
| | | BigDecimal variance = BigDecimal.ZERO; |
| | | for (BigDecimal v : values) { |
| | | BigDecimal diff = v.subtract(mean); |
| | | variance = variance.add(diff.multiply(diff)); |
| | | } |
| | | variance = variance.divide(new BigDecimal(values.size() - 1), 10, RoundingMode.HALF_UP); |
| | | BigDecimal stdDev = sqrt(variance); |
| | | |
| | | // 计ç®Cp, Cpk |
| | | BigDecimal USL = ucl; |
| | | BigDecimal LSL = lcl; |
| | | BigDecimal tolerance = USL.subtract(LSL); |
| | | |
| | | BigDecimal cp = tolerance.divide(stdDev.multiply(new BigDecimal(6)), 4, RoundingMode.HALF_UP); |
| | | BigDecimal cpu = USL.subtract(mean).divide(stdDev.multiply(new BigDecimal(3)), 4, RoundingMode.HALF_UP); |
| | | BigDecimal cpl = mean.subtract(LSL).divide(stdDev.multiply(new BigDecimal(3)), 4, RoundingMode.HALF_UP); |
| | | BigDecimal cpk = cpu.min(cpl); |
| | | |
| | | capability.setCp(cp); |
| | | capability.setCpk(cpk); |
| | | capability.setPp(cp); // ç®åå¤ç |
| | | capability.setPpk(cpk); |
| | | |
| | | return capability; |
| | | } |
| | | |
| | | /** |
| | | * è·åA2å¸¸æ° |
| | | */ |
| | | private BigDecimal getA2(int n) { |
| | | double[] a2Values = {0, 1.880, 1.023, 0.729, 0.577, 0.483, 0.419, 0.373, 0.337, 0.308}; |
| | | return new BigDecimal(a2Values[Math.min(n, 9)]); |
| | | } |
| | | |
| | | /** |
| | | * è·åD3å¸¸æ° |
| | | */ |
| | | private BigDecimal getD3(int n) { |
| | | double[] d3Values = {0, 0, 0, 0, 0, 0, 0.076, 0.136, 0.184, 0.223}; |
| | | return new BigDecimal(d3Values[Math.min(n, 9)]); |
| | | } |
| | | |
| | | /** |
| | | * è·åD4å¸¸æ° |
| | | */ |
| | | private BigDecimal getD4(int n) { |
| | | double[] d4Values = {0, 3.267, 2.574, 2.282, 2.114, 2.004, 1.924, 1.864, 1.816, 1.777}; |
| | | return new BigDecimal(d4Values[Math.min(n, 9)]); |
| | | } |
| | | |
| | | /** |
| | | * å¹³æ¹æ ¹è®¡ç® |
| | | */ |
| | | private BigDecimal sqrt(BigDecimal value) { |
| | | BigDecimal x = value; |
| | | BigDecimal tolerance = new BigDecimal("1E-10"); |
| | | BigDecimal guess = value.divide(BigDecimal.valueOf(2), MathContext.DECIMAL128); |
| | | |
| | | while (x.subtract(guess).abs().compareTo(tolerance) > 0) { |
| | | x = guess; |
| | | guess = x.add(value.divide(x, MathContext.DECIMAL128)).divide(new BigDecimal("2"), MathContext.DECIMAL128); |
| | | } |
| | | |
| | | return guess; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.report.dto.TestItemDataDto; |
| | | import com.ruoyi.report.mapper.TestItemDataMapper; |
| | | import com.ruoyi.report.service.TestItemDataService; |
| | | import com.ruoyi.report.vo.TestItemDataVo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æ£æµé¡¹ç®æ°æ®æå¡å®ç° |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class TestItemDataServiceImpl implements TestItemDataService { |
| | | |
| | | private TestItemDataMapper testItemDataMapper; |
| | | |
| | | @Override |
| | | public Page<TestItemDataVo> pageTestItemData(Page page, TestItemDataDto dto) { |
| | | Page<TestItemDataVo> result = testItemDataMapper.pageTestItemData(page, dto); |
| | | // å¤çæ£æµç»æåç§° |
| | | List<TestItemDataVo> records = result.getRecords(); |
| | | for (TestItemDataVo vo : records) { |
| | | vo.setInsResultName(formatInsResult(vo.getInsResult())); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<TestItemDataVo> getDetail(Long sampleId) { |
| | | List<TestItemDataVo> list = testItemDataMapper.getDetail(sampleId); |
| | | for (TestItemDataVo vo : list) { |
| | | vo.setInsResultName(formatInsResult(vo.getInsResult())); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> compare(TestItemDataDto dto) { |
| | | if (CollectionUtils.isEmpty(dto.getSampleIds())) { |
| | | return new HashMap<>(); |
| | | } |
| | | |
| | | // æ¥è¯¢æ°æ® |
| | | List<TestItemDataVo> dataList = testItemDataMapper.listBySampleIds(dto.getSampleIds()); |
| | | |
| | | // è·åæææ£æµé¡¹åç§° |
| | | List<String> itemNames = dataList.stream() |
| | | .map(TestItemDataVo::getItemName) |
| | | .distinct() |
| | | .sorted() |
| | | .collect(Collectors.toList()); |
| | | |
| | | // ææ ·ååç» |
| | | Map<Long, List<TestItemDataVo>> sampleMap = dataList.stream() |
| | | .collect(Collectors.groupingBy(TestItemDataVo::getSampleId)); |
| | | |
| | | // æå»ºæ¯è¾æ°æ® |
| | | List<Map<String, Object>> compareList = new ArrayList<>(); |
| | | for (Long sampleId : dto.getSampleIds()) { |
| | | Map<String, Object> row = new HashMap<>(); |
| | | List<TestItemDataVo> sampleData = sampleMap.getOrDefault(sampleId, new ArrayList<>()); |
| | | |
| | | // è·åæ ·åä¿¡æ¯ |
| | | if (CollectionUtil.isNotEmpty(sampleData)) { |
| | | TestItemDataVo first = sampleData.get(0); |
| | | row.put("sampleCode", first.getSampleCode()); |
| | | row.put("sampleName", first.getSampleName()); |
| | | row.put("batchNo", first.getBatchNo()); |
| | | } |
| | | |
| | | // å¡«å
æ£æµé¡¹å¼ |
| | | for (String itemName : itemNames) { |
| | | Optional<TestItemDataVo> match = sampleData.stream() |
| | | .filter(v -> v.getItemName().equals(itemName)) |
| | | .findFirst(); |
| | | row.put(itemName, match.map(TestItemDataVo::getLastValue).orElse(null)); |
| | | } |
| | | |
| | | compareList.add(row); |
| | | } |
| | | |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("itemNames", itemNames); |
| | | result.put("compareList", compareList); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public void exportTestItemData(TestItemDataDto dto, HttpServletResponse response) { |
| | | try { |
| | | // æ¥è¯¢å
¨é¨æ°æ® |
| | | Page<TestItemDataVo> page = new Page<>(); |
| | | page.setSize(Long.MAX_VALUE); |
| | | Page<TestItemDataVo> result = testItemDataMapper.pageTestItemData(page, dto); |
| | | |
| | | // å¤çæ°æ® |
| | | List<TestItemDataVo> records = result.getRecords(); |
| | | for (TestItemDataVo vo : records) { |
| | | vo.setInsResultName(formatInsResult(vo.getInsResult())); |
| | | } |
| | | |
| | | // 设置ååºå¤´ |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = "æ£æµé¡¹ç®æ°æ®_" + DateUtil.format(new Date(), "yyyyMMddHHmmss"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | |
| | | // 使ç¨EasyExcelå¯¼åº |
| | | EasyExcel.write(response.getOutputStream(), TestItemDataVo.class) |
| | | .sheet("æ£æµé¡¹ç®æ°æ®") |
| | | .doWrite(records); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getItemNames(TestItemDataDto dto) { |
| | | return testItemDataMapper.getItemNames(dto); |
| | | } |
| | | |
| | | /** |
| | | * æ ¼å¼åæ£æµç»æ |
| | | */ |
| | | private String formatInsResult(Integer val) { |
| | | if (val == null) return ""; |
| | | if (val == 1) return "åæ ¼"; |
| | | if (val == 0) return "ä¸åæ ¼"; |
| | | return ""; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.ruoyi.report.dto.WorkStatisticsDto; |
| | | import com.ruoyi.report.mapper.WorkStatisticsMapper; |
| | | import com.ruoyi.report.service.WorkStatisticsService; |
| | | import com.ruoyi.report.vo.WorkStatisticsVo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * å·¥ä½ç»è®¡æå¡å®ç° |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class WorkStatisticsServiceImpl implements WorkStatisticsService { |
| | | |
| | | private WorkStatisticsMapper workStatisticsMapper; |
| | | |
| | | @Override |
| | | public List<WorkStatisticsVo> getByUser(WorkStatisticsDto dto) { |
| | | // å¤çæ¶é´ç±»å |
| | | processDateType(dto); |
| | | |
| | | List<WorkStatisticsVo> list = workStatisticsMapper.getByUser(dto); |
| | | |
| | | // 计ç®åæ¶ç |
| | | for (WorkStatisticsVo vo : list) { |
| | | int timely = vo.getTimelyCount() != null ? vo.getTimelyCount() : 0; |
| | | int overdue = vo.getOverdueCount() != null ? vo.getOverdueCount() : 0; |
| | | int total = timely + overdue; |
| | | if (total > 0) { |
| | | vo.setTimelyRate((timely * 100.0) / total); |
| | | } else { |
| | | vo.setTimelyRate(0.0); |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getTimelyRate(WorkStatisticsDto dto) { |
| | | processDateType(dto); |
| | | return workStatisticsMapper.getTimelyRate(dto); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getTrend(WorkStatisticsDto dto) { |
| | | processDateType(dto); |
| | | |
| | | List<Map<String, Object>> trendData = workStatisticsMapper.getTrend(dto); |
| | | |
| | | Map<String, Object> result = new HashMap<>(); |
| | | List<String> dates = new ArrayList<>(); |
| | | List<Integer> sampleCounts = new ArrayList<>(); |
| | | List<Integer> itemCounts = new ArrayList<>(); |
| | | |
| | | for (Map<String, Object> item : trendData) { |
| | | dates.add((String) item.get("date")); |
| | | sampleCounts.add(((Number) item.get("sampleCount")).intValue()); |
| | | itemCounts.add(((Number) item.get("itemCount")).intValue()); |
| | | } |
| | | |
| | | result.put("dates", dates); |
| | | result.put("sampleCounts", sampleCounts); |
| | | result.put("itemCounts", itemCounts); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * å¤çæ¶é´ç±»å |
| | | */ |
| | | private void processDateType(WorkStatisticsDto dto) { |
| | | if (dto.getStartTime() != null && dto.getEndTime() != null) { |
| | | return; |
| | | } |
| | | |
| | | String dateType = dto.getDateType(); |
| | | if (dateType == null || dateType.isEmpty()) { |
| | | dateType = "2"; // é»è®¤æ¬æ |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | switch (dateType) { |
| | | case "1": // æ¬å¨ |
| | | dto.setStartTime(DateUtil.format(DateUtil.beginOfWeek(now), "yyyy-MM-dd HH:mm:ss")); |
| | | dto.setEndTime(DateUtil.format(DateUtil.endOfWeek(now), "yyyy-MM-dd HH:mm:ss")); |
| | | break; |
| | | case "2": // æ¬æ |
| | | dto.setStartTime(DateUtil.format(DateUtil.beginOfMonth(now), "yyyy-MM-dd HH:mm:ss")); |
| | | dto.setEndTime(DateUtil.format(DateUtil.endOfMonth(now), "yyyy-MM-dd HH:mm:ss")); |
| | | break; |
| | | case "3": // æ¬å¹´ |
| | | dto.setStartTime(DateUtil.format(DateUtil.beginOfYear(now), "yyyy-MM-dd HH:mm:ss")); |
| | | dto.setEndTime(DateUtil.format(DateUtil.endOfYear(now), "yyyy-MM-dd HH:mm:ss")); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * çæ¿æ¦è§VO |
| | | */ |
| | | @Data |
| | | public class DashboardOverviewVo { |
| | | |
| | | @ApiModelProperty("å¾
颿 ·åæ°") |
| | | private Integer waitReceive; |
| | | |
| | | @ApiModelProperty("å¾
æ£æ ·åæ°") |
| | | private Integer waitInspection; |
| | | |
| | | @ApiModelProperty("å¾
å®¡æ ¸æ ·åæ°") |
| | | private Integer waitAudit; |
| | | |
| | | @ApiModelProperty("å¾
ç¼å¶æ¥åæ°") |
| | | private Integer waitReport; |
| | | |
| | | @ApiModelProperty("仿¥æ°å¢æ ·å") |
| | | private Integer todayNewSample; |
| | | |
| | | @ApiModelProperty("仿¥å®ææ ·å") |
| | | private Integer todayFinished; |
| | | |
| | | @ApiModelProperty("è¿30天忿æ£éªç»æ") |
| | | private List<Map<String, Object>> rawMaterialResult; |
| | | |
| | | @ApiModelProperty("è¿30天åæåæ£éªç»æ") |
| | | private List<Map<String, Object>> semiFinishedResult; |
| | | |
| | | @ApiModelProperty("è¿30天æåæ£éªç»æ") |
| | | private List<Map<String, Object>> finishedProductResult; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 设å¤ä½¿ç¨è®°å½VO |
| | | */ |
| | | @Data |
| | | public class DeviceRecordVo { |
| | | |
| | | @ApiModelProperty("è®°å½ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("设å¤ID") |
| | | private Long deviceId; |
| | | |
| | | @ApiModelProperty("设å¤ç¼å·") |
| | | private String deviceCode; |
| | | |
| | | @ApiModelProperty("设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @ApiModelProperty("æ ·åç¼å·") |
| | | private String sampleCode; |
| | | |
| | | @ApiModelProperty("使ç¨äºº") |
| | | private String useUser; |
| | | |
| | | @ApiModelProperty("å¼å§æ¶é´") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty("ç»ææ¶é´") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty("温度") |
| | | private String temperature; |
| | | |
| | | @ApiModelProperty("湿度") |
| | | private String humidity; |
| | | |
| | | @ApiModelProperty("使ç¨åç¶æ(0å¼å¸¸/1è¯å¥½)") |
| | | private Integer useBefore; |
| | | |
| | | @ApiModelProperty("使ç¨åç¶æ(0å¼å¸¸/1è¯å¥½)") |
| | | private Integer useAfter; |
| | | |
| | | @ApiModelProperty("å¼å¸¸æ
åµ") |
| | | private String abnormal; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ£æåå¸åæç»æVO |
| | | */ |
| | | @Data |
| | | public class NormalDistributionVo { |
| | | |
| | | @ApiModelProperty("ç´æ¹å¾åç»è¾¹ç") |
| | | private List<BigDecimal> binEdges; |
| | | |
| | | @ApiModelProperty("ç´æ¹å¾é¢æ°") |
| | | private List<Integer> frequencies; |
| | | |
| | | @ApiModelProperty("æ£æå叿²çº¿Xè½´") |
| | | private List<BigDecimal> normalX; |
| | | |
| | | @ApiModelProperty("æ£æå叿²çº¿Yè½´") |
| | | private List<BigDecimal> normalY; |
| | | |
| | | @ApiModelProperty("åå¼") |
| | | private BigDecimal mean; |
| | | |
| | | @ApiModelProperty("æ åå·®") |
| | | private BigDecimal stdDev; |
| | | |
| | | @ApiModelProperty("æå°å¼") |
| | | private BigDecimal min; |
| | | |
| | | @ApiModelProperty("æå¤§å¼") |
| | | private BigDecimal max; |
| | | |
| | | @ApiModelProperty("æ ·æ¬æ°") |
| | | private Integer sampleSize; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å¸ç´¯æå¾VO |
| | | */ |
| | | @Data |
| | | public class ParetoVo { |
| | | |
| | | @ApiModelProperty("ä¸åæ ¼é¡¹ç®") |
| | | private List<String> categories; |
| | | |
| | | @ApiModelProperty("ä¸åæ ¼æ¬¡æ°") |
| | | private List<Integer> values; |
| | | |
| | | @ApiModelProperty("累计ç¾åæ¯") |
| | | private List<Double> cumulativePercent; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * æè¡VO |
| | | */ |
| | | @Data |
| | | public class RankingVo { |
| | | |
| | | @ApiModelProperty("æå") |
| | | private Integer rank; |
| | | |
| | | @ApiModelProperty("ç¨æ·ID") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty("ç¨æ·åç§°") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty("é¨é¨åç§°") |
| | | private String deptName; |
| | | |
| | | @ApiModelProperty("æäº¤æ°é") |
| | | private Integer submitCount; |
| | | |
| | | @ApiModelProperty("宿æ°é") |
| | | private Integer finishCount; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * æ ·åè¿åº¦VO |
| | | */ |
| | | @Data |
| | | public class SampleProgressVo { |
| | | |
| | | @ApiModelProperty("æ ·åID") |
| | | private Long sampleId; |
| | | |
| | | @ApiModelProperty("å§æç¼å·") |
| | | private String entrustCode; |
| | | |
| | | @ApiModelProperty("æ ·åç¼å·") |
| | | private String sampleCode; |
| | | |
| | | @ApiModelProperty("æ ·ååç§°") |
| | | private String sampleName; |
| | | |
| | | @ApiModelProperty("æ¥åç¼å·") |
| | | private String reportCode; |
| | | |
| | | @ApiModelProperty("æ£æµç¶æ(0å¾
æ£/1æ£éªä¸/2å·²æ£éª/3å¾
å®¡æ ¸/4å®¡æ ¸æªéè¿/5å®¡æ ¸éè¿)") |
| | | private Integer insState; |
| | | |
| | | @ApiModelProperty("æ£æµç¶æåç§°") |
| | | private String insStateName; |
| | | |
| | | @ApiModelProperty("è¿åº¦ç¾åæ¯") |
| | | private Double progressPercent; |
| | | |
| | | @ApiModelProperty("å·²å®æé¡¹ç®æ°") |
| | | private Integer finishedItems; |
| | | |
| | | @ApiModelProperty("æ»é¡¹ç®æ°") |
| | | private Integer totalItems; |
| | | |
| | | @ApiModelProperty("计å宿æ¶é´") |
| | | private String planFinishTime; |
| | | |
| | | @ApiModelProperty("å®é
宿æ¶é´") |
| | | private String actualFinishTime; |
| | | |
| | | @ApiModelProperty("è´è´£äºº") |
| | | private String chargeUser; |
| | | |
| | | @ApiModelProperty("客æ·åç§°") |
| | | private String custom; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | private String createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * æ ·å颿 ·è®°å½VO |
| | | */ |
| | | @Data |
| | | public class SampleRecordVo { |
| | | |
| | | @ApiModelProperty("è®°å½ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("æ ·åID") |
| | | private Long sampleId; |
| | | |
| | | @ApiModelProperty("æ ·åç¼å·") |
| | | private String sampleCode; |
| | | |
| | | @ApiModelProperty("æ ·ååç§°") |
| | | private String sampleName; |
| | | |
| | | @ApiModelProperty("客æ·åç§°") |
| | | private String custom; |
| | | |
| | | @ApiModelProperty("æä½ç±»å(é¢ç¨/å½è¿/转移)") |
| | | private String operateType; |
| | | |
| | | @ApiModelProperty("æä½ç±»ååç§°") |
| | | private String operateTypeName; |
| | | |
| | | @ApiModelProperty("æä½äºº") |
| | | private String operateUser; |
| | | |
| | | @ApiModelProperty("æä½æ¶é´") |
| | | private String operateTime; |
| | | |
| | | @ApiModelProperty("ååºä½") |
| | | private String fromCell; |
| | | |
| | | @ApiModelProperty("ç®æ åºä½") |
| | | private String toCell; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * SPCåæç»æVO |
| | | */ |
| | | @Data |
| | | public class SpcResultVo { |
| | | |
| | | @ApiModelProperty("X-bar徿°æ®") |
| | | private ChartData xBar; |
| | | |
| | | @ApiModelProperty("R徿°æ®") |
| | | private ChartData rChart; |
| | | |
| | | @ApiModelProperty("å¶ç¨è½å") |
| | | private Capability capability; |
| | | |
| | | @Data |
| | | public static class ChartData { |
| | | @ApiModelProperty("æ°æ®ç¹") |
| | | private List<BigDecimal> data; |
| | | |
| | | @ApiModelProperty("æ§å¶ä¸é") |
| | | private BigDecimal ucl; |
| | | |
| | | @ApiModelProperty("æ§å¶ä¸é") |
| | | private BigDecimal lcl; |
| | | |
| | | @ApiModelProperty("ä¸å¿çº¿") |
| | | private BigDecimal cl; |
| | | |
| | | @ApiModelProperty("æ ·æ¬ç¼å·") |
| | | private List<String> sampleLabels; |
| | | } |
| | | |
| | | @Data |
| | | public static class Capability { |
| | | @ApiModelProperty("å¶ç¨è½åææ°Cp") |
| | | private BigDecimal cp; |
| | | |
| | | @ApiModelProperty("å¶ç¨è½åææ°Cpk") |
| | | private BigDecimal cpk; |
| | | |
| | | @ApiModelProperty("å¶ç¨æ§è½ææ°Pp") |
| | | private BigDecimal pp; |
| | | |
| | | @ApiModelProperty("å¶ç¨æ§è½ææ°Ppk") |
| | | private BigDecimal ppk; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 任塿¥åVO |
| | | */ |
| | | @Data |
| | | public class TaskCalendarVo { |
| | | |
| | | @ApiModelProperty("æ¥æ") |
| | | private String date; |
| | | |
| | | @ApiModelProperty("æ ·åæ°é") |
| | | private Integer sampleCount; |
| | | |
| | | @ApiModelProperty("宿æ°é") |
| | | private Integer finishedCount; |
| | | |
| | | @ApiModelProperty("å¾
å¤çæ°é") |
| | | private Integer pendingCount; |
| | | |
| | | @ApiModelProperty("è¶
ææ°é") |
| | | private Integer overdueCount; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * æ£æµé¡¹ç®æ°æ®VO |
| | | */ |
| | | @Data |
| | | public class TestItemDataVo { |
| | | |
| | | @ApiModelProperty("æ£æµé¡¹ID") |
| | | private Long productId; |
| | | |
| | | @ApiModelProperty("æ ·åID") |
| | | private Long sampleId; |
| | | |
| | | @ApiModelProperty("æ ·åç¼å·") |
| | | private String sampleCode; |
| | | |
| | | @ApiModelProperty("æ ·ååç§°") |
| | | private String sampleName; |
| | | |
| | | @ApiModelProperty("ç产订å") |
| | | private String productionOrder; |
| | | |
| | | @ApiModelProperty("æ¹æ¬¡å·") |
| | | private String batchNo; |
| | | |
| | | @ApiModelProperty("æ£æµé¡¹åç§°") |
| | | private String itemName; |
| | | |
| | | @ApiModelProperty("æ£æµå¼") |
| | | private String lastValue; |
| | | |
| | | @ApiModelProperty("æ åå¼") |
| | | private String standardValue; |
| | | |
| | | @ApiModelProperty("æ£æµç»æ(1åæ ¼/0ä¸åæ ¼)") |
| | | private Integer insResult; |
| | | |
| | | @ApiModelProperty("æ£æµç»æåç§°") |
| | | private String insResultName; |
| | | |
| | | @ApiModelProperty("åä½") |
| | | private String unit; |
| | | |
| | | @ApiModelProperty("æ£æµäºº") |
| | | private String insUser; |
| | | |
| | | @ApiModelProperty("æ£æµæ¶é´") |
| | | private String insTime; |
| | | |
| | | @ApiModelProperty("æ¥åç¼å·") |
| | | private String reportCode; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.report.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * å·¥ä½ç»è®¡VO |
| | | */ |
| | | @Data |
| | | public class WorkStatisticsVo { |
| | | |
| | | @ApiModelProperty("ç¨æ·ID") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty("ç¨æ·åç§°") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty("é¨é¨åç§°") |
| | | private String deptName; |
| | | |
| | | @ApiModelProperty("æ£æµæ ·åæ°") |
| | | private Integer sampleCount; |
| | | |
| | | @ApiModelProperty("æ£æµé¡¹ç®æ°") |
| | | private Integer itemCount; |
| | | |
| | | @ApiModelProperty("åæ¶ç(%)") |
| | | private Double timelyRate; |
| | | |
| | | @ApiModelProperty("ææ¶å®ææ°") |
| | | private Integer timelyCount; |
| | | |
| | | @ApiModelProperty("è¶
æå®ææ°") |
| | | private Integer overdueCount; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.report.mapper.DashboardMapper"> |
| | | |
| | | <!-- è·åå¾
颿 ·åæ° --> |
| | | <select id="getWaitReceive" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) FROM ins_sample WHERE ins_state = 0 |
| | | </select> |
| | | |
| | | <!-- è·åå¾
æ£æ ·åæ° --> |
| | | <select id="getWaitInspection" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) FROM ins_order WHERE ins_state = 0 |
| | | </select> |
| | | |
| | | <!-- è·åå¾
å®¡æ ¸æ ·åæ° --> |
| | | <select id="getWaitAudit" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) FROM ins_order WHERE ins_state = 3 |
| | | </select> |
| | | |
| | | <!-- è·åå¾
ç¼å¶æ¥åæ° --> |
| | | <select id="getWaitReport" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) FROM ins_report WHERE state = 0 |
| | | </select> |
| | | |
| | | <!-- 仿¥æ°å¢æ ·å --> |
| | | <select id="getTodayNewSample" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) FROM ins_sample |
| | | WHERE DATE(create_time) = CURDATE() |
| | | </select> |
| | | |
| | | <!-- 仿¥å®ææ ·å --> |
| | | <select id="getTodayFinished" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) FROM ins_order |
| | | WHERE ins_state = 5 AND DATE(ins_time) = CURDATE() |
| | | </select> |
| | | |
| | | <!-- åå²15å¤©æ°æ® --> |
| | | <select id="getHistoryDays" resultType="com.ruoyi.report.vo.TaskCalendarVo"> |
| | | SELECT |
| | | DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL n DAY), '%Y-%m-%d') AS date, |
| | | COUNT(DISTINCT s.id) AS sampleCount, |
| | | SUM(CASE WHEN o.ins_state = 5 THEN 1 ELSE 0 END) AS finishedCount, |
| | | SUM(CASE WHEN o.ins_state IN (0,1,2,3) THEN 1 ELSE 0 END) AS pendingCount, |
| | | SUM(CASE WHEN o.ins_state IN (0,1,2,3) AND o.appointed < NOW() THEN 1 ELSE 0 END) AS overdueCount |
| | | FROM ( |
| | | SELECT 0 AS n UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 |
| | | UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9 |
| | | UNION SELECT 10 UNION SELECT 11 UNION SELECT 12 UNION SELECT 13 UNION SELECT 14 |
| | | ) days |
| | | LEFT JOIN ins_order o ON DATE(o.create_time) = DATE_SUB(CURDATE(), INTERVAL n DAY) |
| | | LEFT JOIN ins_sample s ON o.id = s.ins_order_id |
| | | GROUP BY date |
| | | ORDER BY date ASC |
| | | </select> |
| | | |
| | | <!-- æªæ¥15å¤©ä»»å¡ --> |
| | | <select id="getFutureDays" resultType="com.ruoyi.report.vo.TaskCalendarVo"> |
| | | SELECT |
| | | DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL n DAY), '%Y-%m-%d') AS date, |
| | | COUNT(DISTINCT s.id) AS sampleCount, |
| | | 0 AS finishedCount, |
| | | SUM(CASE WHEN o.ins_state IN (0,1,2,3) THEN 1 ELSE 0 END) AS pendingCount, |
| | | 0 AS overdueCount |
| | | FROM ( |
| | | SELECT 0 AS n UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 |
| | | UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9 |
| | | UNION SELECT 10 UNION SELECT 11 UNION SELECT 12 UNION SELECT 13 UNION SELECT 14 |
| | | ) days |
| | | LEFT JOIN ins_order o ON DATE(o.appointed) = DATE_ADD(CURDATE(), INTERVAL n DAY) AND o.ins_state IN (0,1,2,3) |
| | | LEFT JOIN ins_sample s ON o.id = s.ins_order_id |
| | | GROUP BY date |
| | | ORDER BY date ASC |
| | | </select> |
| | | |
| | | <!-- æäº¤æè¡(åå§è®°å½) --> |
| | | <select id="getOriginalRecordRanking" resultType="com.ruoyi.report.vo.RankingVo"> |
| | | SELECT |
| | | u.id AS userId, |
| | | u.name AS userName, |
| | | d.dept_name AS deptName, |
| | | COUNT(*) AS submitCount |
| | | FROM ins_product p |
| | | LEFT JOIN ins_product_user pu ON p.id = pu.ins_product_id |
| | | LEFT JOIN user u ON pu.create_user = u.id |
| | | LEFT JOIN sys_dept d ON u.dept_id = d.dept_id |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE o.ins_time IS NOT NULL |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND o.ins_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND o.ins_time <= #{dto.endTime} |
| | | </if> |
| | | GROUP BY u.id, u.name, d.dept_name |
| | | ORDER BY submitCount DESC |
| | | LIMIT 10 |
| | | </select> |
| | | |
| | | <!-- æäº¤æè¡(æ¥å) --> |
| | | <select id="getReportRanking" resultType="com.ruoyi.report.vo.RankingVo"> |
| | | SELECT |
| | | u.id AS userId, |
| | | u.name AS userName, |
| | | d.dept_name AS deptName, |
| | | COUNT(*) AS submitCount |
| | | FROM ins_report r |
| | | LEFT JOIN user u ON r.write_user_id = u.id |
| | | LEFT JOIN sys_dept d ON u.dept_id = d.dept_id |
| | | WHERE r.state >= 1 |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND r.create_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND r.create_time <= #{dto.endTime} |
| | | </if> |
| | | GROUP BY u.id, u.name, d.dept_name |
| | | ORDER BY submitCount DESC |
| | | LIMIT 10 |
| | | </select> |
| | | |
| | | <!-- è¿30天æ£éªç»æ --> |
| | | <select id="getInsResultByDays" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL n DAY), '%Y-%m-%d') AS date, |
| | | SUM(CASE WHEN p.ins_result = 1 THEN 1 ELSE 0 END) AS qualified, |
| | | SUM(CASE WHEN p.ins_result = 0 THEN 1 ELSE 0 END) AS unqualified, |
| | | COUNT(*) AS total |
| | | FROM ( |
| | | SELECT 0 AS n UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 |
| | | UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9 |
| | | UNION SELECT 10 UNION SELECT 11 UNION SELECT 12 UNION SELECT 13 UNION SELECT 14 |
| | | UNION SELECT 15 UNION SELECT 16 UNION SELECT 17 UNION SELECT 18 UNION SELECT 19 |
| | | UNION SELECT 20 UNION SELECT 21 UNION SELECT 22 UNION SELECT 23 UNION SELECT 24 |
| | | UNION SELECT 25 UNION SELECT 26 UNION SELECT 27 UNION SELECT 28 UNION SELECT 29 |
| | | ) days |
| | | LEFT JOIN ins_product p ON DATE(p.create_time) = DATE_SUB(CURDATE(), INTERVAL n DAY) |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE p.ins_result IS NOT NULL |
| | | <if test="orderType != null and orderType != ''"> |
| | | AND o.order_type = #{orderType} |
| | | </if> |
| | | GROUP BY date |
| | | ORDER BY date ASC |
| | | </select> |
| | | |
| | | <!-- è·åè¯é³ææ¥éå --> |
| | | <select id="getVoiceQueue" resultType="java.util.Map"> |
| | | SELECT |
| | | id, |
| | | event_type AS eventType, |
| | | event_name AS eventName, |
| | | details, |
| | | voice_text AS voiceText, |
| | | priority, |
| | | create_time AS createTime |
| | | FROM voice_queue |
| | | WHERE status = 0 |
| | | ORDER BY priority DESC, create_time ASC |
| | | LIMIT 10 |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.report.mapper.NormalDistributionMapper"> |
| | | |
| | | <!-- æ¥è¯¢æ£æµé¡¹æ°æ® --> |
| | | <select id="getItemData" resultType="java.util.Map"> |
| | | SELECT |
| | | s.sample_code AS sampleCode, |
| | | s.sample AS sampleName, |
| | | p.inspection_item AS itemName, |
| | | p.last_value AS lastValue, |
| | | o.ins_time AS insTime |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE p.ins_result IS NOT NULL AND p.last_value IS NOT NULL |
| | | <if test="dto.itemName != null and dto.itemName != ''"> |
| | | AND p.inspection_item = #{dto.itemName} |
| | | </if> |
| | | <if test="dto.sampleName != null and dto.sampleName != ''"> |
| | | AND s.sample LIKE CONCAT('%', #{dto.sampleName}, '%') |
| | | </if> |
| | | <if test="dto.startDate != null and dto.startDate != ''"> |
| | | AND o.ins_time >= #{dto.startDate} |
| | | </if> |
| | | <if test="dto.endDate != null and dto.endDate != ''"> |
| | | AND o.ins_time <= #{dto.endDate} |
| | | </if> |
| | | ORDER BY o.ins_time ASC |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢å¯éæ£æµé¡¹ --> |
| | | <select id="getItemNames" resultType="java.lang.String"> |
| | | SELECT DISTINCT p.inspection_item |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | WHERE p.ins_result IS NOT NULL AND p.last_value IS NOT NULL |
| | | <if test="dto.sampleName != null and dto.sampleName != ''"> |
| | | AND s.sample LIKE CONCAT('%', #{dto.sampleName}, '%') |
| | | </if> |
| | | ORDER BY p.inspection_item ASC |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢å¯éæ ·ååç§°å表 --> |
| | | <select id="getSampleNames" resultType="java.lang.String"> |
| | | SELECT DISTINCT s.sample |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE p.ins_result IS NOT NULL AND p.last_value IS NOT NULL |
| | | <if test="dto.itemName != null and dto.itemName != ''"> |
| | | AND p.inspection_item = #{dto.itemName} |
| | | </if> |
| | | ORDER BY s.sample ASC |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.report.mapper.PassRateMapper"> |
| | | |
| | | <!-- åææåæ ¼ç --> |
| | | <select id="getRawMaterialPassRate" resultType="java.util.Map"> |
| | | SELECT |
| | | s.sample AS sampleName, |
| | | o.entrust_code AS batchNo, |
| | | COUNT(*) AS totalCount, |
| | | SUM(CASE WHEN p.ins_result = 1 THEN 1 ELSE 0 END) AS qualifiedCount, |
| | | SUM(CASE WHEN p.ins_result = 0 THEN 1 ELSE 0 END) AS unqualifiedCount, |
| | | ROUND(SUM(CASE WHEN p.ins_result = 1 THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2) AS passRate |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE p.ins_result IS NOT NULL AND o.order_type = '1' |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND o.ins_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND o.ins_time <= #{dto.endTime} |
| | | </if> |
| | | <if test="dto.sampleName != null and dto.sampleName != ''"> |
| | | AND s.sample LIKE CONCAT('%', #{dto.sampleName}, '%') |
| | | </if> |
| | | <if test="dto.supplierName != null and dto.supplierName != ''"> |
| | | AND o.custom LIKE CONCAT('%', #{dto.supplierName}, '%') |
| | | </if> |
| | | GROUP BY s.sample, o.entrust_code |
| | | ORDER BY passRate ASC |
| | | </select> |
| | | |
| | | <!-- ä¾åºåä¸åæ ¼ç»è®¡ --> |
| | | <select id="getSupplierUnqualified" resultType="java.util.Map"> |
| | | SELECT |
| | | o.custom AS supplierName, |
| | | COUNT(*) AS totalCount, |
| | | SUM(CASE WHEN p.ins_result = 0 THEN 1 ELSE 0 END) AS unqualifiedCount |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE p.ins_result IS NOT NULL AND o.order_type = '1' |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND o.ins_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND o.ins_time <= #{dto.endTime} |
| | | </if> |
| | | GROUP BY o.custom |
| | | HAVING unqualifiedCount > 0 |
| | | ORDER BY unqualifiedCount DESC |
| | | </select> |
| | | |
| | | <!-- ä¸åæ ¼é¡¹ç®ç»è®¡(ç¨äºå¸ç´¯æå¾) --> |
| | | <select id="getUnqualifiedItemStats" resultType="java.util.Map"> |
| | | SELECT |
| | | p.inspection_item AS itemName, |
| | | COUNT(*) AS unqualifiedCount |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE p.ins_result = 0 |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND o.ins_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND o.ins_time <= #{dto.endTime} |
| | | </if> |
| | | <if test="dto.orderType != null and dto.orderType != ''"> |
| | | AND o.order_type = #{dto.orderType} |
| | | </if> |
| | | GROUP BY p.inspection_item |
| | | ORDER BY unqualifiedCount DESC |
| | | </select> |
| | | |
| | | <!-- å·¥åºåæ ¼ç --> |
| | | <select id="getProcessPassRate" resultType="java.util.Map"> |
| | | SELECT |
| | | o.laboratory AS processName, |
| | | COUNT(*) AS totalCount, |
| | | SUM(CASE WHEN p.ins_result = 1 THEN 1 ELSE 0 END) AS qualifiedCount, |
| | | SUM(CASE WHEN p.ins_result = 0 THEN 1 ELSE 0 END) AS unqualifiedCount, |
| | | ROUND(SUM(CASE WHEN p.ins_result = 1 THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2) AS passRate |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE p.ins_result IS NOT NULL |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND o.ins_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND o.ins_time <= #{dto.endTime} |
| | | </if> |
| | | <if test="dto.orderType != null and dto.orderType != ''"> |
| | | AND o.order_type = #{dto.orderType} |
| | | </if> |
| | | GROUP BY o.laboratory |
| | | ORDER BY passRate ASC |
| | | </select> |
| | | |
| | | <!-- æºå°ä¸åæ ¼ç»è®¡ --> |
| | | <select id="getMachineUnqualified" resultType="java.util.Map"> |
| | | SELECT |
| | | p.factory AS machineNo, |
| | | COUNT(*) AS totalCount, |
| | | SUM(CASE WHEN p.ins_result = 0 THEN 1 ELSE 0 END) AS unqualifiedCount |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE p.ins_result IS NOT NULL |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND o.ins_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND o.ins_time <= #{dto.endTime} |
| | | </if> |
| | | <if test="dto.orderType != null and dto.orderType != ''"> |
| | | AND o.order_type = #{dto.orderType} |
| | | </if> |
| | | GROUP BY p.factory |
| | | HAVING unqualifiedCount > 0 |
| | | ORDER BY unqualifiedCount DESC |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.report.mapper.ReportDeviceRecordMapper"> |
| | | |
| | | <!-- å页æ¥è¯¢è®¾å¤ä½¿ç¨è®°å½ --> |
| | | <select id="pageDeviceRecord" resultType="com.ruoyi.report.vo.DeviceRecordVo"> |
| | | SELECT |
| | | r.id AS id, |
| | | d.id AS deviceId, |
| | | d.management_number AS deviceCode, |
| | | d.device_name AS deviceName, |
| | | r.sample_code AS sampleCode, |
| | | r.use_person AS useUser, |
| | | r.use_start_date AS startTime, |
| | | r.use_end_date AS endTime, |
| | | r.temperature, |
| | | r.humidity, |
| | | r.use_before AS useBefore, |
| | | r.use_after AS useAfter, |
| | | r.abnormal, |
| | | r.remark |
| | | FROM device_record r |
| | | LEFT JOIN device d ON r.device_id = d.id |
| | | WHERE 1=1 |
| | | <if test="dto.deviceCode != null and dto.deviceCode != ''"> |
| | | AND d.management_number LIKE CONCAT('%', #{dto.deviceCode}, '%') |
| | | </if> |
| | | <if test="dto.deviceName != null and dto.deviceName != ''"> |
| | | AND d.device_name LIKE CONCAT('%', #{dto.deviceName}, '%') |
| | | </if> |
| | | <if test="dto.useUser != null and dto.useUser != ''"> |
| | | AND r.use_person LIKE CONCAT('%', #{dto.useUser}, '%') |
| | | </if> |
| | | <if test="dto.sampleCode != null and dto.sampleCode != ''"> |
| | | AND r.sample_code LIKE CONCAT('%', #{dto.sampleCode}, '%') |
| | | </if> |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND r.use_start_date >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND r.use_end_date <= #{dto.endTime} |
| | | </if> |
| | | ORDER BY r.use_start_date DESC |
| | | </select> |
| | | |
| | | <!-- 设å¤ä½¿ç¨ç»è®¡ --> |
| | | <select id="getStatistics" resultType="java.util.Map"> |
| | | SELECT |
| | | d.device_name AS deviceName, |
| | | d.management_number AS deviceCode, |
| | | COUNT(*) AS useCount, |
| | | COUNT(DISTINCT r.sample_code) AS sampleCount, |
| | | COUNT(DISTINCT r.use_person_id) AS userCount |
| | | FROM device_record r |
| | | LEFT JOIN device d ON r.device_id = d.id |
| | | WHERE 1=1 |
| | | <if test="dto.deviceCode != null and dto.deviceCode != ''"> |
| | | AND d.management_number LIKE CONCAT('%', #{dto.deviceCode}, '%') |
| | | </if> |
| | | <if test="dto.deviceName != null and dto.deviceName != ''"> |
| | | AND d.device_name LIKE CONCAT('%', #{dto.deviceName}, '%') |
| | | </if> |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND r.use_start_date >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND r.use_end_date <= #{dto.endTime} |
| | | </if> |
| | | GROUP BY d.id |
| | | ORDER BY useCount DESC |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.report.mapper.SampleProgressMapper"> |
| | | |
| | | <!-- å页æ¥è¯¢æ ·åè¿åº¦ --> |
| | | <select id="pageSampleProgress" resultType="com.ruoyi.report.vo.SampleProgressVo"> |
| | | SELECT |
| | | s.id AS sampleId, |
| | | o.entrust_code AS entrustCode, |
| | | s.sample_code AS sampleCode, |
| | | s.sample AS sampleName, |
| | | r.code AS reportCode, |
| | | o.ins_state AS insState, |
| | | COUNT(p.id) AS totalItems, |
| | | SUM(CASE WHEN p.ins_result IS NOT NULL THEN 1 ELSE 0 END) AS finishedItems, |
| | | o.appointed AS planFinishTime, |
| | | o.ins_time AS actualFinishTime, |
| | | u.name AS chargeUser, |
| | | o.custom AS custom, |
| | | s.create_time AS createTime |
| | | FROM ins_sample s |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | LEFT JOIN ins_product p ON s.id = p.ins_sample_id |
| | | LEFT JOIN ins_report r ON o.id = r.ins_order_id |
| | | LEFT JOIN user u ON o.prepare_user_id = u.id |
| | | WHERE 1=1 |
| | | <if test="dto.entrustCode != null and dto.entrustCode != ''"> |
| | | AND o.entrust_code LIKE CONCAT('%', #{dto.entrustCode}, '%') |
| | | </if> |
| | | <if test="dto.sampleCode != null and dto.sampleCode != ''"> |
| | | AND s.sample_code LIKE CONCAT('%', #{dto.sampleCode}, '%') |
| | | </if> |
| | | <if test="dto.sampleName != null and dto.sampleName != ''"> |
| | | AND s.sample LIKE CONCAT('%', #{dto.sampleName}, '%') |
| | | </if> |
| | | <if test="dto.reportCode != null and dto.reportCode != ''"> |
| | | AND r.code LIKE CONCAT('%', #{dto.reportCode}, '%') |
| | | </if> |
| | | <if test="dto.insState != null"> |
| | | AND o.ins_state = #{dto.insState} |
| | | </if> |
| | | <if test="dto.custom != null and dto.custom != ''"> |
| | | AND o.custom LIKE CONCAT('%', #{dto.custom}, '%') |
| | | </if> |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND s.create_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND s.create_time <= #{dto.endTime} |
| | | </if> |
| | | GROUP BY s.id |
| | | ORDER BY s.create_time DESC |
| | | </select> |
| | | |
| | | <!-- è·åç»è®¡æ°æ® --> |
| | | <select id="getStatistics" resultType="java.util.Map"> |
| | | SELECT |
| | | SUM(CASE WHEN o.ins_state = 0 THEN 1 ELSE 0 END) AS waitInspection, |
| | | SUM(CASE WHEN o.ins_state = 1 THEN 1 ELSE 0 END) AS inspecting, |
| | | SUM(CASE WHEN o.ins_state = 3 THEN 1 ELSE 0 END) AS waitAudit, |
| | | SUM(CASE WHEN o.ins_state = 5 THEN 1 ELSE 0 END) AS finished |
| | | FROM ins_sample s |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE 1=1 |
| | | <if test="dto.custom != null and dto.custom != ''"> |
| | | AND o.custom LIKE CONCAT('%', #{dto.custom}, '%') |
| | | </if> |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND s.create_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND s.create_time <= #{dto.endTime} |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- è·åå¾è¡¨æ°æ® --> |
| | | <select id="getChartData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT(s.create_time, '%Y-%m-%d') AS date, |
| | | COUNT(*) AS totalCount, |
| | | SUM(CASE WHEN o.ins_state = 5 THEN 1 ELSE 0 END) AS finishedCount |
| | | FROM ins_sample s |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE 1=1 |
| | | <if test="dto.custom != null and dto.custom != ''"> |
| | | AND o.custom LIKE CONCAT('%', #{dto.custom}, '%') |
| | | </if> |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND s.create_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND s.create_time <= #{dto.endTime} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(s.create_time, '%Y-%m-%d') |
| | | ORDER BY date ASC |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.report.mapper.SampleRecordMapper"> |
| | | |
| | | <!-- å页æ¥è¯¢é¢æ ·è®°å½ --> |
| | | <select id="pageSampleRecord" resultType="com.ruoyi.report.vo.SampleRecordVo"> |
| | | SELECT |
| | | h.id AS id, |
| | | s.id AS sampleId, |
| | | s.sample_code AS sampleCode, |
| | | s.sample_name AS sampleName, |
| | | o.custom AS custom, |
| | | h.operate_type AS operateType, |
| | | u.name AS operateUser, |
| | | h.operate_time AS operateTime, |
| | | h.from_cell AS fromCell, |
| | | h.to_cell AS toCell, |
| | | h.remark AS remark |
| | | FROM warehouse_history h |
| | | LEFT JOIN ins_sample s ON h.sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | LEFT JOIN user u ON h.operate_user_id = u.id |
| | | WHERE 1=1 |
| | | <if test="dto.sampleCode != null and dto.sampleCode != ''"> |
| | | AND s.sample_code LIKE CONCAT('%', #{dto.sampleCode}, '%') |
| | | </if> |
| | | <if test="dto.sampleName != null and dto.sampleName != ''"> |
| | | AND s.sample_name LIKE CONCAT('%', #{dto.sampleName}, '%') |
| | | </if> |
| | | <if test="dto.custom != null and dto.custom != ''"> |
| | | AND o.custom LIKE CONCAT('%', #{dto.custom}, '%') |
| | | </if> |
| | | <if test="dto.receiveUser != null and dto.receiveUser != ''"> |
| | | AND u.name LIKE CONCAT('%', #{dto.receiveUser}, '%') |
| | | </if> |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND h.operate_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND h.operate_time <= #{dto.endTime} |
| | | </if> |
| | | ORDER BY h.operate_time DESC |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢æ ·åæµè½¬è®°å½ --> |
| | | <select id="getFlowRecord" resultType="com.ruoyi.report.vo.SampleRecordVo"> |
| | | SELECT |
| | | h.id AS id, |
| | | s.id AS sampleId, |
| | | s.sample_code AS sampleCode, |
| | | s.sample_name AS sampleName, |
| | | o.custom AS custom, |
| | | h.operate_type AS operateType, |
| | | u.name AS operateUser, |
| | | h.operate_time AS operateTime, |
| | | h.from_cell AS fromCell, |
| | | h.to_cell AS toCell, |
| | | h.remark AS remark |
| | | FROM warehouse_history h |
| | | LEFT JOIN ins_sample s ON h.sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | LEFT JOIN user u ON h.operate_user_id = u.id |
| | | WHERE s.id = #{sampleId} |
| | | ORDER BY h.operate_time ASC |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.report.mapper.SpcChartMapper"> |
| | | |
| | | <!-- æ¥è¯¢æ£æµé¡¹æ°æ® --> |
| | | <select id="getItemData" resultType="java.util.Map"> |
| | | SELECT |
| | | s.sample_code AS sampleCode, |
| | | s.sample AS sampleName, |
| | | p.inspection_item AS itemName, |
| | | p.last_value AS lastValue, |
| | | o.ins_time AS insTime |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE p.ins_result IS NOT NULL AND p.last_value IS NOT NULL |
| | | <if test="dto.itemName != null and dto.itemName != ''"> |
| | | AND p.inspection_item = #{dto.itemName} |
| | | </if> |
| | | <if test="dto.sampleName != null and dto.sampleName != ''"> |
| | | AND s.sample LIKE CONCAT('%', #{dto.sampleName}, '%') |
| | | </if> |
| | | <if test="dto.startDate != null and dto.startDate != ''"> |
| | | AND o.ins_time >= #{dto.startDate} |
| | | </if> |
| | | <if test="dto.endDate != null and dto.endDate != ''"> |
| | | AND o.ins_time <= #{dto.endDate} |
| | | </if> |
| | | ORDER BY o.ins_time ASC |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢å¯éæ£æµé¡¹ --> |
| | | <select id="getItemNames" resultType="java.lang.String"> |
| | | SELECT DISTINCT p.inspection_item |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | WHERE p.ins_result IS NOT NULL AND p.last_value IS NOT NULL |
| | | <if test="dto.sampleName != null and dto.sampleName != ''"> |
| | | AND s.sample LIKE CONCAT('%', #{dto.sampleName}, '%') |
| | | </if> |
| | | ORDER BY p.inspection_item ASC |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢å¯éæ ·ååç§°å表 --> |
| | | <select id="getSampleNames" resultType="java.lang.String"> |
| | | SELECT DISTINCT s.sample |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE p.ins_result IS NOT NULL AND p.last_value IS NOT NULL |
| | | <if test="dto.itemName != null and dto.itemName != ''"> |
| | | AND p.inspection_item = #{dto.itemName} |
| | | </if> |
| | | ORDER BY s.sample ASC |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.report.mapper.TestItemDataMapper"> |
| | | |
| | | <!-- å页æ¥è¯¢æ£æµé¡¹ç®æ°æ® --> |
| | | <select id="pageTestItemData" resultType="com.ruoyi.report.vo.TestItemDataVo"> |
| | | SELECT |
| | | p.id AS productId, |
| | | s.id AS sampleId, |
| | | s.sample_code AS sampleCode, |
| | | s.sample AS sampleName, |
| | | o.production AS productionOrder, |
| | | o.entrust_code AS batchNo, |
| | | p.inspection_item AS itemName, |
| | | p.last_value AS lastValue, |
| | | p.ask AS standardValue, |
| | | p.ins_result AS insResult, |
| | | p.unit AS unit, |
| | | u.name AS insUser, |
| | | o.ins_time AS insTime, |
| | | r.code AS reportCode |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | LEFT JOIN ins_report r ON o.id = r.ins_order_id |
| | | LEFT JOIN ins_product_user pu ON p.id = pu.ins_product_id |
| | | LEFT JOIN user u ON pu.create_user = u.id |
| | | WHERE 1=1 |
| | | <if test="dto.productionOrder != null and dto.productionOrder != ''"> |
| | | AND o.production LIKE CONCAT('%', #{dto.productionOrder}, '%') |
| | | </if> |
| | | <if test="dto.batchNo != null and dto.batchNo != ''"> |
| | | AND o.entrust_code LIKE CONCAT('%', #{dto.batchNo}, '%') |
| | | </if> |
| | | <if test="dto.sampleCode != null and dto.sampleCode != ''"> |
| | | AND s.sample_code LIKE CONCAT('%', #{dto.sampleCode}, '%') |
| | | </if> |
| | | <if test="dto.sampleName != null and dto.sampleName != ''"> |
| | | AND s.sample LIKE CONCAT('%', #{dto.sampleName}, '%') |
| | | </if> |
| | | <if test="dto.itemName != null and dto.itemName != ''"> |
| | | AND p.inspection_item LIKE CONCAT('%', #{dto.itemName}, '%') |
| | | </if> |
| | | <if test="dto.insState != null"> |
| | | AND o.ins_state = #{dto.insState} |
| | | </if> |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND o.ins_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND o.ins_time <= #{dto.endTime} |
| | | </if> |
| | | ORDER BY o.ins_time DESC |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢æ£æµé¡¹ç®è¯¦æ
--> |
| | | <select id="getDetail" resultType="com.ruoyi.report.vo.TestItemDataVo"> |
| | | SELECT |
| | | p.id AS productId, |
| | | s.id AS sampleId, |
| | | s.sample_code AS sampleCode, |
| | | s.sample AS sampleName, |
| | | o.production AS productionOrder, |
| | | o.entrust_code AS batchNo, |
| | | p.inspection_item AS itemName, |
| | | p.last_value AS lastValue, |
| | | p.ask AS standardValue, |
| | | p.ins_result AS insResult, |
| | | p.unit AS unit, |
| | | u.name AS insUser, |
| | | o.ins_time AS insTime, |
| | | r.code AS reportCode |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | LEFT JOIN ins_report r ON o.id = r.ins_order_id |
| | | LEFT JOIN ins_product_user pu ON p.id = pu.ins_product_id |
| | | LEFT JOIN user u ON pu.create_user = u.id |
| | | WHERE s.id = #{sampleId} |
| | | ORDER BY p.inspection_item ASC |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢æ£æµé¡¹åç§°å表 --> |
| | | <select id="getItemNames" resultType="java.lang.String"> |
| | | SELECT DISTINCT p.inspection_item |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | WHERE 1=1 |
| | | <if test="dto.sampleName != null and dto.sampleName != ''"> |
| | | AND s.sample LIKE CONCAT('%', #{dto.sampleName}, '%') |
| | | </if> |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND o.ins_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND o.ins_time <= #{dto.endTime} |
| | | </if> |
| | | ORDER BY p.inspection_item ASC |
| | | </select> |
| | | |
| | | <!-- æ ¹æ®æ ·åIDå表æ¥è¯¢æ£æµæ°æ® --> |
| | | <select id="listBySampleIds" resultType="com.ruoyi.report.vo.TestItemDataVo"> |
| | | SELECT |
| | | p.id AS productId, |
| | | s.id AS sampleId, |
| | | s.sample_code AS sampleCode, |
| | | s.sample AS sampleName, |
| | | o.production AS productionOrder, |
| | | o.entrust_code AS batchNo, |
| | | p.inspection_item AS itemName, |
| | | p.last_value AS lastValue, |
| | | p.ask AS standardValue, |
| | | p.ins_result AS insResult, |
| | | p.unit AS unit, |
| | | u.name AS insUser, |
| | | o.ins_time AS insTime, |
| | | r.code AS reportCode |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | LEFT JOIN ins_report r ON o.id = r.ins_order_id |
| | | LEFT JOIN ins_product_user pu ON p.id = pu.ins_product_id |
| | | LEFT JOIN user u ON pu.create_user = u.id |
| | | WHERE s.id IN |
| | | <foreach collection="sampleIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | ORDER BY s.sample_code ASC, p.inspection_item ASC |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.report.mapper.WorkStatisticsMapper"> |
| | | |
| | | <!-- æäººåç»è®¡ --> |
| | | <select id="getByUser" resultType="com.ruoyi.report.vo.WorkStatisticsVo"> |
| | | SELECT |
| | | u.id AS userId, |
| | | u.name AS userName, |
| | | d.dept_name AS deptName, |
| | | COUNT(DISTINCT s.id) AS sampleCount, |
| | | COUNT(p.id) AS itemCount, |
| | | SUM(CASE WHEN o.ins_time IS NOT NULL AND o.ins_time <= o.appointed THEN 1 ELSE 0 END) AS timelyCount, |
| | | SUM(CASE WHEN o.ins_time IS NOT NULL AND o.ins_time > o.appointed THEN 1 ELSE 0 END) AS overdueCount |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | LEFT JOIN ins_product_user pu ON p.id = pu.ins_product_id |
| | | LEFT JOIN user u ON pu.create_user = u.id |
| | | LEFT JOIN sys_dept d ON u.dept_id = d.dept_id |
| | | WHERE p.ins_result IS NOT NULL |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND o.ins_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND o.ins_time <= #{dto.endTime} |
| | | </if> |
| | | <if test="dto.userId != null"> |
| | | AND pu.create_user = #{dto.userId} |
| | | </if> |
| | | <if test="dto.deptId != null"> |
| | | AND u.dept_id = #{dto.deptId} |
| | | </if> |
| | | GROUP BY u.id |
| | | ORDER BY sampleCount DESC |
| | | </select> |
| | | |
| | | <!-- åæ¶çç»è®¡ --> |
| | | <select id="getTimelyRate" resultType="java.util.Map"> |
| | | SELECT |
| | | u.name AS userName, |
| | | COUNT(*) AS totalCount, |
| | | SUM(CASE WHEN o.ins_time IS NOT NULL AND o.ins_time <= o.appointed THEN 1 ELSE 0 END) AS timelyCount, |
| | | ROUND(SUM(CASE WHEN o.ins_time IS NOT NULL AND o.ins_time <= o.appointed THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2) AS timelyRate |
| | | FROM ins_order o |
| | | LEFT JOIN ins_sample s ON o.id = s.ins_order_id |
| | | LEFT JOIN ins_product p ON s.id = p.ins_sample_id |
| | | LEFT JOIN user u ON o.prepare_user_id = u.id |
| | | WHERE o.ins_state = 5 |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND o.ins_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND o.ins_time <= #{dto.endTime} |
| | | </if> |
| | | <if test="dto.deptId != null"> |
| | | AND u.dept_id = #{dto.deptId} |
| | | </if> |
| | | GROUP BY u.id |
| | | ORDER BY timelyRate DESC |
| | | </select> |
| | | |
| | | <!-- å·¥ä½è¶å¿å¾ --> |
| | | <select id="getTrend" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT(o.ins_time, '%Y-%m-%d') AS date, |
| | | COUNT(DISTINCT s.id) AS sampleCount, |
| | | COUNT(p.id) AS itemCount |
| | | FROM ins_product p |
| | | LEFT JOIN ins_sample s ON p.ins_sample_id = s.id |
| | | LEFT JOIN ins_order o ON s.ins_order_id = o.id |
| | | LEFT JOIN ins_product_user pu ON p.id = pu.ins_product_id |
| | | WHERE p.ins_result IS NOT NULL |
| | | <if test="dto.startTime != null and dto.startTime != ''"> |
| | | AND o.ins_time >= #{dto.startTime} |
| | | </if> |
| | | <if test="dto.endTime != null and dto.endTime != ''"> |
| | | AND o.ins_time <= #{dto.endTime} |
| | | </if> |
| | | <if test="dto.userId != null"> |
| | | AND pu.create_user = #{dto.userId} |
| | | </if> |
| | | GROUP BY DATE_FORMAT(o.ins_time, '%Y-%m-%d') |
| | | ORDER BY date ASC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <artifactId>cnas-personnel</artifactId> |
| | | </dependency> |
| | | |
| | | <!--æ¥è¡¨å¾è¡¨æ¨¡å--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>report-server</artifactId> |
| | | </dependency> |
| | | |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | # redis é
ç½® |
| | | redis: |
| | | # å°å |
| | | host: localhost |
| | | host: 47.114.74.44 |
| | | # 端å£ï¼é»è®¤ä¸º6379 |
| | | port: 6379 |
| | | port: 6399 |
| | | # æ°æ®åºç´¢å¼ |
| | | database: 0 |
| | | database: 9 |
| | | # # å¯ç |
| | | password: 123456 |
| | | password: |
| | | # è¿æ¥è¶
æ¶æ¶é´ |
| | | timeout: 10s |
| | | lettuce: |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | -- ===================================================== |
| | | -- æ¥è¡¨å¾è¡¨ç®¡çæ¨¡åæ°æ®åºèæ¬ |
| | | -- æ§è¡å请å¤ä»½æ°æ®åº |
| | | -- å建æ¶é´: 2026-06-04 |
| | | -- ===================================================== |
| | | |
| | | -- ============================================= |
| | | -- 1. è¯é³ææ¥éå表 (voice_queue) - æ°å¢ |
| | | -- ============================================= |
| | | DROP TABLE IF EXISTS `voice_queue`; |
| | | CREATE TABLE `voice_queue` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®ID', |
| | | `event_type` varchar(50) NOT NULL COMMENT 'äºä»¶ç±»å(sample_receive/task_assign/report_submit/emergency)', |
| | | `event_name` varchar(100) NOT NULL COMMENT 'äºä»¶åç§°', |
| | | `details` varchar(500) DEFAULT '' COMMENT 'äºä»¶è¯¦æ
', |
| | | `voice_text` varchar(500) NOT NULL COMMENT 'è¯é³ææ¥ææ¬', |
| | | `priority` int DEFAULT 0 COMMENT 'ä¼å
级(0æ®é/1éè¦/2ç´§æ¥)', |
| | | `status` tinyint DEFAULT 0 COMMENT 'ç¶æ(0å¾
ææ¥/1å·²ææ¥/2已忶)', |
| | | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | PRIMARY KEY (`id`), |
| | | KEY `idx_status_priority` (`status`, `priority`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='è¯é³ææ¥éå表'; |
| | | |
| | | -- ============================================= |
| | | -- 2. æ¥è¡¨é
置表 |
| | | -- ============================================= |
| | | DROP TABLE IF EXISTS `report_config`; |
| | | CREATE TABLE `report_config` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®ID', |
| | | `report_name` varchar(100) NOT NULL COMMENT 'æ¥è¡¨åç§°', |
| | | `report_code` varchar(50) NOT NULL COMMENT 'æ¥è¡¨ç¼ç ', |
| | | `report_type` varchar(20) NOT NULL COMMENT 'æ¥è¡¨ç±»å(sample_progress/test_item/sample_record/device_record/dashboard)', |
| | | `query_config` text COMMENT 'æ¥è¯¢æ¡ä»¶é
ç½®JSON', |
| | | `column_config` text COMMENT 'åé
ç½®JSON', |
| | | `chart_config` text COMMENT 'å¾è¡¨é
ç½®JSON', |
| | | `status` tinyint DEFAULT 1 COMMENT 'ç¶æ(1å¯ç¨/0åç¨)', |
| | | `create_by` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `update_by` varchar(64) DEFAULT '' COMMENT 'æ´æ°è
', |
| | | `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `remark` varchar(500) DEFAULT '' COMMENT '夿³¨', |
| | | PRIMARY KEY (`id`), |
| | | UNIQUE KEY `uk_report_code` (`report_code`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='æ¥è¡¨é
置表'; |
| | | |
| | | -- ============================================= |
| | | -- 3. å¾è¡¨é
置表 |
| | | -- ============================================= |
| | | DROP TABLE IF EXISTS `chart_config`; |
| | | CREATE TABLE `chart_config` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®ID', |
| | | `chart_name` varchar(100) NOT NULL COMMENT 'å¾è¡¨åç§°', |
| | | `chart_code` varchar(50) NOT NULL COMMENT 'å¾è¡¨ç¼ç ', |
| | | `chart_type` varchar(20) NOT NULL COMMENT 'å¾è¡¨ç±»å(bar/line/pie/radar/spc/normal)', |
| | | `data_source` varchar(100) NOT NULL COMMENT 'æ°æ®æºSQLææ¥å£æ è¯', |
| | | `x_axis_field` varchar(50) COMMENT 'Xè½´åæ®µ', |
| | | `y_axis_field` varchar(100) COMMENT 'Yè½´åæ®µ(JSONæ°ç»)', |
| | | `query_params` text COMMENT 'æ¥è¯¢åæ°é
ç½®JSON', |
| | | `chart_options` text COMMENT 'EChartsé
ç½®JSON', |
| | | `status` tinyint DEFAULT 1 COMMENT 'ç¶æ(1å¯ç¨/0åç¨)', |
| | | `create_by` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `update_by` varchar(64) DEFAULT '' COMMENT 'æ´æ°è
', |
| | | `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `remark` varchar(500) DEFAULT '' COMMENT '夿³¨', |
| | | PRIMARY KEY (`id`), |
| | | UNIQUE KEY `uk_chart_code` (`chart_code`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='å¾è¡¨é
置表'; |
| | | |
| | | -- ============================================= |
| | | -- 4. çæ¿é
置表 |
| | | -- ============================================= |
| | | DROP TABLE IF EXISTS `dashboard_config`; |
| | | CREATE TABLE `dashboard_config` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®ID', |
| | | `dashboard_name` varchar(100) NOT NULL COMMENT 'çæ¿åç§°', |
| | | `dashboard_code` varchar(50) NOT NULL COMMENT 'çæ¿ç¼ç ', |
| | | `layout_config` text COMMENT 'å¸å±é
ç½®JSON', |
| | | `components` text COMMENT 'ç»ä»¶é
ç½®JSON', |
| | | `voice_config` text COMMENT 'è¯é³ææ¥é
ç½®JSON', |
| | | `refresh_interval` int DEFAULT 30 COMMENT 'å·æ°é´é(ç§)', |
| | | `status` tinyint DEFAULT 1 COMMENT 'ç¶æ(1å¯ç¨/0åç¨)', |
| | | `create_by` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `update_by` varchar(64) DEFAULT '' COMMENT 'æ´æ°è
', |
| | | `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `remark` varchar(500) DEFAULT '' COMMENT '夿³¨', |
| | | PRIMARY KEY (`id`), |
| | | UNIQUE KEY `uk_dashboard_code` (`dashboard_code`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='çæ¿é
置表'; |
| | | |
| | | -- ============================================= |
| | | -- 5. èåæéé
ç½® |
| | | -- ============================================= |
| | | -- æ¥è¡¨å¾è¡¨ç®¡çï¼ä¸çº§ç®å½ï¼- æå¨æåï¼order_num = 21 |
| | | INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`, `is_rersonal_button`) VALUES |
| | | (3000, 'æ¥è¡¨å¾è¡¨ç®¡ç', 0, 21, 'reportChart', '', NULL, '', 1, 0, 'M', '0', '0', '', 'chart', 'admin', NOW(), '', NULL, 'æ¥è¡¨å¾è¡¨ç®¡çç®å½', 0), |
| | | |
| | | -- æ°ååè¯é³çæ¿ï¼äºçº§ç®å½ï¼ |
| | | (3001, 'æ°ååè¯é³çæ¿', 3000, 1, 'dashboard', '', NULL, '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', NOW(), '', NULL, 'æ°ååè¯é³çæ¿ç®å½', 0), |
| | | |
| | | -- è¯éªå¤§å
|
| | | (3002, 'è¯éªå¤§å
', 3001, 1, 'testHall', 'report/dashboard/index', NULL, '', 1, 0, 'C', '0', '0', 'report:dashboard:list', 'monitor', 'admin', NOW(), '', NULL, 'è¯éªå¤§å
èå', 0), |
| | | |
| | | -- æ¥è¡¨ç®¡çï¼äºçº§ç®å½ï¼ |
| | | (3010, 'æ¥è¡¨ç®¡ç', 3000, 2, 'report', '', NULL, '', 1, 0, 'M', '0', '0', '', 'form', 'admin', NOW(), '', NULL, 'æ¥è¡¨ç®¡çç®å½', 0), |
| | | |
| | | -- æ ·åè¿åº¦æ¥è¡¨ |
| | | (3011, 'æ ·åè¿åº¦æ¥è¡¨', 3010, 1, 'sampleProgress', 'report/sampleProgress/index', NULL, '', 1, 0, 'C', '0', '0', 'report:sampleProgress:list', 'table', 'admin', NOW(), '', NULL, 'æ ·åè¿åº¦æ¥è¡¨èå', 0), |
| | | |
| | | -- æ£æµé¡¹ç®æ°æ® |
| | | (3012, 'æ£æµé¡¹ç®æ°æ®', 3010, 2, 'testItemData', 'report/testItemData/index', NULL, '', 1, 0, 'C', '0', '0', 'report:testItemData:list', 'table', 'admin', NOW(), '', NULL, 'æ£æµé¡¹ç®æ°æ®èå', 0), |
| | | |
| | | -- æ ·å颿 ·è®°å½ |
| | | (3013, 'æ ·å颿 ·è®°å½', 3010, 3, 'sampleRecord', 'report/sampleRecord/index', NULL, '', 1, 0, 'C', '0', '0', 'report:sampleRecord:list', 'table', 'admin', NOW(), '', NULL, 'æ ·å颿 ·è®°å½èå', 0), |
| | | |
| | | -- 设å¤ä½¿ç¨è®°å½ |
| | | (3014, '设å¤ä½¿ç¨è®°å½', 3010, 4, 'deviceRecord', 'report/deviceRecord/index', NULL, '', 1, 0, 'C', '0', '0', 'report:deviceRecord:list', 'table', 'admin', NOW(), '', NULL, '设å¤ä½¿ç¨è®°å½èå', 0), |
| | | |
| | | -- æºè½å¾è¡¨ï¼äºçº§ç®å½ï¼ |
| | | (3020, 'æºè½å¾è¡¨', 3000, 3, 'chart', '', NULL, '', 1, 0, 'M', '0', '0', '', 'chart', 'admin', NOW(), '', NULL, 'æºè½å¾è¡¨ç®å½', 0), |
| | | |
| | | -- å·¥ä½ç»è®¡ |
| | | (3021, 'å·¥ä½ç»è®¡', 3020, 1, 'workStatistics', 'report/workStatistics/index', NULL, '', 1, 0, 'C', '0', '0', 'chart:workStatistics:list', 'peoples', 'admin', NOW(), '', NULL, 'å·¥ä½ç»è®¡èå', 0), |
| | | |
| | | -- åæ ¼çç»è®¡ |
| | | (3022, 'åæ ¼çç»è®¡', 3020, 2, 'passRate', 'report/passRate/index', NULL, '', 1, 0, 'C', '0', '0', 'chart:passRate:list', 'chart', 'admin', NOW(), '', NULL, 'åæ ¼çç»è®¡èå', 0), |
| | | |
| | | -- SPCæ§å¶å¾ |
| | | (3023, 'SPCæ§å¶å¾', 3020, 3, 'spcChart', 'report/spcChart/index', NULL, '', 1, 0, 'C', '0', '0', 'chart:spcChart:list', 'chart', 'admin', NOW(), '', NULL, 'SPCæ§å¶å¾èå', 0), |
| | | |
| | | -- æ£æåå¸å¾ |
| | | (3024, 'æ£æåå¸å¾', 3020, 4, 'normalDistribution', 'report/normalDistribution/index', NULL, '', 1, 0, 'C', '0', '0', 'chart:normalDistribution:list', 'chart', 'admin', NOW(), '', NULL, 'æ£æåå¸å¾èå', 0); |
| | | |
| | | -- ============================================= |
| | | -- 6. åå§åçæ¿é
ç½®æ°æ® |
| | | -- ============================================= |
| | | INSERT INTO `dashboard_config` (`dashboard_name`, `dashboard_code`, `layout_config`, `components`, `voice_config`, `refresh_interval`, `status`, `create_by`) VALUES |
| | | ('è¯éªå¤§å
çæ¿', 'test_hall', |
| | | '[{"i":"history","x":0,"y":0,"w":8,"h":4},{"i":"future","x":8,"y":0,"w":4,"h":4},{"i":"ranking","x":0,"y":4,"w":6,"h":3},{"i":"status","x":6,"y":4,"w":6,"h":3},{"i":"result","x":0,"y":7,"w":12,"h":3}]', |
| | | '[{"id":"history","type":"calendar","title":"åå²15å¤©æ£æµä»»å¡","api":"/report/dashboard/history15Days"},{"id":"future","type":"calendar","title":"æªæ¥15å¤©æ£æµä»»å¡","api":"/report/dashboard/future15Days"},{"id":"ranking","type":"ranking","title":"æäº¤æè¡","api":"/report/dashboard/ranking"},{"id":"status","type":"stat","title":"å¾
å¤çç»è®¡","api":"/report/dashboard/overview"},{"id":"result","type":"chart","title":"æ£éªç»æç»è®¡","api":"/report/dashboard/insResult"}]', |
| | | '{"enabled":true,"events":["sample_receive","task_assign","report_submit","emergency"],"template":"ç´§æ¥éç¥ï¼{eventName}ï¼{details}"}', |
| | | 30, 1, 'admin'); |
| | | |
| | | -- ============================================= |
| | | -- 7. åå§åæ¥è¡¨é
ç½®æ°æ® |
| | | -- ============================================= |
| | | INSERT INTO `report_config` (`report_name`, `report_code`, `report_type`, `query_config`, `status`, `create_by`) VALUES |
| | | ('æ ·åè¿åº¦æ¥è¡¨', 'sample_progress', 'sample_progress', '[{"field":"entrustCode","label":"å§æç¼å·","type":"input"},{"field":"sampleCode","label":"æ ·åç¼å·","type":"input"},{"field":"sampleName","label":"æ ·ååç§°","type":"input"},{"field":"insState","label":"æ£æµç¶æ","type":"select","options":[{"value":0,"label":"å¾
æ£"},{"value":1,"label":"æ£éªä¸"},{"value":5,"label":"已宿"}]}]', 1, 'admin'), |
| | | ('æ£æµé¡¹ç®æ°æ®', 'test_item_data', 'test_item', '[{"field":"productionOrder","label":"ç产订å","type":"input"},{"field":"batchNo","label":"æ¹æ¬¡å·","type":"input"},{"field":"sampleCode","label":"æ ·åç¼å·","type":"input"},{"field":"itemName","label":"æ£æµé¡¹ç®","type":"input"}]', 1, 'admin'), |
| | | ('æ ·å颿 ·è®°å½', 'sample_record', 'sample_record', '[{"field":"sampleCode","label":"æ ·åç¼å·","type":"input"},{"field":"operateUser","label":"æä½äºº","type":"input"},{"field":"startTime","label":"å¼å§æ¶é´","type":"date"},{"field":"endTime","label":"ç»ææ¶é´","type":"date"}]', 1, 'admin'), |
| | | ('设å¤ä½¿ç¨è®°å½', 'device_record', 'device_record', '[{"field":"deviceCode","label":"设å¤ç¼å·","type":"input"},{"field":"deviceName","label":"设å¤åç§°","type":"input"},{"field":"useUser","label":"使ç¨äºº","type":"input"}]', 1, 'admin'); |
| | | |
| | | -- ============================================= |
| | | -- 8. åå§åå¾è¡¨é
ç½®æ°æ® |
| | | -- ============================================= |
| | | INSERT INTO `chart_config` (`chart_name`, `chart_code`, `chart_type`, `data_source`, `x_axis_field`, `y_axis_field`, `status`, `create_by`) VALUES |
| | | ('å·¥ä½ç»è®¡å¾', 'work_statistics', 'bar', '/chart/workStatistics/byUser', 'userName', '[{"field":"sampleCount","name":"æ ·åæ°é"},{"field":"itemCount","name":"é¡¹ç®æ°é"}]', 1, 'admin'), |
| | | ('åæ¶çç»è®¡', 'timely_rate', 'line', '/chart/workStatistics/timelyRate', 'userName', '[{"field":"timelyRate","name":"åæ¶ç(%)"}]', 1, 'admin'), |
| | | ('åææåæ ¼ç', 'raw_material_pass_rate', 'bar', '/chart/passRate/rawMaterial', 'sampleName', '[{"field":"passRate","name":"åæ ¼ç(%)"}]', 1, 'admin'), |
| | | ('å¸ç´¯æå¾', 'pareto', 'bar', '/chart/passRate/pareto', 'itemName', '[{"field":"unqualifiedCount","name":"ä¸åæ ¼æ°"},{"field":"cumulativePercent","name":"累计ç¾åæ¯"}]', 1, 'admin'), |
| | | ('å·¥åºåæ ¼ç', 'process_pass_rate', 'pie', '/chart/passRate/process', 'processName', '[{"field":"passRate","name":"åæ ¼ç(%)"}]', 1, 'admin'), |
| | | ('SPCæ§å¶å¾', 'spc_chart', 'line', '/chart/spc/analyze', 'subgroup', '[{"field":"xBar","name":"X-Bar"},{"field":"ucl","name":"UCL"},{"field":"lcl","name":"LCL"}]', 1, 'admin'), |
| | | ('æ£æåå¸å¾', 'normal_distribution', 'line', '/chart/normalDistribution/analyze', 'value', '[{"field":"frequency","name":"é¢ç"},{"field":"normalCurve","name":"æ£ææ²çº¿"}]', 1, 'admin'); |
| | | |
| | | -- ============================================= |
| | | -- 9. åå§åè¯é³ææ¥æµè¯æ°æ® |
| | | -- ============================================= |
| | | INSERT INTO `voice_queue` (`event_type`, `event_name`, `details`, `voice_text`, `priority`, `status`) VALUES |
| | | ('sample_receive', 'æ ·åæ¥æ¶', 'æ ·åA001å·²å°è¾¾å®éªå®¤', 'æ ·åA001å·²å°è¾¾å®éªå®¤ï¼è¯·åæ¶é¢å', 0, 0), |
| | | ('task_assign', 'ä»»å¡åé
', 'æ£æµä»»å¡å·²åé
ç»å¼ ä¸', 'æ£æµä»»å¡å·²åé
ç»å¼ ä¸ï¼è¯·å°½å¿«å¼å§æ£æµ', 1, 0), |
| | | ('emergency', 'ç´§æ¥éç¥', 'è®¾å¤æ
ééè¦ç»´ä¿®', 'ç´§æ¥éç¥ï¼å
³é®æ£æµè®¾å¤åºç°æ
éï¼è¯·ç«å³è系维修人å', 2, 0); |
| | | |
| | | -- ===================================================== |
| | | -- æ§è¡å®æ |
| | | -- ===================================================== |