Compare commits

...

7 Commits

Author SHA1 Message Date
caixiang
74aaf857f0 mark 2023-01-06 16:21:09 +08:00
caixiang
353471b1f7 Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC 2023-01-04 09:14:04 +08:00
caixiang
23aa6d5f89 commit for pull 2023-01-04 09:13:34 +08:00
caixiang
8b14c369fb Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC 2023-01-03 16:29:29 +08:00
caixiang
c1d37a3dbc commit for pull 2023-01-03 16:29:18 +08:00
caixiang
9b545a9a03 Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC
# Conflicts:
#	ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java
2023-01-03 09:24:49 +08:00
caixiang
c75c89cab9 commit for pull 2023-01-03 09:24:12 +08:00
13 changed files with 238 additions and 114 deletions

View File

@ -113,13 +113,13 @@ public enum InfluxClient {
Point point = null; Point point = null;
if(event.getSampleNumber()==null){ if(event.getSampleNumber()==null){
point = Point.measurement(measurement) point = Point.measurement(measurement)
.addTag("transationId", event.getTransationId()) .addTag("transationId", event.getTransationId()==null ? "" : event.getTransationId())
.addTag("argName", event.getArgName()) .addTag("argName", event.getArgName())
.addField("argValue", event.getArgValue()) .addField("argValue", event.getArgValue())
.time(event.getTime().toEpochMilli(), WritePrecision.MS); .time(event.getTime().toEpochMilli(), WritePrecision.MS);
}else { }else {
point = Point.measurement(measurement) point = Point.measurement(measurement)
.addTag("transationId", event.getTransationId()) .addTag("transationId", event.getTransationId()==null ? "" : event.getTransationId())
.addTag("inspectionSheetId", event.getInspectionSheetId()) .addTag("inspectionSheetId", event.getInspectionSheetId())
// .addTag("batchNum", event.getBatchNum()) // .addTag("batchNum", event.getBatchNum())
@ -141,13 +141,18 @@ public enum InfluxClient {
public List<FluxTable> query(QueryDataParam param){ public List<FluxTable> query(QueryDataParam param){
String measurement = param.getMeasurement(); String measurement = param.getMeasurement();
List<String> dropedTagNames = param.getDropedTagNames();
Range range = param.getRange();
String bucket = param.getBucket(); String bucket = param.getBucket();
PageInfo pageInfo = param.getPageInfo();
String flux = "from(bucket:\""+bucket+"\")"; String flux = "from(bucket:\""+bucket+"\")";
if(param.getRange() != null){
Range range = param.getRange();
flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")"; flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
}
flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")"; flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
if(param.getTags()!=null && param.getTags().size()>0){ if(param.getTags()!=null && param.getTags().size()>0){
@ -161,12 +166,16 @@ public enum InfluxClient {
//调整时区查询出的结果 +8个小时 //调整时区查询出的结果 +8个小时
//flux += "|> timeShift(duration: 8h)"; //flux += "|> timeShift(duration: 8h)";
if(param.getDropedTagNames() != null){
List<String> dropedTagNames = param.getDropedTagNames();
for(String dropName:dropedTagNames){ for(String dropName:dropedTagNames){
flux += "|> drop(columns: [\""+dropName+"\"])"; flux += "|> drop(columns: [\""+dropName+"\"])";
} }
}
flux += "|> sort(columns: [\"_time\"], desc: true)"; flux += "|> sort(columns: [\"_time\"], desc: true)";
if(pageInfo!=null){ if(param.getPageInfo() != null){
PageInfo pageInfo = param.getPageInfo();
flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")"; flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")";
} }
return queryApi.query(flux); return queryApi.query(flux);

View File

@ -0,0 +1,25 @@
package com.cnbm.influx.controller;
import com.cnbm.influx.template.Event;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.Instant;
import java.util.List;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2022/12/9 15:53
*/
@Data
@ApiModel(value = "Events")
public class InfluxData {
@ApiModelProperty("ID (transationId、argName、argValue、time 必填)")
private List<Event> events;
@ApiModelProperty("measurement(相当于mysql 中的table一台工艺设备一个measurement)")
private String measurement;
}

View File

@ -0,0 +1,49 @@
package com.cnbm.influx.controller;
import com.cnbm.common.spc.util.DataUtils;
import com.cnbm.common.utils.Result;
import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.constant.Constant;
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.query.FluxTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.Instant;
import java.util.*;
@RestController
@RequestMapping("/spcData")
public class SPCController {
private static final Logger logger = LoggerFactory.getLogger(SPCController.class);
@PostMapping("/getData")
public Result getData(@RequestBody QueryDataParam param) throws InterruptedException {
List<FluxTable> query = InfluxClient.Client.query(param);
return new Result<List<FluxTable>>().ok(query);
}
@PostMapping("/insertOrUpdate")
public Result insertBatchForNew(@RequestBody InfluxData data){
if(data.getEvents()== null || data.getMeasurement()== null){
return new Result().error("传入events 或者 measurement为空");
}
try {
InfluxClient.Client.batchInsert(data.getEvents(),data.getMeasurement());
}catch (Exception e){
return new Result().ok("influxdb 操作异常");
}
return new Result().error("成功");
}
}

View File

@ -1,10 +1,12 @@
package com.cnbm.influx.controller; package com.cnbm.influx.controller;
import com.cnbm.influx.template.Event;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.time.Instant; import java.time.Instant;
import java.util.List;
/** /**
* @Desc: "" * @Desc: ""
@ -14,7 +16,9 @@ import java.time.Instant;
@Data @Data
@ApiModel(value = "检验样本 DTO对象") @ApiModel(value = "检验样本 DTO对象")
public class TIMETest { public class TIMETest {
@ApiModelProperty(value = "时间2")
@ApiModelProperty(value = "Events")
private Instant time2; private Instant time2;
} }

View File

@ -147,49 +147,48 @@ public class ProcessInspectionController {
xmrGraph.getSpecificationLimit()==null?null:xmrGraph.getSpecificationLimit(), xmrGraph.getSpecificationLimit()==null?null:xmrGraph.getSpecificationLimit(),
xmrGraph.getProcessCapacity()==null?null:xmrGraph.getProcessCapacity(), xmrGraph.getProcessCapacity()==null?null:xmrGraph.getProcessCapacity(),
(xmrGraph.getXigma()==null||xmrGraph.getTotalXigma()==null)?null:new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma()) (xmrGraph.getXigma()==null||xmrGraph.getTotalXigma()==null)?null:new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma())
); );
return R.ok("成功",xmrGraphData); return R.ok("成功",xmrGraphData);
} }
@PostMapping("/getBatchs") // @PostMapping("/getBatchs")
public R<List<String>> getBatchs() throws InterruptedException { // public R<List<String>> getBatchs() throws InterruptedException {
List<Event> list = new ArrayList<>(); // List<Event> list = new ArrayList<>();
Random r = new Random(); // Random r = new Random();
Instant instant = DataUtils.getBeforeDate(400).toInstant(); // Instant instant = DataUtils.getBeforeDate(400).toInstant();
List<String> res = new ArrayList<>(); // List<String> res = new ArrayList<>();
//
QueryDataParam queryDataParam = new QueryDataParam(); // QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setBucket("qgs-bucket"); // queryDataParam.setBucket("qgs-bucket");
queryDataParam.setMeasurement("Weight"); // queryDataParam.setMeasurement("Weight");
List<String> dropNames = new ArrayList<>(); // List<String> dropNames = new ArrayList<>();
dropNames.add("transationId"); // dropNames.add("transationId");
dropNames.add("_value"); // dropNames.add("_value");
dropNames.add("_start"); // dropNames.add("_start");
dropNames.add("_stop"); // dropNames.add("_stop");
dropNames.add("_time"); // dropNames.add("_time");
dropNames.add("_field"); // dropNames.add("_field");
dropNames.add("_measurement"); // dropNames.add("_measurement");
dropNames.add("inspectionSheetId"); // dropNames.add("inspectionSheetId");
dropNames.add("argName"); // dropNames.add("argName");
queryDataParam.setDropedTagNames(dropNames); // queryDataParam.setDropedTagNames(dropNames);
//
queryDataParam.setTags(Arrays.asList(new Tag("argName","LTWeight"))); // queryDataParam.setTags(Arrays.asList(new Tag("argName","LTWeight")));
//
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(100).toInstant(),Instant.now())); // queryDataParam.setRange(new Range(DataUtils.getBeforeDate(100).toInstant(),Instant.now()));
// queryDataParam.setPageInfo(new PageInfo(1,10)); //// queryDataParam.setPageInfo(new PageInfo(1,10));
List<FluxTable> query = InfluxClient.Client.queryByGroup(queryDataParam); // List<FluxTable> query = InfluxClient.Client.queryByGroup(queryDataParam);
//
//
for (FluxTable fluxTable : query) { // for (FluxTable fluxTable : query) {
List<FluxRecord> records = fluxTable.getRecords(); // List<FluxRecord> records = fluxTable.getRecords();
if(records.size()!=0){ // if(records.size()!=0){
res.add((String) records.get(0).getValueByKey("batchNum")); // res.add((String) records.get(0).getValueByKey("batchNum"));
continue; // continue;
} // }
} // }
return R.ok(res); // return R.ok(res);
} // }
@PostMapping("/NPGraphTest") @PostMapping("/NPGraphTest")
@ -216,6 +215,32 @@ public class ProcessInspectionController {
return R.ok("成功",npGraph1); return R.ok("成功",npGraph1);
} }
@PostMapping("/NPGraph")
public R<NPGraphData> NPGraph(@RequestBody GraphArg graphArg) throws Exception {
ProductFeatures productFeatures = setRealSampleSize(graphArg);
if(productFeatures == null){
return R.failed("检验参数异常");
}
NPGraph npGraph = new NPGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
queryDataParam.setTimeType(graphArg.getGroupType());
npGraph.initialDate(queryDataParam);
NPGraphData npGraph1 = new NPGraphData(
npGraph.getList()==null?null:npGraph.getList(),
npGraph.getArgName()==null?null:npGraph.getArgName()
);
return R.ok("成功",npGraph1);
}
@PostMapping("/PGraphTest") @PostMapping("/PGraphTest")
public R<PGraphData> PGraphTest() throws Exception { public R<PGraphData> PGraphTest() throws Exception {
ProductFeatures productFeatures = new ProductFeatures(); ProductFeatures productFeatures = new ProductFeatures();
@ -296,9 +321,13 @@ public class ProcessInspectionController {
private ProductFeatures setRealSampleSize(GraphArg graphArg){ private ProductFeatures setRealSampleSize(GraphArg graphArg){
ProductFeaturesDTO productFeaturesDTO = productFeaturesService.get(graphArg.getProductFeaturesId()); ProductFeaturesDTO productFeaturesDTO = productFeaturesService.get(graphArg.getProductFeaturesId());
if(productFeaturesDTO == null){
return null;
}
if(graphArg.getSampleSize()!=null){ if(graphArg.getSampleSize()!=null){
productFeaturesDTO.setSampleSize(graphArg.getSampleSize()); productFeaturesDTO.setSampleSize(graphArg.getSampleSize());
} }
ProductFeatures productFeatures = new ProductFeatures(); ProductFeatures productFeatures = new ProductFeatures();
BeanUtils.copyProperties(productFeaturesDTO, productFeatures); BeanUtils.copyProperties(productFeaturesDTO, productFeatures);
return productFeatures; return productFeatures;
@ -313,7 +342,13 @@ public class ProcessInspectionController {
@PostMapping("/XbarSGraph") @PostMapping("/XbarSGraph")
public R<XbarSGraphData> xbarSGraph(@RequestBody GraphArg graphArg) throws Exception { public R<XbarSGraphData> xbarSGraph(@RequestBody GraphArg graphArg) throws Exception {
ProductFeatures productFeatures = setRealSampleSize(graphArg); ProductFeatures productFeatures = setRealSampleSize(graphArg);
if(productFeatures == null){
return R.failed("检验参数异常");
}else {
if(productFeatures.getSampleSize()==null || productFeatures.getName()==null){
return R.failed("ProductFeatures 参数异常");
}
}
MeanStandardDeviationGraph meanStandardDeviationGraph = new MeanStandardDeviationGraph(productFeatures); MeanStandardDeviationGraph meanStandardDeviationGraph = new MeanStandardDeviationGraph(productFeatures);
if(graphArg.getInterpretationScheme()!=null){ if(graphArg.getInterpretationScheme()!=null){
meanStandardDeviationGraph.isNeedInterpretation(graphArg.getInterpretationScheme()); meanStandardDeviationGraph.isNeedInterpretation(graphArg.getInterpretationScheme());
@ -339,6 +374,13 @@ public class ProcessInspectionController {
public R<XbarRGraphData> XbarRGraph(@RequestBody GraphArg graphArg) throws Exception { public R<XbarRGraphData> XbarRGraph(@RequestBody GraphArg graphArg) throws Exception {
ProductFeatures productFeatures = setRealSampleSize(graphArg); ProductFeatures productFeatures = setRealSampleSize(graphArg);
if(productFeatures == null){
return R.failed("检验参数异常");
}else {
if(productFeatures.getSampleSize()==null || productFeatures.getName()==null){
return R.failed("ProductFeatures 参数异常");
}
}
MeanRGraph meanRGraph = new MeanRGraph(productFeatures); MeanRGraph meanRGraph = new MeanRGraph(productFeatures);
//如果要检验那么set 判读方案 //如果要检验那么set 判读方案
@ -372,7 +414,9 @@ public class ProcessInspectionController {
public R<XMRGraphData> XMRGraph(@RequestBody GraphArg graphArg) throws Exception { public R<XMRGraphData> XMRGraph(@RequestBody GraphArg graphArg) throws Exception {
ProductFeatures productFeatures = setRealSampleSize(graphArg); ProductFeatures productFeatures = setRealSampleSize(graphArg);
if(productFeatures == null){
return R.failed("检验参数异常");
}
XMRGraph xmrGraph = new XMRGraph(productFeatures); XMRGraph xmrGraph = new XMRGraph(productFeatures);
//如果要检验那么set 判读方案 //如果要检验那么set 判读方案
if(graphArg.getInterpretationScheme()!=null){ if(graphArg.getInterpretationScheme()!=null){
@ -397,31 +441,15 @@ public class ProcessInspectionController {
return R.ok("成功",xmrGraphData); return R.ok("成功",xmrGraphData);
} }
@PostMapping("/NPGraph")
public R<NPGraphData> NPGraph(@RequestBody GraphArg graphArg) throws Exception {
ProductFeatures productFeatures = setRealSampleSize(graphArg);
NPGraph npGraph = new NPGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
queryDataParam.setTimeType(graphArg.getGroupType());
npGraph.initialDate(queryDataParam);
NPGraphData npGraph1 = new NPGraphData(
npGraph.getList()==null?null:npGraph.getList(),
npGraph.getArgName()==null?null:npGraph.getArgName()
);
return R.ok("成功",npGraph1);
}
@PostMapping("/PGraph") @PostMapping("/PGraph")
public R<PGraphData> PGraph(@RequestBody GraphArg graphArg) throws Exception { public R<PGraphData> PGraph(@RequestBody GraphArg graphArg) throws Exception {
ProductFeatures productFeatures = setRealSampleSize(graphArg); ProductFeatures productFeatures = setRealSampleSize(graphArg);
if(productFeatures == null){
return R.failed("检验参数异常");
}
PGraph pGraph = new PGraph(productFeatures); PGraph pGraph = new PGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
@ -440,7 +468,9 @@ public class ProcessInspectionController {
public R<CGraphData> CGraph(@RequestBody GraphArg graphArg) throws Exception { public R<CGraphData> CGraph(@RequestBody GraphArg graphArg) throws Exception {
ProductFeatures productFeatures = setRealSampleSize(graphArg); ProductFeatures productFeatures = setRealSampleSize(graphArg);
if(productFeatures == null){
return R.failed("检验参数异常");
}
CGraph cGraph = new CGraph(productFeatures); CGraph cGraph = new CGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
@ -460,7 +490,9 @@ public class ProcessInspectionController {
public R<UGraphData> UGraph(@RequestBody GraphArg graphArg) throws Exception { public R<UGraphData> UGraph(@RequestBody GraphArg graphArg) throws Exception {
ProductFeatures productFeatures = setRealSampleSize(graphArg); ProductFeatures productFeatures = setRealSampleSize(graphArg);
if(productFeatures == null){
return R.failed("检验参数异常");
}
UGraph uGraph = new UGraph(productFeatures); UGraph uGraph = new UGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();

View File

@ -2,10 +2,12 @@ package com.cnbm.processInspection.dto;
import com.cnbm.basic.entity.ProductFeatures; import com.cnbm.basic.entity.ProductFeatures;
import com.cnbm.influx.param.Range; import com.cnbm.influx.param.Range;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -18,15 +20,20 @@ import java.util.List;
@ApiModel(value = "控制图 查询参数类") @ApiModel(value = "控制图 查询参数类")
public class GraphArg { public class GraphArg {
@ApiModelProperty(value = "检验特性Id") @ApiModelProperty(value = "检验特性Id")
@NotNull(message = "检验特性Id 不能为空")
private Long productFeaturesId; private Long productFeaturesId;
@ApiModelProperty(value = "查询时间段,开始") @ApiModelProperty(value = "查询时间段,开始")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
@NotNull(message = "时间段,开始 不能为空")
private Date begin; private Date begin;
@ApiModelProperty(value = "查询时间段,结束") @ApiModelProperty(value = "查询时间段,结束")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
@NotNull(message = "时间段,结束 不能为空")
private Date end; private Date end;
@ApiModelProperty(value = "判读方案列表") @ApiModelProperty(value = "判读方案列表,只用于 计量型")
private List<InterpretationListArg> interpretationScheme; private List<InterpretationListArg> interpretationScheme;
@ApiModelProperty(value = "样本大小,不填的话用之前配置的") @ApiModelProperty(value = "样本大小,不填的话用之前配置的")

View File

@ -65,9 +65,7 @@ public class MeanRGraph {
public MeanRGraph(ProductFeatures productFeatures) throws Exception { public MeanRGraph(ProductFeatures productFeatures) throws Exception {
if(productFeatures.getSampleSize()==null || productFeatures.getName()==null){
throw new Exception("ProductFeatures 参数异常");
}
this.argName = productFeatures.getName(); this.argName = productFeatures.getName();
this.sampleSize = productFeatures.getSampleSize().intValue(); this.sampleSize = productFeatures.getSampleSize().intValue();
this.a2 = XBarRCoefficients.getA2(sampleSize); this.a2 = XBarRCoefficients.getA2(sampleSize);
@ -92,6 +90,7 @@ public class MeanRGraph {
this.interpretationScheme = list; this.interpretationScheme = list;
} }
/** /**
* name : 初始化数据函数 * name : 初始化数据函数
* desc : 从influxdb 里面读取数据然后 加工处理成 我需要的 * desc : 从influxdb 里面读取数据然后 加工处理成 我需要的

View File

@ -62,9 +62,7 @@ public class MeanStandardDeviationGraph {
public MeanStandardDeviationGraph(ProductFeatures productFeatures) throws Exception { public MeanStandardDeviationGraph(ProductFeatures productFeatures) throws Exception {
if(productFeatures.getSampleSize()==null || productFeatures.getName()==null){
throw new Exception("ProductFeatures 参数异常");
}
this.argName = productFeatures.getName(); this.argName = productFeatures.getName();
this.sampleSize = productFeatures.getSampleSize().intValue(); this.sampleSize = productFeatures.getSampleSize().intValue();
this.as = XBarSCoefficients.getAS(sampleSize); this.as = XBarSCoefficients.getAS(sampleSize);
@ -123,6 +121,9 @@ public class MeanStandardDeviationGraph {
List<Double> rArray = new ArrayList<>(); List<Double> rArray = new ArrayList<>();
for(int i=0;i<doubleListList.size();i++){ for(int i=0;i<doubleListList.size();i++){
Double[] doubleList = toDoubleArray(doubleListList.get(i).toArray()); Double[] doubleList = toDoubleArray(doubleListList.get(i).toArray());
if(doubleList.length == 1){
continue;
}
Double xbar = Math.getMean(doubleList); Double xbar = Math.getMean(doubleList);
Double s = Math.StandardDiviation(doubleList).getNormal(); Double s = Math.StandardDiviation(doubleList).getNormal();

View File

@ -62,9 +62,6 @@ public class XMRGraph {
public XMRGraph(ProductFeatures productFeatures) throws Exception { public XMRGraph(ProductFeatures productFeatures) throws Exception {
if(productFeatures.getSampleSize()==null || productFeatures.getName()==null){
throw new Exception("ProductFeatures 参数异常");
}
this.argName = productFeatures.getName(); this.argName = productFeatures.getName();
this.sampleSize = 1; this.sampleSize = 1;
this.specificationLimit = new SpecificationLimit( this.specificationLimit = new SpecificationLimit(

View File

@ -155,7 +155,7 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
params.put("inspectionStage", dto.getInspectionStage()); params.put("inspectionStage", dto.getInspectionStage());
List<ProductFeaturesDTO> inspectionSheetFeaturesList = getInspectionSheetFeaturesList(params); List<ProductFeaturesDTO> inspectionSheetFeaturesList = getInspectionSheetFeaturesList(params);
if (inspectionSheetFeaturesList != null && inspectionSheetFeaturesList.size() != 0) { if (inspectionSheetFeaturesList != null && inspectionSheetFeaturesList.size() != 0) {
//分组样本数=样本大小=检验特性分组数的最大值 //分组样本数 = 样本大小 = 检验特性分组数的最大值
//Integer numbersOfSamples = inspectionSheetFeaturesList.stream().max(Comparator.comparing(ProductFeaturesDTO::getSampleSize)).get().getSampleSize(); //Integer numbersOfSamples = inspectionSheetFeaturesList.stream().max(Comparator.comparing(ProductFeaturesDTO::getSampleSize)).get().getSampleSize();
//过滤计量型特性 //过滤计量型特性
List<ProductFeaturesDTO> featuresList = inspectionSheetFeaturesList.stream().filter(s-> s.getSampleSize()!=null && s.getType()==1).collect(Collectors.toList()); List<ProductFeaturesDTO> featuresList = inspectionSheetFeaturesList.stream().filter(s-> s.getSampleSize()!=null && s.getType()==1).collect(Collectors.toList());
@ -308,19 +308,9 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
@Override @Override
public void saveFluxParamList2(InspectionSampleDTO2[] lists){ public void saveFluxParamList2(InspectionSampleDTO2[] lists){
for (InspectionSampleDTO2 dto : lists) { for (InspectionSampleDTO2 dto : lists) {
//String jsonData = {"workingProcedureName":"test","inspectionSheetId":"116","param1":"0.47","param2":"0.687","param2":"0.53"};
String workingProcedureName = dto.getWorkingProcedureName(); String workingProcedureName = dto.getWorkingProcedureName();
String inspectionSheetId = dto.getInspectionSheetId();
// String batchNum = dto.getBatchNum();
String sampleNumber = dto.getSampleNumber();
// LocalDateTime sampleTime = dto.getSampleTime();
// Instant eventTime = sampleTime.toInstant(ZoneOffset.UTC);
InfluxClient.Client.batchInsert(dto.getEvents(), workingProcedureName); InfluxClient.Client.batchInsert(dto.getEvents(), workingProcedureName);
} }
// //样本数据更新后 计算检验单缺陷数不良数
// System.out.println("--------------------------------------");
// calculate(Long.valueOf(lists[0].getInspectionSheetId()));
} }
private Event newEvent(Instant time, String inspectionSheetId, String argName, String argValue, String sampleNo) { private Event newEvent(Instant time, String inspectionSheetId, String argName, String argValue, String sampleNo) {

View File

@ -1,5 +1,6 @@
package com.cnbm.qualityPlanning.entity; package com.cnbm.qualityPlanning.entity;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
/** /**
@ -20,6 +21,13 @@ public class XMRPoint extends Point {
//xbar 不满足 判读方案 //xbar 不满足 判读方案
private Set<Integer> rsUnsatisfiedRules; private Set<Integer> rsUnsatisfiedRules;
public XMRPoint(Integer position, Double value, Double x, Double rs) {
super(position,value);
this.x = x;
this.rs = rs;
xUnsatisfiedRules = new HashSet<Integer>();
rsUnsatisfiedRules = new HashSet<Integer>();
}
private void setValueToTest(Double value){ private void setValueToTest(Double value){
setValueForInterpretation(value); setValueForInterpretation(value);
@ -57,11 +65,7 @@ public class XMRPoint extends Point {
this.rs = rs; this.rs = rs;
} }
public XMRPoint(Integer position, Double value, Double x, Double rs) {
super(position,value);
this.x = x;
this.rs = rs;
}
@Override @Override
public Integer getPosition() { public Integer getPosition() {

View File

@ -1,6 +1,7 @@
package com.cnbm.qualityPlanning.entity; package com.cnbm.qualityPlanning.entity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -21,7 +22,14 @@ public class XbarRPoint extends Point {
private Set<Integer> rUnsatisfiedRules; private Set<Integer> rUnsatisfiedRules;
//xbar 不满足 判读方案 //xbar 不满足 判读方案
private Set<Integer> xbarUnsatisfiedRules; private Set<Integer> xbarUnsatisfiedRules;
public XbarRPoint(Integer position, Double value, Double xbar, Double r, List<Double> data) {
super(position,value);
this.xbar = xbar;
this.r = r;
this.data = data;
rUnsatisfiedRules = new HashSet<Integer>();
xbarUnsatisfiedRules = new HashSet<Integer>();
}
private void setValueToTest(Double value){ private void setValueToTest(Double value){
setValueForInterpretation(value); setValueForInterpretation(value);
@ -68,12 +76,7 @@ public class XbarRPoint extends Point {
this.r = r; this.r = r;
} }
public XbarRPoint(Integer position, Double value, Double xbar, Double r, List<Double> data) {
super(position,value);
this.xbar = xbar;
this.r = r;
this.data = data;
}
@Override @Override
public Integer getPosition() { public Integer getPosition() {

View File

@ -3,6 +3,7 @@ package com.cnbm.qualityPlanning.entity;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -20,12 +21,21 @@ public class XbarSPoint extends Point {
public XbarSPoint(Integer position, Double value) { public XbarSPoint(Integer position, Double value) {
super(position, value); super(position, value);
} }
//s 不满足 判读方案 //s 不满足 判读方案
private Set<Integer> sUnsatisfiedRules; private Set<Integer> sUnsatisfiedRules;
//xbar 不满足 判读方案 //xbar 不满足 判读方案
private Set<Integer> xbarUnsatisfiedRules; private Set<Integer> xbarUnsatisfiedRules;
public XbarSPoint(Integer position, Double value, Double xbar, Double s, Double r,List<Double> data) {
super(position,value);
this.xbar = xbar;
this.s = s;
this.r = r;
this.data = data;
sUnsatisfiedRules = new HashSet<Integer>();
xbarUnsatisfiedRules = new HashSet<Integer>();
}
private void setValueToTest(Double value){ private void setValueToTest(Double value){
setValueForInterpretation(value); setValueForInterpretation(value);
} }
@ -78,13 +88,7 @@ public class XbarSPoint extends Point {
this.r = r; this.r = r;
} }
public XbarSPoint(Integer position, Double value, Double xbar, Double s, Double r,List<Double> data) {
super(position,value);
this.xbar = xbar;
this.s = s;
this.r = r;
this.data = data;
}
@Override @Override
public Integer getPosition() { public Integer getPosition() {