diff --git a/pom.xml b/pom.xml
index d7b8a9f..2858adf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,6 +15,7 @@
ym-baisc
ym-schedule-task
ym-influx
+ ym-quality-planning
pom
@@ -92,17 +93,17 @@
-
- org.springframework.boot
- spring-boot-actuator-autoconfigure
- true
-
-
- com.fasterxml.jackson.core
- jackson-databind
-
-
-
+
+
+
+
+
+
+
+
+
+
+
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 966d208..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,10 +1,17 @@
package com.cnbm.influx.controller;
+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;
+import com.cnbm.influx.param.Range;
+import com.cnbm.influx.param.Tag;
import com.cnbm.influx.template.Event;
import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.domain.WritePrecision;
import com.influxdb.client.write.Point;
+import com.influxdb.query.FluxRecord;
+import com.influxdb.query.FluxTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -12,47 +19,88 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.Instant;
+import java.util.ArrayList;
+import java.util.List;
@RestController
@RequestMapping("/influx")
public class S7DemoController {
private static final Logger logger = LoggerFactory.getLogger(S7DemoController.class);
- @Autowired
- InfluxDBClient influxDBClient;
+ @PostMapping("/insertBatch")
+ public void insertBatch() throws InterruptedException {
+ List list = new ArrayList<>();
+
+ for(int i=0;i<99;i++){
+ Thread.sleep(100);
+ Event event = new Event();
+ event.setTime(Instant.now());
+ event.setTransationId("asas"+i);
+ event.setArgName("arg7");
+ event.setArgValue(new Double(i));
+ list.add(event);
+ }
+ InfluxClient.Client.batchInsert(list,"ASProcessCompleteEventAS");
+ }
-// try (WriteApi writeApi = influxDBClient.makeWriteApi()) {
-// Temperature temperature = new Temperature();
-// temperature.setLocation("east");
-// temperature.setValue(106.2D);
-// temperature.setTime(Instant.now());
-// writeApi.writeMeasurement(WritePrecision.NS,temperature);
-// }
-//
-// try (WriteApi writeApi = influxDBClient.makeWriteApi()) {
-// Point point = Point.measurement("temperature")
-// .addTag("location","south")
-// .addTag("owner","wxm")
-// .addField("wxm",230.8);
-// writeApi.writePoint(point);
-// }
+ /**
+ * 测试连接是否正常
+ *
+ * @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<>();
- @PostMapping("/insertBatch")
- public void insertBatch() throws InterruptedException {
-// List list = new ArrayList<>();
-//
-// for(int i=0;i<99;i++){
-// //Thread.sleep(1000);
-// Event event = new Event();
-// event.time = Instant.now();
-// event.transationId = "asas"+i;
-// event.argName = "arg5";
-// event.argValue = new Double(i);
-// list.add(event);
-// }
-// influxService.batchInsert(list);
+ QueryDataParam queryDataParam = new QueryDataParam();
+ queryDataParam.setBucket("qgs-bucket");
+ queryDataParam.setMeasurement("ASProcessCompleteEventAS");
+ queryDataParam.setDropedTagName("transationId");
+ queryDataParam.setTag(new Tag("argName","arg6"));
+ queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(),Instant.now()));
+ queryDataParam.setPageInfo(new PageInfo(1,10));
+ List query = InfluxClient.Client.query(queryDataParam);
+
+
+ for (FluxTable fluxTable : query) {
+ List records = fluxTable.getRecords();
+ for (FluxRecord fluxRecord : records) {
+ System.out.println("value: " + fluxRecord.getValueByKey("_value"));
+
+ }
+ }
+ System.out.println();
+ }
+
+ public static void main(String[] args) {
+ List list = new ArrayList<>();
+
+ QueryDataParam queryDataParam = new QueryDataParam();
+ queryDataParam.setBucket("qgs-bucket");
+ queryDataParam.setMeasurement("ASProcessCompleteEventAS");
+ queryDataParam.setDropedTagName("transationId");
+ queryDataParam.setTag(new Tag("argName","arg7"));
+ queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(),Instant.now()));
+ queryDataParam.setPageInfo(new PageInfo(2,10));
+ List query = InfluxClient.Client.query(queryDataParam);
+
+
+ for (FluxTable fluxTable : query) {
+ List records = fluxTable.getRecords();
+ for (FluxRecord fluxRecord : records) {
+ System.out.println("value: " + fluxRecord.getValueByKey("_value"));
+
+ }
+ }
}
@@ -71,8 +119,8 @@ public class S7DemoController {
event.setTime(Instant.now());
event.setTransationId("asasd11");
event.setArgName("argName11");
- event.setArgValue(7d);
+ event.setArgValue(900001d);
Point asProcessCompleteEvent = insert(event, "ASProcessCompleteEvent");
- influxDBClient.makeWriteApi().writePoint(asProcessCompleteEvent);
+ InfluxClient.Client.insert(event,"ASProcessCompleteEvent");
}
}
diff --git a/ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicator.java b/ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicator.java
deleted file mode 100644
index 27a1e19..0000000
--- a/ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicator.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package com.cnbm.influx.health;
-
-import com.influxdb.client.InfluxDBClient;
-import org.springframework.boot.actuate.health.AbstractHealthIndicator;
-import org.springframework.boot.actuate.health.Health;
-import org.springframework.util.Assert;
-
-/**
- * {@link //HealthIndicator} for InfluxDB 2.
- *
- * @author Jakub Bednar (bednar@github)
- */
-public class InfluxDB2HealthIndicator extends AbstractHealthIndicator {
-
- private final InfluxDBClient influxDBClient;
-
- public InfluxDB2HealthIndicator(final InfluxDBClient influxDBClient) {
- super("InfluxDBClient 2 health check failed");
- Assert.notNull(influxDBClient, "InfluxDBClient must not be null");
-
- this.influxDBClient = influxDBClient;
- }
-
- @Override
- protected void doHealthCheck(final Health.Builder builder) {
- boolean success = this.influxDBClient.ping();
-
- if (success) {
- builder.up();
- } else {
- builder.down();
- }
- }
-}
diff --git a/ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicatorAutoConfiguration.java b/ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicatorAutoConfiguration.java
deleted file mode 100644
index bd2d439..0000000
--- a/ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicatorAutoConfiguration.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package com.cnbm.influx.health;
-
-import com.cnbm.influx.influx.InfluxDB2AutoConfiguration;
-import com.influxdb.client.InfluxDBClient;
-import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
-import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
-import org.springframework.boot.actuate.health.HealthContributor;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.Map;
-
-/**
- * {@link EnableAutoConfiguration Auto-configuration} for {@link InfluxDB2HealthIndicator}.
- *
- * @author Jakub Bednar
- */
-@Configuration(proxyBeanMethods = false)
-@ConditionalOnClass(InfluxDBClient.class)
-@ConditionalOnBean(InfluxDBClient.class)
-@ConditionalOnEnabledHealthIndicator("influx")
-@AutoConfigureAfter(InfluxDB2AutoConfiguration.class)
-public class InfluxDB2HealthIndicatorAutoConfiguration
- extends CompositeHealthContributorConfiguration {
-
- @Bean
- @ConditionalOnMissingBean(name = { "influxDB2HealthIndicator", "influxDB2HealthContributor" })
- public HealthContributor influxDbHealthContributor(final Map influxDBClients) {
- return createContributor(influxDBClients);
- }
-
-}
\ No newline at end of file
diff --git a/ym-influx/src/main/java/com/cnbm/influx/influx/AbstractInfluxDB2AutoConfiguration.java b/ym-influx/src/main/java/com/cnbm/influx/influx/AbstractInfluxDB2AutoConfiguration.java
deleted file mode 100644
index 942d394..0000000
--- a/ym-influx/src/main/java/com/cnbm/influx/influx/AbstractInfluxDB2AutoConfiguration.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package com.cnbm.influx.influx;
-
-import com.influxdb.client.InfluxDBClientOptions;
-import okhttp3.OkHttpClient;
-import okhttp3.Protocol;
-import org.springframework.util.StringUtils;
-
-import javax.annotation.Nonnull;
-import java.util.Collections;
-
-/**
- * @author Jakub Bednar (04/08/2021 11:41)
- */
-abstract class AbstractInfluxDB2AutoConfiguration {
- protected final InfluxDB2Properties properties;
- protected final InfluxDB2OkHttpClientBuilderProvider builderProvider;
-
- protected AbstractInfluxDB2AutoConfiguration(final InfluxDB2Properties properties,
- final InfluxDB2OkHttpClientBuilderProvider builderProvider) {
- this.properties = properties;
- this.builderProvider = builderProvider;
- }
-
- @Nonnull
- protected InfluxDBClientOptions.Builder makeBuilder() {
- OkHttpClient.Builder okHttpBuilder;
- if (builderProvider == null) {
- okHttpBuilder = new OkHttpClient.Builder()
- .protocols(Collections.singletonList(Protocol.HTTP_1_1))
- .readTimeout(properties.getReadTimeout())
- .writeTimeout(properties.getWriteTimeout())
- .connectTimeout(properties.getConnectTimeout());
- } else {
- okHttpBuilder = builderProvider.get();
- }
-
- InfluxDBClientOptions.Builder influxBuilder = InfluxDBClientOptions.builder()
- .url(properties.getUrl())
- .bucket(properties.getBucket())
- .org(properties.getOrg())
- .okHttpClient(okHttpBuilder);
-
- if (StringUtils.hasLength(properties.getToken())) {
- influxBuilder.authenticateToken(properties.getToken().toCharArray());
- } else if (StringUtils.hasLength(properties.getUsername()) && StringUtils.hasLength(properties.getPassword())) {
- influxBuilder.authenticate(properties.getUsername(), properties.getPassword().toCharArray());
- }
- return influxBuilder;
- }
-}
diff --git a/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2AutoConfiguration.java b/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2AutoConfiguration.java
deleted file mode 100644
index 8635d4f..0000000
--- a/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2AutoConfiguration.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package com.cnbm.influx.influx;
-
-import com.influxdb.client.InfluxDBClient;
-import com.influxdb.client.InfluxDBClientFactory;
-import com.influxdb.client.InfluxDBClientOptions;
-import org.springframework.beans.factory.ObjectProvider;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * {@link EnableAutoConfiguration Auto-configuration} for InfluxDB 2.
- *
- * @author Jakub Bednar (bednar@github) (06/05/2019 13:09)
- */
-@Configuration
-@ConditionalOnClass(InfluxDBClient.class)
-@EnableConfigurationProperties(InfluxDB2Properties.class)
-public class InfluxDB2AutoConfiguration extends AbstractInfluxDB2AutoConfiguration {
-
- public InfluxDB2AutoConfiguration(final InfluxDB2Properties properties,
- final ObjectProvider builderProvider) {
- super(properties, builderProvider.getIfAvailable());
- }
-
- @Bean
- @ConditionalOnProperty("influx.url")
- @ConditionalOnMissingBean(InfluxDBClient.class)
- public InfluxDBClient influxDBClient() {
-
- InfluxDBClientOptions.Builder influxBuilder = makeBuilder();
-
- return InfluxDBClientFactory.create(influxBuilder.build()).setLogLevel(properties.getLogLevel());
- }
-}
\ No newline at end of file
diff --git a/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2OkHttpClientBuilderProvider.java b/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2OkHttpClientBuilderProvider.java
deleted file mode 100644
index db6fb5a..0000000
--- a/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2OkHttpClientBuilderProvider.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package com.cnbm.influx.influx;
-
-import okhttp3.OkHttpClient;
-
-import java.util.function.Supplier;
-
-/**
- * Provide the {@link OkHttpClient.Builder OkHttpClient.Builder} to use to
- * customize the auto-configured {@link com.influxdb.client.InfluxDBClient} instance.
- *
- * @author Jakub Bednar (bednar@github) (06/05/2019 13:11)
- */
-@FunctionalInterface
-public interface InfluxDB2OkHttpClientBuilderProvider extends Supplier {
-
-}
\ No newline at end of file
diff --git a/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2Properties.java b/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2Properties.java
deleted file mode 100644
index 9e3f6dc..0000000
--- a/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2Properties.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package com.cnbm.influx.influx;
-
-import com.cnbm.influx.constant.Constant;
-import com.influxdb.LogLevel;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-import java.time.Duration;
-
-/**
- * Configuration properties for InfluxDB 2.
- *
- * @author Jakub Bednar (bednar@github) (06/05/2019 12:54)
- */
-@ConfigurationProperties(prefix = "influx")
-public class InfluxDB2Properties {
-
-// public InfluxDB2Properties{
-// this.bucket = Constant.bucket;
-// this.url = Constant.url;
-// this.org = Constant.org;
-// this.token = Constant.token;
-// this.username = Constant.username;
-// this.password = Constant.password;
-// }
-
- private static final int DEFAULT_TIMEOUT = 10_000;
-
- /**
- * URL to connect to InfluxDB.
- */
- private String url = Constant.url;
-
- /**
- * Username to use in the basic auth.
- */
- private String username = Constant.username;
-
- /**
- * Password to use in the basic auth.
- */
- private String password = Constant.password;
-
- /**
- * Token to use for the authorization.
- */
- private String token = Constant.token;
-
- /**
- * Default destination organization for writes and queries.
- */
- private String org = Constant.org;
-
- /**
- * Default destination bucket for writes.
- */
- private String bucket = Constant.bucket;
-
- /**
- * The log level for logging the HTTP request and HTTP response.
- */
- private LogLevel logLevel = LogLevel.NONE;
-
- /**
- * Read timeout for {@code OkHttpClient}.
- */
- private Duration readTimeout = Duration.ofMillis(DEFAULT_TIMEOUT);
-
- /**
- * Write timeout for {@code OkHttpClient}.
- */
- private Duration writeTimeout = Duration.ofMillis(DEFAULT_TIMEOUT);
-
- /**
- * Connection timeout for {@code OkHttpClient}.
- */
- private Duration connectTimeout = Duration.ofMillis(DEFAULT_TIMEOUT);
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(final String url) {
- this.url = url;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(final String username) {
- this.username = username;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(final String password) {
- this.password = password;
- }
-
- public String getToken() {
- return token;
- }
-
- public void setToken(final String token) {
- this.token = token;
- }
-
- public LogLevel getLogLevel() {
- return logLevel;
- }
-
- public void setLogLevel(final LogLevel logLevel) {
- this.logLevel = logLevel;
- }
-
- public String getOrg() {
- return org;
- }
-
- public void setOrg(final String org) {
- this.org = org;
- }
-
- public String getBucket() {
- return bucket;
- }
-
- public void setBucket(final String bucket) {
- this.bucket = bucket;
- }
-
- public Duration getReadTimeout() {
- return readTimeout;
- }
-
- public void setReadTimeout(final Duration readTimeout) {
- this.readTimeout = readTimeout;
- }
-
- public Duration getWriteTimeout() {
- return writeTimeout;
- }
-
- public void setWriteTimeout(final Duration writeTimeout) {
- this.writeTimeout = writeTimeout;
- }
-
- public Duration getConnectTimeout() {
- return connectTimeout;
- }
-
- public void setConnectTimeout(final Duration connectTimeout) {
- this.connectTimeout = connectTimeout;
- }
-}
\ No newline at end of file
diff --git a/ym-influx/src/main/resources/application-influx.yml b/ym-influx/src/main/resources/application-influx.yml
deleted file mode 100644
index 3c0f8bf..0000000
--- a/ym-influx/src/main/resources/application-influx.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-influx:
- url: http://192.168.0.170:8086 # URL to connect to InfluxDB.
- username: caixiang # Username to use in the basic auth.
- password: 251128856 # Password to use in the basic auth.
- token: lkBsC27QZr1W50BSPlGxpTqNNpwuUk5uz1dZZRPSPbCG5VmNDDUo8P3UkZIhGWwfJwkuz6ZGZ7Et4_KBaG3gHw== # Token to use for the authorization.
- org: qgs # Default destination organization for writes and queries.
- bucket: qgs-bucket # Default destination bucket for writes.
- logLevel: BODY # The log level for logging the HTTP request and HTTP response. (Default: NONE)
- readTimeout: 5s # Read timeout for OkHttpClient. (Default: 10s)
- writeTimeout: 5s # Write timeout for OkHttpClient. (Default: 10s)
- connectTimeout: 5s # Connection timeout for OkHttpClient. (Default: 10s)
-
- # management.health.influx.enabled=true # Whether to enable InfluxDB 2.x health check.
-management:
- health:
- influxdb:
- enabled: true
\ No newline at end of file
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;
+}