Browse Source

新增判读方案

pull/4/head
caixiang 2 years ago
parent
commit
970359823b
18 changed files with 1100 additions and 14 deletions
  1. +1
    -0
      pom.xml
  2. +7
    -1
      ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java
  3. +71
    -1
      ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.xml
  4. +1
    -1
      ym-baisc/src/main/java/com/cnbm/basic/mapper/UnitMapper.xml
  5. +101
    -0
      ym-common/src/main/java/com/cnbm/common/spc/math/Math.java
  6. +3
    -5
      ym-common/src/main/java/com/cnbm/common/spc/util/DataUtils.java
  7. +5
    -0
      ym-gateway/pom.xml
  8. +16
    -0
      ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java
  9. +5
    -1
      ym-influx/pom.xml
  10. +3
    -2
      ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java
  11. +16
    -3
      ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java
  12. +25
    -0
      ym-quality-planning/pom.xml
  13. +257
    -0
      ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/StatisticalControlledTest.java
  14. +261
    -0
      ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/constant/XBarRCoefficients.java
  15. +257
    -0
      ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/constant/XBarSCoefficients.java
  16. +24
    -0
      ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/ControlLimit.java
  17. +29
    -0
      ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/Point.java
  18. +18
    -0
      ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/SpecificationLimit.java

+ 1
- 0
pom.xml View File

@@ -15,6 +15,7 @@
<module>ym-baisc</module>
<module>ym-schedule-task</module>
<module>ym-influx</module>
<module>ym-quality-planning</module>
</modules>
<packaging>pom</packaging>



+ 7
- 1
ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java View File

@@ -1,9 +1,13 @@
package com.cnbm.basic.mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

import com.cnbm.common.dao.BaseDao;
import com.cnbm.basic.entity.ProductType;
import org.apache.ibatis.annotations.Mapper;

import java.io.Serializable;

