From 650e9a232440c07b5b6b875097561cbbaeb3d76d Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Tue, 29 Nov 2022 11:11:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A4=E8=AF=BB=E6=96=B9?= =?UTF-8?q?=E6=A1=88=E7=AE=97=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/spc/math/StandardDiviation.java | 7 +- .../com/cnbm/influx/constant/Constant.java | 2 +- .../ProcessInspectionController.java | 188 ++--- .../processInspection/dto/XbarRGraphData.java | 22 +- .../forMeterage/mr/MeanRGraph.java | 13 + .../common/StatisticalControlledTest.java | 721 ++++++++++++------ .../common/test/MainRule5TEST.java | 115 +++ .../common/test/MainRule7TEST.java | 112 +++ .../entity/ControlLimitDetail.java | 8 +- 9 files changed, 872 insertions(+), 316 deletions(-) create mode 100644 ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/test/MainRule5TEST.java create mode 100644 ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/test/MainRule7TEST.java diff --git a/ym-common/src/main/java/com/cnbm/common/spc/math/StandardDiviation.java b/ym-common/src/main/java/com/cnbm/common/spc/math/StandardDiviation.java index 43a6976..44a0c2d 100644 --- a/ym-common/src/main/java/com/cnbm/common/spc/math/StandardDiviation.java +++ b/ym-common/src/main/java/com/cnbm/common/spc/math/StandardDiviation.java @@ -1,5 +1,7 @@ package com.cnbm.common.spc.math; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -8,10 +10,13 @@ import lombok.Data; * @DATE: 2022/7/25 15:23 */ @Data +@ApiModel(value = "标准差结果类") public class StandardDiviation { - //标准差 + //组内标准差 + @ApiModelProperty(value = "组内标准差") private Double normal; //总体标准差 + @ApiModelProperty(value = "总体标准差") private Double totality; public StandardDiviation(Double normal, Double totality) { diff --git a/ym-influx/src/main/java/com/cnbm/influx/constant/Constant.java b/ym-influx/src/main/java/com/cnbm/influx/constant/Constant.java index 2c3f07a..113d69f 100644 --- a/ym-influx/src/main/java/com/cnbm/influx/constant/Constant.java +++ b/ym-influx/src/main/java/com/cnbm/influx/constant/Constant.java @@ -18,7 +18,7 @@ public class Constant { public static final LogLevel readTimeout = LogLevel.BODY; public static final LogLevel writeTimeout = LogLevel.BODY; public static final LogLevel connectTimeout = LogLevel.BODY; - public static final String measurement = "Weights"; + public static final String measurement = "Weight"; } diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/ProcessInspectionController.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/ProcessInspectionController.java index 2de9d4d..3a0209f 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/ProcessInspectionController.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/ProcessInspectionController.java @@ -21,6 +21,7 @@ import com.cnbm.processInspection.graphAnalyzed.forCount.u.UGraph; import com.cnbm.processInspection.graphAnalyzed.forMeterage.mr.MeanRGraph; import com.cnbm.processInspection.graphAnalyzed.forMeterage.ms.MeanStandardDeviationGraph; import com.cnbm.processInspection.graphAnalyzed.forMeterage.xmr.XMRGraph; +import com.cnbm.qualityPlanning.entity.ControlLimitDetail; import com.influxdb.query.FluxRecord; import com.influxdb.query.FluxTable; import org.slf4j.Logger; @@ -48,11 +49,11 @@ public class ProcessInspectionController { @PostMapping("/XbarSGraphTest") public R xbarSGraphTest() throws Exception { ProductFeatures productFeatures = new ProductFeatures(); - productFeatures.setSl(new Float(5)); - productFeatures.setUsl(new Float(10)); - productFeatures.setLsl(new Float(1)); + productFeatures.setSl(new Float(65)); + productFeatures.setUsl(new Float(66)); + productFeatures.setLsl(new Float(69)); - productFeatures.setName("LostDays"); + productFeatures.setName("LTWeight"); productFeatures.setSampleSize(10); MeanStandardDeviationGraph meanStandardDeviationGraph = new MeanStandardDeviationGraph(productFeatures); //判读方案 @@ -68,12 +69,12 @@ public class ProcessInspectionController { meanStandardDeviationGraph.initialDate(queryDataParam); XbarSGraphData xbarSGraphData = new XbarSGraphData( - meanStandardDeviationGraph.getMsdGraphEntity(), - meanStandardDeviationGraph.getXbarCL(), - meanStandardDeviationGraph.getSCL(), - meanStandardDeviationGraph.getSpecificationLimit(), - meanStandardDeviationGraph.getProcessCapacity(), - new StandardDiviation(meanStandardDeviationGraph.getXigma(),meanStandardDeviationGraph.getTotalXigma()) + meanStandardDeviationGraph.getMsdGraphEntity()==null?null:meanStandardDeviationGraph.getMsdGraphEntity(), + meanStandardDeviationGraph.getXbarCL()==null?null:meanStandardDeviationGraph.getXbarCL(), + meanStandardDeviationGraph.getSCL()==null?null:meanStandardDeviationGraph.getSCL(), + meanStandardDeviationGraph.getSpecificationLimit()==null?null:meanStandardDeviationGraph.getSpecificationLimit(), + meanStandardDeviationGraph.getProcessCapacity()==null?null:meanStandardDeviationGraph.getProcessCapacity(), + (meanStandardDeviationGraph.getXigma()==null||meanStandardDeviationGraph.getTotalXigma()==null)?null:new StandardDiviation(meanStandardDeviationGraph.getXigma(),meanStandardDeviationGraph.getTotalXigma()) ); return R.ok("成功",xbarSGraphData); @@ -83,11 +84,11 @@ public class ProcessInspectionController { public R XbarRGraphTest() throws Exception { //todo SL/USL/LSL 和 sampleSize 需要从外面传过来。 ProductFeatures productFeatures = new ProductFeatures(); - productFeatures.setSl(new Float(5)); - productFeatures.setUsl(new Float(10)); - productFeatures.setLsl(new Float(1)); + productFeatures.setSl(new Float(65)); + productFeatures.setUsl(new Float(66)); + productFeatures.setLsl(new Float(69)); - productFeatures.setName("LostDays"); + productFeatures.setName("LTWeight"); productFeatures.setSampleSize(10); MeanRGraph meanRGraph = new MeanRGraph(productFeatures); //判读方案 @@ -103,12 +104,16 @@ public class ProcessInspectionController { meanRGraph.initialDate(queryDataParam); XbarRGraphData xbarSGraphData = new XbarRGraphData( - meanRGraph.getMrGraphEntity(), - meanRGraph.getXbarCL(), - meanRGraph.getRCL(), - meanRGraph.getSpecificationLimit(), - meanRGraph.getProcessCapacity(), - new StandardDiviation(meanRGraph.getXigma(),meanRGraph.getTotalXigma()) + meanRGraph.getMrGraphEntity()==null?null:meanRGraph.getMrGraphEntity(), + + meanRGraph.getXbarCL()==null?null:new ControlLimitDetail(meanRGraph.getXbarCL().getUCL(), meanRGraph.getXbarCL().getCL(), meanRGraph.getXbarCL().getLCL()), + meanRGraph.getRCL()==null?null:new ControlLimitDetail(meanRGraph.getRCL().getUCL(), meanRGraph.getRCL().getCL(), meanRGraph.getRCL().getLCL()), + + meanRGraph.getSpecificationLimit()==null?null:meanRGraph.getSpecificationLimit(), + meanRGraph.getProcessCapacity()==null?null:meanRGraph.getProcessCapacity(), + (meanRGraph.getXigma()==null||meanRGraph.getTotalXigma()==null)?null:new StandardDiviation(meanRGraph.getXigma(),meanRGraph.getTotalXigma()) + + ); return R.ok("成功",xbarSGraphData); @@ -116,11 +121,11 @@ public class ProcessInspectionController { @PostMapping("/XMRGraphTest") public R XMRGraphTest() throws Exception { ProductFeatures productFeatures = new ProductFeatures(); - productFeatures.setSl(new Float(5)); - productFeatures.setUsl(new Float(10)); - productFeatures.setLsl(new Float(1)); + productFeatures.setSl(new Float(65)); + productFeatures.setUsl(new Float(66)); + productFeatures.setLsl(new Float(69)); - productFeatures.setName("LostDays"); + productFeatures.setName("LTWeight"); productFeatures.setSampleSize(1); XMRGraph xmrGraph = new XMRGraph(productFeatures); //判读方案 @@ -136,12 +141,13 @@ public class ProcessInspectionController { xmrGraph.initialDate(queryDataParam); XMRGraphData xmrGraphData = new XMRGraphData( - xmrGraph.getXmrGraphEntity(), - xmrGraph.getXCL(), - xmrGraph.getRSCL(), - xmrGraph.getSpecificationLimit(), - xmrGraph.getProcessCapacity(), - new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma()) + xmrGraph.getXmrGraphEntity()==null?null:xmrGraph.getXmrGraphEntity(), + xmrGraph.getXCL()==null?null:xmrGraph.getXCL(), + xmrGraph.getRSCL()==null?null:xmrGraph.getRSCL(), + xmrGraph.getSpecificationLimit()==null?null:xmrGraph.getSpecificationLimit(), + xmrGraph.getProcessCapacity()==null?null:xmrGraph.getProcessCapacity(), + (xmrGraph.getXigma()==null||xmrGraph.getTotalXigma()==null)?null:new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma()) + ); return R.ok("成功",xmrGraphData); @@ -188,11 +194,11 @@ public class ProcessInspectionController { @PostMapping("/NPGraphTest") public R NPGraphTest() throws Exception { ProductFeatures productFeatures = new ProductFeatures(); - productFeatures.setSl(new Float(5)); - productFeatures.setUsl(new Float(10)); - productFeatures.setLsl(new Float(1)); + productFeatures.setSl(new Float(65)); + productFeatures.setUsl(new Float(66)); + productFeatures.setLsl(new Float(69)); - productFeatures.setName("LostDays"); + productFeatures.setName("LTWeight"); NPGraph npGraph = new NPGraph(productFeatures); @@ -203,9 +209,9 @@ public class ProcessInspectionController { npGraph.initialDate(queryDataParam); NPGraphData npGraph1 = new NPGraphData( - npGraph.getList(), - npGraph.getSpecificationLimit(), - npGraph.getArgName() + npGraph.getList()==null?null:npGraph.getList(), + npGraph.getSpecificationLimit()==null?null:npGraph.getSpecificationLimit(), + npGraph.getArgName()==null?null:npGraph.getArgName() ); return R.ok("成功",npGraph1); @@ -213,11 +219,11 @@ public class ProcessInspectionController { @PostMapping("/PGraphTest") public R PGraphTest() throws Exception { ProductFeatures productFeatures = new ProductFeatures(); - productFeatures.setSl(new Float(5)); - productFeatures.setUsl(new Float(10)); - productFeatures.setLsl(new Float(1)); + productFeatures.setSl(new Float(65)); + productFeatures.setUsl(new Float(66)); + productFeatures.setLsl(new Float(69)); - productFeatures.setName("LostDays"); + productFeatures.setName("LTWeight"); PGraph pGraph = new PGraph(productFeatures); @@ -228,9 +234,9 @@ public class ProcessInspectionController { pGraph.initialDate(queryDataParam); PGraphData npGraph1 = new PGraphData( - pGraph.getList(), - pGraph.getSpecificationLimit(), - pGraph.getArgName() + pGraph.getList()==null?null:pGraph.getList(), + pGraph.getSpecificationLimit()==null?null:pGraph.getSpecificationLimit(), + pGraph.getArgName()==null?null:pGraph.getArgName() ); return R.ok("成功",npGraph1); @@ -238,11 +244,11 @@ public class ProcessInspectionController { @PostMapping("/CGraphTest") public R CGraphTest() throws Exception { ProductFeatures productFeatures = new ProductFeatures(); - productFeatures.setSl(new Float(5)); - productFeatures.setUsl(new Float(10)); - productFeatures.setLsl(new Float(1)); + productFeatures.setSl(new Float(65)); + productFeatures.setUsl(new Float(66)); + productFeatures.setLsl(new Float(69)); - productFeatures.setName("LostDays"); + productFeatures.setName("LTWeight"); CGraph cGraph = new CGraph(productFeatures); @@ -255,9 +261,9 @@ public class ProcessInspectionController { cGraph.initialDate(queryDataParam); CGraphData npGraph1 = new CGraphData( - cGraph.getList(), - cGraph.getSpecificationLimit(), - cGraph.getArgName() + cGraph.getList()==null?null:cGraph.getList(), + cGraph.getSpecificationLimit()==null?null:cGraph.getSpecificationLimit(), + cGraph.getArgName()==null?null:cGraph.getArgName() ); return R.ok("成功",npGraph1); @@ -266,11 +272,11 @@ public class ProcessInspectionController { @PostMapping("/UGraphTest") public R UGraphTest() throws Exception { ProductFeatures productFeatures = new ProductFeatures(); - productFeatures.setSl(new Float(5)); - productFeatures.setUsl(new Float(10)); - productFeatures.setLsl(new Float(1)); + productFeatures.setSl(new Float(65)); + productFeatures.setUsl(new Float(66)); + productFeatures.setLsl(new Float(69)); - productFeatures.setName("LostDays"); + productFeatures.setName("LTWeight"); UGraph uGraph = new UGraph(productFeatures); @@ -281,9 +287,9 @@ public class ProcessInspectionController { uGraph.initialDate(queryDataParam); UGraphData npGraph1 = new UGraphData( - uGraph.getList(), - uGraph.getSpecificationLimit(), - uGraph.getArgName() + uGraph.getList()==null?null:uGraph.getList(), + uGraph.getSpecificationLimit()==null?null:uGraph.getSpecificationLimit(), + uGraph.getArgName()==null?null:uGraph.getArgName() ); return R.ok("成功",npGraph1); @@ -321,12 +327,12 @@ public class ProcessInspectionController { meanStandardDeviationGraph.initialDate(queryDataParam); XbarSGraphData xbarSGraphData = new XbarSGraphData( - meanStandardDeviationGraph.getMsdGraphEntity(), - meanStandardDeviationGraph.getXbarCL(), - meanStandardDeviationGraph.getSCL(), - meanStandardDeviationGraph.getSpecificationLimit(), - meanStandardDeviationGraph.getProcessCapacity(), - new StandardDiviation(meanStandardDeviationGraph.getXigma(),meanStandardDeviationGraph.getTotalXigma()) + meanStandardDeviationGraph.getMsdGraphEntity()==null?null:meanStandardDeviationGraph.getMsdGraphEntity(), + meanStandardDeviationGraph.getXbarCL()==null?null:meanStandardDeviationGraph.getXbarCL(), + meanStandardDeviationGraph.getSCL()==null?null:meanStandardDeviationGraph.getSCL(), + meanStandardDeviationGraph.getSpecificationLimit()==null?null:meanStandardDeviationGraph.getSpecificationLimit(), + meanStandardDeviationGraph.getProcessCapacity()==null?null:meanStandardDeviationGraph.getProcessCapacity(), + (meanStandardDeviationGraph.getXigma()==null||meanStandardDeviationGraph.getTotalXigma()==null)?null:new StandardDiviation(meanStandardDeviationGraph.getXigma(),meanStandardDeviationGraph.getTotalXigma()) ); return R.ok("成功",xbarSGraphData); @@ -348,13 +354,18 @@ public class ProcessInspectionController { queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant())); meanRGraph.initialDate(queryDataParam); + XbarRGraphData xbarSGraphData = new XbarRGraphData( - meanRGraph.getMrGraphEntity(), - meanRGraph.getXbarCL(), - meanRGraph.getRCL(), - meanRGraph.getSpecificationLimit(), - meanRGraph.getProcessCapacity(), - new StandardDiviation(meanRGraph.getXigma(),meanRGraph.getTotalXigma()) + meanRGraph.getMrGraphEntity()==null?null:meanRGraph.getMrGraphEntity(), + + meanRGraph.getXbarCL()==null?null:new ControlLimitDetail(meanRGraph.getXbarCL().getUCL(), meanRGraph.getXbarCL().getCL(), meanRGraph.getXbarCL().getLCL()), + meanRGraph.getRCL()==null?null:new ControlLimitDetail(meanRGraph.getRCL().getUCL(), meanRGraph.getRCL().getCL(), meanRGraph.getRCL().getLCL()), + + meanRGraph.getSpecificationLimit()==null?null:meanRGraph.getSpecificationLimit(), + meanRGraph.getProcessCapacity()==null?null:meanRGraph.getProcessCapacity(), + (meanRGraph.getXigma()==null||meanRGraph.getTotalXigma()==null)?null:new StandardDiviation(meanRGraph.getXigma(),meanRGraph.getTotalXigma()) + + ); return R.ok("成功",xbarSGraphData); @@ -377,12 +388,13 @@ public class ProcessInspectionController { xmrGraph.initialDate(queryDataParam); XMRGraphData xmrGraphData = new XMRGraphData( - xmrGraph.getXmrGraphEntity(), - xmrGraph.getXCL(), - xmrGraph.getRSCL(), - xmrGraph.getSpecificationLimit(), - xmrGraph.getProcessCapacity(), - new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma()) + xmrGraph.getXmrGraphEntity()==null?null:xmrGraph.getXmrGraphEntity(), + xmrGraph.getXCL()==null?null:xmrGraph.getXCL(), + xmrGraph.getRSCL()==null?null:xmrGraph.getRSCL(), + xmrGraph.getSpecificationLimit()==null?null:xmrGraph.getSpecificationLimit(), + xmrGraph.getProcessCapacity()==null?null:xmrGraph.getProcessCapacity(), + (xmrGraph.getXigma()==null||xmrGraph.getTotalXigma()==null)?null:new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma()) + ); return R.ok("成功",xmrGraphData); @@ -402,9 +414,9 @@ public class ProcessInspectionController { npGraph.initialDate(queryDataParam); NPGraphData npGraph1 = new NPGraphData( - npGraph.getList(), - npGraph.getSpecificationLimit(), - npGraph.getArgName() + npGraph.getList()==null?null:npGraph.getList(), + npGraph.getSpecificationLimit()==null?null:npGraph.getSpecificationLimit(), + npGraph.getArgName()==null?null:npGraph.getArgName() ); return R.ok("成功",npGraph1); } @@ -423,9 +435,9 @@ public class ProcessInspectionController { pGraph.initialDate(queryDataParam); PGraphData npGraph1 = new PGraphData( - pGraph.getList(), - pGraph.getSpecificationLimit(), - pGraph.getArgName() + pGraph.getList()==null?null:pGraph.getList(), + pGraph.getSpecificationLimit()==null?null:pGraph.getSpecificationLimit(), + pGraph.getArgName()==null?null:pGraph.getArgName() ); return R.ok("成功",npGraph1); } @@ -443,9 +455,9 @@ public class ProcessInspectionController { cGraph.initialDate(queryDataParam); CGraphData npGraph1 = new CGraphData( - cGraph.getList(), - cGraph.getSpecificationLimit(), - cGraph.getArgName() + cGraph.getList()==null?null:cGraph.getList(), + cGraph.getSpecificationLimit()==null?null:cGraph.getSpecificationLimit(), + cGraph.getArgName()==null?null:cGraph.getArgName() ); return R.ok("成功",npGraph1); } @@ -464,9 +476,9 @@ public class ProcessInspectionController { uGraph.initialDate(queryDataParam); UGraphData uGraphData = new UGraphData( - uGraph.getList(), - uGraph.getSpecificationLimit(), - uGraph.getArgName() + uGraph.getList()==null?null:uGraph.getList(), + uGraph.getSpecificationLimit()==null?null:uGraph.getSpecificationLimit(), + uGraph.getArgName()==null?null:uGraph.getArgName() ); return R.ok("成功",uGraphData); } diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/dto/XbarRGraphData.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/dto/XbarRGraphData.java index 4235b87..9a80ae8 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/dto/XbarRGraphData.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/dto/XbarRGraphData.java @@ -2,13 +2,15 @@ package com.cnbm.processInspection.dto; import com.cnbm.common.spc.math.StandardDiviation; import com.cnbm.processInspection.graphAnalyzed.forMeterage.mr.MRGraphEntity; -import com.cnbm.qualityPlanning.entity.ControlLimit; -import com.cnbm.qualityPlanning.entity.ProcessCapability; -import com.cnbm.qualityPlanning.entity.SpecificationLimit; +import com.cnbm.qualityPlanning.entity.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + /** * @Desc: "" * @Author: caixiang @@ -20,9 +22,11 @@ public class XbarRGraphData { @ApiModelProperty(value = "控制图list数据") private MRGraphEntity mrGraphEntity; @ApiModelProperty(value = "xbar控制图 控制限") - private ControlLimit XBarCL; + private ControlLimitDetail XBarCL; + @ApiModelProperty(value = "R控制图 控制限") - private ControlLimit RCL; + private ControlLimitDetail RCL; + @ApiModelProperty(value = "工艺规格限") private SpecificationLimit SL; @@ -34,12 +38,14 @@ public class XbarRGraphData { private StandardDiviation standardDiviation; - public XbarRGraphData(MRGraphEntity mrGraphEntity, ControlLimit xBarCL, ControlLimit rCL, SpecificationLimit sl, ProcessCapability processCapability, StandardDiviation standardDiviation){ + public XbarRGraphData(MRGraphEntity mrGraphEntity, ControlLimitDetail xBarCLDetail , ControlLimitDetail rCLDetail, SpecificationLimit sl, ProcessCapability processCapability, StandardDiviation standardDiviation){ this.mrGraphEntity = mrGraphEntity; - this.XBarCL = xBarCL; - this.RCL = rCL; + this.XBarCL = xBarCLDetail; + this.RCL = rCLDetail; this.SL = sl; this.processCapability = processCapability; this.standardDiviation = standardDiviation; } + + } diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/mr/MeanRGraph.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/mr/MeanRGraph.java index 744c6bd..dde11e6 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/mr/MeanRGraph.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/graphAnalyzed/forMeterage/mr/MeanRGraph.java @@ -107,6 +107,9 @@ public class MeanRGraph { queryDataParam.setTag(new Tag("argName",argName)); List query = InfluxClient.Client.query(queryDataParam); + if(query.size() == 0){ + return; + } //1. 先从fluxdb 里面提取原始数据 List originData = new ArrayList<>(); for (FluxTable fluxTable : query) { @@ -217,6 +220,9 @@ public class MeanRGraph { * 注意:此函数 要在 initialDate()函数执行之后 * */ public ControlLimit getXbarCL(){ + if(this.mrGraphEntity == null){ + return null; + } return new ControlLimit( (this.mrGraphEntity.getXbarbar() + a2*this.mrGraphEntity.getRbar()), this.mrGraphEntity.getXbarbar(), @@ -229,6 +235,9 @@ public class MeanRGraph { * 注意:此函数 要在 initialDate()函数执行之后 * */ public ControlLimit getRCL(){ + if(this.mrGraphEntity==null){ + return null; + } return new ControlLimit( ( d4 * this.mrGraphEntity.getRbar() ) , this.mrGraphEntity.getRbar() , @@ -241,6 +250,10 @@ public class MeanRGraph { * 注意:此函数 要在 initialDate()函数执行之后 * */ public ProcessCapability getProcessCapacity(){ + if(this.miu==null || this.xigma==null || this.specificationLimit==null){ + return null; + } + SpecificationLimit sp = this.specificationLimit; List warming = new ArrayList<>(); Float usl = sp.getUSL(); diff --git a/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/StatisticalControlledTest.java b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/StatisticalControlledTest.java index 3e1940b..5776783 100644 --- a/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/StatisticalControlledTest.java +++ b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/StatisticalControlledTest.java @@ -2,6 +2,7 @@ package com.cnbm.qualityPlanning.common; import com.cnbm.qualityPlanning.entity.*; +import io.swagger.models.auth.In; import java.util.*; @@ -608,76 +609,109 @@ public class StatisticalControlledTest { + /** * name : 规则5 * desc : 连续 m 点中 有 n 点 落在中心线同一侧,B区以外。( 默认 m:3 , n:2 ) - * 注意: 如果存在满足rule5的点,会在原数组 Point.unsatisfiedRules 里标注出来。 + * 注意: + * ① 如果存在满足rule5的点,会在原数组 Point.unsatisfiedRules 里标注出来。 + * ② 如果如果存在UB外和 LB外的连续 数据也是算的 * return : * 存在满足rule5的点 => true * 不存在满足rule5的点 => false + * + * Test status: OK(CaiXiang) + * * */ - public static Boolean rule5(List data,ControlLimit controlLimit, Integer m, Integer n){ - Boolean result = false; - Integer upi = 0; - List upforMarkKey = new ArrayList<>(); - List downforMarkKey = new ArrayList<>(); -// Double[] dataArray = (Double[])data.toArray(); - Object[] dataArray = data.toArray(); - ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL()); - System.out.println("controlLimitDetail : "+controlLimitDetail.toString()); - Boolean lastFlag = false; - while(upi < data.size()){ - Point[] keyList = new Point[m]; - if(m>=(data.size()-upi)){ - if(lastFlag){ - break; - } - //System.arraycopy(dataArray , 10 , keyList , 0 , 2 ); - System.arraycopy(dataArray,upi,keyList,0,(data.size()-upi)); - lastFlag = true; - }else { - System.arraycopy(dataArray,upi,keyList,0,m); + private static void rule5Core(List data,Integer m,Integer n){ + //开始 + Stack stack = new Stack(); + int seqNum = 0; + int i = 0; + while((i+1)< data.size()){ + if(stack.size()==0){ + stack.push(data.get(i)); + i++; + seqNum++; } - Integer upTimes = 0; - Integer downTimes = 0; - for(Point i:keyList){ - if(i.getValueForInterpretation()>controlLimitDetail.getUB()[1]){ - upTimes++; - upforMarkKey.add(i); - System.out.println(); - } - if(i.getValueForInterpretation()=n || downTimes>=n){ - result = true; - if(upTimes>=n){ - for(Point i:upforMarkKey){ - i.getUnsatisfiedRules().add(rule5Number); - } - upforMarkKey = new ArrayList<>(); -// return true; - } - if(downTimes>=n){ - for(Point i:downforMarkKey){ - i.getUnsatisfiedRules().add(rule5Number); - } - downforMarkKey = new ArrayList<>(); -// return true; - } - -// return true; + Boolean sequence = ((stack.peek().getPosition()+1) == data.get(i).getPosition()); + if( sequence ){ + stack.push(data.get(i)); }else { - upforMarkKey = new ArrayList<>(); - downforMarkKey = new ArrayList<>(); + Boolean stackIsFull = (stack.size()>=n); + Boolean seqNumIsOK = (seqNum>=m); + if(stackIsFull && seqNumIsOK){ + int size = stack.size(); + for(int s=0;s=n); + Boolean seqNumIsOK = (seqNum>=m); + if(stackIsFull && seqNumIsOK){ + int size = stack.size(); + for(int s=0;s=n); + Boolean seqNumIsOK = (seqNum>=m); + if(stackIsFull && seqNumIsOK){ + int size = stack.size(); + for(int s=0;s data,ControlLimit controlLimit, Integer m, Integer n){ + Boolean result = false; + + List upforMarkKey = new ArrayList<>(); + List downforMarkKey = new ArrayList<>(); + + ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL()); + System.out.println("controlLimitDetail : "+controlLimitDetail.toString()); + + + //1.先把异常数据都整理出来 +// for(Point i:data){ +// if(i.getValueForInterpretation()>controlLimitDetail.getUB()[1] || i.getValueForInterpretation()controlLimitDetail.getUB()[1]){ + upforMarkKey.add(i); + } + if(i.getValueForInterpretation() true * 不存在满足rule6的点 => false + * Test status: OK(CaiXiang) * */ - public static Boolean rule6(List data,ControlLimit controlLimit, Integer m, Integer n){ - Boolean result = false; - Integer upi = 0; - List upforMarkKey = new ArrayList<>(); - List downforMarkKey = new ArrayList<>(); -// Double[] dataArray = (Double[])data.toArray(); - Object[] dataArray = data.toArray(); - ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL()); - System.out.println("controlLimitDetail : "+controlLimitDetail.toString()); - Boolean lastFlag = false; - while(upi < data.size()){ - Point[] keyList = new Point[m]; - if(m>=(data.size()-upi)){ - if(lastFlag){ - break; - } - //System.arraycopy(dataArray , 10 , keyList , 0 , 2 ); - System.arraycopy(dataArray,upi,keyList,0,(data.size()-upi)); - lastFlag = true; +// public static Boolean rule6(List data,ControlLimit controlLimit, Integer m, Integer n){ +// Boolean result = false; +// Integer upi = 0; +// List upforMarkKey = new ArrayList<>(); +// List downforMarkKey = new ArrayList<>(); +//// Double[] dataArray = (Double[])data.toArray(); +// Object[] dataArray = data.toArray(); +// ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL()); +// System.out.println("controlLimitDetail : "+controlLimitDetail.toString()); +// Boolean lastFlag = false; +// while(upi < data.size()){ +// Point[] keyList = new Point[m]; +// if(m>=(data.size()-upi)){ +// if(lastFlag){ +// break; +// } +// //System.arraycopy(dataArray , 10 , keyList , 0 , 2 ); +// System.arraycopy(dataArray,upi,keyList,0,(data.size()-upi)); +// lastFlag = true; +// }else { +// System.arraycopy(dataArray,upi,keyList,0,m); +// } +// +// Integer upTimes = 0; +// Integer downTimes = 0; +// for(Point i:keyList){ +// if(i.getValueForInterpretation()>controlLimitDetail.getUC()[1]){ +// upTimes++; +// upforMarkKey.add(i); +// +// } +// if(i.getValueForInterpretation()=n || downTimes>=n){ +// result = true; +// if(upTimes>=n){ +// for(Point i:upforMarkKey){ +// +// i.getUnsatisfiedRules().add(rule6Number); +// } +// upforMarkKey = new ArrayList<>(); +//// return true; +// } +// if(downTimes>=n){ +// for(Point i:downforMarkKey){ +// if(i.getPosition() == 13){ +// System.out.println(1); +// } +// i.getUnsatisfiedRules().add(rule6Number); +// } +//// return true; +// downforMarkKey = new ArrayList<>(); +// } +// +//// return true; +// }else { +// upforMarkKey = new ArrayList<>(); +// downforMarkKey = new ArrayList<>(); +// } +// upi++; +// } +// +// +// return result; +// } + private static void rule6Core(List data,Integer m,Integer n){ + //开始 + Stack stack = new Stack(); + int seqNum = 0; + int i = 0; + while((i+1)< data.size()){ + if(stack.size()==0){ + stack.push(data.get(i)); + i++; + seqNum++; + } + + Boolean sequence = ((stack.peek().getPosition()+1) == data.get(i).getPosition()); + if( sequence ){ + stack.push(data.get(i)); }else { - System.arraycopy(dataArray,upi,keyList,0,m); - } - - Integer upTimes = 0; - Integer downTimes = 0; - for(Point i:keyList){ - if(i.getValueForInterpretation()>controlLimitDetail.getUC()[1]){ - upTimes++; - upforMarkKey.add(i); - - } - if(i.getValueForInterpretation()=n || downTimes>=n){ - result = true; - if(upTimes>=n){ - for(Point i:upforMarkKey){ - - i.getUnsatisfiedRules().add(rule6Number); + Boolean stackIsFull = (stack.size()>=n); + Boolean seqNumIsOK = (seqNum>=m); + if(stackIsFull && seqNumIsOK){ + int size = stack.size(); + for(int s=0;s(); -// return true; } - if(downTimes>=n){ - for(Point i:downforMarkKey){ - if(i.getPosition() == 13){ - System.out.println(1); - } - i.getUnsatisfiedRules().add(rule6Number); - } -// return true; - downforMarkKey = new ArrayList<>(); - } - -// return true; - }else { - upforMarkKey = new ArrayList<>(); - downforMarkKey = new ArrayList<>(); + stack.clear(); + stack.push(data.get(i)); } - upi++; + + i++; + seqNum++; + } + //判断最后一次情况 + Boolean sequence = ((stack.peek().getPosition()+1) == data.get(i).getPosition()); + if( sequence ){ + stack.push(data.get(i)); + seqNum++; + }else { + Boolean stackIsFull = (stack.size()>=n); + Boolean seqNumIsOK = (seqNum>=m); + if(stackIsFull && seqNumIsOK){ + int size = stack.size(); + for(int s=0;s=n); + Boolean seqNumIsOK = (seqNum>=m); + if(stackIsFull && seqNumIsOK){ + int size = stack.size(); + for(int s=0;s data,ControlLimit controlLimit, Integer m, Integer n){ + Boolean result = false; + + List upforMarkKey = new ArrayList<>(); + List downforMarkKey = new ArrayList<>(); + + ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL()); + System.out.println("controlLimitDetail : "+controlLimitDetail.toString()); + + + //1.先把异常数据都整理出来 +// for(Point i:data){ +// if(i.getValueForInterpretation()>controlLimitDetail.getUB()[1] || i.getValueForInterpretation()controlLimitDetail.getUC()[1]){ + upforMarkKey.add(i); + } + if(i.getValueForInterpretation() true * 不存在满足rule7的点 => false + * Test status: OK(CaiXiang) * */ - public static Boolean rule7(List data,ControlLimit controlLimit, Integer n){ - - Boolean result = false; - - //Integer upi = 0; - ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL()); - System.out.println(controlLimitDetail.toString()); - Integer times = 0; - List markKey = new ArrayList<>(); - - - for(int i=0;icontrolLimitDetail.getLC()[0] && point.getValueForInterpretation()(); - } - break; +// public static Boolean rule7(List data,ControlLimit controlLimit, Integer n){ +// +// Boolean result = false; +// +// //Integer upi = 0; +// ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL()); +// System.out.println(controlLimitDetail.toString()); +// Integer times = 0; +// List markKey = new ArrayList<>(); +// +// +// for(int i=0;icontrolLimitDetail.getLC()[0] && point.getValueForInterpretation()(); +// } +// break; +// } +// +// //通常情况 +// Point point = data.get(i); +// if( isBetween( data.get(i),data.get(i+1) ) ){ +// if(point.getValueForInterpretation()>controlLimitDetail.getLC()[0] && point.getValueForInterpretation()(); +// } +// }else { +// times = 0; +// markKey = new ArrayList<>(); +// } +// }else { +// times = 0; +// markKey = new ArrayList<>(); +// } +// } +// return result; +// } + private static void rule7Core(List data,Integer n){ + //开始 + Stack stack = new Stack(); + int i = 0; + while((i+1)< data.size()){ + if(stack.size()==0){ + stack.push(data.get(i)); + i++; } - //通常情况 - Point point = data.get(i); - if( isBetween( data.get(i),data.get(i+1) ) ){ - if(point.getValueForInterpretation()>controlLimitDetail.getLC()[0] && point.getValueForInterpretation()(); - } - }else { - times = 0; - markKey = new ArrayList<>(); - } + Boolean sequence = ((stack.peek().getPosition()+1) == data.get(i).getPosition()); + if( sequence ){ + stack.push(data.get(i)); }else { - times = 0; - markKey = new ArrayList<>(); + Boolean stackIsFull = (stack.size()>=n); + + if(stackIsFull){ + int size = stack.size(); + for(int s=0;s=n); + + if(stackIsFull){ + int size = stack.size(); + for(int s=0;s=n); + + if(stackIsFull){ + int size = stack.size(); + for(int s=0;s data,ControlLimit controlLimit, Integer n){ + Boolean result = false; + +// List upforMarkKey = new ArrayList<>(); +// List downforMarkKey = new ArrayList<>(); + List errforMarkKey = new ArrayList<>(); + + ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL()); + System.out.println("controlLimitDetail : "+controlLimitDetail.toString()); + + + //1.先把异常数据都整理出来 + for(Point i:data){ + if(i.getValueForInterpretation()>controlLimitDetail.getLC()[0] && i.getValueForInterpretation() true * 不存在满足rule8的点 => false + * Test status: OK(CaiXiang) * */ - public static Boolean rule8(List data,ControlLimit controlLimit, Integer n){ - - Boolean result = true; - //Integer upi = 0; - ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL()); - System.out.println(controlLimitDetail.toString()); - Integer times = 0; - List markKey = new ArrayList<>(); - - - for(int i=0;icontrolLimitDetail.getUC()[1] || point.getValueForInterpretation()(); - } - break; +// public static Boolean rule8(List data,ControlLimit controlLimit, Integer n){ +// +// Boolean result = true; +// //Integer upi = 0; +// ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL()); +// System.out.println(controlLimitDetail.toString()); +// Integer times = 0; +// List markKey = new ArrayList<>(); +// +// +// for(int i=0;icontrolLimitDetail.getUC()[1] || point.getValueForInterpretation()(); +// } +// break; +// } +// +// //通常情况 +// Point point = data.get(i); +// if( isBetween( data.get(i),data.get(i+1) ) ){ +// if( point.getValueForInterpretation()>controlLimitDetail.getUC()[1] || point.getValueForInterpretation()(); +// } +// }else { +// times = 0; +// markKey = new ArrayList<>(); +// } +// }else { +// times = 0; +// markKey = new ArrayList<>(); +// } +// } +// return result; +// } + private static void rule8Core(List data,Integer n){ + //开始 + Stack stack = new Stack(); + int i = 0; + while((i+1)< data.size()){ + if(stack.size()==0){ + stack.push(data.get(i)); + i++; } - //通常情况 - Point point = data.get(i); - if( isBetween( data.get(i),data.get(i+1) ) ){ - if( point.getValueForInterpretation()>controlLimitDetail.getUC()[1] || point.getValueForInterpretation()(); - } - }else { - times = 0; - markKey = new ArrayList<>(); - } + Boolean sequence = ((stack.peek().getPosition()+1) == data.get(i).getPosition()); + if( sequence ){ + stack.push(data.get(i)); }else { - times = 0; - markKey = new ArrayList<>(); + Boolean stackIsFull = (stack.size()>=n); + + if(stackIsFull){ + int size = stack.size(); + for(int s=0;s=n); + + if(stackIsFull){ + int size = stack.size(); + for(int s=0;s=n); + + if(stackIsFull){ + int size = stack.size(); + for(int s=0;s data,ControlLimit controlLimit, Integer n){ + Boolean result = false; + +// List upforMarkKey = new ArrayList<>(); +// List downforMarkKey = new ArrayList<>(); + List errforMarkKey = new ArrayList<>(); + + ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL()); + System.out.println("controlLimitDetail : "+controlLimitDetail.toString()); + + //1.先把异常数据都整理出来 + for(Point i:data){ + if(i.getValueForInterpretation()>controlLimitDetail.getUC()[1] && i.getValueForInterpretation() upforMarkKey){ + //开始 + Stack stack = new Stack(); + int seqNum = 0; + int i = 0; + while((i+1)< upforMarkKey.size()){ + if(stack.size()==0){ + stack.push(upforMarkKey.get(i)); + i++; + seqNum++; + } + + Boolean sequence = ((stack.peek().getPosition()+1) == upforMarkKey.get(i).getPosition()); + if( sequence ){ + stack.push(upforMarkKey.get(i)); + }else { + Boolean stackIsFull = (stack.size()>=3); + Boolean seqNumIsOK = (seqNum>=5); + if(stackIsFull && seqNumIsOK){ + int size = stack.size(); + for(int s=0;s=3); + Boolean seqNumIsOK = (seqNum>=5); + if(stackIsFull && seqNumIsOK){ + int size = stack.size(); + for(int s=0;s=3); + Boolean seqNumIsOK = (seqNum>=5); + if(stackIsFull && seqNumIsOK){ + int size = stack.size(); + for(int s=0;s upforMarkKey = new ArrayList<>(); + Point point1 = new Point(1,1.0); + Point point2 = new Point(2,1.0); + Point point3 = new Point(4,1.0); + Point point4 = new Point(5,1.0); + Point point5 = new Point(6,1.0); + Point point6 = new Point(7,1.0); + Point point7 = new Point(8,1.0); + Point point8 = new Point(10,1.0); + Point point9 = new Point(11,1.0); + Point point10 = new Point(13,1.0); + Point point11 = new Point(14,1.0); + Point point12 = new Point(15,1.0); + Point point13 = new Point(16,1.0); + Point point14 = new Point(17,1.0); + + + upforMarkKey.add(point1); + upforMarkKey.add(point2); + upforMarkKey.add(point3); + upforMarkKey.add(point4); + upforMarkKey.add(point5); + upforMarkKey.add(point6); + upforMarkKey.add(point7); + upforMarkKey.add(point8); + upforMarkKey.add(point9); + upforMarkKey.add(point10); + upforMarkKey.add(point11); + upforMarkKey.add(point12); + upforMarkKey.add(point13); + upforMarkKey.add(point14); + + + rule5Core(upforMarkKey); + + System.out.println(); + + } +} diff --git a/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/test/MainRule7TEST.java b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/test/MainRule7TEST.java new file mode 100644 index 0000000..b8b4598 --- /dev/null +++ b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/test/MainRule7TEST.java @@ -0,0 +1,112 @@ +package com.cnbm.qualityPlanning.common.test; + +import com.cnbm.qualityPlanning.entity.Point; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + +/** + * @Desc: "" + * @Author: caixiang + * @DATE: 2022/11/29 10:49 + */ +public class MainRule7TEST { + + private static void rule7Core(List data,Integer n){ + //开始 + Stack stack = new Stack(); + int i = 0; + while((i+1)< data.size()){ + if(stack.size()==0){ + stack.push(data.get(i)); + i++; + } + + Boolean sequence = ((stack.peek().getPosition()+1) == data.get(i).getPosition()); + if( sequence ){ + stack.push(data.get(i)); + }else { + Boolean stackIsFull = (stack.size()>=n); + + if(stackIsFull){ + int size = stack.size(); + for(int s=0;s=n); + + if(stackIsFull){ + int size = stack.size(); + for(int s=0;s=n); + + if(stackIsFull){ + int size = stack.size(); + for(int s=0;s upforMarkKey = new ArrayList<>(); + Point point1 = new Point(1,1.0); + Point point2 = new Point(2,1.0); + Point point3 = new Point(4,1.0); + Point point4 = new Point(5,1.0); + Point point5 = new Point(6,1.0); + Point point6 = new Point(7,1.0); + Point point7 = new Point(8,1.0); + Point point8 = new Point(10,1.0); + Point point9 = new Point(11,1.0); + Point point10 = new Point(13,1.0); + Point point11 = new Point(14,1.0); + Point point12 = new Point(15,1.0); + Point point13 = new Point(16,1.0); + Point point14 = new Point(17,1.0); + + + upforMarkKey.add(point1); + upforMarkKey.add(point2); + upforMarkKey.add(point3); + upforMarkKey.add(point4); + upforMarkKey.add(point5); + upforMarkKey.add(point6); + upforMarkKey.add(point7); + upforMarkKey.add(point8); + upforMarkKey.add(point9); + upforMarkKey.add(point10); + upforMarkKey.add(point11); + upforMarkKey.add(point12); + upforMarkKey.add(point13); + upforMarkKey.add(point14); + + + rule7Core(upforMarkKey,3); + + System.out.println(); + + } +} diff --git a/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/ControlLimitDetail.java b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/ControlLimitDetail.java index 2d06b89..8759c82 100644 --- a/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/ControlLimitDetail.java +++ b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/ControlLimitDetail.java @@ -29,10 +29,10 @@ public class ControlLimitDetail { Double agv1 = (this.UCL-this.CL)/3; this.UC[0] = this.CL; this.UC[1] = this.CL+agv1; - this.UB[0] = this.UC[0]; - this.UB[1] = this.UC[0]+agv1; - this.UA[0] = this.UB[0]; - this.UA[1] = this.UB[0]+agv1; + this.UB[0] = this.UC[1]; + this.UB[1] = this.UB[0]+agv1; + this.UA[0] = this.UB[1]; + this.UA[1] = this.UA[0]+agv1; Double agv2 = (this.CL-this.LCL)/3; this.LC[0] = this.CL-agv2;