修改判读方案算法
This commit is contained in:
parent
a2d91083f2
commit
650e9a2324
@ -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) {
|
||||
|
@ -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";
|
||||
|
||||
|
||||
}
|
||||
|
@ -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<XbarSGraphData> 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<XbarRGraphData> 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<XMRGraphData> 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<NPGraphData> 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<PGraphData> 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<CGraphData> 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<UGraphData> 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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -107,6 +107,9 @@ public class MeanRGraph {
|
||||
queryDataParam.setTag(new Tag("argName",argName));
|
||||
|
||||
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
|
||||
if(query.size() == 0){
|
||||
return;
|
||||
}
|
||||
//1. 先从fluxdb 里面提取原始数据
|
||||
List<Double> 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<String> warming = new ArrayList<>();
|
||||
Float usl = sp.getUSL();
|
||||
|
@ -2,6 +2,7 @@ package com.cnbm.qualityPlanning.common;
|
||||
|
||||
|
||||
import com.cnbm.qualityPlanning.entity.*;
|
||||
import io.swagger.models.auth.In;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
@ -608,75 +609,108 @@ 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<Point> data,ControlLimit controlLimit, Integer m, Integer n){
|
||||
Boolean result = false;
|
||||
Integer upi = 0;
|
||||
List<Point> upforMarkKey = new ArrayList<>();
|
||||
List<Point> 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<Point> data,Integer m,Integer n){
|
||||
//开始
|
||||
Stack<Point> stack = new Stack<Point>();
|
||||
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){
|
||||
Boolean sequence = ((stack.peek().getPosition()+1) == data.get(i).getPosition());
|
||||
if( sequence ){
|
||||
stack.push(data.get(i));
|
||||
}else {
|
||||
Boolean stackIsFull = (stack.size()>=n);
|
||||
Boolean seqNumIsOK = (seqNum>=m);
|
||||
if(stackIsFull && seqNumIsOK){
|
||||
int size = stack.size();
|
||||
for(int s=0;s<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(rule5Number);
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
stack.push(data.get(i));
|
||||
}
|
||||
|
||||
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<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(rule5Number);
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
stack.push(data.get(i));
|
||||
}
|
||||
|
||||
|
||||
Boolean stackIsFull = (stack.size()>=n);
|
||||
Boolean seqNumIsOK = (seqNum>=m);
|
||||
if(stackIsFull && seqNumIsOK){
|
||||
int size = stack.size();
|
||||
for(int s=0;s<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(rule5Number);
|
||||
}
|
||||
}
|
||||
//结束
|
||||
}
|
||||
public static Boolean rule5(List<Point> data,ControlLimit controlLimit, Integer m, Integer n){
|
||||
Boolean result = false;
|
||||
|
||||
List<Point> upforMarkKey = new ArrayList<>();
|
||||
List<Point> 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.getLB()[0]){
|
||||
// upforMarkKey.add(i);
|
||||
// }
|
||||
// }
|
||||
for(Point i:data){
|
||||
if(i.getValueForInterpretation()>controlLimitDetail.getUB()[1]){
|
||||
upTimes++;
|
||||
upforMarkKey.add(i);
|
||||
System.out.println();
|
||||
}
|
||||
if(i.getValueForInterpretation()<controlLimitDetail.getLB()[0]){
|
||||
downTimes++;
|
||||
downforMarkKey.add(i);
|
||||
}
|
||||
}
|
||||
if(upTimes>=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;
|
||||
}else {
|
||||
upforMarkKey = new ArrayList<>();
|
||||
downforMarkKey = new ArrayList<>();
|
||||
}
|
||||
upi++;
|
||||
}
|
||||
|
||||
//2.再用rule5进行分析
|
||||
rule5Core(upforMarkKey,m,n);
|
||||
rule5Core(downforMarkKey,m,n);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -688,72 +722,164 @@ public class StatisticalControlledTest {
|
||||
* return :
|
||||
* 存在满足rule6的点 => true
|
||||
* 不存在满足rule6的点 => false
|
||||
* Test status: OK(CaiXiang)
|
||||
* */
|
||||
// public static Boolean rule6(List<Point> data,ControlLimit controlLimit, Integer m, Integer n){
|
||||
// Boolean result = false;
|
||||
// Integer upi = 0;
|
||||
// List<Point> upforMarkKey = new ArrayList<>();
|
||||
// List<Point> 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()<controlLimitDetail.getLC()[0]){
|
||||
// downTimes++;
|
||||
// downforMarkKey.add(i);
|
||||
// }
|
||||
// }
|
||||
// if(upTimes>=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<Point> data,Integer m,Integer n){
|
||||
//开始
|
||||
Stack<Point> stack = new Stack<Point>();
|
||||
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 {
|
||||
Boolean stackIsFull = (stack.size()>=n);
|
||||
Boolean seqNumIsOK = (seqNum>=m);
|
||||
if(stackIsFull && seqNumIsOK){
|
||||
int size = stack.size();
|
||||
for(int s=0;s<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(rule6Number);
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
stack.push(data.get(i));
|
||||
}
|
||||
|
||||
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<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(rule6Number);
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
stack.push(data.get(i));
|
||||
}
|
||||
|
||||
|
||||
Boolean stackIsFull = (stack.size()>=n);
|
||||
Boolean seqNumIsOK = (seqNum>=m);
|
||||
if(stackIsFull && seqNumIsOK){
|
||||
int size = stack.size();
|
||||
for(int s=0;s<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(rule6Number);
|
||||
}
|
||||
}
|
||||
//结束
|
||||
}
|
||||
public static Boolean rule6(List<Point> data,ControlLimit controlLimit, Integer m, Integer n){
|
||||
Boolean result = false;
|
||||
Integer upi = 0;
|
||||
|
||||
List<Point> upforMarkKey = new ArrayList<>();
|
||||
List<Point> 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){
|
||||
|
||||
//1.先把异常数据都整理出来
|
||||
// for(Point i:data){
|
||||
// if(i.getValueForInterpretation()>controlLimitDetail.getUB()[1] || i.getValueForInterpretation()<controlLimitDetail.getLB()[0]){
|
||||
// upforMarkKey.add(i);
|
||||
// }
|
||||
// }
|
||||
for(Point i:data){
|
||||
if(i.getValueForInterpretation()>controlLimitDetail.getUC()[1]){
|
||||
upTimes++;
|
||||
upforMarkKey.add(i);
|
||||
|
||||
}
|
||||
if(i.getValueForInterpretation()<controlLimitDetail.getLC()[0]){
|
||||
downTimes++;
|
||||
downforMarkKey.add(i);
|
||||
}
|
||||
}
|
||||
if(upTimes>=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++;
|
||||
}
|
||||
|
||||
//2.再用rule5进行分析
|
||||
rule6Core(upforMarkKey,m,n);
|
||||
rule6Core(downforMarkKey,m,n);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -765,65 +891,151 @@ public class StatisticalControlledTest {
|
||||
* return :
|
||||
* 存在满足rule7的点 => true
|
||||
* 不存在满足rule7的点 => false
|
||||
* Test status: OK(CaiXiang)
|
||||
* */
|
||||
public static Boolean rule7(List<Point> data,ControlLimit controlLimit, Integer n){
|
||||
// public static Boolean rule7(List<Point> 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<Point> markKey = new ArrayList<>();
|
||||
//
|
||||
//
|
||||
// for(int i=0;i<data.size();i++){
|
||||
// //判断最后一次
|
||||
// if((i+1) == data.size()){
|
||||
// Point point = data.get(i);
|
||||
// if(point.getValueForInterpretation()>controlLimitDetail.getLC()[0] && point.getValueForInterpretation()<controlLimitDetail.getUC()[1]){
|
||||
// times++;
|
||||
// markKey.add(point);
|
||||
// if(times.equals(n)){
|
||||
// for(Point j:markKey){
|
||||
// j.getUnsatisfiedRules().add(rule7Number);
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// }else {
|
||||
// times = 0;
|
||||
// markKey = new ArrayList<>();
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// //通常情况
|
||||
// Point point = data.get(i);
|
||||
// if( isBetween( data.get(i),data.get(i+1) ) ){
|
||||
// if(point.getValueForInterpretation()>controlLimitDetail.getLC()[0] && point.getValueForInterpretation()<controlLimitDetail.getUC()[1]){
|
||||
// times++;
|
||||
// markKey.add(point);
|
||||
// if(times.equals(n)){
|
||||
// for(Point j:markKey){
|
||||
// j.getUnsatisfiedRules().add(rule7Number);
|
||||
// }
|
||||
//// return true;
|
||||
// result = true;
|
||||
// times = 0;
|
||||
// markKey = new ArrayList<>();
|
||||
// }
|
||||
// }else {
|
||||
// times = 0;
|
||||
// markKey = new ArrayList<>();
|
||||
// }
|
||||
// }else {
|
||||
// times = 0;
|
||||
// markKey = new ArrayList<>();
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
private static void rule7Core(List<Point> data,Integer n){
|
||||
//开始
|
||||
Stack<Point> stack = new Stack<Point>();
|
||||
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<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(rule7Number);
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
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<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(rule7Number);
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
stack.push(data.get(i));
|
||||
}
|
||||
|
||||
Boolean stackIsFull = (stack.size()>=n);
|
||||
|
||||
if(stackIsFull){
|
||||
int size = stack.size();
|
||||
for(int s=0;s<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(rule7Number);
|
||||
}
|
||||
}
|
||||
//结束
|
||||
}
|
||||
|
||||
public static Boolean rule7(List<Point> data,ControlLimit controlLimit, Integer n){
|
||||
Boolean result = false;
|
||||
|
||||
//Integer upi = 0;
|
||||
// List<Point> upforMarkKey = new ArrayList<>();
|
||||
// List<Point> downforMarkKey = new ArrayList<>();
|
||||
List<Point> errforMarkKey = new ArrayList<>();
|
||||
|
||||
ControlLimitDetail controlLimitDetail = new ControlLimitDetail(controlLimit.getUCL(), controlLimit.getCL(), controlLimit.getLCL());
|
||||
System.out.println(controlLimitDetail.toString());
|
||||
Integer times = 0;
|
||||
List<Point> markKey = new ArrayList<>();
|
||||
System.out.println("controlLimitDetail : "+controlLimitDetail.toString());
|
||||
|
||||
|
||||
for(int i=0;i<data.size();i++){
|
||||
//判断最后一次
|
||||
if((i+1) == data.size()){
|
||||
Point point = data.get(i);
|
||||
if(point.getValueForInterpretation()>controlLimitDetail.getLC()[0] && point.getValueForInterpretation()<controlLimitDetail.getUC()[1]){
|
||||
times++;
|
||||
markKey.add(point);
|
||||
if(times.equals(n)){
|
||||
for(Point j:markKey){
|
||||
j.getUnsatisfiedRules().add(rule7Number);
|
||||
//1.先把异常数据都整理出来
|
||||
for(Point i:data){
|
||||
if(i.getValueForInterpretation()>controlLimitDetail.getLC()[0] && i.getValueForInterpretation()<controlLimitDetail.getUC()[1]){
|
||||
errforMarkKey.add(i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}else {
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//通常情况
|
||||
Point point = data.get(i);
|
||||
if( isBetween( data.get(i),data.get(i+1) ) ){
|
||||
if(point.getValueForInterpretation()>controlLimitDetail.getLC()[0] && point.getValueForInterpretation()<controlLimitDetail.getUC()[1]){
|
||||
times++;
|
||||
markKey.add(point);
|
||||
if(times.equals(n)){
|
||||
for(Point j:markKey){
|
||||
j.getUnsatisfiedRules().add(rule7Number);
|
||||
}
|
||||
// return true;
|
||||
result = true;
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
}else {
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
}else {
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
//2.再用rule5进行分析
|
||||
rule7Core(errforMarkKey,n);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* name : 规则8
|
||||
* desc : 连续 n 点 落在中心线两侧,且无一点在C区内。( 默认 n:8 )
|
||||
@ -831,63 +1043,144 @@ public class StatisticalControlledTest {
|
||||
* return :
|
||||
* 存在满足rule8的点 => true
|
||||
* 不存在满足rule8的点 => false
|
||||
* Test status: OK(CaiXiang)
|
||||
* */
|
||||
// public static Boolean rule8(List<Point> 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<Point> markKey = new ArrayList<>();
|
||||
//
|
||||
//
|
||||
// for(int i=0;i<data.size();i++){
|
||||
// //判断最后一次
|
||||
// if((i+1) == data.size()){
|
||||
// Point point = data.get(i);
|
||||
// if( point.getValueForInterpretation()>controlLimitDetail.getUC()[1] || point.getValueForInterpretation()<controlLimitDetail.getLC()[0] ){
|
||||
// times++;
|
||||
// markKey.add(point);
|
||||
// if(times.equals(n)){
|
||||
// for(Point j:markKey){
|
||||
// j.getUnsatisfiedRules().add(rule8Number);
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// }else {
|
||||
// times = 0;
|
||||
// markKey = new ArrayList<>();
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// //通常情况
|
||||
// Point point = data.get(i);
|
||||
// if( isBetween( data.get(i),data.get(i+1) ) ){
|
||||
// if( point.getValueForInterpretation()>controlLimitDetail.getUC()[1] || point.getValueForInterpretation()<controlLimitDetail.getLC()[0] ){
|
||||
// times++;
|
||||
// markKey.add(point);
|
||||
// if(times.equals(n)){
|
||||
// for(Point j:markKey){
|
||||
// j.getUnsatisfiedRules().add(rule8Number);
|
||||
// }
|
||||
// result = true;
|
||||
// times = 0;
|
||||
// markKey = new ArrayList<>();
|
||||
// }
|
||||
// }else {
|
||||
// times = 0;
|
||||
// markKey = new ArrayList<>();
|
||||
// }
|
||||
// }else {
|
||||
// times = 0;
|
||||
// markKey = new ArrayList<>();
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
private static void rule8Core(List<Point> data,Integer n){
|
||||
//开始
|
||||
Stack<Point> stack = new Stack<Point>();
|
||||
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<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(rule8Number);
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
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<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(rule8Number);
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
stack.push(data.get(i));
|
||||
}
|
||||
|
||||
Boolean stackIsFull = (stack.size()>=n);
|
||||
|
||||
if(stackIsFull){
|
||||
int size = stack.size();
|
||||
for(int s=0;s<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(rule8Number);
|
||||
}
|
||||
}
|
||||
//结束
|
||||
}
|
||||
|
||||
public static Boolean rule8(List<Point> data,ControlLimit controlLimit, Integer n){
|
||||
Boolean result = false;
|
||||
|
||||
// List<Point> upforMarkKey = new ArrayList<>();
|
||||
// List<Point> downforMarkKey = new ArrayList<>();
|
||||
List<Point> errforMarkKey = new ArrayList<>();
|
||||
|
||||
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<Point> markKey = new ArrayList<>();
|
||||
System.out.println("controlLimitDetail : "+controlLimitDetail.toString());
|
||||
|
||||
//1.先把异常数据都整理出来
|
||||
for(Point i:data){
|
||||
if(i.getValueForInterpretation()>controlLimitDetail.getUC()[1] && i.getValueForInterpretation()<controlLimitDetail.getLC()[0]){
|
||||
errforMarkKey.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(int i=0;i<data.size();i++){
|
||||
//判断最后一次
|
||||
if((i+1) == data.size()){
|
||||
Point point = data.get(i);
|
||||
if( point.getValueForInterpretation()>controlLimitDetail.getUC()[1] || point.getValueForInterpretation()<controlLimitDetail.getLC()[0] ){
|
||||
times++;
|
||||
markKey.add(point);
|
||||
if(times.equals(n)){
|
||||
for(Point j:markKey){
|
||||
j.getUnsatisfiedRules().add(rule8Number);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}else {
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
break;
|
||||
}
|
||||
//2.再用rule5进行分析
|
||||
rule8Core(errforMarkKey,n);
|
||||
|
||||
//通常情况
|
||||
Point point = data.get(i);
|
||||
if( isBetween( data.get(i),data.get(i+1) ) ){
|
||||
if( point.getValueForInterpretation()>controlLimitDetail.getUC()[1] || point.getValueForInterpretation()<controlLimitDetail.getLC()[0] ){
|
||||
times++;
|
||||
markKey.add(point);
|
||||
if(times.equals(n)){
|
||||
for(Point j:markKey){
|
||||
j.getUnsatisfiedRules().add(rule8Number);
|
||||
}
|
||||
result = true;
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
}else {
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
}else {
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果 这两个点是相邻的 ==》 true
|
||||
* */
|
||||
|
@ -0,0 +1,115 @@
|
||||
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 MainRule5TEST {
|
||||
|
||||
public static void rule5Core(List<Point> upforMarkKey){
|
||||
//开始
|
||||
Stack<Point> stack = new Stack<Point>();
|
||||
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<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(5);
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
stack.push(upforMarkKey.get(i));
|
||||
}
|
||||
|
||||
i++;
|
||||
seqNum++;
|
||||
}
|
||||
//判断最后一次情况
|
||||
Boolean sequence = ((stack.peek().getPosition()+1) == upforMarkKey.get(i).getPosition());
|
||||
if( sequence ){
|
||||
stack.push(upforMarkKey.get(i));
|
||||
seqNum++;
|
||||
}else {
|
||||
Boolean stackIsFull = (stack.size()>=3);
|
||||
Boolean seqNumIsOK = (seqNum>=5);
|
||||
if(stackIsFull && seqNumIsOK){
|
||||
int size = stack.size();
|
||||
for(int s=0;s<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(5);
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
stack.push(upforMarkKey.get(i));
|
||||
}
|
||||
|
||||
|
||||
Boolean stackIsFull = (stack.size()>=3);
|
||||
Boolean seqNumIsOK = (seqNum>=5);
|
||||
if(stackIsFull && seqNumIsOK){
|
||||
int size = stack.size();
|
||||
for(int s=0;s<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(5);
|
||||
}
|
||||
}
|
||||
//结束
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
List<Point> 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();
|
||||
|
||||
}
|
||||
}
|
@ -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<Point> data,Integer n){
|
||||
//开始
|
||||
Stack<Point> stack = new Stack<Point>();
|
||||
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<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(7);
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
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<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(7);
|
||||
}
|
||||
}
|
||||
stack.clear();
|
||||
stack.push(data.get(i));
|
||||
}
|
||||
|
||||
Boolean stackIsFull = (stack.size()>=n);
|
||||
|
||||
if(stackIsFull){
|
||||
int size = stack.size();
|
||||
for(int s=0;s<size;s++){
|
||||
stack.pop().getUnsatisfiedRules().add(7);
|
||||
}
|
||||
}
|
||||
//结束
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
List<Point> 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();
|
||||
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user