/**
* 产品类型 表
*
@@ -12,5 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ProductTypeMapper extends BaseDao<ProductType> {
int insertList(@Param("list")List<ProductType> list);


}

+ 71
- 1
ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.xml View File

@@ -1,5 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.generator.code.mapper.ProductTypeMapper">
<mapper namespace="com.cnbm.basic.mapper.ProductTypeMapper">
<sql id="Base_Column_List">
id,
`name`,
code,
descs,
`status`,
remark,
`valid`,
creator_id,
creator_name,
create_time,
updater_id,
updater_name,
update_time,
version
</sql>
<resultMap id="BaseResultMap" type="com.cnbm.basic.entity.ProductType">
<result column="id" property="id"/>
<result column="name" property="name"/>
<result column="code" property="code"/>
<result column="descs" property="descs"/>
<result column="status" property="status"/>
<result column="remark" property="remark"/>
<result column="valid" property="valid"/>
<result column="creator_id" property="creatorId"/>
<result column="creator_name" property="creatorName"/>
<result column="create_time" property="createTime"/>
<result column="updater_id" property="updaterId"/>
<result column="updater_name" property="updaterName"/>
<result column="update_time" property="updateTime"/>
<result column="version" property="version"/>
</resultMap>

<!--auto generated by MybatisCodeHelper on 2022-07-05-->
<insert id="insertList">
INSERT INTO product_type(
id,
name,
code,
descs,
status,
remark,
valid,
creator_id,
creator_name,
create_time,
updater_id,
updater_name,
update_time,
version
)VALUES
<foreach collection="list" item="element" index="index" separator=",">
(
#{element.id},
#{element.name},
#{element.code},
#{element.descs},
#{element.status},
#{element.remark},
#{element.valid},
#{element.creatorId},
#{element.creatorName},
#{element.createTime},
#{element.updaterId},
#{element.updaterName},
#{element.updateTime},
#{element.version}
)
</foreach>
</insert>

</mapper>

+ 1
- 1
ym-baisc/src/main/java/com/cnbm/basic/mapper/UnitMapper.xml View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.generator.code.mapper.UnitMapper">
<mapper namespace="com.cnbm.basic.mapper.UnitMapper">

</mapper>

+ 101
- 0
ym-common/src/main/java/com/cnbm/common/spc/math/Math.java View File

@@ -0,0 +1,101 @@
package com.cnbm.common.spc.math;

import java.math.RoundingMode;
import java.text.DecimalFormat;

public class Math {

public static void main(String[] args) {
// try(Scanner input = new Scanner(System.in);) {
// System.out.print("Enter ten numbers: ");
// double[] numbers = new double[10];
// for (int i = 0; i < numbers.length; i++)
// numbers[i] = input.nextDouble();
//
// System.out.println("The mean is "+getMean(numbers)+
// "\nThe stand deviation is "+getStandDeviation(numbers));
// }

//8.1 10.6 9.8 9.0 9.4 9.3 10.2 11.7
double[] d = new double[8];
d[0] = new Double(8.1) ;
d[1] = new Double(10.6);
d[2] = new Double(9.8);
d[3] = new Double(9.0);
d[4] = new Double(9.4);
d[5] = new Double(9.3);
d[6] = new Double(10.2);
d[7] = new Double(11.7);

;
System.out.println("均值: "+getMean(d)+",,标准差:"+StandardDiviation(d)+",极差:"+range(d));
}

//平均值
public static double getMean(double...numbers) {
return format(getSum(numbers) / numbers.length);
}

//极差
public static double range(double[] in) {
if (in == null) {
throw new NumberFormatException();
}
double max = Double.MIN_VALUE;
double min = Double.MAX_VALUE;
for (int i = 0; i < in.length; i++) {
max = java.lang.Math.max(max, in[i]);
min = java.lang.Math.min(min, in[i]);
}
return format(max - min);
//return Mutil.subtract(max, min);
}

public static double format(double value) {
DecimalFormat df = new DecimalFormat("0.00");//创建一个df对象,传入0.00表示构造一个保留小数点后两位的df对象
df.setRoundingMode(RoundingMode.HALF_UP);//设置规则,这里采用的也是四舍五入规则
return Double.parseDouble(df.format(value));//返回value(在返回之前使用df对象的格式化方法将数据格式化)
}

//方差s^2=[(x1-x)^2 +...(xn-x)^2]/n 或者s^2=[(x1-x)^2 +...(xn-x)^2]/(n-1)
public static double Variance(double[] x) {
int m=x.length;
double sum=0;
for(int i=0;i<m;i++){//求和
sum+=x[i];
}
double dAve=sum/m;//求平均值
double dVar=0;
for(int i=0;i<m;i++){//求方差
dVar+=(x[i]-dAve)*(x[i]-dAve);
}
return format(dVar/m);
}

//标准差σ=sqrt(s^2)
public static double StandardDiviation(double[] x) {
int m=x.length;
double sum=0;
for(int i=0;i<m;i++){//求和
sum+=x[i];
}
double dAve=sum/m;//求平均值
double dVar=0;
for(int i=0;i<m;i++){//求方差
dVar+=(x[i]-dAve)*(x[i]-dAve);
}
return format(java.lang.Math.sqrt(dVar/(m-1)));
//return Math.sqrt(dVar/m);
}


//前n项和
public static double getSum(double...numbers) {
double sum = 0.0;

for (double i : numbers) {
sum += i;
}
return sum;
}
}

ym-influx/src/main/java/com/cnbm/influx/common/Utils.java → ym-common/src/main/java/com/cnbm/common/spc/util/DataUtils.java View File

@@ -1,4 +1,4 @@
package com.cnbm.influx.common;
package com.cnbm.common.spc.util;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -9,9 +9,9 @@ import java.util.List;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2022/6/29 16:23
* @DATE: 2022/7/12 14:23
*/
public class Utils {
public class DataUtils {
public static void main(String[] args) {
ArrayList<Integer> arrs = new ArrayList<>();

@@ -64,6 +64,4 @@ public class Utils {
}
return result;
}


}

+ 5
- 0
ym-gateway/pom.xml View File

@@ -37,6 +37,11 @@
<artifactId>ym-influx</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.cnbm</groupId>
<artifactId>ym-quality-planning</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-actuator-autoconfigure</artifactId>-->


+ 16
- 0
ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java View File

@@ -112,6 +112,22 @@ public class SwaggerConfig {
.securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
}

@Bean
public Docket qualityPlanningApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("ym-quality-planning")
.apiInfo(apiInfos("质量规划", "质量规划模块"))
.useDefaultResponseMessages(true)
.forCodeGeneration(false)
.select()
.apis(RequestHandlerSelectors.basePackage("com.cnbm.qualityPlanning"))
.paths(PathSelectors.any())
.build()
.securityContexts(Arrays.asList(securityContext()))
// ApiKey的name需与SecurityReference的reference保持一致
.securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
}

