This commit is contained in:
caixiang 2022-12-13 11:00:15 +08:00
parent 5e8110ad2c
commit 69f911c07c
7 changed files with 93 additions and 8 deletions

View File

@ -107,7 +107,7 @@ public class S7DemoController {
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
queryDataParam.setDropedTagNames(dropNames);
queryDataParam.setTags(Arrays.asList(new Tag("argName","LTWeight"),new Tag("inspectionSheetId","1601096578382766082")));
queryDataParam.setTags(Arrays.asList(new Tag("argName","LTWeight"),new Tag("inspectionSheetId","1601123134690340865")));
queryDataParam.setBucket(Constant.bucket);
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
@ -132,8 +132,22 @@ public class S7DemoController {
return new Result<Instant>().ok(time);
}
@PostMapping("/saveFlux")
public void saveFlux(@RequestBody TIMETest timeTest) throws InterruptedException {
@PostMapping("/saveFlux1")
public Result<Instant> saveFlux1() throws InterruptedException {
List<Event> list = new ArrayList<>();
Event event2 = new Event();
Instant instant = new Date().toInstant();
event2.setTime(instant);
event2.setArgName("failDayDay");
event2.setArgValue("");
event2.setSampleNumber("10001");
list.add(event2);
InfluxClient.Client.batchInsert(list,"Weight");
return new Result<Instant>().ok(instant);
}
@PostMapping("/saveFlux2")
public void saveFlux2(@RequestBody TIMETest timeTest) throws InterruptedException {
List<Event> list = new ArrayList<>();
Event event2 = new Event();

View File

@ -16,6 +16,7 @@ import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.processInspection.dto.InspectionSampleDTO;
import com.cnbm.processInspection.dto.InspectionSampleDTO2;
import com.cnbm.processInspection.dto.InspectionSheetDTO;
import com.cnbm.processInspection.entity.InspectionSheet;
import com.cnbm.processInspection.excel.InspectionSheetExcel;
@ -184,6 +185,17 @@ public class InspectionSheetController {
return new Result();
}
@PostMapping("saveFluxParamList2")
@ApiOperation("将样本检测参数写入influxdb2")
public Result saveFluxParamList2(@RequestBody InspectionSampleDTO2[] lists) throws InterruptedException{
inspectionSheetService.saveFluxParamList2(lists);
Thread.sleep(1000);
//样本数据更新后 计算检验单缺陷数不良数
inspectionSheetService.calculate(Long.valueOf(lists[0].getInspectionSheetId()));
return new Result();
}
@PostMapping("getInspectionSheetFeaturesList")
@ApiOperation("获取检验单对应检验属性")
@ApiImplicitParams({

View File

@ -149,7 +149,6 @@ public class ProcessInspectionController {
(xmrGraph.getXigma()==null||xmrGraph.getTotalXigma()==null)?null:new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma())
);
return R.ok("成功",xmrGraphData);
}

View File

@ -0,0 +1,40 @@
package com.cnbm.processInspection.dto;
import com.cnbm.influx.template.Event;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.Instant;
import java.util.List;
/**
* 检验样本
*
* @author yanyang
* @since 2022-11-24
*/
@Data
@ApiModel(value = "检验样本 DTO对象")
public class InspectionSampleDTO2 implements Serializable {
@ApiModelProperty(value = "工序名称关联working_procedure表")
private String workingProcedureName;
@ApiModelProperty(value = "检验单id")
private String inspectionSheetId;
@ApiModelProperty(value = "检验参数")
private List<Event> events;
@ApiModelProperty(value = "批次号")
private String batchNum;
@ApiModelProperty(value = "取样时间")
private Instant sampleTime;
@ApiModelProperty(value = "样本号")
private String sampleNumber;
}

View File

@ -7,6 +7,7 @@ import com.cnbm.common.service.CrudService;
import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.template.Event;
import com.cnbm.processInspection.dto.InspectionSampleDTO;
import com.cnbm.processInspection.dto.InspectionSampleDTO2;
import com.cnbm.processInspection.dto.InspectionSheetDTO;
import com.cnbm.processInspection.entity.InspectionSheet;
import com.influxdb.query.FluxTable;
@ -38,7 +39,7 @@ public interface IInspectionSheetService extends CrudService<InspectionSheet, In
List<InspectionSampleDTO> getFluxParamList(Long inspectionSheetId);
void saveFluxParamList(InspectionSampleDTO[] lists);
void saveFluxParamList2(InspectionSampleDTO2[] lists);
List<ProductFeaturesDTO> getInspectionSheetFeaturesList(Map<String, Object> params);
void calculate(Long inspectionSheetId);

View File

@ -26,6 +26,7 @@ import com.cnbm.influx.param.Range;
import com.cnbm.influx.param.Tag;
import com.cnbm.influx.template.Event;
import com.cnbm.processInspection.dto.InspectionSampleDTO;
import com.cnbm.processInspection.dto.InspectionSampleDTO2;
import com.cnbm.processInspection.dto.InspectionSheetDTO;
import com.cnbm.processInspection.entity.InspectionSheet;
import com.cnbm.processInspection.mapper.InspectionSheetMapper;
@ -290,6 +291,24 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
// calculate(Long.valueOf(lists[0].getInspectionSheetId()));
}
@Override
public void saveFluxParamList2(InspectionSampleDTO2[] 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 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);
}
// //样本数据更新后 计算检验单缺陷数不良数
// System.out.println("--------------------------------------");
// calculate(Long.valueOf(lists[0].getInspectionSheetId()));
}
private Event newEvent(Instant time, String inspectionSheetId, String argName, String argValue, String sampleNo) {
Event event = new Event();
event.setInspectionSheetId(inspectionSheetId);

View File

@ -88,13 +88,13 @@
LEFT JOIN product_features pf ON pf.id=fspr.product_features_id
<where>
pf.valid = 1 and fspr.valid = 1
<if test="productId != null">
<if test="productId != null and productId.trim() != ''">
and pf.product_id = #{productId}
</if>
<if test="inspectionStage != null">
<if test="inspectionStage != null and inspectionStage.trim() != ''">
and fspr.inspection_stage = #{inspectionStage}
</if>
<if test="workingProcedureId != null">
<if test="workingProcedureId != null and workingProcedureId.trim() != ''">
and fspr.working_procedure_id = #{workingProcedureId}
</if>
</where>