修改判读方案算法

This commit is contained in:
caixiang 2022-12-01 11:45:05 +08:00
parent 650e9a2324
commit 8bfcaaf429
18 changed files with 266 additions and 130 deletions

View File

@ -23,6 +23,8 @@ public class DataUtils {
}
public List<List<Date>> split(List<Date> value) {
List<List<Date>> result = new ArrayList<>();

View File

@ -1,14 +1,8 @@
import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.template.Event;
import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.InfluxDBClientFactory;
import com.influxdb.client.WriteApi;
import com.influxdb.client.domain.WritePrecision;
import com.influxdb.client.write.Point;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
/**
* @Desc: ""

View File

@ -1,21 +1,15 @@
package com.cnbm.influx;
import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.param.PageInfo;
import com.cnbm.influx.param.Range;
import com.cnbm.influx.param.Tag;
import com.cnbm.influx.template.Event;
import com.influxdb.client.*;
import com.influxdb.client.domain.WritePrecision;
import com.influxdb.client.write.Point;
import com.influxdb.query.FluxRecord;
import com.influxdb.query.FluxTable;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.*;
/**
@ -131,6 +125,8 @@ public class Main {
// |> filter(fn: (r) => r["argName"] == "arg4")
// |> drop(columns: ["transationId"])
// |> sort(columns: ["_time"], desc: true)
// |> timeShift(duration: 12h) //用于时区转换
// 取前10条数据
// |> limit(n: 10, offset: 0)
//
@ -142,31 +138,31 @@ public class Main {
QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setBucket("qgs-bucket");
queryDataParam.setRange(new Range(getDate().toInstant(),new Date().toInstant()));
queryDataParam.setMeasurement("WeightHeiHei");
queryDataParam.setTag(new Tag("argName","LTWeight"));
// queryDataParam.setDropedTagName("transationId");
List<String> dropNames = new ArrayList<>();
dropNames.add("transationId");
dropNames.add("inspectionSheetId");
dropNames.add("batchNum");
queryDataParam.setDropedTagNames(dropNames);
queryDataParam.setPageInfo(new PageInfo(1,10000));
List<FluxTable> tables = query(queryDataParam,influxDBClient);
List<FluxRecord> records1 = tables.get(0).getRecords();
// List<List<FluxRecord>> lists = Utils.fixedGroup(records1, 10);
for (FluxTable fluxTable : tables) {
List<FluxRecord> records = fluxTable.getRecords();
for (FluxRecord fluxRecord : records) {
Instant timms = fluxRecord.getTime();
System.out.println("time: "+fluxRecord.getTime() +" key:"+fluxRecord.getField()+" value: " + fluxRecord.getValueByKey("_value")+" measurement: " + fluxRecord.getMeasurement());
}
}
// QueryDataParam queryDataParam = new QueryDataParam();
// queryDataParam.setBucket("qgs-bucket");
// queryDataParam.setRange(new Range(getDate().toInstant(),new Date().toInstant()));
// queryDataParam.setMeasurement("WeightHeiHei");
// queryDataParam.setTag(new Tag("argName","LTWeight"));
//// queryDataParam.setDropedTagName("transationId");
// List<String> dropNames = new ArrayList<>();
// dropNames.add("transationId");
// dropNames.add("inspectionSheetId");
// dropNames.add("batchNum");
// queryDataParam.setDropedTagNames(dropNames);
// queryDataParam.setPageInfo(new PageInfo(1,10000));
//
// List<FluxTable> tables = query(queryDataParam,influxDBClient);
// List<FluxRecord> records1 = tables.get(0).getRecords();
//// List<List<FluxRecord>> lists = Utils.fixedGroup(records1, 10);
//
// for (FluxTable fluxTable : tables) {
// List<FluxRecord> records = fluxTable.getRecords();
// for (FluxRecord fluxRecord : records) {
// Instant timms = fluxRecord.getTime();
// System.out.println("time: "+fluxRecord.getTime() +" key:"+fluxRecord.getField()+" value: " + fluxRecord.getValueByKey("_value")+" measurement: " + fluxRecord.getMeasurement());
//
// }
// }
influxDBClient.close();
}
@ -221,4 +217,6 @@ public class Main {
return tables;
}
}

View File

@ -77,12 +77,24 @@ public enum InfluxClient {
}
public void insert(Event event, String measurement){
Point point = Point.measurement(measurement)
.addTag("transationId", event.getTransationId())
.addTag("inspectionSheetId", event.getInspectionSheetId())
.addTag("argName", event.getArgName())
.addField("argValue", event.getArgValue())
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
Point point = null;
if(event.getBatchNum()==null){
point = Point.measurement(measurement)
.addTag("transationId", event.getTransationId())
.addTag("inspectionSheetId", event.getInspectionSheetId())
.addTag("argName", event.getArgName())
.addField("argValue", event.getArgValue())
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
}else {
point = Point.measurement(measurement)
.addTag("transationId", event.getTransationId())
//.addTag("inspectionSheetId", event.getInspectionSheetId())
.addTag("batchNum", event.getBatchNum().toString())
.addTag("argName", event.getArgName())
.addField("argValue", event.getArgValue())
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
}
writeApi.writePoint(point);
}
@ -103,7 +115,7 @@ public enum InfluxClient {
}else {
point = Point.measurement(measurement)
.addTag("transationId", event.getTransationId())
.addTag("inspectionSheetId", event.getInspectionSheetId())
//.addTag("inspectionSheetId", event.getInspectionSheetId())
.addTag("batchNum", event.getBatchNum().toString())
.addTag("argName", event.getArgName())
.addField("argValue", event.getArgValue())
@ -130,6 +142,8 @@ public enum InfluxClient {
flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
//调整时区查询出的结果 +8个小时
flux += "|> timeShift(duration: 8h)";
for(String dropName:dropedTagNames){
flux += "|> drop(columns: [\""+dropName+"\"])";
}
@ -154,6 +168,7 @@ public enum InfluxClient {
flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
flux += "|> timeShift(duration: 8h)";
flux += "|> group(columns: [\""+groupName+"\"], mode: \"except\")";
for(String dropName:dropedTagNames){
flux += "|> drop(columns: [\""+dropName+"\"])";
@ -178,6 +193,7 @@ public enum InfluxClient {
flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
flux += "|> timeShift(duration: 8h)";
for(String dropName:dropedTagNames){
flux += "|> drop(columns: [\""+dropName+"\"])";
}
@ -205,4 +221,4 @@ public enum InfluxClient {
// }
return queryApi.query(flux);
}
}
}

View File

@ -0,0 +1,78 @@
package com.cnbm.influx.config;
import com.cnbm.common.spc.util.DataUtils;
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.InfluxDBClientFactory;
import com.influxdb.client.WriteApi;
import com.influxdb.client.domain.WritePrecision;
import com.influxdb.client.write.Point;
import com.influxdb.query.FluxTable;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2022/11/30 16:56
*/
public class Main {
public static void main(String[] args) throws InterruptedException {
//方式一
// char[] token = "lkBsC27QZr1W50BSPlGxpTqNNpwuUk5uz1dZZRPSPbCG5VmNDDUo8P3UkZIhGWwfJwkuz6ZGZ7Et4_KBaG3gHw==".toCharArray();
// String org = "qgs";
// String bucket = "qgs-bucket";
// InfluxDBClient influxDBClient = InfluxDBClientFactory.create("http://192.168.0.170:8086", token, org, bucket);
//
//
// WriteApi writeApi = influxDBClient.makeWriteApi();
//
//
//
// Point point2 = Point.measurement("FORUPDATE")
// .addTag("transationId", "222312")
// .addTag("argName", "forUpdate")
// .addField("argValue", 4D)
// .time(Instant.now().toEpochMilli(), WritePrecision.MS);
// List<Point> list = new ArrayList<>();
// list.add(point2);
//
// writeApi.writePoints(list);
//方式二
Event event = new Event();
event.setTime(new Date().toInstant());
event.setTransationId("2344");
event.setBatchNum("22");
event.setArgName("forUpdate");
event.setArgValue("124.1");
InfluxClient.Client.insert(event,"FORUPDATE");
// Thread.sleep(50000);
//
// event.setArgValue(333.3);
// InfluxClient.Client.insert(event,"FORUPDATE");
QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setBucket("qgs-bucket");
queryDataParam.setMeasurement("FORUPDATE");
List<String> dropNames = new ArrayList<>();
dropNames.add("transationId");
dropNames.add("inspectionSheetId");
queryDataParam.setDropedTagNames(dropNames);
queryDataParam.setTag(new Tag("argName","forUpdate"));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(),DataUtils.getAfterDate(999).toInstant()));
queryDataParam.setPageInfo(new PageInfo(1,10));
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
System.out.println();
}
}