/**
* 创建该API的基本信息(这些基本信息会展现在文档页面中)
* 访问地址:http://ip:port/swagger-ui.html


+ 5
- 1
ym-influx/pom.xml View File

@@ -23,7 +23,11 @@
<artifactId>influxdb-client-java</artifactId>
<version>6.3.0</version>
</dependency>

<dependency>
<groupId>com.cnbm</groupId>
<artifactId>ym-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

<!--- begin -->
<!-- <dependency>-->


+ 3
- 2
ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java View File

@@ -60,16 +60,17 @@ public enum InfluxClient {
* true 服务正常健康
* false 异常
*/
private boolean ping() {
public boolean ping() {
boolean isConnected = false;
Boolean pong;
try {
pong = influxDBClient.ping();
if (pong != null) {
isConnected = true;
isConnected = pong;
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
return isConnected;
}


+ 16
- 3
ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java View File

@@ -1,6 +1,6 @@
package com.cnbm.influx.controller;

import com.cnbm.influx.common.Utils;
import com.cnbm.common.spc.util.DataUtils;
import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.param.PageInfo;
import com.cnbm.influx.param.QueryDataParam;
@@ -44,6 +44,19 @@ public class S7DemoController {
InfluxClient.Client.batchInsert(list,"ASProcessCompleteEventAS");
}

/**
* 测试连接是否正常
*
* @return
* true 服务正常健康
* false 异常
*/
@PostMapping("/ping")
public void ping() throws InterruptedException {
boolean ping = InfluxClient.Client.ping();
System.out.println(ping);
}

@PostMapping("/query")
public void query() throws InterruptedException {
List<Event> list = new ArrayList<>();
@@ -53,7 +66,7 @@ public class S7DemoController {
queryDataParam.setMeasurement("ASProcessCompleteEventAS");
queryDataParam.setDropedTagName("transationId");
queryDataParam.setTag(new Tag("argName","arg6"));
queryDataParam.setRange(new Range(Utils.getBeforeDate(10).toInstant(),Instant.now()));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(),Instant.now()));
queryDataParam.setPageInfo(new PageInfo(1,10));
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);

@@ -76,7 +89,7 @@ public class S7DemoController {
queryDataParam.setMeasurement("ASProcessCompleteEventAS");
queryDataParam.setDropedTagName("transationId");
queryDataParam.setTag(new Tag("argName","arg7"));
queryDataParam.setRange(new Range(Utils.getBeforeDate(10).toInstant(),Instant.now()));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(),Instant.now()));
queryDataParam.setPageInfo(new PageInfo(2,10));
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);



+ 25
- 0
ym-quality-planning/pom.xml View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ym-pass</artifactId>
<groupId>com.cnbm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ym-quality-planning</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.cnbm</groupId>
<artifactId>ym-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

+ 257
- 0
ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/StatisticalControlledTest.java View File

@@ -0,0 +1,257 @@
package com.cnbm.qualityPlanning.common;

import com.cnbm.qualityPlanning.entity.ControlLimit;
import com.cnbm.qualityPlanning.entity.Point;
import io.swagger.models.auth.In;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;

