From 970359823bae7533b53f972f57f9745da58fa167 Mon Sep 17 00:00:00 2001
From: caixiang <939387484@qq.com>
Date: Wed, 13 Jul 2022 16:41:43 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=A4=E8=AF=BB=E6=96=B9?=
=?UTF-8?q?=E6=A1=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 1 +
.../cnbm/basic/mapper/ProductTypeMapper.java | 8 +-
.../cnbm/basic/mapper/ProductTypeMapper.xml | 72 ++++-
.../java/com/cnbm/basic/mapper/UnitMapper.xml | 2 +-
.../java/com/cnbm/common/spc/math/Math.java | 101 +++++++
.../com/cnbm/common/spc/util/DataUtils.java | 8 +-
ym-gateway/pom.xml | 5 +
.../java/com/cnbm/config/SwaggerConfig.java | 16 ++
ym-influx/pom.xml | 6 +-
.../com/cnbm/influx/config/InfluxClient.java | 5 +-
.../influx/controller/S7DemoController.java | 19 +-
ym-quality-planning/pom.xml | 25 ++
.../common/StatisticalControlledTest.java | 257 +++++++++++++++++
.../constant/XBarRCoefficients.java | 261 ++++++++++++++++++
.../constant/XBarSCoefficients.java | 257 +++++++++++++++++
.../qualityPlanning/entity/ControlLimit.java | 24 ++
.../cnbm/qualityPlanning/entity/Point.java | 29 ++
.../entity/SpecificationLimit.java | 18 ++
18 files changed, 1100 insertions(+), 14 deletions(-)
create mode 100644 ym-common/src/main/java/com/cnbm/common/spc/math/Math.java
rename ym-influx/src/main/java/com/cnbm/influx/common/Utils.java => ym-common/src/main/java/com/cnbm/common/spc/util/DataUtils.java (96%)
create mode 100644 ym-quality-planning/pom.xml
create mode 100644 ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/StatisticalControlledTest.java
create mode 100644 ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/constant/XBarRCoefficients.java
create mode 100644 ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/constant/XBarSCoefficients.java
create mode 100644 ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/ControlLimit.java
create mode 100644 ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/Point.java
create mode 100644 ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/SpecificationLimit.java
diff --git a/pom.xml b/pom.xml
index c672916..2858adf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,6 +15,7 @@
ym-baisc
ym-schedule-task
ym-influx
+ ym-quality-planning
pom
diff --git a/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java b/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java
index 9248037..c88152c 100644
--- a/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java
+++ b/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.java
@@ -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 {
-
+ int insertList(@Param("list")List list);
+
+
}
\ No newline at end of file
diff --git a/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.xml b/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.xml
index 3409746..1a9a449 100644
--- a/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.xml
+++ b/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductTypeMapper.xml
@@ -1,5 +1,75 @@
-
+
+
+ id,
+ `name`,
+ code,
+ descs,
+ `status`,
+ remark,
+ `valid`,
+ creator_id,
+ creator_name,
+ create_time,
+ updater_id,
+ updater_name,
+ update_time,
+ version
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+ (
+ #{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}
+ )
+
+
diff --git a/ym-baisc/src/main/java/com/cnbm/basic/mapper/UnitMapper.xml b/ym-baisc/src/main/java/com/cnbm/basic/mapper/UnitMapper.xml
index 42c18b6..b3d1a3b 100644
--- a/ym-baisc/src/main/java/com/cnbm/basic/mapper/UnitMapper.xml
+++ b/ym-baisc/src/main/java/com/cnbm/basic/mapper/UnitMapper.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/ym-common/src/main/java/com/cnbm/common/spc/math/Math.java b/ym-common/src/main/java/com/cnbm/common/spc/math/Math.java
new file mode 100644
index 0000000..4faf392
--- /dev/null
+++ b/ym-common/src/main/java/com/cnbm/common/spc/math/Math.java
@@ -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 arrs = new ArrayList<>();
@@ -64,6 +64,4 @@ public class Utils {
}
return result;
}
-
-
}
diff --git a/ym-gateway/pom.xml b/ym-gateway/pom.xml
index db6f686..46ed380 100644
--- a/ym-gateway/pom.xml
+++ b/ym-gateway/pom.xml
@@ -37,6 +37,11 @@
ym-influx
1.0-SNAPSHOT
+
+ com.cnbm
+ ym-quality-planning
+ 1.0-SNAPSHOT
+
diff --git a/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java b/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java
index 94ac7bd..c7b3426 100644
--- a/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java
+++ b/ym-gateway/src/main/java/com/cnbm/config/SwaggerConfig.java
@@ -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
diff --git a/ym-influx/pom.xml b/ym-influx/pom.xml
index 91fae60..423bd98 100644
--- a/ym-influx/pom.xml
+++ b/ym-influx/pom.xml
@@ -23,7 +23,11 @@
influxdb-client-java
6.3.0
-
+
+ com.cnbm
+ ym-common
+ 1.0-SNAPSHOT
+
diff --git a/ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java b/ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java
index a26dd81..9bb554e 100644
--- a/ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java
+++ b/ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java
@@ -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;
}
diff --git a/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java b/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java
index d9927b5..02cd253 100644
--- a/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java
+++ b/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java
@@ -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 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 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 query = InfluxClient.Client.query(queryDataParam);
diff --git a/ym-quality-planning/pom.xml b/ym-quality-planning/pom.xml
new file mode 100644
index 0000000..5e838e8
--- /dev/null
+++ b/ym-quality-planning/pom.xml
@@ -0,0 +1,25 @@
+
+
+
+ ym-pass
+ com.cnbm
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ ym-quality-planning
+
+
+ 8
+ 8
+
+
+
+ com.cnbm
+ ym-common
+ 1.0-SNAPSHOT
+
+
+
\ No newline at end of file
diff --git a/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/StatisticalControlledTest.java b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/StatisticalControlledTest.java
new file mode 100644
index 0000000..fd4b2f6
--- /dev/null
+++ b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/common/StatisticalControlledTest.java
@@ -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 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 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 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 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 data,List 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 data, ControlLimit controlLimit,Integer n){
+ List upList = new ArrayList<>();
+ List 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 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 data, Integer n){
+
+ //递增情况
+ Integer upi = 0;
+ Integer uptime = 0;
+ List 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;
+ }
+
+}
diff --git a/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/constant/XBarRCoefficients.java b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/constant/XBarRCoefficients.java
new file mode 100644
index 0000000..5fba1e2
--- /dev/null
+++ b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/constant/XBarRCoefficients.java
@@ -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;
+ }
+
+}
diff --git a/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/constant/XBarSCoefficients.java b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/constant/XBarSCoefficients.java
new file mode 100644
index 0000000..e25f844
--- /dev/null
+++ b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/constant/XBarSCoefficients.java
@@ -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;
+ }
+}
diff --git a/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/ControlLimit.java b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/ControlLimit.java
new file mode 100644
index 0000000..90552a0
--- /dev/null
+++ b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/ControlLimit.java
@@ -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;
+ }
+}
diff --git a/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/Point.java b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/Point.java
new file mode 100644
index 0000000..0af577b
--- /dev/null
+++ b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/Point.java
@@ -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 unsatisfiedRules;
+
+ public Point(Integer position , Double value){
+ this.position = position;
+ this.value = value;
+ this.unsatisfiedRules = new HashSet();
+ }
+
+}
diff --git a/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/SpecificationLimit.java b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/SpecificationLimit.java
new file mode 100644
index 0000000..592537d
--- /dev/null
+++ b/ym-quality-planning/src/main/java/com/cnbm/qualityPlanning/entity/SpecificationLimit.java
@@ -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;
+}