View File

@ -1,8 +1,6 @@
package com.cnbm.influx.controller;
import com.cnbm.common.spc.util.DataUtils;
import com.cnbm.common.utils.Result;
import com.cnbm.common.vo.R;
import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.param.PageInfo;
import com.cnbm.influx.param.QueryDataParam;
@ -19,7 +17,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.DateFormat;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
@ -40,11 +37,19 @@ public class S7DemoController {
for(int i=0;i<999;i++){
Thread.sleep(10);
Event event = new Event();
event.setTime(Instant.now());
event.setTime(DataUtils.getAfterDate(i).toInstant());
event.setTransationId("asas"+i);
event.setArgName("LTWeight");
Double d = r.nextDouble() * 2.5 + 66;
event.setArgValue(d);
event.setArgName("failDay");
int i1 = r.nextInt(10);
if(i1<4){
event.setArgValue("0");
}else {
event.setArgValue("1");
}
// Double d = r.nextDouble() * 2.5 + 66;
// event.setArgValue(d);
list.add(event);
}
@ -63,8 +68,8 @@ public class S7DemoController {
event.setTransationId("forbatch"+i);
event.setArgName("LTWeight");
Double d = r.nextDouble() * 2.5 + 66;
event.setArgValue(d);
event.setBatchNum(4);
event.setArgValue(d.toString());
event.setBatchNum(4+"");
event.setInspectionSheetId(i+"");
list.add(event);
}
@ -86,14 +91,44 @@ public class S7DemoController {
event.setArgName("LTWeight");
Double d = r.nextDouble() * 2.5 + 66;
event.setInspectionSheetId(j+"");
event.setArgValue(d);
event.setBatchNum(i);
event.setArgValue(d.toString());
event.setBatchNum(i+"");
list.add(event);
}
}
InfluxClient.Client.batchInsert(list,"WeightHei");
}
@PostMapping("/insertAndQuery")
public void insertAndQuery() throws InterruptedException {
Event event = new Event();
event.setTime(new Date().toInstant());
event.setTransationId("2344");
event.setBatchNum("22");
event.setArgName("forUpdate");
event.setArgValue("124.1");
InfluxClient.Client.insert(event,"FORUPDATEEEE");
// Thread.sleep(50000);
//
// event.setArgValue(333.3);
// InfluxClient.Client.insert(event,"FORUPDATE");
QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setBucket("qgs-bucket");
queryDataParam.setMeasurement("FORUPDATEEEE");
List<String> dropNames = new ArrayList<>();
dropNames.add("transationId");
dropNames.add("inspectionSheetId");
queryDataParam.setDropedTagNames(dropNames);
queryDataParam.setTag(new Tag("argName","forUpdate"));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(),DataUtils.getAfterDate(999).toInstant()));
queryDataParam.setPageInfo(new PageInfo(1,10));
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
System.out.println();
}
@PostMapping("/insertBatchJYDForTest")
@ -109,13 +144,13 @@ public class S7DemoController {
event.setArgName("LostDays");
int i1 = r.nextInt(10);
if(i1<4){
event.setArgValue(new Double(0));
event.setArgValue("0");
}else {
event.setArgValue(new Double(1));
event.setArgValue("1");
}
event.setInspectionSheetId(i+"");
event.setBatchNum(i);
event.setBatchNum(i+"");
list.add(event);
}
InfluxClient.Client.batchInsert(list,"Weights");
@ -139,10 +174,10 @@ public class S7DemoController {
// event.setArgValue(new Double(1));
// }
Double d = r.nextDouble() * 2.5 + 66;
event.setArgValue(d);
event.setArgValue(d.toString());
event.setInspectionSheetId(i+"");
event.setBatchNum(i);
event.setBatchNum(i+"");
list.add(event);
}
InfluxClient.Client.batchInsert(list,"Weights");
@ -227,7 +262,7 @@ public class S7DemoController {
event.setTime(Instant.now());
event.setTransationId("asasd11");
event.setArgName("argName11");
event.setArgValue(900001d);
event.setArgValue("900001");
Point asProcessCompleteEvent = insert(event, "ASProcessCompleteEvent");
InfluxClient.Client.insert(event,"ASProcessCompleteEvent");
}

