mark
This commit is contained in:
@@ -4,6 +4,8 @@ package com.cnbm.qualityPlanning.common;
|
||||
import com.cnbm.qualityPlanning.entity.ControlLimit;
|
||||
import com.cnbm.qualityPlanning.entity.ControlLimitDetail;
|
||||
import com.cnbm.qualityPlanning.entity.Point;
|
||||
import com.cnbm.qualityPlanning.entity.XbarSPoint;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -38,6 +40,15 @@ public class StatisticalControlledTest {
|
||||
Point point10 = new Point(10,new Double(3.7));
|
||||
Point point11 = new Point(11,new Double(3.7));
|
||||
Point point12 = new Point(12,new Double(3.7));
|
||||
Point point13 = new Point(13,new Double(3.7));
|
||||
Point point14 = new Point(14,new Double(3.7));
|
||||
Point point15 = new Point(15,new Double(3.7));
|
||||
Point point16 = new Point(16,new Double(3.7));
|
||||
Point point17 = new Point(17,new Double(3.7));
|
||||
Point point18 = new Point(18,new Double(3.7));
|
||||
Point point19 = new Point(19,new Double(3.7));
|
||||
Point point20 = new Point(20,new Double(3.7));
|
||||
|
||||
List<Point> list = new ArrayList<>();
|
||||
list.add(point);
|
||||
list.add(point2);
|
||||
@@ -53,16 +64,68 @@ public class StatisticalControlledTest {
|
||||
list.add(point12);
|
||||
return list;
|
||||
}
|
||||
public static List<Point> createData2(){
|
||||
XbarSPoint point = new XbarSPoint(1, new Double(2.5));
|
||||
XbarSPoint point2 = new XbarSPoint(2, new Double(2.5));
|
||||
XbarSPoint point3 = new XbarSPoint(3, new Double(2.5));
|
||||
XbarSPoint point4 = new XbarSPoint(4, new Double(2.5));
|
||||
XbarSPoint point5 = new XbarSPoint(5, new Double(2.5));
|
||||
XbarSPoint point6 = new XbarSPoint(6, new Double(2.5));
|
||||
XbarSPoint point7 = new XbarSPoint(7, new Double(2.5));
|
||||
XbarSPoint point8 = new XbarSPoint(8, new Double(2));
|
||||
XbarSPoint point9 = new XbarSPoint(9, new Double(2.5));
|
||||
XbarSPoint point10 = new XbarSPoint(10, new Double(2.5));
|
||||
XbarSPoint point11 = new XbarSPoint(11, new Double(2.5));
|
||||
XbarSPoint point12 = new XbarSPoint(12, new Double(2.5));
|
||||
XbarSPoint point13 = new XbarSPoint(13,new Double(2.5));
|
||||
XbarSPoint point14 = new XbarSPoint(14,new Double(2.5));
|
||||
XbarSPoint point15 = new XbarSPoint(15,new Double(2.5));
|
||||
XbarSPoint point16 = new XbarSPoint(16,new Double(2));
|
||||
XbarSPoint point17 = new XbarSPoint(17,new Double(2.5));
|
||||
XbarSPoint point18 = new XbarSPoint(18,new Double(2.5));
|
||||
XbarSPoint point19 = new XbarSPoint(19,new Double(2.5));
|
||||
XbarSPoint point20 = new XbarSPoint(20,new Double(2.5));
|
||||
XbarSPoint point21 = new XbarSPoint(21,new Double(2.5));
|
||||
XbarSPoint point22 = new XbarSPoint(22,new Double(2.5));
|
||||
XbarSPoint point23 = new XbarSPoint(23,new Double(2.5));
|
||||
List<Point> list = new ArrayList<>();
|
||||
list.add(point);
|
||||
list.add(point2);
|
||||
list.add(point3);
|
||||
list.add(point4);
|
||||
list.add(point5);
|
||||
list.add(point6);
|
||||
list.add(point7);
|
||||
list.add(point8);
|
||||
list.add(point9);
|
||||
list.add(point10);
|
||||
list.add(point11);
|
||||
list.add(point12);
|
||||
list.add(point13);
|
||||
list.add(point14);
|
||||
list.add(point15);
|
||||
list.add(point16);
|
||||
list.add(point17);
|
||||
list.add(point18);
|
||||
list.add(point19);
|
||||
list.add(point20);
|
||||
list.add(point21);
|
||||
list.add(point22);
|
||||
list.add(point23);
|
||||
return list;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<Point> list = createData();
|
||||
ControlLimit controlLimit = new ControlLimit(new Double(12),new Double(2),new Double(1));
|
||||
//
|
||||
// List<Point> list = createData();
|
||||
List<Point> list = createData2();
|
||||
ControlLimit controlLimit = new ControlLimit(new Double(12),new Double(3),new Double(1));
|
||||
System.out.println("controlLimit : "+controlLimit.toString());
|
||||
//
|
||||
// //TEST FOR RULE1
|
||||
// Boolean aBoolean1 = rule1(list, controlLimit);
|
||||
//
|
||||
//TEST FOR RULE2
|
||||
// Boolean aBoolean2 = rule2(list, controlLimit, 9);
|
||||
// Boolean aBoolean2 = rule2(list, controlLimit, 5);
|
||||
// System.out.println();
|
||||
//
|
||||
//
|
||||
@@ -72,7 +135,7 @@ public class StatisticalControlledTest {
|
||||
//
|
||||
//
|
||||
// //TEST FOR RULE4
|
||||
// Boolean aBoolean4 = rule4(list, 5);
|
||||
// Boolean aBoolean4 = rule4(list, 6);
|
||||
// System.out.println();
|
||||
|
||||
// //TEST FOR RULE5
|
||||
@@ -80,17 +143,19 @@ public class StatisticalControlledTest {
|
||||
// System.out.println();
|
||||
|
||||
// //TEST FOR RULE6
|
||||
// Boolean aBoolean6 = rule6(list, controlLimit, 3,2);
|
||||
// >6 或者 <2.3
|
||||
// Boolean aBoolean6 = rule6(list, controlLimit, 5,4);
|
||||
// System.out.println();
|
||||
|
||||
//TEST FOR RULE7
|
||||
//LC0 = 1.6666 ;; UC1 = 5
|
||||
Boolean aBoolean7 = rule7(list, controlLimit,7);
|
||||
System.out.println();
|
||||
// //>2.33 <3
|
||||
// Boolean aBoolean7 = rule7(list, controlLimit,7);
|
||||
// System.out.println();
|
||||
|
||||
//TEST FOR RULE8
|
||||
// Boolean aBoolean8 = rule8(list, controlLimit,8);
|
||||
// System.out.println();
|
||||
Boolean aBoolean8 = rule8(list, controlLimit,8);
|
||||
System.out.println();
|
||||
|
||||
// int[] array={1,2,3,4,5,6};
|
||||
// int[] ret=new int[3];
|
||||
@@ -99,6 +164,7 @@ public class StatisticalControlledTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* status : ok
|
||||
* name : 规则1
|
||||
* desc : 控制图上有 1 个点位于三倍标准差以外(对中心线来说)(母体的 $\sigma$ )
|
||||
* 注意: 如果存在满足rule1的点,会在原数组 Point.unsatisfiedRules 里标注出来。
|
||||
@@ -109,7 +175,7 @@ public class StatisticalControlledTest {
|
||||
private static Boolean rule1(List<Point> data, ControlLimit controlLimit){
|
||||
Boolean flag = false;
|
||||
for(Point i:data){
|
||||
if(i.getValue() > controlLimit.getUCL() || i.getValue() < controlLimit.getLCL()){
|
||||
if(i.getValueForInterpretation() > controlLimit.getUCL() || i.getValueForInterpretation() < controlLimit.getLCL()){
|
||||
i.getUnsatisfiedRules().add(rule1Number);
|
||||
flag = true;
|
||||
}
|
||||
@@ -124,20 +190,23 @@ public class StatisticalControlledTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* status : ok
|
||||
* name : 规则2
|
||||
* desc : 连续 n 点落在中心线的用一侧 (默认:9)
|
||||
* desc : 连续 n 点落在中心线的同一侧 (默认:9)
|
||||
* 注意: 如果存在满足rule2的点,会在原数组 Point.unsatisfiedRules 里标注出来。
|
||||
* return :
|
||||
* 存在满足rule2的点 => true
|
||||
* 不存在满足rule2的点 => false
|
||||
* */
|
||||
private static Boolean rule2(List<Point> data, ControlLimit controlLimit,Integer n){
|
||||
Boolean result = false;
|
||||
|
||||
List<Point> upList = new ArrayList<>();
|
||||
List<Point> downList = new ArrayList<>();
|
||||
for(Point i:data){
|
||||
if(i.getValue() > controlLimit.getCL()){
|
||||
if(i.getValueForInterpretation() > controlLimit.getCL()){
|
||||
upList.add(i);
|
||||
}else if(i.getValue() < controlLimit.getCL()){
|
||||
}else if(i.getValueForInterpretation() < controlLimit.getCL()){
|
||||
downList.add(i);
|
||||
}
|
||||
}
|
||||
@@ -151,15 +220,17 @@ public class StatisticalControlledTest {
|
||||
|
||||
while((upi+1) < upList.size()){
|
||||
//if((upList.get(upi).getPosition()+1)==upList.get(upi+1).getPosition()){
|
||||
if(isBetween(upList.get(upi),upList.get(upi+1))){
|
||||
//|| upi==(n-1)
|
||||
if( isBetween(upList.get(upi),upList.get(upi+1)) || upi==(n-1) ){
|
||||
uptime +=1;
|
||||
forMarkPoints.add(upList.get(upi));
|
||||
if((upi+1)==upTotalSize){
|
||||
if((upi+1)==(upTotalSize-1)){
|
||||
uptime +=1;
|
||||
forMarkPoints.add(upList.get(upi+1));
|
||||
}
|
||||
//只要到达n 了,就return,防止中间段到达 后面又被重置了
|
||||
if(uptime>=n){
|
||||
result = true;
|
||||
//1.
|
||||
for (Point key:forMarkPoints){
|
||||
for(Point j:data){
|
||||
@@ -169,14 +240,12 @@ public class StatisticalControlledTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
//2.
|
||||
// markUnsatisfiedRulesByKeys(data,forMarkKey,rule2Number);
|
||||
|
||||
return true;
|
||||
//2.不考虑 return ,先把所有点都找出来。( 重置所有标志位 )
|
||||
uptime = 0;
|
||||
}
|
||||
}else {
|
||||
forMarkPoints = new ArrayList<>();
|
||||
upTotalSize-=1;
|
||||
// upTotalSize--;
|
||||
uptime = 0;
|
||||
}
|
||||
upi++;
|
||||
@@ -189,15 +258,17 @@ public class StatisticalControlledTest {
|
||||
Integer totalSize = downList.size();
|
||||
forMarkPoints = new ArrayList<>();
|
||||
while((downi+1) < downList.size()){
|
||||
if(isBetween(downList.get(downi),downList.get(downi+1))){
|
||||
//这里之所以 要加上downi==(n-1) 是因为,在比较顺序的时候,要把最后一种可能加上。
|
||||
//|| downi==(n-1)
|
||||
if(isBetween(downList.get(downi),downList.get(downi+1)) || downi==(n-1) ){
|
||||
downtime +=1;
|
||||
forMarkPoints.add(downList.get(downi));
|
||||
if((downi+1)==totalSize){
|
||||
if((downi+1)==(totalSize-1)){
|
||||
downtime++;
|
||||
forMarkPoints.add(downList.get(downi+1));
|
||||
}
|
||||
if(downtime>=n){
|
||||
|
||||
result = true;
|
||||
for (Point key:forMarkPoints){
|
||||
for(Point j:data){
|
||||
if(key.getPosition().equals(j.getPosition())){
|
||||
@@ -206,22 +277,22 @@ public class StatisticalControlledTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
//2.不考虑 return ,先把所有点都找出来。( 重置所有标志位 )
|
||||
downtime = 0;
|
||||
}
|
||||
}else {
|
||||
totalSize-=1;
|
||||
forMarkPoints = new ArrayList<>();
|
||||
// totalSize--;
|
||||
downtime = 0;
|
||||
}
|
||||
downi++;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* status : ok
|
||||
* name : 规则3
|
||||
* desc : 连续 n 点递增或者递减 (默认:6)
|
||||
* 注意: 如果存在满足rule3的点,会在原数组 Point.unsatisfiedRules 里标注出来。
|
||||
@@ -244,7 +315,9 @@ public class StatisticalControlledTest {
|
||||
data.get(key).getUnsatisfiedRules().add(rule3Number);
|
||||
}
|
||||
|
||||
return true;
|
||||
//不return了, 把所有不满足的点都找出来
|
||||
// return true;
|
||||
uptime = 0;
|
||||
}
|
||||
}else {
|
||||
uptime = 0;
|
||||
@@ -267,7 +340,8 @@ public class StatisticalControlledTest {
|
||||
data.get(key).getUnsatisfiedRules().add(rule3Number);
|
||||
}
|
||||
|
||||
return true;
|
||||
// return true;
|
||||
downtime = 0;
|
||||
}
|
||||
}else {
|
||||
downtime = 0;
|
||||
@@ -280,18 +354,24 @@ public class StatisticalControlledTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* status : ok
|
||||
* name : 规则4
|
||||
* desc : 连续 n 点中 相邻点 交替上下 ( 默认:14 )
|
||||
* desc : 连续 n 点中 相邻点 交替上下 ( 默认:14 ) (n>2)
|
||||
* 注意: 如果存在满足rule4的点,会在原数组 Point.unsatisfiedRules 里标注出来。
|
||||
* return :
|
||||
* 存在满足rule4的点 => true
|
||||
* 不存在满足rule4的点 => false
|
||||
* */
|
||||
private static Boolean rule4(List<Point> data, Integer n){
|
||||
if(n<=2){
|
||||
return false;
|
||||
}
|
||||
Boolean result = false;
|
||||
Integer upi = 0;
|
||||
Boolean current;
|
||||
Boolean nextNeeded;
|
||||
Integer times = 0;
|
||||
Integer isAgain = 1;
|
||||
List<Integer> forMarkKey = new ArrayList<>();
|
||||
if(isSmall(data.get(0),data.get(1))){
|
||||
current = true;
|
||||
@@ -303,11 +383,34 @@ public class StatisticalControlledTest {
|
||||
|
||||
while((upi+1) < data.size()){
|
||||
if(isBetween( data.get(upi),data.get(upi+1) )){
|
||||
//
|
||||
//最后一个节点情况
|
||||
if((upi+1)==(data.size()-1)){
|
||||
|
||||
Double u1 = data.get(upi-1).getValueForInterpretation();
|
||||
Double u2 = data.get(upi).getValueForInterpretation();
|
||||
Double u3 = data.get(upi+1).getValueForInterpretation();
|
||||
if(isUpAndDown(u1,u2,u3)){
|
||||
forMarkKey.add(upi);
|
||||
forMarkKey.add(upi+1);
|
||||
times+=2;
|
||||
}
|
||||
if(times >= n){
|
||||
for(Integer key:forMarkKey){
|
||||
data.get(key).getUnsatisfiedRules().add(rule4Number);
|
||||
}
|
||||
|
||||
//set完了就重置
|
||||
result = true;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//formark 最后一个点的时候
|
||||
if(forMarkKey.size()==(n-1)){
|
||||
Double u1 = data.get(upi-2).getValue();
|
||||
Double u2 = data.get(upi-1).getValue();
|
||||
Double u3 = data.get(upi).getValue();
|
||||
Double u1 = data.get(upi-2).getValueForInterpretation();
|
||||
Double u2 = data.get(upi-1).getValueForInterpretation();
|
||||
Double u3 = data.get(upi).getValueForInterpretation();
|
||||
if(isUpAndDown(u1,u2,u3)){
|
||||
forMarkKey.add(upi);
|
||||
times++;
|
||||
@@ -316,7 +419,16 @@ public class StatisticalControlledTest {
|
||||
for(Integer key:forMarkKey){
|
||||
data.get(key).getUnsatisfiedRules().add(rule4Number);
|
||||
}
|
||||
return true;
|
||||
|
||||
//set完了就重置
|
||||
result = true;
|
||||
times=0;
|
||||
forMarkKey = new ArrayList<>();
|
||||
|
||||
//
|
||||
isAgain =2;
|
||||
//
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,6 +440,10 @@ public class StatisticalControlledTest {
|
||||
}else {
|
||||
current = false;
|
||||
}
|
||||
if(isAgain == 2){
|
||||
nextNeeded = current;
|
||||
isAgain = 1;
|
||||
}
|
||||
|
||||
|
||||
if (current.equals(nextNeeded)){
|
||||
@@ -335,9 +451,9 @@ public class StatisticalControlledTest {
|
||||
forMarkKey.add(upi);
|
||||
//加入最后一个元素的判断
|
||||
if((upi+1)==(data.size()-1)){
|
||||
Double u0 = data.get(upi - 1).getValue();
|
||||
Double u1 = data.get(upi).getValue();
|
||||
Double u2 = data.get(upi + 1).getValue();
|
||||
Double u0 = data.get(upi - 1).getValueForInterpretation();
|
||||
Double u1 = data.get(upi).getValueForInterpretation();
|
||||
Double u2 = data.get(upi + 1).getValueForInterpretation();
|
||||
if(isUpAndDown(u0,u1,u2)){
|
||||
forMarkKey.add(upi+1);
|
||||
times++;
|
||||
@@ -349,7 +465,14 @@ public class StatisticalControlledTest {
|
||||
for(Integer key:forMarkKey){
|
||||
data.get(key).getUnsatisfiedRules().add(rule4Number);
|
||||
}
|
||||
return true;
|
||||
// return true;
|
||||
result = true;
|
||||
times=0;
|
||||
forMarkKey = new ArrayList<>();
|
||||
//
|
||||
isAgain =2;
|
||||
//
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
times=0;
|
||||
@@ -363,7 +486,7 @@ public class StatisticalControlledTest {
|
||||
upi++;
|
||||
}
|
||||
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -377,6 +500,7 @@ public class StatisticalControlledTest {
|
||||
* 不存在满足rule5的点 => false
|
||||
* */
|
||||
private 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<>();
|
||||
@@ -401,37 +525,43 @@ public class StatisticalControlledTest {
|
||||
Integer upTimes = 0;
|
||||
Integer downTimes = 0;
|
||||
for(Point i:keyList){
|
||||
if(i.getValue()>controlLimitDetail.getUB()[1]){
|
||||
if(i.getValueForInterpretation()>controlLimitDetail.getUB()[1]){
|
||||
upTimes++;
|
||||
upforMarkKey.add(i);
|
||||
System.out.println();
|
||||
}
|
||||
if(i.getValue()<controlLimitDetail.getLB()[0]){
|
||||
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);
|
||||
}
|
||||
return true;
|
||||
upforMarkKey = new ArrayList<>();
|
||||
// return true;
|
||||
}
|
||||
if(downTimes>=n){
|
||||
for(Point i:downforMarkKey){
|
||||
i.getUnsatisfiedRules().add(rule5Number);
|
||||
}
|
||||
return true;
|
||||
downforMarkKey = new ArrayList<>();
|
||||
// return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
// return true;
|
||||
}else {
|
||||
upforMarkKey = new ArrayList<>();
|
||||
downforMarkKey = new ArrayList<>();
|
||||
}
|
||||
upi++;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -443,6 +573,7 @@ public class StatisticalControlledTest {
|
||||
* 不存在满足rule6的点 => false
|
||||
* */
|
||||
private 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<>();
|
||||
@@ -467,37 +598,47 @@ public class StatisticalControlledTest {
|
||||
Integer upTimes = 0;
|
||||
Integer downTimes = 0;
|
||||
for(Point i:keyList){
|
||||
if(i.getValue()>controlLimitDetail.getUC()[1]){
|
||||
if(i.getValueForInterpretation()>controlLimitDetail.getUC()[1]){
|
||||
upTimes++;
|
||||
upforMarkKey.add(i);
|
||||
System.out.println();
|
||||
|
||||
}
|
||||
if(i.getValue()<controlLimitDetail.getLC()[0]){
|
||||
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);
|
||||
}
|
||||
return true;
|
||||
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;
|
||||
// return true;
|
||||
downforMarkKey = new ArrayList<>();
|
||||
}
|
||||
|
||||
return true;
|
||||
// return true;
|
||||
}else {
|
||||
upforMarkKey = new ArrayList<>();
|
||||
downforMarkKey = new ArrayList<>();
|
||||
}
|
||||
upi++;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -510,6 +651,7 @@ public class StatisticalControlledTest {
|
||||
* */
|
||||
private 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());
|
||||
@@ -522,7 +664,7 @@ public class StatisticalControlledTest {
|
||||
//判断最后一次
|
||||
if((i+1) == data.size()){
|
||||
Point point = data.get(i);
|
||||
if(point.getValue()>controlLimitDetail.getLC()[0] && point.getValue()<controlLimitDetail.getUC()[1]){
|
||||
if(point.getValueForInterpretation()>controlLimitDetail.getLC()[0] && point.getValueForInterpretation()<controlLimitDetail.getUC()[1]){
|
||||
times++;
|
||||
markKey.add(point);
|
||||
if(times.equals(n)){
|
||||
@@ -541,14 +683,17 @@ public class StatisticalControlledTest {
|
||||
//通常情况
|
||||
Point point = data.get(i);
|
||||
if( isBetween( data.get(i),data.get(i+1) ) ){
|
||||
if(point.getValue()>controlLimitDetail.getLC()[0] && point.getValue()<controlLimitDetail.getUC()[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;
|
||||
// return true;
|
||||
result = true;
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
}else {
|
||||
times = 0;
|
||||
@@ -559,7 +704,7 @@ public class StatisticalControlledTest {
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -572,7 +717,7 @@ public class StatisticalControlledTest {
|
||||
* */
|
||||
private 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());
|
||||
@@ -584,7 +729,7 @@ public class StatisticalControlledTest {
|
||||
//判断最后一次
|
||||
if((i+1) == data.size()){
|
||||
Point point = data.get(i);
|
||||
if( point.getValue()>controlLimitDetail.getUC()[1] || point.getValue()<controlLimitDetail.getLC()[0] ){
|
||||
if( point.getValueForInterpretation()>controlLimitDetail.getUC()[1] || point.getValueForInterpretation()<controlLimitDetail.getLC()[0] ){
|
||||
times++;
|
||||
markKey.add(point);
|
||||
if(times.equals(n)){
|
||||
@@ -603,14 +748,16 @@ public class StatisticalControlledTest {
|
||||
//通常情况
|
||||
Point point = data.get(i);
|
||||
if( isBetween( data.get(i),data.get(i+1) ) ){
|
||||
if( point.getValue()>controlLimitDetail.getUC()[1] || point.getValue()<controlLimitDetail.getLC()[0] ){
|
||||
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;
|
||||
result = true;
|
||||
times = 0;
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
}else {
|
||||
times = 0;
|
||||
@@ -621,7 +768,7 @@ public class StatisticalControlledTest {
|
||||
markKey = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -634,13 +781,13 @@ public class StatisticalControlledTest {
|
||||
* 如果 head 小于 after ==》 true
|
||||
* */
|
||||
private static boolean isSmall(Point head,Point after){
|
||||
return (head.getValue()- after.getValue()) < 0;
|
||||
return (head.getValueForInterpretation()- after.getValueForInterpretation()) < 0;
|
||||
}
|
||||
/**
|
||||
* 如果 head 大于 after ==》 true
|
||||
* */
|
||||
private static boolean isBig(Point head,Point after){
|
||||
return (head.getValue()- after.getValue()) > 0;
|
||||
return (head.getValueForInterpretation()- after.getValueForInterpretation()) > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.cnbm.qualityPlanning.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -8,12 +10,16 @@ import lombok.Data;
|
||||
* @DATE: 2022/7/12 15:17
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "控制限")
|
||||
public class ControlLimit {
|
||||
//控制上限
|
||||
@ApiModelProperty(value = "控制上限")
|
||||
private Double UCL;
|
||||
//控制中心线
|
||||
@ApiModelProperty(value = "控制中心线")
|
||||
private Double CL;
|
||||
//控制下限
|
||||
@ApiModelProperty(value = "控制下限")
|
||||
private Double LCL;
|
||||
|
||||
public ControlLimit(Double UCL,Double CL,Double LCL){
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.cnbm.qualityPlanning.entity;
|
||||
|
||||
/**
|
||||
* @Desc: ""
|
||||
* @Author: caixiang
|
||||
* @DATE: 2022/7/25 16:31
|
||||
*/
|
||||
public class PCWarming {
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.cnbm.qualityPlanning.entity;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -15,14 +13,14 @@ import java.util.Set;
|
||||
@Data
|
||||
public class Point {
|
||||
private Integer position;
|
||||
private Double value;
|
||||
private Double valueForInterpretation;
|
||||
|
||||
//不满足的 规则 例子 : [1,2] => 代表 不满足 规则1 和 规则2
|
||||
private Set<Integer> unsatisfiedRules;
|
||||
|
||||
public Point(Integer position , Double value){
|
||||
public Point(Integer position , Double valueForInterpretation){
|
||||
this.position = position;
|
||||
this.value = value;
|
||||
this.valueForInterpretation = valueForInterpretation;
|
||||
this.unsatisfiedRules = new HashSet();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.cnbm.qualityPlanning.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Desc: ""
|
||||
* @Author: caixiang
|
||||
* @DATE: 2022/7/12 15:17
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "工序能力")
|
||||
public class ProcessCapability {
|
||||
//工序能力指数CP
|
||||
@ApiModelProperty(value = "工序能力指数CP")
|
||||
private Double CP;
|
||||
//实际工序能力指数CPK
|
||||
@ApiModelProperty(value = "实际工序能力指数CPK")
|
||||
private Double CPK;
|
||||
//上侧规范 工序能力指数CPU
|
||||
@ApiModelProperty(value = "上侧规范 工序能力指数CPU")
|
||||
private Double CPU;
|
||||
//下侧规范 工序能力指数CPL
|
||||
@ApiModelProperty(value = "下侧规范 工序能力指数CPL")
|
||||
private Double CPL;
|
||||
|
||||
@ApiModelProperty(value = "工序能力报警")
|
||||
private List<String> warming;
|
||||
|
||||
public ProcessCapability(Double CP, Double CPK, Double CPU, Double CPL,List<String> warming) {
|
||||
this.CP = CP;
|
||||
this.CPK = CPK;
|
||||
this.CPU = CPU;
|
||||
this.CPL = CPL;
|
||||
this.warming = warming;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.cnbm.qualityPlanning.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -8,11 +10,21 @@ import lombok.Data;
|
||||
* @DATE: 2022/7/12 15:19
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "规格限")
|
||||
public class SpecificationLimit {
|
||||
//规格上限
|
||||
private Double USL;
|
||||
@ApiModelProperty(value = "规格上限")
|
||||
private Float USL;
|
||||
//规格中心线
|
||||
private Double SL;
|
||||
@ApiModelProperty(value = "规格中心限")
|
||||
private Float SL;
|
||||
//规格下限
|
||||
private Double LSL;
|
||||
@ApiModelProperty(value = "规格下限")
|
||||
private Float LSL;
|
||||
|
||||
public SpecificationLimit(Float USL, Float SL, Float LSL) {
|
||||
this.USL = USL;
|
||||
this.SL = SL;
|
||||
this.LSL = LSL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.cnbm.qualityPlanning.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Desc: "整合,处理好 后的一行数据 (sampleSize 后的数据) "
|
||||
* @Author: caixiang
|
||||
* @DATE: 2022/7/21 9:43
|
||||
*/
|
||||
public class XbarSPoint extends Point {
|
||||
List<Double> data = new ArrayList<>();
|
||||
private Double xbar;
|
||||
private Double s;
|
||||
private Double r;
|
||||
//position 是这个数据在数组中的位置 ;; value 是待被判读方案 分析的value(从 xbar、s、r 中选一)
|
||||
public XbarSPoint(Integer position, Double value) {
|
||||
super(position, value);
|
||||
}
|
||||
//
|
||||
|
||||
|
||||
public Double getXbar() {
|
||||
return xbar;
|
||||
}
|
||||
|
||||
public void setXbar(Double xbar) {
|
||||
this.xbar = xbar;
|
||||
}
|
||||
|
||||
public Double getS() {
|
||||
return s;
|
||||
}
|
||||
|
||||
public void setS(Double s) {
|
||||
this.s = s;
|
||||
}
|
||||
|
||||
public Double getR() {
|
||||
return r;
|
||||
}
|
||||
|
||||
public void setR(Double r) {
|
||||
this.r = r;
|
||||
}
|
||||
|
||||
public XbarSPoint(Integer position, Double value, Double xbar, Double s, Double r) {
|
||||
super(position,value);
|
||||
this.xbar = xbar;
|
||||
this.s = s;
|
||||
this.r = r;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPosition() {
|
||||
return super.getPosition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getValueForInterpretation() {
|
||||
return super.getValueForInterpretation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Integer> getUnsatisfiedRules() {
|
||||
return super.getUnsatisfiedRules();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(Integer position) {
|
||||
super.setPosition(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueForInterpretation(Double valueForInterpretation) {
|
||||
super.setValueForInterpretation(valueForInterpretation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUnsatisfiedRules(Set<Integer> unsatisfiedRules) {
|
||||
super.setUnsatisfiedRules(unsatisfiedRules);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user