/**
* @Desc: "检测参数统计受控 检验类"
* @Author: caixiang
* @DATE: 2022/7/11 15:27
*/
public class StatisticalControlledTest {
private static final Integer rule1Number = 1;
private static final Integer rule2Number = 2;
private static final Integer rule3Number = 3;
private static final Integer rule4Number = 4;
private static final Integer rule5Number = 5;
private static final Integer rule6Number = 6;
private static final Integer rule7Number = 7;
private static final Integer rule8Number = 8;
private static final Integer rule9Number = 9;
private static final Integer rule10Number = 10;

public static List<Point> createData(){
Point point = new Point(1,new Double(1));
Point point2 = new Point(2,new Double(2));
Point point3 = new Point(3,new Double(3));
Point point4 = new Point(4,new Double(4));
Point point5 = new Point(5,new Double(5));
Point point6 = new Point(6,new Double(6));
Point point7 = new Point(7,new Double(7));
Point point8 = new Point(8,new Double(8));
Point point9 = new Point(9,new Double(9));
Point point10 = new Point(10,new Double(10));
Point point11 = new Point(11,new Double(11));
Point point12 = new Point(12,new Double(12));
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);
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));

//TEST FOR RULE1
Boolean aBoolean1 = rule1(list, controlLimit);

//TEST FOR RULE2
Boolean aBoolean2 = rule2(list, controlLimit, 9);
System.out.println();


//TEST FOR RULE3
Boolean aBoolean3 = rule3(list, 3);
System.out.println();
}

/**
* name : 规则1
* desc : 控制图上有 1 个点位于三倍标准差以外(对中心线来说)(母体的 $\sigma$ )
*
* return : 返回的 就是不满足 规则1 的点。
* */
private static Boolean rule1(List<Point> data, ControlLimit controlLimit){
for(Point i:data){
if(i.getValue() > controlLimit.getUCL() || i.getValue() < controlLimit.getLCL()){
i.getUnsatisfiedRules().add(1);
}
}
return true;
}

private static void markUnsatisfiedRulesByKeys(List<Point> data,List<Integer> keys,Integer ruleNumber){
for (Integer key:keys){
data.get(key).getUnsatisfiedRules().add(ruleNumber);
}
}

/**
* name : 规则2
* desc : 连续 n 点落在中心线的用一侧 (默认:9)
*
* return : 返回的 就是不满足 规则2 的点。
* */
private static Boolean rule2(List<Point> data, ControlLimit controlLimit,Integer n){
List<Point> upList = new ArrayList<>();
List<Point> downList = new ArrayList<>();
for(Point i:data){
if(i.getValue() > controlLimit.getCL()){
upList.add(i);
}else if(i.getValue() < controlLimit.getCL()){
downList.add(i);
}
}

//上侧的情况
Integer upi = 0;
Integer uptime = 0;
//标注不合格的 参数
List<Point> forMarkPoints = new ArrayList<>();
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))){
uptime +=1;
forMarkPoints.add(upList.get(upi));
//只要到达n 了,就return,防止中间段到达 后面又被重置了
if(uptime>=n){
//1.
for (Point key:forMarkPoints){
for(Point j:data){
if(key.getPosition()== j.getPosition()){
j.getUnsatisfiedRules().add(rule2Number);
continue;
}
}
}
//2.
// markUnsatisfiedRulesByKeys(data,forMarkKey,rule2Number);

return true;
}
}else {
forMarkPoints = new ArrayList<>();
uptime = 0;
}
upi++;
}


//下侧的情况
Integer downi = 0;
Integer downtime = 0;
forMarkPoints = new ArrayList<>();
while((downi+1) < downList.size()){
if(isBetween(downList.get(upi),downList.get(upi+1))){
downtime +=1;
forMarkPoints.add(downList.get(downi));
if(downtime>=n){

for (Point key:forMarkPoints){
for(Point j:data){
if(key.getPosition()== j.getPosition()){
j.getUnsatisfiedRules().add(rule2Number);
continue;
}
}
}

return true;
}
}else {
forMarkPoints = new ArrayList<>();
downtime = 0;
}
downi++;
}