View File

@ -17,14 +17,18 @@ public class Event {
private Instant time;
private String inspectionSheetId;
private String transationId;
private String argName;
private Double argValue;
private String argValue;
//批次号可选的
private Integer batchNum;
private String BatchNum;
private String InspectionSheetId;
public Event() {
BatchNum = "1";
InspectionSheetId = "1";
}
}

View File

@ -70,8 +70,8 @@ public class ProcessInspectionController {
XbarSGraphData xbarSGraphData = new XbarSGraphData(
meanStandardDeviationGraph.getMsdGraphEntity()==null?null:meanStandardDeviationGraph.getMsdGraphEntity(),
meanStandardDeviationGraph.getXbarCL()==null?null:meanStandardDeviationGraph.getXbarCL(),
meanStandardDeviationGraph.getSCL()==null?null:meanStandardDeviationGraph.getSCL(),
meanStandardDeviationGraph.getXbarCL()==null?null:new ControlLimitDetail(meanStandardDeviationGraph.getXbarCL().getUCL(), meanStandardDeviationGraph.getXbarCL().getCL(), meanStandardDeviationGraph.getXbarCL().getLCL()),
meanStandardDeviationGraph.getSCL()==null?null:new ControlLimitDetail(meanStandardDeviationGraph.getSCL().getUCL(), meanStandardDeviationGraph.getSCL().getCL(), meanStandardDeviationGraph.getSCL().getLCL()),
meanStandardDeviationGraph.getSpecificationLimit()==null?null:meanStandardDeviationGraph.getSpecificationLimit(),
meanStandardDeviationGraph.getProcessCapacity()==null?null:meanStandardDeviationGraph.getProcessCapacity(),
(meanStandardDeviationGraph.getXigma()==null||meanStandardDeviationGraph.getTotalXigma()==null)?null:new StandardDiviation(meanStandardDeviationGraph.getXigma(),meanStandardDeviationGraph.getTotalXigma())
@ -112,8 +112,6 @@ public class ProcessInspectionController {
meanRGraph.getSpecificationLimit()==null?null:meanRGraph.getSpecificationLimit(),
meanRGraph.getProcessCapacity()==null?null:meanRGraph.getProcessCapacity(),
(meanRGraph.getXigma()==null||meanRGraph.getTotalXigma()==null)?null:new StandardDiviation(meanRGraph.getXigma(),meanRGraph.getTotalXigma())
);
return R.ok("成功",xbarSGraphData);
@ -142,8 +140,8 @@ public class ProcessInspectionController {
XMRGraphData xmrGraphData = new XMRGraphData(
xmrGraph.getXmrGraphEntity()==null?null:xmrGraph.getXmrGraphEntity(),
xmrGraph.getXCL()==null?null:xmrGraph.getXCL(),
xmrGraph.getRSCL()==null?null:xmrGraph.getRSCL(),
xmrGraph.getXCL()==null?null:new ControlLimitDetail(xmrGraph.getXCL().getUCL(), xmrGraph.getXCL().getCL(), xmrGraph.getXCL().getLCL()),
xmrGraph.getRSCL()==null?null:new ControlLimitDetail(xmrGraph.getRSCL().getUCL(), xmrGraph.getRSCL().getCL(), xmrGraph.getRSCL().getLCL()),
xmrGraph.getSpecificationLimit()==null?null:xmrGraph.getSpecificationLimit(),
xmrGraph.getProcessCapacity()==null?null:xmrGraph.getProcessCapacity(),
(xmrGraph.getXigma()==null||xmrGraph.getTotalXigma()==null)?null:new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma())
@ -198,14 +196,14 @@ public class ProcessInspectionController {
productFeatures.setUsl(new Float(66));
productFeatures.setLsl(new Float(69));
productFeatures.setName("LTWeight");
productFeatures.setName("failDay");
NPGraph npGraph = new NPGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
queryDataParam.setTimeType(1);
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(9999).toInstant(), DataUtils.getAfterDate(9999).toInstant() ));
queryDataParam.setTimeType(2);
npGraph.initialDate(queryDataParam);
NPGraphData npGraph1 = new NPGraphData(
@ -328,8 +326,8 @@ public class ProcessInspectionController {
XbarSGraphData xbarSGraphData = new XbarSGraphData(
meanStandardDeviationGraph.getMsdGraphEntity()==null?null:meanStandardDeviationGraph.getMsdGraphEntity(),
meanStandardDeviationGraph.getXbarCL()==null?null:meanStandardDeviationGraph.getXbarCL(),
meanStandardDeviationGraph.getSCL()==null?null:meanStandardDeviationGraph.getSCL(),
meanStandardDeviationGraph.getXbarCL()==null?null:new ControlLimitDetail(meanStandardDeviationGraph.getXbarCL().getUCL(), meanStandardDeviationGraph.getXbarCL().getCL(), meanStandardDeviationGraph.getXbarCL().getLCL()),
meanStandardDeviationGraph.getSCL()==null?null:new ControlLimitDetail(meanStandardDeviationGraph.getSCL().getUCL(), meanStandardDeviationGraph.getSCL().getCL(), meanStandardDeviationGraph.getSCL().getLCL()),
meanStandardDeviationGraph.getSpecificationLimit()==null?null:meanStandardDeviationGraph.getSpecificationLimit(),
meanStandardDeviationGraph.getProcessCapacity()==null?null:meanStandardDeviationGraph.getProcessCapacity(),
(meanStandardDeviationGraph.getXigma()==null||meanStandardDeviationGraph.getTotalXigma()==null)?null:new StandardDiviation(meanStandardDeviationGraph.getXigma(),meanStandardDeviationGraph.getTotalXigma())
@ -389,8 +387,8 @@ public class ProcessInspectionController {
XMRGraphData xmrGraphData = new XMRGraphData(
xmrGraph.getXmrGraphEntity()==null?null:xmrGraph.getXmrGraphEntity(),
xmrGraph.getXCL()==null?null:xmrGraph.getXCL(),
xmrGraph.getRSCL()==null?null:xmrGraph.getRSCL(),
xmrGraph.getXCL()==null?null:new ControlLimitDetail(xmrGraph.getXCL().getUCL(), xmrGraph.getXCL().getCL(), xmrGraph.getXCL().getLCL()),
xmrGraph.getRSCL()==null?null:new ControlLimitDetail(xmrGraph.getRSCL().getUCL(), xmrGraph.getRSCL().getCL(), xmrGraph.getRSCL().getLCL()),
xmrGraph.getSpecificationLimit()==null?null:xmrGraph.getSpecificationLimit(),
xmrGraph.getProcessCapacity()==null?null:xmrGraph.getProcessCapacity(),
(xmrGraph.getXigma()==null||xmrGraph.getTotalXigma()==null)?null:new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma())

View File

@ -3,6 +3,7 @@ package com.cnbm.processInspection.dto;
import com.cnbm.common.spc.math.StandardDiviation;
import com.cnbm.processInspection.graphAnalyzed.forMeterage.xmr.XMRGraphEntity;
import com.cnbm.qualityPlanning.entity.ControlLimit;
import com.cnbm.qualityPlanning.entity.ControlLimitDetail;
import com.cnbm.qualityPlanning.entity.ProcessCapability;
import com.cnbm.qualityPlanning.entity.SpecificationLimit;
import io.swagger.annotations.ApiModel;
@ -20,9 +21,9 @@ public class XMRGraphData {
@ApiModelProperty(value = "控制图list数据")
private XMRGraphEntity xmrGraphEntity;
@ApiModelProperty(value = "xbar控制图 控制限")
private ControlLimit XBarCL;
private ControlLimitDetail XBarCL;
@ApiModelProperty(value = "R控制图 控制限")
private ControlLimit RCL;
private ControlLimitDetail RCL;
@ApiModelProperty(value = "工艺规格限")
private SpecificationLimit SL;
@ -34,7 +35,7 @@ public class XMRGraphData {
private StandardDiviation standardDiviation;
public XMRGraphData(XMRGraphEntity xmrGraphEntity, ControlLimit xBarCL, ControlLimit rCL, SpecificationLimit sl, ProcessCapability processCapability, StandardDiviation standardDiviation){
public XMRGraphData(XMRGraphEntity xmrGraphEntity, ControlLimitDetail xBarCL, ControlLimitDetail rCL, SpecificationLimit sl, ProcessCapability processCapability, StandardDiviation standardDiviation){
this.xmrGraphEntity = xmrGraphEntity;
this.XBarCL = xBarCL;
this.RCL = rCL;

View File

@ -3,6 +3,7 @@ package com.cnbm.processInspection.dto;
import com.cnbm.common.spc.math.StandardDiviation;
import com.cnbm.processInspection.graphAnalyzed.forMeterage.ms.MSDGraphEntity;
import com.cnbm.qualityPlanning.entity.ControlLimit;
import com.cnbm.qualityPlanning.entity.ControlLimitDetail;
import com.cnbm.qualityPlanning.entity.ProcessCapability;
import com.cnbm.qualityPlanning.entity.SpecificationLimit;
import io.swagger.annotations.ApiModel;
@ -20,9 +21,9 @@ public class XbarSGraphData {
@ApiModelProperty(value = "控制图list数据")
private MSDGraphEntity msdGraphEntity;
@ApiModelProperty(value = "xbar控制图 控制限")
private ControlLimit XBarCL;
private ControlLimitDetail XBarCL;
@ApiModelProperty(value = "s控制图 控制限")
private ControlLimit SCL;
private ControlLimitDetail SCL;
@ApiModelProperty(value = "工艺规格限")
private SpecificationLimit SL;
@ -34,7 +35,7 @@ public class XbarSGraphData {
private StandardDiviation standardDiviation;
public XbarSGraphData(MSDGraphEntity msdGraphEntity,ControlLimit xBarCL,ControlLimit sCL,SpecificationLimit sl,ProcessCapability processCapability,StandardDiviation standardDiviation){
public XbarSGraphData(MSDGraphEntity msdGraphEntity,ControlLimitDetail xBarCL,ControlLimitDetail sCL,SpecificationLimit sl,ProcessCapability processCapability,StandardDiviation standardDiviation){
this.msdGraphEntity = msdGraphEntity;
this.XBarCL = xBarCL;
this.SCL = sCL;

View File

@ -8,7 +8,6 @@ import com.cnbm.influx.param.QueryDataGroupByTimeParam;
import com.cnbm.influx.param.Tag;
import com.cnbm.qualityPlanning.entity.CPoint;
import com.cnbm.qualityPlanning.entity.ControlLimit;
import com.cnbm.qualityPlanning.entity.PPoint;
import com.cnbm.qualityPlanning.entity.SpecificationLimit;
import com.influxdb.query.FluxRecord;
import com.influxdb.query.FluxTable;

View File

@ -1,22 +1,15 @@
package com.cnbm.processInspection.graphAnalyzed.forCount.np;
import com.cnbm.basic.entity.ProductFeatures;
import com.cnbm.common.spc.math.StandardDiviation;
import com.cnbm.common.spc.util.DataUtils;
import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.constant.Constant;
import com.cnbm.influx.param.QueryDataGroupByTimeParam;
import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.param.Tag;
import com.cnbm.processInspection.controlCoefficientConstant.XBarRCoefficients;
import com.cnbm.processInspection.dto.InterpretationListArg;
import com.cnbm.processInspection.dto.InterpretationListArgForCount;
import com.cnbm.qualityPlanning.common.StatisticalControlledTest;
import com.cnbm.qualityPlanning.entity.*;
import com.influxdb.query.FluxRecord;
import com.influxdb.query.FluxTable;
import lombok.Data;
import org.omg.CORBA.PRIVATE_MEMBER;
import java.util.ArrayList;
import java.util.List;

View File

@ -7,7 +7,6 @@ import com.cnbm.influx.constant.Constant;
import com.cnbm.influx.param.QueryDataGroupByTimeParam;
import com.cnbm.influx.param.Tag;
import com.cnbm.qualityPlanning.entity.ControlLimit;
import com.cnbm.qualityPlanning.entity.NPPoint;
import com.cnbm.qualityPlanning.entity.PPoint;
import com.cnbm.qualityPlanning.entity.SpecificationLimit;
import com.influxdb.query.FluxRecord;
@ -15,7 +14,6 @@ import com.influxdb.query.FluxTable;
import lombok.Data;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**

View File

@ -7,7 +7,6 @@ import com.cnbm.influx.constant.Constant;
import com.cnbm.influx.param.QueryDataGroupByTimeParam;
import com.cnbm.influx.param.Tag;
import com.cnbm.qualityPlanning.entity.ControlLimit;
import com.cnbm.qualityPlanning.entity.PPoint;
import com.cnbm.qualityPlanning.entity.SpecificationLimit;
import com.cnbm.qualityPlanning.entity.UPoint;
import com.influxdb.query.FluxRecord;

View File

@ -3,8 +3,6 @@ package com.cnbm.processInspection.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.basic.dto.ProductFactoryRelationDTO;
import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.basic.entity.Machine;
import com.cnbm.basic.entity.Product;
import com.cnbm.basic.entity.Shift;
@ -16,9 +14,6 @@ import com.cnbm.basic.service.impl.WorkingProcedureServiceImpl;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.param.Range;
@ -28,7 +23,6 @@ import com.cnbm.processInspection.dto.InspectionSheetDTO;
import com.cnbm.processInspection.entity.InspectionSheet;
import com.cnbm.processInspection.mapper.InspectionSheetMapper;
import com.cnbm.processInspection.service.IInspectionSheetService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.influxdb.query.FluxTable;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -193,7 +187,7 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
event.setTime(time);
event.setArgName(argName);
if(!Objects.equals(argValue, "") && argValue != null ){
event.setArgValue(argValue);
event.setArgValue(argValue.toString());
}
return event;
}

View File

@ -624,6 +624,10 @@ public class StatisticalControlledTest {
*
* */
private static void rule5Core(List<Point> data,Integer m,Integer n){
if(data.size() == 0 || data.size() == 1){
return;
}
//开始
Stack<Point> stack = new Stack<Point>();
int seqNum = 0;
@ -655,6 +659,8 @@ public class StatisticalControlledTest {
seqNum++;
}
//判断最后一次情况
Integer nowi = i>= data.size()?(i-1):i;
i = nowi;
Boolean sequence = ((stack.peek().getPosition()+1) == data.get(i).getPosition());
if( sequence ){
stack.push(data.get(i));
@ -793,6 +799,9 @@ public class StatisticalControlledTest {
// return result;
// }
private static void rule6Core(List<Point> data,Integer m,Integer n){
if(data.size() == 0 || data.size() == 1){
return;
}
//开始
Stack<Point> stack = new Stack<Point>();
int seqNum = 0;
@ -824,6 +833,8 @@ public class StatisticalControlledTest {
seqNum++;
}
//判断最后一次情况
Integer nowi = i>= data.size()?(i-1):i;
i = nowi;
Boolean sequence = ((stack.peek().getPosition()+1) == data.get(i).getPosition());
if( sequence ){
stack.push(data.get(i));
@ -951,6 +962,9 @@ public class StatisticalControlledTest {
// return result;
// }
private static void rule7Core(List<Point> data,Integer n){
if(data.size() == 0 || data.size() == 1){
return;
}
//开始
Stack<Point> stack = new Stack<Point>();
int i = 0;
@ -980,6 +994,8 @@ public class StatisticalControlledTest {
}
//判断最后一次情况
Integer nowi = i>= data.size()?(i-1):i;
i = nowi;
Boolean sequence = ((stack.peek().getPosition()+1) == data.get(i).getPosition());
if( sequence ){
stack.push(data.get(i));
@ -1101,6 +1117,9 @@ public class StatisticalControlledTest {
// return result;
// }
private static void rule8Core(List<Point> data,Integer n){
if(data.size() == 0 || data.size() == 1){
return;
}
//开始
Stack<Point> stack = new Stack<Point>();
int i = 0;
@ -1130,6 +1149,8 @@ public class StatisticalControlledTest {
}
//判断最后一次情况
Integer nowi = i>= data.size()?(i-1):i;
i = nowi;
Boolean sequence = ((stack.peek().getPosition()+1) == data.get(i).getPosition());
if( sequence ){
stack.push(data.get(i));

View File

@ -45,7 +45,10 @@ public class MainRule5TEST {
seqNum++;
}
//判断最后一次情况
Boolean sequence = ((stack.peek().getPosition()+1) == upforMarkKey.get(i).getPosition());
Integer nowi = i>= upforMarkKey.size()?(i-1):i;
i = nowi;
Integer c = (stack.peek().getPosition()+1);
Boolean sequence = ( c == upforMarkKey.get(i).getPosition());
if( sequence ){
stack.push(upforMarkKey.get(i));
seqNum++;
@ -92,19 +95,19 @@ public class MainRule5TEST {
upforMarkKey.add(point1);
upforMarkKey.add(point2);
upforMarkKey.add(point3);
upforMarkKey.add(point4);
upforMarkKey.add(point5);
upforMarkKey.add(point6);
upforMarkKey.add(point7);
upforMarkKey.add(point8);
upforMarkKey.add(point9);
upforMarkKey.add(point10);
upforMarkKey.add(point11);
upforMarkKey.add(point12);
upforMarkKey.add(point13);
upforMarkKey.add(point14);
// upforMarkKey.add(point2);
// upforMarkKey.add(point3);
// upforMarkKey.add(point4);
// upforMarkKey.add(point5);
// upforMarkKey.add(point6);
// upforMarkKey.add(point7);
// upforMarkKey.add(point8);
// upforMarkKey.add(point9);
// upforMarkKey.add(point10);
// upforMarkKey.add(point11);
// upforMarkKey.add(point12);
// upforMarkKey.add(point13);
// upforMarkKey.add(point14);
rule5Core(upforMarkKey);

View File

@ -1,6 +1,8 @@
package com.cnbm.qualityPlanning.entity;
import cn.hutool.core.util.NumberUtil;
import lombok.Data;
import org.springframework.util.NumberUtils;
/**
* @Desc: ""
@ -27,19 +29,19 @@ public class ControlLimitDetail {
this.CL = CL;
this.LCL = LCL;
Double agv1 = (this.UCL-this.CL)/3;
this.UC[0] = this.CL;
this.UC[1] = this.CL+agv1;
this.UB[0] = this.UC[1];
this.UB[1] = this.UB[0]+agv1;
this.UA[0] = this.UB[1];
this.UA[1] = this.UA[0]+agv1;
this.UC[0] = NumberUtil.round(this.CL,4).doubleValue();
this.UC[1] = NumberUtil.round(this.CL+agv1,4).doubleValue();
this.UB[0] = NumberUtil.round(this.UC[1],4).doubleValue();
this.UB[1] = NumberUtil.round(this.UB[0]+agv1,4).doubleValue();
this.UA[0] = NumberUtil.round(this.UB[1],4).doubleValue();
this.UA[1] = NumberUtil.round(this.UA[0]+agv1,4).doubleValue();
Double agv2 = (this.CL-this.LCL)/3;
this.LC[0] = this.CL-agv2;
this.LC[1] = this.CL;
this.LB[0] = this.LC[0]-agv2;
this.LB[1] = this.LC[0];
this.LA[0] = this.LB[0]-agv2;
this.LA[1] = this.LB[0];
this.LC[0] = NumberUtil.round(this.CL-agv2,4).doubleValue();
this.LC[1] = NumberUtil.round(this.CL,4).doubleValue();
this.LB[0] = NumberUtil.round(this.LC[0]-agv2,4).doubleValue();
this.LB[1] = NumberUtil.round(this.LC[0],4).doubleValue();
this.LA[0] = NumberUtil.round(this.LB[0]-agv2,4).doubleValue();
this.LA[1] = NumberUtil.round(this.LB[0],4).doubleValue();
}
}