From 69f911c07c9a37c4039ad0595d580240aeff9691 Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Tue, 13 Dec 2022 11:00:15 +0800 Subject: [PATCH] Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC --- .../influx/controller/S7DemoController.java | 20 ++++++++-- .../controller/InspectionSheetController.java | 12 ++++++ .../ProcessInspectionController.java | 1 - .../dto/InspectionSampleDTO2.java | 40 +++++++++++++++++++ .../service/IInspectionSheetService.java | 3 +- .../impl/InspectionSheetServiceImpl.java | 19 +++++++++ .../mapper/InspectionSheetMapper.xml | 6 +-- 7 files changed, 93 insertions(+), 8 deletions(-) create mode 100644 ym-process-inspection/src/main/java/com/cnbm/processInspection/dto/InspectionSampleDTO2.java 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 ca6baeb..ed17a2d 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 @@ -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 query = InfluxClient.Client.query(queryDataParam); @@ -132,8 +132,22 @@ public class S7DemoController { return new Result().ok(time); } - @PostMapping("/saveFlux") - public void saveFlux(@RequestBody TIMETest timeTest) throws InterruptedException { + @PostMapping("/saveFlux1") + public Result saveFlux1() throws InterruptedException { + + List 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().ok(instant); + } + @PostMapping("/saveFlux2") + public void saveFlux2(@RequestBody TIMETest timeTest) throws InterruptedException { List list = new ArrayList<>(); Event event2 = new Event(); diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java index a9e486c..6a77494 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java @@ -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({ diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/ProcessInspectionController.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/ProcessInspectionController.java index e1f16a3..121c8ed 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/ProcessInspectionController.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/ProcessInspectionController.java @@ -149,7 +149,6 @@ public class ProcessInspectionController { (xmrGraph.getXigma()==null||xmrGraph.getTotalXigma()==null)?null:new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma()) ); - return R.ok("成功",xmrGraphData); } diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/dto/InspectionSampleDTO2.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/dto/InspectionSampleDTO2.java new file mode 100644 index 0000000..6bc1c22 --- /dev/null +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/dto/InspectionSampleDTO2.java @@ -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 events; + + @ApiModelProperty(value = "批次号") + private String batchNum; + + @ApiModelProperty(value = "取样时间") + private Instant sampleTime; + + @ApiModelProperty(value = "样本号") + private String sampleNumber; + +} diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/IInspectionSheetService.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/IInspectionSheetService.java index 2f4b9d6..490bbd5 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/IInspectionSheetService.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/IInspectionSheetService.java @@ -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 getFluxParamList(Long inspectionSheetId); void saveFluxParamList(InspectionSampleDTO[] lists); - + void saveFluxParamList2(InspectionSampleDTO2[] lists); List getInspectionSheetFeaturesList(Map params); void calculate(Long inspectionSheetId); diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/impl/InspectionSheetServiceImpl.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/impl/InspectionSheetServiceImpl.java index ab994b7..126331f 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/impl/InspectionSheetServiceImpl.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/impl/InspectionSheetServiceImpl.java @@ -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 pf.valid = 1 and fspr.valid = 1 - + and pf.product_id = #{productId} - + and fspr.inspection_stage = #{inspectionStage} - + and fspr.working_procedure_id = #{workingProcedureId}