return false;
}

/**
* name : 规则3
* desc : 连续 n 点递增或者递减 (默认:6)
*
* return : 返回的 就是不满足 规则2 的点。
* */
private static Boolean rule3(List<Point> data, Integer n){

//递增情况
Integer upi = 0;
Integer uptime = 0;
List<Integer> forMarkKey = new ArrayList<>();
while((upi+1) < data.size()){
if((isBetween( data.get(upi),data.get(upi+1) )) && isSmall( data.get(upi),data.get(upi+1) ) ){
uptime +=1;
forMarkKey.add(upi);
if(uptime>=n){
for(Integer key:forMarkKey){
data.get(key).getUnsatisfiedRules().add(rule3Number);
}

return true;
}
}else {
uptime = 0;
forMarkKey = new ArrayList<>();
}
upi++;
}


//递减情况
Integer downi = 0;
Integer downtime = 0;
forMarkKey = new ArrayList<>();
while((downi+1) < data.size()){
if((isBetween( data.get(downi),data.get(downi+1) )) && isBig( data.get(downi),data.get(downi+1) ) ){
downtime +=1;
forMarkKey.add(downi);
if(downtime>=n){
for(Integer key:forMarkKey){
data.get(key).getUnsatisfiedRules().add(rule3Number);
}

return true;
}
}else {
downtime = 0;
forMarkKey = new ArrayList<>();
}
downi++;
}

return false;
}




/**
* 如果 这两个点是相邻的 ==》 true
* */
private static boolean isBetween(Point head,Point after){
return (head.getPosition()+1) == after.getPosition();
}
/**
* 如果 head 小于 after ==》 true
* */
private static boolean isSmall(Point head,Point after){
return (head.getValue()- after.getValue()) < 0;
}
/**
* 如果 head 大于 after ==》 true
* */
private static boolean isBig(Point head,Point after){
return (head.getValue()- after.getValue()) > 0;
}

}

+ 261
- 0
ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/constant/XBarRCoefficients.java View File

@@ -0,0 +1,261 @@
package com.cnbm.qualityPlanning.constant;

