Compare commits

...

7 Commits

Author SHA1 Message Date
1b01150a7e Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC into yanyang
 Conflicts:
	ym-baisc/src/main/java/com/cnbm/basic/controller/ProductController.java
2022-08-01 13:44:25 +08:00
e9e0c47536 mark 2022-08-01 13:44:01 +08:00
caixiang
0750c9583e mark 2022-08-01 13:42:54 +08:00
caixiang
e9c8f7857b 新增:XMR 控制图 2022-07-29 16:56:35 +08:00
caixiang
227a27295d Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC 2022-07-29 14:23:19 +08:00
caixiang
2d1ef3d743 mark for pull 2022-07-29 14:23:13 +08:00
46b6e5e66e Merge pull request '数据库字段更改' (#4) from yanyang into master
Reviewed-on: #4
2022-07-29 14:22:20 +08:00
43 changed files with 1110 additions and 49 deletions

View File

@ -0,0 +1,18 @@
/*
* Copyright (c) 2018.
* http://www.ulabcare.com
*/
package com.cnbm.admin.basic;
import java.io.Serializable;
/**
* 接口请求参数基类
*
* @author jiff
* @date 2018/11/1
* @since 1.0
*/
public class BaseParam implements Serializable {
}

View File

@ -73,6 +73,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/webjars/**", "/webjars/**",
"/websocket/**", "/websocket/**",
"/influx/**", "/influx/**",
"/basic/**",
"/processInspection/**", "/processInspection/**",
"/captcha").anonymous() "/captcha").anonymous()
// .antMatchers("/testCors").hasAuthority("system:dept:list222") // .antMatchers("/testCors").hasAuthority("system:dept:list222")

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2018.
* http://www.ulabcare.com
*/
package com.cnbm.admin.params;
import com.cnbm.admin.basic.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 主键请求参数对象
*
* @author jiff
* @date 2018/11/9
* @since 1.0
*/
@Data
@ApiModel("主键参数对象")
public class IdParam implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull(message = "主键不能为空")
@ApiModelProperty(value = "主键", required = true, example = "1", notes = "根据实际接口传递不同对象的主键")
private Long id;
}

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-13 * @since 2022-07-13
*/ */
@RestController @RestController
@RequestMapping("/code/factory") @RequestMapping("/basic/factory")
@Api(tags="工厂 表") @Api(tags="工厂 表")
public class FactoryController { public class FactoryController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-15 * @since 2022-07-15
*/ */
@RestController @RestController
@RequestMapping("/code/machine") @RequestMapping("/basic/machine")
@Api(tags="机台表") @Api(tags="机台表")
public class MachineController { public class MachineController {
@Autowired @Autowired
@ -119,7 +119,7 @@ public class MachineController {
public Result changeStatus(@PathVariable("id") Long id){ public Result changeStatus(@PathVariable("id") Long id){
machineService.changeStatus(id); machineService.changeStatus(id);
return new Result(); return new Result().ok(true);
} }
} }

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-13 * @since 2022-07-13
*/ */
@RestController @RestController
@RequestMapping("/code/measureTool") @RequestMapping("/basic/measureTool")
@Api(tags="量具表") @Api(tags="量具表")
public class MeasureToolController { public class MeasureToolController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-13 * @since 2022-07-13
*/ */
@RestController @RestController
@RequestMapping("/code/platform") @RequestMapping("/basic/platform")
@Api(tags="站点表") @Api(tags="站点表")
public class PlatformController { public class PlatformController {
@Autowired @Autowired

View File

@ -1,6 +1,7 @@
package com.cnbm.basic.controller; package com.cnbm.basic.controller;
import com.cnbm.admin.annotation.LogOperation; import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.admin.params.IdParam;
import com.cnbm.common.constant.Constant; import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.utils.ExcelUtils; import com.cnbm.common.utils.ExcelUtils;
@ -34,7 +35,7 @@ import java.util.Map;
* @since 2022-07-11 * @since 2022-07-11
*/ */
@RestController @RestController
@RequestMapping("/code/product") @RequestMapping("/basic/product")
@Api(tags="产品 表") @Api(tags="产品 表")
public class ProductController { public class ProductController {
@Autowired @Autowired
@ -113,11 +114,11 @@ public class ProductController {
ExcelUtils.exportExcelToTarget(response, null, list, ProductExcel.class); ExcelUtils.exportExcelToTarget(response, null, list, ProductExcel.class);
} }
@GetMapping("status") @PostMapping("status")
@ApiOperation("改变状态") @ApiOperation("改变状态")
@LogOperation("改变状态") @LogOperation("改变状态")
public Result changeStatus(@PathVariable("id") Long id){ public Result changeStatus(@RequestBody IdParam id){
productService.changeStatus(id); productService.changeStatus(id.getId());
return new Result(); return new Result();
} }

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-27 * @since 2022-07-27
*/ */
@RestController @RestController
@RequestMapping("/code/productFactoryRelation") @RequestMapping("/basic/productFactoryRelation")
@Api(tags="产品-工厂 关系表") @Api(tags="产品-工厂 关系表")
public class ProductFactoryRelationController { public class ProductFactoryRelationController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-15 * @since 2022-07-15
*/ */
@RestController @RestController
@RequestMapping("/code/productFeatures") @RequestMapping("/basic/productFeatures")
@Api(tags="产品特性 表") @Api(tags="产品特性 表")
public class ProductFeaturesController { public class ProductFeaturesController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-15 * @since 2022-07-15
*/ */
@RestController @RestController
@RequestMapping("/code/productFeaturesHis") @RequestMapping("/basic/productFeaturesHis")
@Api(tags="产品特性 历史表") @Api(tags="产品特性 历史表")
public class ProductFeaturesHisController { public class ProductFeaturesHisController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-06-30 * @since 2022-06-30
*/ */
@RestController @RestController
@RequestMapping("/code/productType") @RequestMapping("/basic/productType")
@Api(tags="产品类型 表") @Api(tags="产品类型 表")
public class ProductTypeController { public class ProductTypeController {
@Autowired @Autowired

View File

@ -35,7 +35,7 @@ import java.util.Map;
* @since 2022-07-15 * @since 2022-07-15
*/ */
@RestController @RestController
@RequestMapping("/code/productWorkingprocedureRelation") @RequestMapping("/basic/productWorkingprocedureRelation")
@Api(tags="产品-工序 关系表") @Api(tags="产品-工序 关系表")
public class ProductWorkingprocedureRelationController { public class ProductWorkingprocedureRelationController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-13 * @since 2022-07-13
*/ */
@RestController @RestController
@RequestMapping("/code/shift") @RequestMapping("/basic/shift")
@Api(tags="班次 表") @Api(tags="班次 表")
public class ShiftController { public class ShiftController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-13 * @since 2022-07-13
*/ */
@RestController @RestController
@RequestMapping("/code/team") @RequestMapping("/basic/team")
@Api(tags="班组 表") @Api(tags="班组 表")
public class TeamController { public class TeamController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-06-30 * @since 2022-06-30
*/ */
@RestController @RestController
@RequestMapping("/code/unit") @RequestMapping("/basic/unit")
@Api(tags="单位 表") @Api(tags="单位 表")
public class UnitController { public class UnitController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-15 * @since 2022-07-15
*/ */
@RestController @RestController
@RequestMapping("/code/workingProcedure") @RequestMapping("/basic/workingProcedure")
@Api(tags="工序 表") @Api(tags="工序 表")
public class WorkingProcedureController { public class WorkingProcedureController {
@Autowired @Autowired

View File

@ -34,7 +34,7 @@ import java.util.Map;
* @since 2022-07-15 * @since 2022-07-15
*/ */
@RestController @RestController
@RequestMapping("/code/workingProcedureType") @RequestMapping("/basic/workingProcedureType")
@Api(tags="工序类型表 表") @Api(tags="工序类型表 表")
public class WorkingProcedureTypeController { public class WorkingProcedureTypeController {
@Autowired @Autowired

View File

@ -22,6 +22,6 @@ public interface IProductService extends CrudService<Product, ProductDTO> {
void update(ProductDTO dto); void update(ProductDTO dto);
void changeStatus(Long id); boolean changeStatus(Long id);
} }

View File

@ -90,6 +90,8 @@ public class MachineServiceImpl extends CrudServiceImpl<MachineMapper, Machine,
Integer status = 1 - entity.getStatus(); Integer status = 1 - entity.getStatus();
entity.setStatus(status); entity.setStatus(status);
updateById(entity); updateById(entity);
//return updateById(entity);
} }
} }

View File

@ -90,12 +90,12 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void changeStatus(Long id) { public boolean changeStatus(Long id) {
//改变状态 开启1 关闭0 //改变状态 开启1 关闭0
Product entity = baseDao.selectById(id); Product entity = baseDao.selectById(id);
Integer status = 1 - entity.getStatus(); Integer status = 1 - entity.getStatus();
entity.setStatus(status); entity.setStatus(status);
updateById(entity); return updateById(entity);
} }
} }

View File

@ -0,0 +1,116 @@
package com.cnbm.generator.code.controller;
import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData;
import com.cnbm.common.utils.ExcelUtils;
import com.cnbm.common.utils.Result;
import com.cnbm.common.validator.AssertUtils;
import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.generator.code.dto.ProductDTO;
import com.cnbm.generator.code.excel.ProductExcel;
import com.cnbm.generator.code.service.IProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 产品 前端控制器
*
* @author why
* @since 2022-08-01
*/
@RestController
@RequestMapping("/code/product")
@Api(tags="产品 表")
public class ProductController {
@Autowired
private IProductService productService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class)
})
@PreAuthorize("@ex.hasAuthority('code:product:page')")
public Result<PageData<ProductDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<ProductDTO> page = productService.page(params);
return new Result<PageData<ProductDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@PreAuthorize("@ex.hasAuthority('code:product:info')")
public Result<ProductDTO> get(@PathVariable("id") Long id){
ProductDTO data = productService.get(id);
return new Result<ProductDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('code:product:save')")
public Result save(@RequestBody ProductDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
productService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@PreAuthorize("@ex.hasAuthority('code:product:update')")
public Result update(@RequestBody ProductDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
productService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@PreAuthorize("@ex.hasAuthority('code:product:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
productService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@PreAuthorize("@ex.hasAuthority('code:product:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ProductDTO> list = productService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ProductExcel.class);
}
}

View File

@ -0,0 +1,86 @@
package com.cnbm.generator.code.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.math.BigDecimal;
/**
* 产品
*
* @author why
* @since 2022-08-01
*/
@Data
@ApiModel(value = "产品 表DTO对象")
public class ProductDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
private Long id;
@ApiModelProperty(value = "产品 名")
private String name;
@ApiModelProperty(value = "产品 编码")
private String code;
@ApiModelProperty(value = "产品 规格")
private String specifications;
@ApiModelProperty(value = "产品 图纸")
private String drawing;
@ApiModelProperty(value = "描述")
private String descs;
@ApiModelProperty(value = "")
private Long productTypeId;
@ApiModelProperty(value = "")
private Long unitId;
@ApiModelProperty(value = "检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;; 如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
private String inspectionStage;
@ApiModelProperty(value = "检验标准")
private String inspectionStandard;
@ApiModelProperty(value = "1 可用0 不可用")
private Integer status;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "删除标志,是否有效:1 可用 0不可用")
private Integer valid;
@ApiModelProperty(value = "")
private Long creatorId;
@ApiModelProperty(value = "创建人姓名")
private String creatorName;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "")
private Long updaterId;
@ApiModelProperty(value = "更新人姓名")
private String updaterName;
@ApiModelProperty(value = "更新时间")
private LocalDateTime updateTime;
@ApiModelProperty(value = "版本号")
private Integer version;
}

View File

@ -0,0 +1,79 @@
package com.cnbm.generator.code.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
* 产品
* </p>
*
* @author why
* @since 2022-08-01
*/
@Data
@ApiModel(value = "Product对象", description = "产品 表")
public class Product implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty("产品 名")
private String name;
@ApiModelProperty("产品 编码")
private String code;
@ApiModelProperty("产品 规格")
private String specifications;
@ApiModelProperty("产品 图纸")
private String drawing;
@ApiModelProperty("描述")
private String descs;
private Long productTypeId;
private Long unitId;
@ApiModelProperty("检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;; 如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
private String inspectionStage;
@ApiModelProperty("检验标准")
private String inspectionStandard;
@ApiModelProperty("1 可用0 不可用")
private Integer status;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
private Integer valid;
private Long creatorId;
@ApiModelProperty("创建人姓名")
private String creatorName;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
private Long updaterId;
@ApiModelProperty("更新人姓名")
private String updaterName;
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
@ApiModelProperty("版本号")
private Integer version;
}

View File

@ -0,0 +1,60 @@
package com.cnbm.generator.code.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.util.Date;
/**
* 产品
*
* @author why
* @since 2022-08-01
*/
@Data
public class ProductExcel {
@Excel(name = "")
private Long id;
@Excel(name = "产品 名")
private String name;
@Excel(name = "产品 编码")
private String code;
@Excel(name = "产品 规格")
private String specifications;
@Excel(name = "产品 图纸")
private String drawing;
@Excel(name = "描述")
private String descs;
@Excel(name = "")
private Long productTypeId;
@Excel(name = "")
private Long unitId;
@Excel(name = "检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;; 如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
private String inspectionStage;
@Excel(name = "检验标准")
private String inspectionStandard;
@Excel(name = "1 可用0 不可用")
private Integer status;
@Excel(name = "备注")
private String remark;
@Excel(name = "删除标志,是否有效:1 可用 0不可用")
private Integer valid;
@Excel(name = "")
private Long creatorId;
@Excel(name = "创建人姓名")
private String creatorName;
@Excel(name = "创建时间")
private LocalDateTime createTime;
@Excel(name = "")
private Long updaterId;
@Excel(name = "更新人姓名")
private String updaterName;
@Excel(name = "更新时间")
private LocalDateTime updateTime;
@Excel(name = "版本号")
private Integer version;
}

View File

@ -0,0 +1,16 @@
package com.cnbm.generator.code.mapper;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.generator.code.entity.Product;
import org.apache.ibatis.annotations.Mapper;
/**
* 产品
*
* @author why
* @since 2022-08-01
*/
@Mapper
public interface ProductMapper extends BaseDao<Product> {
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.generator.code.mapper.ProductMapper">
</mapper>

View File

@ -0,0 +1,15 @@
package com.cnbm.generator.code.service;
import com.cnbm.common.service.CrudService;
import com.cnbm.generator.code.dto.ProductDTO;
import com.cnbm.generator.code.entity.Product;
/**
* 产品
*
* @author why
* @since 2022-08-01
*/
public interface IProductService extends CrudService<Product, ProductDTO> {
}

View File

@ -0,0 +1,34 @@
package com.cnbm.generator.code.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.generator.code.dto.ProductDTO;
import com.cnbm.generator.code.mapper.ProductMapper;
import com.cnbm.generator.code.entity.Product;
import com.cnbm.generator.code.service.IProductService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 产品
*
* @author why
* @since 2022-08-01
*/
@Service
public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product, ProductDTO> implements IProductService {
@Override
public QueryWrapper<Product> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<Product> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}

View File

@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull;
import java.time.Instant; import java.time.Instant;
/** /**
* @Desc: "" * @Desc: "常规计量值 - entity"
* @Author: caixiang * @Author: caixiang
* @DATE: 2022/6/25 11:13 * @DATE: 2022/6/25 11:13
*/ */

View File

@ -0,0 +1,31 @@
package com.cnbm.influx.template;
import lombok.Data;
import java.time.Instant;
/**
* @Desc: "常规计数值 - entity"
* @Author: caixiang
* @DATE: 2022/6/25 11:13
*/
@Data
public class EventForCount {
private Instant time;
private String inspectionSheetId;
//n = 某个批次的样本数
private Integer n;
//failN = 某个批次不合格品数
private String failN;
//batchNum = 某个批次
private String batchNum;
//检测名
private String detectionName;
}

View File

@ -1,26 +1,27 @@
package com.cnbm.processInspection.controller; package com.cnbm.processInspection.controller;
import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.basic.entity.ProductFeatures; import com.cnbm.basic.entity.ProductFeatures;
import com.cnbm.basic.service.IProductFeaturesService;
import com.cnbm.common.spc.math.StandardDiviation; import com.cnbm.common.spc.math.StandardDiviation;
import com.cnbm.common.spc.util.DataUtils; import com.cnbm.common.spc.util.DataUtils;
import com.cnbm.common.vo.R; import com.cnbm.common.vo.R;
import com.cnbm.influx.constant.Constant; import com.cnbm.influx.constant.Constant;
import com.cnbm.influx.param.QueryDataParam; import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.param.Range; import com.cnbm.influx.param.Range;
import com.cnbm.processInspection.dto.GraphArg; import com.cnbm.processInspection.dto.*;
import com.cnbm.processInspection.dto.InterpretationListArg; import com.cnbm.processInspection.graphAnalyzed.forMeterage.mr.MeanRGraph;
import com.cnbm.processInspection.dto.XbarRGraphData; import com.cnbm.processInspection.graphAnalyzed.forMeterage.ms.MeanStandardDeviationGraph;
import com.cnbm.processInspection.dto.XbarSGraphData; import com.cnbm.processInspection.graphAnalyzed.forMeterage.xmr.XMRGraph;
import com.cnbm.processInspection.graphAnalyzed.mr.MeanRGraph;
import com.cnbm.processInspection.graphAnalyzed.ms.MeanStandardDeviationGraph;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -29,11 +30,15 @@ import java.util.List;
@RequestMapping("/processInspection") @RequestMapping("/processInspection")
public class ProcessInspectionController { public class ProcessInspectionController {
private static final Logger logger = LoggerFactory.getLogger(ProcessInspectionController.class); private static final Logger logger = LoggerFactory.getLogger(ProcessInspectionController.class);
@Autowired
IProductFeaturesService productFeaturesService;
@PostMapping("/XbarSGraphTest") @PostMapping("/XbarSGraphTest")
public R<XbarSGraphData> xbarSGraphTest() throws Exception { public R<XbarSGraphData> xbarSGraphTest() throws Exception {
ProductFeaturesDTO productFeaturesDTO = productFeaturesService.get(new Long(1));
ProductFeatures productFeatures = new ProductFeatures(); ProductFeatures productFeatures = new ProductFeatures();
productFeatures.setSl(new Float(5)); productFeatures.setSl(new Float(5));
productFeatures.setUsl(new Float(10)); productFeatures.setUsl(new Float(10));
@ -99,7 +104,49 @@ public class ProcessInspectionController {
return R.ok("成功",xbarSGraphData); return R.ok("成功",xbarSGraphData);
} }
@PostMapping("/XMRGraphTest")
public R<XMRGraphData> XMRGraphTest() throws Exception {
ProductFeatures productFeatures = new ProductFeatures();
productFeatures.setSl(new Float(5));
productFeatures.setUsl(new Float(10));
productFeatures.setLsl(new Float(1));
productFeatures.setName("LTWeight");
productFeatures.setSampleSize(1);
XMRGraph xmrGraph = new XMRGraph(productFeatures);
//判读方案
List<InterpretationListArg> interpretationScheme = new ArrayList<>();
interpretationScheme.add(new InterpretationListArg(1,null,null));
interpretationScheme.add(new InterpretationListArg(5,3,2));
xmrGraph.isNeedInterpretation(interpretationScheme);
QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setMeasurement("Weight");
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(), Instant.now()));
xmrGraph.initialDate(queryDataParam);
XMRGraphData xmrGraphData = new XMRGraphData(
xmrGraph.getXmrGraphEntity(),
xmrGraph.getXCL(),
xmrGraph.getRSCL(),
xmrGraph.getSpecificationLimit(),
xmrGraph.getProcessCapacity(),
new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma())
);
return R.ok("成功",xmrGraphData);
}
private ProductFeatures setRealSampleSize(GraphArg graphArg){
ProductFeaturesDTO productFeaturesDTO = productFeaturesService.get(graphArg.getProductFeaturesId());
if(graphArg.getSampleSize()!=null){
productFeaturesDTO.setSampleSize(graphArg.getSampleSize());
}
ProductFeatures productFeatures = new ProductFeatures();
BeanUtils.copyProperties(productFeaturesDTO, productFeatures);
return productFeatures;
}
//筛选条件顺序 //筛选条件顺序
// 先工厂产品表 => 检验类型产品表=> 产品名产品表=> 工序产品表=> 特性检验参数name product_features // 先工厂产品表 => 检验类型产品表=> 产品名产品表=> 工序产品表=> 特性检验参数name product_features
@ -109,8 +156,7 @@ public class ProcessInspectionController {
// 3.检验类型产品表 ; 4.产品名 产品表; 5.工艺流程就是工序 也是设备名用到工序表; 6.特性(product_features.name ,也是influxdb中的argName) ; // 3.检验类型产品表 ; 4.产品名 产品表; 5.工艺流程就是工序 也是设备名用到工序表; 6.特性(product_features.name ,也是influxdb中的argName) ;
@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 = graphArg.getProductFeatures();
MeanStandardDeviationGraph meanStandardDeviationGraph = new MeanStandardDeviationGraph(productFeatures); MeanStandardDeviationGraph meanStandardDeviationGraph = new MeanStandardDeviationGraph(productFeatures);
if(graphArg.getInterpretationScheme()!=null){ if(graphArg.getInterpretationScheme()!=null){
@ -136,8 +182,8 @@ public class ProcessInspectionController {
@PostMapping("/XbarRGraph") @PostMapping("/XbarRGraph")
public R<XbarRGraphData> XbarRGraph(@RequestBody GraphArg graphArg) throws Exception { public R<XbarRGraphData> XbarRGraph(@RequestBody GraphArg graphArg) throws Exception {
//new 对象 ProductFeatures productFeatures = setRealSampleSize(graphArg);
ProductFeatures productFeatures = graphArg.getProductFeatures();
MeanRGraph meanRGraph = new MeanRGraph(productFeatures); MeanRGraph meanRGraph = new MeanRGraph(productFeatures);
//如果要检验那么set 判读方案 //如果要检验那么set 判读方案
if(graphArg.getInterpretationScheme()!=null){ if(graphArg.getInterpretationScheme()!=null){
@ -161,4 +207,32 @@ public class ProcessInspectionController {
return R.ok("成功",xbarSGraphData); return R.ok("成功",xbarSGraphData);
} }
@PostMapping("/XMRGraph")
public R<XMRGraphData> XMRGraph(@RequestBody GraphArg graphArg) throws Exception {
ProductFeatures productFeatures = setRealSampleSize(graphArg);
XMRGraph xmrGraph = new XMRGraph(productFeatures);
//如果要检验那么set 判读方案
if(graphArg.getInterpretationScheme()!=null){
xmrGraph.isNeedInterpretation(graphArg.getInterpretationScheme());
}
QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
xmrGraph.initialDate(queryDataParam);
XMRGraphData xmrGraphData = new XMRGraphData(
xmrGraph.getXmrGraphEntity(),
xmrGraph.getXCL(),
xmrGraph.getRSCL(),
xmrGraph.getSpecificationLimit(),
xmrGraph.getProcessCapacity(),
new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma())
);
return R.ok("成功",xmrGraphData);
}
} }

View File

@ -17,8 +17,8 @@ import java.util.List;
@Data @Data
@ApiModel(value = "控制图 查询参数类") @ApiModel(value = "控制图 查询参数类")
public class GraphArg { public class GraphArg {
@ApiModelProperty(value = "检验特性,,全量传过来") @ApiModelProperty(value = "检验特性Id")
private ProductFeatures productFeatures; private Long productFeaturesId;
@ApiModelProperty(value = "查询时间段,开始") @ApiModelProperty(value = "查询时间段,开始")
private Date begin; private Date begin;
@ -29,4 +29,8 @@ public class GraphArg {
@ApiModelProperty(value = "判读方案列表") @ApiModelProperty(value = "判读方案列表")
private List<InterpretationListArg> interpretationScheme; private List<InterpretationListArg> interpretationScheme;
@ApiModelProperty(value = "样本大小,不填的话用之前配置的")
private Integer sampleSize;
} }

View File

@ -0,0 +1,45 @@
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.ProcessCapability;
import com.cnbm.qualityPlanning.entity.SpecificationLimit;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2022/7/22 14:18
*/
@Data
@ApiModel(value = "均值极差控制图 结果类")
public class XMRGraphData {
@ApiModelProperty(value = "控制图list数据")
private XMRGraphEntity xmrGraphEntity;
@ApiModelProperty(value = "xbar控制图 控制限")
private ControlLimit XBarCL;
@ApiModelProperty(value = "R控制图 控制限")
private ControlLimit RCL;
@ApiModelProperty(value = "工艺规格限")
private SpecificationLimit SL;
@ApiModelProperty(value = "工序能力")
private ProcessCapability processCapability;
@ApiModelProperty(value = "标准差/总体标准差")
private StandardDiviation standardDiviation;
public XMRGraphData(XMRGraphEntity xmrGraphEntity, ControlLimit xBarCL, ControlLimit rCL, SpecificationLimit sl, ProcessCapability processCapability, StandardDiviation standardDiviation){
this.xmrGraphEntity = xmrGraphEntity;
this.XBarCL = xBarCL;
this.RCL = rCL;
this.SL = sl;
this.processCapability = processCapability;
this.standardDiviation = standardDiviation;
}
}

View File

@ -1,7 +1,7 @@
package com.cnbm.processInspection.dto; package com.cnbm.processInspection.dto;
import com.cnbm.common.spc.math.StandardDiviation; import com.cnbm.common.spc.math.StandardDiviation;
import com.cnbm.processInspection.graphAnalyzed.mr.MRGraphEntity; import com.cnbm.processInspection.graphAnalyzed.forMeterage.mr.MRGraphEntity;
import com.cnbm.qualityPlanning.entity.ControlLimit; import com.cnbm.qualityPlanning.entity.ControlLimit;
import com.cnbm.qualityPlanning.entity.ProcessCapability; import com.cnbm.qualityPlanning.entity.ProcessCapability;
import com.cnbm.qualityPlanning.entity.SpecificationLimit; import com.cnbm.qualityPlanning.entity.SpecificationLimit;

View File

@ -1,7 +1,7 @@
package com.cnbm.processInspection.dto; package com.cnbm.processInspection.dto;
import com.cnbm.common.spc.math.StandardDiviation; import com.cnbm.common.spc.math.StandardDiviation;
import com.cnbm.processInspection.graphAnalyzed.ms.MSDGraphEntity; import com.cnbm.processInspection.graphAnalyzed.forMeterage.ms.MSDGraphEntity;
import com.cnbm.qualityPlanning.entity.ControlLimit; import com.cnbm.qualityPlanning.entity.ControlLimit;
import com.cnbm.qualityPlanning.entity.ProcessCapability; import com.cnbm.qualityPlanning.entity.ProcessCapability;
import com.cnbm.qualityPlanning.entity.SpecificationLimit; import com.cnbm.qualityPlanning.entity.SpecificationLimit;

View File

@ -1,4 +1,4 @@
package com.cnbm.processInspection.graphAnalyzed.mr; package com.cnbm.processInspection.graphAnalyzed.forMeterage.mr;

View File

@ -1,4 +1,4 @@
package com.cnbm.processInspection.graphAnalyzed.mr; package com.cnbm.processInspection.graphAnalyzed.forMeterage.mr;
import com.cnbm.basic.entity.ProductFeatures; import com.cnbm.basic.entity.ProductFeatures;
import com.cnbm.common.spc.math.Math; import com.cnbm.common.spc.math.Math;
@ -7,7 +7,6 @@ import com.cnbm.common.spc.util.DataUtils;
import com.cnbm.influx.config.InfluxClient; import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.constant.Constant; import com.cnbm.influx.constant.Constant;
import com.cnbm.influx.param.QueryDataParam; import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.param.Range;
import com.cnbm.influx.param.Tag; import com.cnbm.influx.param.Tag;
import com.cnbm.processInspection.controlCoefficientConstant.XBarRCoefficients; import com.cnbm.processInspection.controlCoefficientConstant.XBarRCoefficients;
import com.cnbm.processInspection.dto.InterpretationListArg; import com.cnbm.processInspection.dto.InterpretationListArg;
@ -17,7 +16,6 @@ import com.influxdb.query.FluxRecord;
import com.influxdb.query.FluxTable; import com.influxdb.query.FluxTable;
import lombok.Data; import lombok.Data;
import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -106,7 +104,6 @@ public class MeanRGraph {
dropNames.add("inspectionSheetId"); dropNames.add("inspectionSheetId");
queryDataParam.setDropedTagNames(dropNames); queryDataParam.setDropedTagNames(dropNames);
queryDataParam.setTag(new Tag("argName",argName)); queryDataParam.setTag(new Tag("argName",argName));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(), Instant.now()));
List<FluxTable> query = InfluxClient.Client.query(queryDataParam); List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
//1. 先从fluxdb 里面提取原始数据 //1. 先从fluxdb 里面提取原始数据

View File

@ -1,4 +1,4 @@
package com.cnbm.processInspection.graphAnalyzed.ms; package com.cnbm.processInspection.graphAnalyzed.forMeterage.ms;

View File

@ -1,4 +1,4 @@
package com.cnbm.processInspection.graphAnalyzed.ms; package com.cnbm.processInspection.graphAnalyzed.forMeterage.ms;
import com.cnbm.basic.entity.ProductFeatures; import com.cnbm.basic.entity.ProductFeatures;
import com.cnbm.common.spc.math.Math; import com.cnbm.common.spc.math.Math;
@ -7,7 +7,6 @@ import com.cnbm.common.spc.util.DataUtils;
import com.cnbm.influx.config.InfluxClient; import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.constant.Constant; import com.cnbm.influx.constant.Constant;
import com.cnbm.influx.param.QueryDataParam; import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.param.Range;
import com.cnbm.influx.param.Tag; import com.cnbm.influx.param.Tag;
import com.cnbm.processInspection.controlCoefficientConstant.XBarSCoefficients; import com.cnbm.processInspection.controlCoefficientConstant.XBarSCoefficients;
@ -18,7 +17,6 @@ import com.influxdb.query.FluxRecord;
import com.influxdb.query.FluxTable; import com.influxdb.query.FluxTable;
import lombok.Data; import lombok.Data;
import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -103,7 +101,6 @@ public class MeanStandardDeviationGraph {
dropNames.add("inspectionSheetId"); dropNames.add("inspectionSheetId");
queryDataParam.setDropedTagNames(dropNames); queryDataParam.setDropedTagNames(dropNames);
queryDataParam.setTag(new Tag("argName",argName)); queryDataParam.setTag(new Tag("argName",argName));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(), Instant.now()));
List<FluxTable> query = InfluxClient.Client.query(queryDataParam); List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
//1. 先从fluxdb 里面提取原始数据 //1. 先从fluxdb 里面提取原始数据

View File

@ -0,0 +1,299 @@
package com.cnbm.processInspection.graphAnalyzed.forMeterage.xmr;
import com.cnbm.basic.entity.ProductFeatures;
import com.cnbm.common.spc.math.Math;
import com.cnbm.common.spc.math.StandardDiviation;
import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.constant.Constant;
import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.param.Tag;
import com.cnbm.processInspection.dto.InterpretationListArg;
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 java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
/**
* @Desc: "均值标准差 控制图 , 计算类"
* @Author: caixiang
* @DATE: 2022/7/20 14:26
* 使用方式 先new MeanStandardDeviationGraph 对象 再initialData 初始化数据 再get 控制限
*
* 步骤
* 先读mysql表查询 product_features 先读到 sample_size样本量
* 再依据 influx.argName == mysql.product_feature.name && 时间段 查询所有的 参数数据
* 拿到参数数据后分组 整合成List<Point>,
* 计算控制限
* 计算 母体 \sigma bar{x}
* 计算CPK CPU CPL这些
* 如果配置了判读方案还要 调用 StatisticalControlledTest Function 检验
*
*/
@Data
public class XMRGraph {
//母体的 μ = xbarbar
private Double miu;
//母体的 xigma 全局计算的;
private Double xigma;
//母体的 xigma 全局计算的;
private Double totalXigma;
//需要去检验的 判读方案 eg:[1,2,3,4,6]
private List<InterpretationListArg> interpretationScheme;
//这里 是特有参数 -- begin
//单值移动极差 控制图 xbar == xbarbar
private Double xbar;
private Double rsbar;
//这里 是特有参数 -- end
private Integer sampleSize;
private String argName;
private SpecificationLimit specificationLimit;
private XMRGraphEntity xmrGraphEntity;
public XMRGraph(ProductFeatures productFeatures) throws Exception {
if(productFeatures.getSampleSize()==null || productFeatures.getName()==null){
throw new Exception("ProductFeatures 参数异常");
}
this.argName = productFeatures.getName();
this.sampleSize = 1;
this.specificationLimit = new SpecificationLimit(
productFeatures.getUsl()==null?null:productFeatures.getUsl(),
productFeatures.getSl()==null?null:productFeatures.getSl(),
productFeatures.getUsl()==null?null:productFeatures.getUsl()
);
}
private Double[] toDoubleArray(Object[] o){
Double[] res= new Double[o.length];
for(int i=0;i<o.length;i++){
res[i] = (Double) o[i];
}
return res;
}
public void isNeedInterpretation(List<InterpretationListArg> list){
this.interpretationScheme = list;
}
/**
* name : 初始化数据函数
* desc : 从influxdb 里面读取数据然后 加工处理成 我需要的
* 步骤
*
* */
public void initialDate(QueryDataParam queryDataParam){
queryDataParam.setBucket(Constant.bucket);
List<String> dropNames = new ArrayList<>();
dropNames.add("transationId");
dropNames.add("inspectionSheetId");
queryDataParam.setDropedTagNames(dropNames);
queryDataParam.setTag(new Tag("argName",argName));
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
//1. 先从fluxdb 里面提取原始数据
List<Double> originData = new ArrayList<>();
for (FluxTable fluxTable : query) {
List<FluxRecord> records = fluxTable.getRecords();
for (FluxRecord fluxRecord : records) {
//因为 传进去的就是Double 类型所以取出来自然而然就是Double
originData.add(Double.parseDouble(fluxRecord.getValueByKey("_value").toString()));
}
}
//2. convert to XbarSPoint
List<XMRPoint> list = new ArrayList<>();
Double lastOne = (double) 0;
List<Double> rsArray = new ArrayList<>();
for(int i=0;i<originData.size();i++){
if(i==0){
list.add(new XMRPoint(
i,
new Double(0),
originData.get(i),
null
));
lastOne = originData.get(i);
continue;
}
Double now = originData.get(i);
Double rs = ( java.lang.Math.abs( now - lastOne ) );
rsArray.add(rs);
list.add(new XMRPoint(
i,
new Double(0),
now,
rs
));
lastOne = now;
}
//3. 以及一些 控制图的全局参数
this.xbar = Math.getMean(toDoubleArray(originData.toArray()));
this.miu = xbar;
StandardDiviation standardDiviation =Math.StandardDiviation(toDoubleArray(originData.toArray()));
this.xigma = standardDiviation.getNormal();
this.totalXigma = standardDiviation.getTotality();
this.rsbar = Math.getMean(toDoubleArray(rsArray.toArray()));
this.xmrGraphEntity = new XMRGraphEntity(list,xbar,rsbar);
//4.判读方案 校验
// 开始
if(this.interpretationScheme != null){
List<Point> forX = new ArrayList<>();
List<Point> forRS = new ArrayList<>();
for(XMRPoint x:list){
forX.add( new Point( x.getPosition() , x.getX() ) );
if(x.getPosition()!=0){
forRS.add( new Point( x.getPosition(), x.getRs() ) );
}
}
ControlLimit xcl = getXCL();
ControlLimit rscl = getRSCL();
for(InterpretationListArg arg : this.interpretationScheme){
switch (arg.getNumber())//值必须是整型或者字符型
{
case 1:
StatisticalControlledTest.rule1(forX,xcl);
StatisticalControlledTest.rule1(forRS,rscl);
break;
case 2:
StatisticalControlledTest.rule2(forX,xcl,arg.getArg1());
StatisticalControlledTest.rule2(forRS,rscl,arg.getArg1());
break;
case 3:
StatisticalControlledTest.rule3(forX,arg.getArg1());
StatisticalControlledTest.rule3(forRS,arg.getArg1());
break;
case 4:
StatisticalControlledTest.rule4(forX,arg.getArg1());
StatisticalControlledTest.rule4(forRS,arg.getArg1());
break;
case 5:
StatisticalControlledTest.rule5(forX,xcl,arg.getArg1(), arg.getArg2());
StatisticalControlledTest.rule5(forRS,rscl,arg.getArg1(), arg.getArg2());
break;
case 6:
StatisticalControlledTest.rule6(forX,xcl,arg.getArg1(), arg.getArg2());
StatisticalControlledTest.rule6(forRS,rscl,arg.getArg1(), arg.getArg2());
break;
case 7:
StatisticalControlledTest.rule7(forX,xcl,arg.getArg1());
StatisticalControlledTest.rule7(forRS,rscl, arg.getArg1());
break;
case 8:
StatisticalControlledTest.rule8(forX,xcl, arg.getArg1());
StatisticalControlledTest.rule8(forRS,rscl, arg.getArg1());
break;
default:
break;
}
}
for(int i=0;i<list.size();i++){
if(i==0){
list.get(i).setxUnsatisfiedRules(forX.get(i).getUnsatisfiedRules());
list.get(i).setRsUnsatisfiedRules(new HashSet<>());
}else {
list.get(i).setxUnsatisfiedRules(forX.get(i).getUnsatisfiedRules());
list.get(i).setRsUnsatisfiedRules(forRS.get(i-1).getUnsatisfiedRules());
}
}
}
// 结束
}
/**
* desc: get X控制图(单值控制图) 的控制限
* 注意此函数 要在 initialDate()函数执行之后
* */
public ControlLimit getXCL(){
return new ControlLimit(
(this.xmrGraphEntity.getXbar() + 2.66 * this.xmrGraphEntity.getRsbar()),
this.xmrGraphEntity.getXbar() ,
(this.xmrGraphEntity.getXbar() - 2.66 * this.xmrGraphEntity.getRsbar())
);
}
/**
* desc: get R控制图 的控制限
* 注意此函数 要在 initialDate()函数执行之后
* */
public ControlLimit getRSCL(){
return new ControlLimit(
( 3.267 * this.xmrGraphEntity.getRsbar() ) ,
this.xmrGraphEntity.getRsbar() ,
(double) 0
);
}
/**
* desc: get 工序能力
* 注意此函数 要在 initialDate()函数执行之后
* */
public ProcessCapability getProcessCapacity(){
SpecificationLimit sp = this.specificationLimit;
List<String> warming = new ArrayList<>();
Float usl = sp.getUSL();
Float lsl = sp.getLSL();
if(usl==null || lsl==null){
if(usl==null && lsl!=null){
if(this.miu<lsl){
warming.add("平均值已不能满足规范要求, 有相当多数据均为不合格, 则表示完全没有工序能力");
return new ProcessCapability(null,null,null,(double)0,warming);
}
Double cpl = ( (this.miu-lsl) / (3 * this.xigma) );
return new ProcessCapability(null,null,null,cpl,warming);
} else if (lsl == null && usl!=null) {
if(this.miu>usl){
warming.add("平均值已不能满足规范要求, 有相当多数据均为不合格, 则表示完全没有工序能力");
return new ProcessCapability(null,null,(double)0,null,warming);
}
Double cpu = ( (usl-this.miu) / (3 * this.xigma) );
return new ProcessCapability(null,null,cpu,null,warming);
}else {
return new ProcessCapability(null,null,null,null,warming);
}
}
//下面就是 usl lsl 都部位null的情况
Float k1 = usl-lsl;
Float k2 = usl+lsl;
Double cp = ( k1 / (6*this.xigma) );
Double k = ( java.lang.Math.abs( (this.miu-k2/2) ) / (k1/2) );
if(k>1){
warming.add("此工艺参数K 大于1, 说明均值μ已经偏离到规范范围意外,即相当多的工艺参数均不满足规范要求,这说明工艺加工结果很差,该设备根本不适用于批量生产");
}
Double cpk = cp * ( 1- k);
if(cpk<0){
warming.add("Cpk=0该工序完全没有能力 批量生产");
cpk = (double) 0;
}
Double cpu = ( (usl-this.miu) / (3 * this.xigma) );
Double cpl = ( (this.miu-lsl) / (3 * this.xigma) );
return new ProcessCapability(cp,cpk,cpu,cpl,warming);
}
}

View File

@ -0,0 +1,50 @@
package com.cnbm.processInspection.graphAnalyzed.forMeterage.xmr;
import com.cnbm.qualityPlanning.entity.XMRPoint;
import com.cnbm.qualityPlanning.entity.XbarRPoint;
import java.util.List;
/**
* @Desc: "xbar-R 结果类"
* @Author: caixiang
* @DATE: 2022/7/21 16:26
*/
public class XMRGraphEntity {
private List<XMRPoint> list;
private Double xbar;
private Double rsbar;
public XMRGraphEntity(List<XMRPoint> list, Double xbar, Double rsbar){
this.list = list;
this.rsbar = rsbar;
this.xbar = xbar;
}
public List<XMRPoint> getList() {
return list;
}
public void setList(List<XMRPoint> list) {
this.list = list;
}
public Double getXbar() {
return xbar;
}
public void setXbar(Double xbar) {
this.xbar = xbar;
}
public Double getRsbar() {
return rsbar;
}
public void setRsbar(Double rsbar) {
this.rsbar = rsbar;
}
}

View File

@ -0,0 +1,95 @@
package com.cnbm.qualityPlanning.entity;
import java.util.Set;
/**
* @Desc: "整合,处理好 后的一行数据 (sampleSize 后的数据) "
* @Author: caixiang
* @DATE: 2022/7/21 9:43
*/
public class XMRPoint extends Point {
private Double x;
private Double rs;
//position 是这个数据在数组中的位置 value 是待被判读方案 分析的value xbarsr 中选一
public XMRPoint(Integer position, Double value) {
super(position, value);
}
//r 不满足 判读方案
private Set<Integer> xUnsatisfiedRules;
//xbar 不满足 判读方案
private Set<Integer> rsUnsatisfiedRules;
private void setValueToTest(Double value){
setValueForInterpretation(value);
}
public Set<Integer> getxUnsatisfiedRules() {
return xUnsatisfiedRules;
}
public void setxUnsatisfiedRules(Set<Integer> xUnsatisfiedRules) {
this.xUnsatisfiedRules = xUnsatisfiedRules;
}
public Set<Integer> getRsUnsatisfiedRules() {
return rsUnsatisfiedRules;
}
public void setRsUnsatisfiedRules(Set<Integer> rsUnsatisfiedRules) {
this.rsUnsatisfiedRules = rsUnsatisfiedRules;
}
public Double getX() {
return x;
}
public void setX(Double x) {
this.x = x;
}
public Double getRs() {
return rs;
}
public void setRs(Double rs) {
this.rs = rs;
}
public XMRPoint(Integer position, Double value, Double x, Double rs) {
super(position,value);
this.x = x;
this.rs = rs;
}
@Override
public Integer getPosition() {
return super.getPosition();
}
@Override
public Double getValueForInterpretation() {
return super.getValueForInterpretation();
}
@Override
public Set<Integer> getUnsatisfiedRules() {
return super.getUnsatisfiedRules();
}
@Override
public void setPosition(Integer position) {
super.setPosition(position);
}
@Override
public void setValueForInterpretation(Double valueForInterpretation) {
super.setValueForInterpretation(valueForInterpretation);
}
@Override
public void setUnsatisfiedRules(Set<Integer> unsatisfiedRules) {
super.setUnsatisfiedRules(unsatisfiedRules);
}
}