/**
* @Desc: " "x bar - R" 控制系数 "
* @Author: caixiang
* @DATE: 2022/6/30 10:44
*/
public class XBarRCoefficients {
public static Double getA2(Integer sampleSize){
if(sampleSize<=1){
return null;
}
Double res = null;
switch(sampleSize){
//P92
case 2:
res = new Double(1.880);
break;
case 3:
res = new Double(1.023);
break;
case 4:
res = new Double(0.729);
break;
case 5:
res = new Double(0.577);
break;
case 6:
res = new Double(0.483);
break;
case 7:
res = new Double(0.419);
break;
case 8:
res = new Double(0.373);
break;
case 9:
res = new Double(0.337);
break;
case 10:
res = new Double(0.308);
break;
case 11:
res = new Double(0.285);
break;
case 12:
res = new Double(0.266);
break;
case 13:
res = new Double(0.249);
break;
case 14:
res = new Double(0.235);
break;
case 15:
res = new Double(0.223);
break;
case 16:
res = new Double(0.212);
break;
case 17:
res = new Double(0.203);
break;
case 18:
res = new Double(0.194);
break;
case 19:
res = new Double(0.187);
break;
case 20:
res = new Double(0.180);
break;
case 21:
res = new Double(0.173);
break;
case 22:
res = new Double(0.167);
break;
case 23:
res = new Double(0.162);
break;
case 24:
res = new Double(0.157);
break;
//大于等于25 都是用0.153
default :
res = new Double(0.153);
break;
}
return res;
}

public static Double getD3(Integer sampleSize){
if(sampleSize<=1){
return null;
}
Double res = null;
switch(sampleSize){
//P92
case 2:
res = new Double(0);
break;
case 3:
res = new Double(0);
break;
case 4:
res = new Double(0);
break;
case 5:
res = new Double(0);
break;
case 6:
res = new Double(0);
break;
case 7:
res = new Double(0.076);
break;
case 8:
res = new Double(0.136);
break;
case 9:
res = new Double(0.184);
break;
case 10:
res = new Double(0.223);
break;
case 11:
res = new Double(0.256);
break;
case 12:
res = new Double(0.283);
break;
case 13:
res = new Double(0.307);
break;
case 14:
res = new Double(0.328);
break;
case 15:
res = new Double(0.347);
break;
case 16:
res = new Double(0.363);
break;
case 17:
res = new Double(0.378);
break;
case 18:
res = new Double(0.391);
break;
case 19:
res = new Double(0.403);
break;
case 20:
res = new Double(0.415);
break;
case 21:
res = new Double(0.425);
break;
case 22:
res = new Double(0.434);
break;
case 23:
res = new Double(0.443);
break;
case 24:
res = new Double(0.451);
break;
//大于等于25 都是用0.459
default :
res = new Double(0.459);
break;
}
return res;
}

public static Double getD4(Integer sampleSize){
if(sampleSize<=1){
return null;
}
Double res = null;
switch(sampleSize){
//P92
case 2:
res = new Double(3.267);
break;
case 3:
res = new Double(2.574);
break;
case 4:
res = new Double(2.282);
break;
case 5:
res = new Double(2.114);
break;
case 6:
res = new Double(2.004);
break;
case 7:
res = new Double(1.924);
break;
case 8:
res = new Double(1.864);
break;
case 9:
res = new Double(1.816);
break;
case 10:
res = new Double(1.777);
break;
case 11:
res = new Double(1.744);
break;
case 12:
res = new Double(1.717);
break;
case 13:
res = new Double(1.693);
break;
case 14:
res = new Double(1.672);
break;
case 15:
res = new Double(1.653);
break;
case 16:
res = new Double(1.637);
break;
case 17:
res = new Double(1.622);
break;
case 18:
res = new Double(1.608);
break;
case 19:
res = new Double(1.597);
break;
case 20:
res = new Double(1.585);
break;
case 21:
res = new Double(1.575);
break;
case 22:
res = new Double(1.566);
break;
case 23:
res = new Double(1.557);
break;
case 24:
res = new Double(1.548);
break;
//大于等于25 都是用1.541
default :
res = new Double(1.541);
break;
}
return res;
}

}

+ 257
- 0
ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/constant/XBarSCoefficients.java View File

@@ -0,0 +1,257 @@
package com.cnbm.qualityPlanning.constant;

/**
* @Desc: " "x bar - s" 控制系数 "
* @Author: caixiang
* @DATE: 2022/6/30 10:44
*/
public class XBarSCoefficients {
public static Double getAS(Integer sampleSize){
if(sampleSize<=1){
return null;
}
Double res = null;
switch(sampleSize){
case 2:
res = new Double(2.659);
break;
case 3:
res = new Double(1.954);
break;
case 4:
res = new Double(1.628);
break;
case 5:
res = new Double(1.427);
break;
case 6:
res = new Double(1.287);
break;
case 7:
res = new Double(1.182);
break;
case 8:
res = new Double(1.099);
break;
case 9:
res = new Double(1.032);
break;
case 10:
res = new Double(0.975);
break;
case 11:
res = new Double(0.972);
break;
case 12:
res = new Double(0.866);
break;
case 13:
res = new Double(0.850);
break;
case 14:
res = new Double(0.817);
break;
case 15:
res = new Double(0.789);
break;
case 16:
res = new Double(0.763);
break;
case 17:
res = new Double(0.739);
break;
case 18:
res = new Double(0.718);
break;
case 19:
res = new Double(0.698);
break;
case 20:
res = new Double(0.680);
break;
case 21:
res = new Double(0.663);
break;
case 22:
res = new Double(0.647);
break;
case 23:
res = new Double(0.633);
break;
case 24:
res = new Double(0.619);
break;
//大于等于25 都是用0.606
default :
res = new Double(0.606);
break;
}
return res;
}

public static Double getBU(Integer sampleSize){
if(sampleSize<=1){
return null;
}
Double res = null;
switch(sampleSize){
case 2:
res = new Double(3.267);
break;
case 3:
res = new Double(2.568);
break;
case 4:
res = new Double(2.266);
break;
case 5:
res = new Double(2.089);
break;
case 6:
res = new Double(1.970);
break;
case 7:
res = new Double(1.882);
break;
case 8:
res = new Double(1.815);
break;
case 9:
res = new Double(1.761);
break;
case 10:
res = new Double(1.716);
break;
case 11:
res = new Double(1.679);
break;
case 12:
res = new Double(1.646);
break;
case 13:
res = new Double(1.618);
break;
case 14:
res = new Double(1.594);
break;
case 15:
res = new Double(1.572);
break;
case 16:
res = new Double(1.552);
break;
case 17:
res = new Double(1.534);
break;
case 18:
res = new Double(1.518);
break;
case 19:
res = new Double(1.503);
break;
case 20:
res = new Double(1.490);
break;
case 21:
res = new Double(1.477);
break;
case 22:
res = new Double(1.466);
break;
case 23:
res = new Double(1.455);
break;
case 24:
res = new Double(1.445);
break;
//大于等于25 都是用1.435
default :
res = new Double(1.435);
break;
}
return res;
}

public static Double getBL(Integer sampleSize){
if(sampleSize<=1){
return null;
}
Double res = null;
switch(sampleSize){
case 2:
res = new Double(0);
break;
case 3:
res = new Double(0);
break;
case 4:
res = new Double(0);
break;
case 5:
res = new Double(0);
break;
case 6:
res = new Double(0.030);
break;
case 7:
res = new Double(0.118);
break;
case 8:
res = new Double(0.185);
break;
case 9:
res = new Double(0.239);
break;
case 10:
res = new Double(0.284);
break;
case 11:
res = new Double(0.321);
break;
case 12:
res = new Double(0.354);
break;
case 13:
res = new Double(0.382);
break;
case 14:
res = new Double(0.406);
break;
case 15:
res = new Double(0.428);
break;
case 16:
res = new Double(0.448);
break;
case 17:
res = new Double(0.466);
break;
case 18:
res = new Double(0.482);
break;
case 19:
res = new Double(0.497);
break;
case 20:
res = new Double(0.510);
break;
case 21:
res = new Double(0.523);
break;
case 22:
res = new Double(0.534);
break;
case 23:
res = new Double(0.545);
break;
case 24:
res = new Double(0.555);
break;
//大于等于25 都是用0.565
default :
res = new Double(0.565);
break;
}
return res;
}
}

+ 24
- 0
ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/ControlLimit.java View File

@@ -0,0 +1,24 @@
package com.cnbm.qualityPlanning.entity;

import lombok.Data;

/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2022/7/12 15:17
*/
@Data
public class ControlLimit {
//控制上限
private Double UCL;
//控制中心线
private Double CL;
//控制下限
private Double LCL;

public ControlLimit(Double UCL,Double CL,Double LCL){
this.UCL = UCL;
this.CL = CL;
this.LCL = LCL;
}
}

+ 29
- 0
ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/Point.java View File

@@ -0,0 +1,29 @@
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;

/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2022/7/12 15:12
*/
@Data
public class Point {
private Integer position;
private Double value;

//不满足的 规则 例子 : [1,2] => 代表 不满足 规则1 和 规则2
private Set<Integer> unsatisfiedRules;

public Point(Integer position , Double value){
this.position = position;
this.value = value;
this.unsatisfiedRules = new HashSet();
}

}

+ 18
- 0
ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/SpecificationLimit.java View File

@@ -0,0 +1,18 @@
package com.cnbm.qualityPlanning.entity;

import lombok.Data;

/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2022/7/12 15:19
*/
@Data
public class SpecificationLimit {
//规格上限
private Double USL;
//规格中心线
private Double SL;
//规格下限
private Double LSL;
}

Loading…
Cancel
Save