Compare commits

...

22 Commits

Author SHA1 Message Date
d03a3e06a3 MARK 2022-12-09 15:27:11 +08:00
c9d01c9e11 Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC into yanyang 2022-12-09 09:08:12 +08:00
caixiang
de3fe9b95c mark 2022-12-09 09:06:52 +08:00
caixiang
53f0c58507 mark 2022-12-08 17:21:28 +08:00
95a82b042d Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC into yanyang 2022-12-08 16:26:28 +08:00
b15ad64d76 MARK FOR PULL 2022-12-08 16:26:17 +08:00
caixiang
bf67380718 mark 2022-12-08 16:17:15 +08:00
caixiang
b93869c4a1 修改 influxdb query函数 2022-12-08 15:28:10 +08:00
6829169a4a Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC into yanyang
 Conflicts:
	ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java
2022-12-07 16:58:35 +08:00
caixiang
2d9b0ea1f1 修改 influxdb query函数 2022-12-07 16:56:47 +08:00
0e3f0f9168 Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC into yanyang 2022-12-07 11:07:41 +08:00
b515eacbab MARK FOR PULL 2022-12-07 11:07:31 +08:00
caixiang
515df64760 修改判读方案算法 2022-12-07 11:05:27 +08:00
ab35b10130 Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC into yanyang
 Conflicts:
	ym-influx/src/main/java/com/cnbm/influx/config/InfluxClient.java
	ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java
	ym-influx/src/main/java/com/cnbm/influx/template/Event.java
2022-12-01 15:54:41 +08:00
4864545f12 m 2022-12-01 15:50:30 +08:00
caixiang
f7712f184a 修改判读方案算法 2022-12-01 15:33:57 +08:00
caixiang
8bfcaaf429 修改判读方案算法 2022-12-01 11:45:05 +08:00
caixiang
650e9a2324 修改判读方案算法 2022-11-29 11:11:07 +08:00
caixiang
a2d91083f2 Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC 2022-11-25 10:12:40 +08:00
caixiang
bd9276036b mark for pull 2022-11-25 10:12:33 +08:00
8a4f0094a1 Merge pull request 'm' (#12) from yanyang into master
Reviewed-on: #12
2022-11-25 10:07:32 +08:00
e6b5583d05 Merge pull request '质量计划' (#11) from yanyang into master
Reviewed-on: #11
2022-09-30 08:56:37 +08:00
111 changed files with 5000 additions and 671 deletions

View File

@ -73,6 +73,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/webjars/**",
"/websocket/**",
"/influx/**",
// "/basic/**",
// "/qualityPlanning/**",
// "/processInspection/**",

View File

@ -44,13 +44,13 @@ public class SysRoleController {
@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) ,
@ApiImplicitParam(name = "name", value = "角色名", paramType = "query", dataTypeClass=String.class)
})
// @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) ,
// @ApiImplicitParam(name = "name", value = "角色名", paramType = "query", dataTypeClass=String.class)
// })
@PreAuthorize("@ex.hasAuthority('sys:role:page')")
public Result<PageData<SysRoleDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<SysRoleDTO> page = sysRoleService.page(params);

View File

@ -160,4 +160,10 @@ public class SysUserController {
ExcelUtils.exportExcelToTarget(response, null, list, SysUserExcel.class);
}
@PostMapping(value = "list")
@ApiOperation(value = "获取用户列表")
@LogOperation("获取用户列表")
public List<SysUserDTO> list(@ApiIgnore @RequestParam Map<String, Object> params) {
return sysUserService.list(params); }
}

View File

@ -144,4 +144,12 @@ public class MachineController {
return new Result().ok(true);
}
@PostMapping(value = "list")
@ApiOperation(value = "获取机台列表")
@LogOperation("获取机台列表")
@ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataTypeClass = Integer.class)
public List<MachineDTO> list(@ApiIgnore @RequestParam Map<String, Object> params) {
return machineService.list(params);
}
}

View File

@ -129,4 +129,11 @@ public class ProductController {
return new Result();
}
@PostMapping(value = "list")
@ApiOperation(value = "获取产品列表")
@LogOperation("获取产品列表")
public List<ProductDTO> list() {
return productService.list();
}
}

View File

@ -114,4 +114,11 @@ public class ShiftController {
ExcelUtils.exportExcelToTarget(response, null, list, ShiftExcel.class);
}
@PostMapping(value = "list")
@ApiOperation(value = "获取班次列表")
@LogOperation("获取班次列表")
public List<ShiftDTO> list() {
return shiftService.list();
}
}

View File

@ -1,6 +1,7 @@
package com.cnbm.basic.controller;
import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.basic.dto.ShiftDTO;
import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData;
import com.cnbm.common.utils.ExcelUtils;
@ -114,4 +115,9 @@ public class TeamController {
ExcelUtils.exportExcelToTarget(response, null, list, TeamExcel.class);
}
@PostMapping(value = "list")
@ApiOperation(value = "获取班组列表")
@LogOperation("获取班组列表")
public List<TeamDTO> list() { return teamService.list(); }
}

View File

@ -19,7 +19,6 @@ public class ProductFeaturesDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
private Long id;

View File

@ -7,6 +7,7 @@ import com.cnbm.basic.entity.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
@ -18,4 +19,5 @@ import java.util.Map;
@Mapper
public interface ProductMapper extends BaseDao<Product> {
// IPage<ProductDTO> page(Map<String, Object> params);
List<ProductDTO> list();
}

View File

@ -1,9 +1,12 @@
package com.cnbm.basic.mapper;
import com.cnbm.basic.dto.ShiftDTO;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.basic.entity.Shift;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 班次
*
@ -12,5 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ShiftMapper extends BaseDao<Shift> {
List<ShiftDTO> list();
}

View File

@ -1,9 +1,12 @@
package com.cnbm.basic.mapper;
import com.cnbm.basic.dto.TeamDTO;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.basic.entity.Team;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 班组
*
@ -12,5 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface TeamMapper extends BaseDao<Team> {
List<TeamDTO> list();
}

View File

@ -6,6 +6,7 @@ import com.cnbm.basic.dto.ProductDTO;
import com.cnbm.basic.entity.Product;
import com.cnbm.common.vo.IdVo;
import java.util.List;
import java.util.Map;
/**
@ -27,4 +28,6 @@ public interface IProductService extends CrudService<Product, ProductDTO> {
boolean changeStatus(Long id);
List<ProductDTO> list();
}

View File

@ -5,6 +5,7 @@ import com.cnbm.common.service.CrudService;
import com.cnbm.basic.dto.ShiftDTO;
import com.cnbm.basic.entity.Shift;
import java.util.List;
import java.util.Map;
/**
@ -23,4 +24,6 @@ public interface IShiftService extends CrudService<Shift, ShiftDTO> {
void update(ShiftDTO dto);
void delete(Long[] ids);
List<ShiftDTO> list();
}

View File

@ -5,6 +5,7 @@ import com.cnbm.common.service.CrudService;
import com.cnbm.basic.dto.TeamDTO;
import com.cnbm.basic.entity.Team;
import java.util.List;
import java.util.Map;
/**
@ -23,4 +24,6 @@ public interface ITeamService extends CrudService<Team, TeamDTO> {
void update(TeamDTO dto);
void delete(Long[] ids);
List<TeamDTO> list();
}

View File

@ -125,4 +125,11 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<ProductDTO> list() {
List<ProductDTO> list = mapper.list();
return list;
}
}

View File

@ -10,10 +10,12 @@ import com.cnbm.basic.entity.Shift;
import com.cnbm.basic.service.IShiftService;
import com.cnbm.common.utils.ConvertUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
@ -25,6 +27,9 @@ import java.util.Map;
@Service
public class ShiftServiceImpl extends CrudServiceImpl<ShiftMapper, Shift, ShiftDTO> implements IShiftService {
@Autowired
private ShiftMapper mapper;
@Override
public QueryWrapper<Shift> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
@ -72,4 +77,11 @@ public class ShiftServiceImpl extends CrudServiceImpl<ShiftMapper, Shift, ShiftD
deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<ShiftDTO> list() {
List<ShiftDTO> list = mapper.list();
return list;
}
}

View File

@ -2,8 +2,6 @@ package com.cnbm.basic.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cnbm.basic.dto.ProductTypeDTO;
import com.cnbm.basic.entity.ProductType;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.basic.dto.TeamDTO;
@ -12,11 +10,13 @@ import com.cnbm.basic.entity.Team;
import com.cnbm.basic.service.ITeamService;
import com.cnbm.common.utils.ConvertUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
@ -28,6 +28,9 @@ import java.util.Map;
@Service
public class TeamServiceImpl extends CrudServiceImpl<TeamMapper, Team, TeamDTO> implements ITeamService {
@Autowired
private TeamMapper mapper;
@Override
public QueryWrapper<Team> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
@ -74,4 +77,11 @@ public class TeamServiceImpl extends CrudServiceImpl<TeamMapper, Team, TeamDTO>
deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<TeamDTO> list() {
List<TeamDTO> list = mapper.list();
return list;
}
}

View File

@ -2,4 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.basic.mapper.ProductMapper">
<select id="list" resultType="com.cnbm.basic.dto.ProductDTO">
select * from product
order by id asc
</select>
</mapper>

View File

@ -2,4 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.basic.mapper.ShiftMapper">
<select id="list" resultType="com.cnbm.basic.dto.ShiftDTO">
select * from shift
order by id asc
</select>
</mapper>

View File

@ -2,4 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.basic.mapper.TeamMapper">
<select id="list" resultType="com.cnbm.basic.dto.TeamDTO">
select * from team
order by id asc
</select>
</mapper>

View File

@ -15,5 +15,12 @@
<build>
<finalName>${project.artifactId}</finalName>
</build>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
</dependencies>
</project>

View File

@ -28,7 +28,6 @@ public class Math {
d[6] = new Double(10.2);
d[7] = new Double(11.7);
;
System.out.println("均值: "+getMean(d)+",,标准差:"+StandardDiviation(d)+",极差:"+range(d));
}

View File

@ -0,0 +1,793 @@
package com.cnbm.common.spc.math;
import com.cnbm.common.spc.math.entity.T2GraphEntity;
import org.apache.commons.math3.distribution.FDistribution;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.List;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2022/9/2 15:33
*/
public class Matrix {
// public static void main(String[] args) {
// double[] xbarbar = new double[2];
// xbarbar[0] = 115.6084;
// xbarbar[1] = 1.0564;
//
// double[] xi = new double[2];
// xi[0] = 115.84;
// xi[1] = 1.078;
//
// double[] xi2 = new double[2];
// xi2[0] = 115.76;
// xi2[1] = 1.072;
//
// double[] xi3 = new double[2];
// xi3[0] = 115.11;
// xi3[1] = 1.015;
//
// double[] xi4 = new double[2];
// xi4[0] = 116.02;
// xi4[1] = 1.089;
//
// double[] xi5 = new double[2];
// xi5[0] = 115.80;
// xi5[1] = 1.090;
//
// System.out.println("Ti1:"+ forTi2(xi,xbarbar)*10);
// System.out.println("Ti2:"+ forTi2(xi2,xbarbar)*10);
// System.out.println("Ti3:"+ forTi2(xi3,xbarbar)*10);
// System.out.println("Ti4:"+ forTi2(xi4,xbarbar)*10);
// System.out.println("Ti4:"+ forTi2(xi5,xbarbar)*10);
//// double ti = 10*()
//
//
//
// //创建一个F分布对象参数为自由度
// FDistribution fd = new FDistribution(2,179);
// //当α=0.05时参数为1-α=0.95
// double v = fd.inverseCumulativeProbability(0.99865);
// //输出值
// System.out.println("v: "+v*342/179);
//
//
// //m = 25 n = 1 p = 3
// FDistribution fd2 = new FDistribution(3,21);
// //当α=0.05时参数为1-α=0.95
// double v2 = fd2.inverseCumulativeProbability(0.99865);
// //输出值
// System.out.println("v2: "+v2);
// }
// public static void main(String[] args) {
//
// double[] xlv = new double[5];
// xlv[0] = 155;
// xlv[1] = 170;
// xlv[2] = 160;
// xlv[3] = 162;
// xlv[4] = 163;
//
// double[] weigth = new double[5];
// weigth[0] = 125;
// weigth[1] = 162;
// weigth[2] = 139;
// weigth[3] = 150;
// weigth[4] = 146;
//
// double x1bar = getBar(xlv);
// double x2bar = getBar(weigth);
// System.out.println();
// double s11 = forS11(xlv,x1bar);
// double s12 = forS12(weigth,x1bar,xlv,x2bar);
// double s22 = forS22(weigth,x2bar);
// System.out.println();
//
// }
public static double[][] initialDemoSource(){
double[][] source = new double[60][6];
source[0][0] = 1;
source[0][1] = 1;
source[0][2] = 155;
source[0][3] = 100;
source[0][4] = 60;
source[0][5] = 125;
source[1][0] = 1;
source[1][1] = 2;
source[1][2] = 170;
source[1][3] = 120;
source[1][4] = 82;
source[1][5] = 162;
source[2][0] = 1;
source[2][1] = 3;
source[2][2] = 160;
source[2][3] = 132;
source[2][4] = 71;
source[2][5] = 139;
source[3][0] = 1;
source[3][1] = 4;
source[3][2] = 162;
source[3][3] = 139;
source[3][4] = 70;
source[3][5] = 150;
source[4][0] = 1;
source[4][1] = 5;
source[4][2] = 163;
source[4][3] = 110;
source[4][4] = 80;
source[4][5] = 146;
source[5][0] = 2;
source[5][1] = 1;
source[5][2] = 157;
source[5][3] = 110;
source[5][4] = 59;
source[5][5] = 124;
source[6][0] = 2;
source[6][1] = 2;
source[6][2] = 171;
source[6][3] = 122;
source[6][4] = 81;
source[6][5] = 163;
source[7][0] = 2;
source[7][1] = 3;
source[7][2] = 162;
source[7][3] = 133;
source[7][4] = 73;
source[7][5] = 139;
source[8][0] = 2;
source[8][1] = 4;
source[8][2] = 165;
source[8][3] = 140;
source[8][4] = 72;
source[8][5] = 152;
source[9][0] = 2;
source[9][1] = 5;
source[9][2] = 161;
source[9][3] = 112;
source[9][4] = 81;
source[9][5] = 147;
source[10][0] = 3;
source[10][1] = 1;
source[10][2] = 153;
source[10][3] = 110;
source[10][4] = 63;
source[10][5] = 123;
source[11][0] = 3;
source[11][1] = 2;
source[11][2] = 169;
source[11][3] = 120;
source[11][4] = 86;
source[11][5] = 161;
source[12][0] = 3;
source[12][1] = 3;
source[12][2] = 161;
source[12][3] = 133;
source[12][4] = 79;
source[12][5] = 141;
source[13][0] = 3;
source[13][1] = 4;
source[13][2] = 160;
source[13][3] = 140;
source[13][4] = 72;
source[13][5] = 153;
source[14][0] = 3;
source[14][1] = 5;
source[14][2] = 159;
source[14][3] = 118;
source[14][4] = 82;
source[14][5] = 149;
source[15][0] = 4;
source[15][1] = 1;
source[15][2] = 157;
source[15][3] = 109;
source[15][4] = 60;
source[15][5] = 126;
source[16][0] = 4;
source[16][1] = 2;
source[16][2] = 171;
source[16][3] = 126;
source[16][4] = 81;
source[16][5] = 163;
source[17][0] = 4;
source[17][1] = 3;
source[17][2] = 162;
source[17][3] = 135;
source[17][4] = 72;
source[17][5] = 142;
source[18][0] = 4;
source[18][1] = 4;
source[18][2] = 163;
source[18][3] = 135;
source[18][4] = 70;
source[18][5] = 151;
source[19][0] = 4;
source[19][1] = 5;
source[19][2] = 164;
source[19][3] = 108;
source[19][4] = 72;
source[19][5] = 147;
source[20][0] = 5;
source[20][1] = 1;
source[20][2] = 156;
source[20][3] = 108;
source[20][4] = 70;
source[20][5] = 126;
source[21][0] = 5;
source[21][1] = 2;
source[21][2] = 172;
source[21][3] = 113;
source[21][4] = 80;
source[21][5] = 162;
source[22][0] = 5;
source[22][1] = 3;
source[22][2] = 162;
source[22][3] = 130;
source[22][4] = 70;
source[22][5] = 141;
source[23][0] = 5;
source[23][1] = 4;
source[23][2] = 162;
source[23][3] = 142;
source[23][4] = 76;
source[23][5] = 150;
source[24][0] = 5;
source[24][1] = 5;
source[24][2] = 164;
source[24][3] = 110;
source[24][4] = 83;
source[24][5] = 146;
source[25][0] = 6;
source[25][1] = 1;
source[25][2] = 157;
source[25][3] = 100;
source[25][4] = 60;
source[25][5] = 128;
source[26][0] = 6;
source[26][1] = 2;
source[26][2] = 167;
source[26][3] = 122;
source[26][4] = 80;
source[26][5] = 162;
source[27][0] = 6;
source[27][1] = 3;
source[27][2] = 156;
source[27][3] = 133;
source[27][4] = 73;
source[27][5] = 142;
source[28][0] = 6;
source[28][1] = 4;
source[28][2] = 161;
source[28][3] = 140;
source[28][4] = 76;
source[28][5] = 150;
source[29][0] = 6;
source[29][1] = 5;
source[29][2] = 164;
source[29][3] = 111;
source[29][4] = 82;
source[29][5] = 147;
source[30][0] = 7;
source[30][1] = 1;
source[30][2] = 157;
source[30][3] = 106;
source[30][4] = 62;
source[30][5] = 127;
source[31][0] = 7;
source[31][1] = 2;
source[31][2] = 167;
source[31][3] = 130;
source[31][4] = 83;
source[31][5] = 162;
source[32][0] = 7;
source[32][1] = 3;
source[32][2] = 162;
source[32][3] = 125;
source[32][4] = 73;
source[32][5] = 142;
source[33][0] = 7;
source[33][1] = 4;
source[33][2] = 161;
source[33][3] = 144;
source[33][4] = 76;
source[33][5] = 152;
source[34][0] = 7;
source[34][1] = 5;
source[34][2] = 160;
source[34][3] = 118;
source[34][4] = 85;
source[34][5] = 147;
source[35][0] = 8;
source[35][1] = 1;
source[35][2] = 159;
source[35][3] = 108;
source[35][4] = 62;
source[35][5] = 128;
source[36][0] = 8;
source[36][1] = 2;
source[36][2] = 167;
source[36][3] = 118;
source[36][4] = 84;
source[36][5] = 162;
source[37][0] = 8;
source[37][1] = 3;
source[37][2] = 161;
source[37][3] = 120;
source[37][4] = 73;
source[37][5] = 144;
source[38][0] = 8;
source[38][1] = 4;
source[38][2] = 164;
source[38][3] = 135;
source[38][4] = 76;
source[38][5] = 151;
source[39][0] = 8;
source[39][1] = 5;
source[39][2] = 160;
source[39][3] = 101;
source[39][4] = 81;
source[39][5] = 146;
source[40][0] = 9;
source[40][1] = 1;
source[40][2] = 157;
source[40][3] = 97;
source[40][4] = 57;
source[40][5] = 126;
source[41][0] = 9;
source[41][1] = 2;
source[41][2] = 171;
source[41][3] = 130;
source[41][4] = 72;
source[41][5] = 162;
source[42][0] = 9;
source[42][1] = 3;
source[42][2] = 162;
source[42][3] = 134;
source[42][4] = 68;
source[42][5] = 144;
source[43][0] = 9;
source[43][1] = 4;
source[43][2] = 164;
source[43][3] = 143;
source[43][4] = 70;
source[43][5] = 150;
source[44][0] = 9;
source[44][1] = 5;
source[44][2] = 166;
source[44][3] = 114;
source[44][4] = 80;
source[44][5] = 147;
source[45][0] = 10;
source[45][1] = 1;
source[45][2] = 157;
source[45][3] = 107;
source[45][4] = 62;
source[45][5] = 124;
source[46][0] = 10;
source[46][1] = 2;
source[46][2] = 172;
source[46][3] = 122;
source[46][4] = 81;
source[46][5] = 160;
source[47][0] = 10;
source[47][1] = 3;
source[47][2] = 163;
source[47][3] = 135;
source[47][4] = 72;
source[47][5] = 143;
source[48][0] = 10;
source[48][1] = 4;
source[48][2] = 164;
source[48][3] = 141;
source[48][4] = 70;
source[48][5] = 148;
source[49][0] = 10;
source[49][1] = 5;
source[49][2] = 166;
source[49][3] = 118;
source[49][4] = 82;
source[49][5] = 146;
source[50][0] = 11;
source[50][1] = 1;
source[50][2] = 152;
source[50][3] = 106;
source[50][4] = 62;
source[50][5] = 124;
source[51][0] = 11;
source[51][1] = 2;
source[51][2] = 167;
source[51][3] = 122;
source[51][4] = 82;
source[51][5] = 162;
source[52][0] = 11;
source[52][1] = 3;
source[52][2] = 158;
source[52][3] = 137;
source[52][4] = 74;
source[52][5] = 146;
source[53][0] = 11;
source[53][1] = 4;
source[53][2] = 159;
source[53][3] = 146;
source[53][4] = 72;
source[53][5] = 150;
source[54][0] = 11;
source[54][1] = 5;
source[54][2] = 160;
source[54][3] = 98;
source[54][4] = 82;
source[54][5] = 145;
source[55][0] = 12;
source[55][1] = 1;
source[55][2] = 153;
source[55][3] = 106;
source[55][4] = 62;
source[55][5] = 122;
source[56][0] = 12;
source[56][1] = 2;
source[56][2] = 168;
source[56][3] = 125;
source[56][4] = 85;
source[56][5] = 164;
source[57][0] = 12;
source[57][1] = 3;
source[57][2] = 159;
source[57][3] = 137;
source[57][4] = 72;
source[57][5] = 144;
source[58][0] = 12;
source[58][1] = 4;
source[58][2] = 162;
source[58][3] = 146;
source[58][4] = 73;
source[58][5] = 149;
source[59][0] = 12;
source[59][1] = 5;
source[59][2] = 167;
source[59][3] = 99;
source[59][4] = 70;
source[59][5] = 148;
return source;
}
public static void main(String[] args) {
double[][] source = initialDemoSource();
T2GraphEntity[] all = new T2GraphEntity[12];
//取值
for(int i=1;i<=12;i++){
T2GraphEntity t = new T2GraphEntity();
for(int j=0;j<source.length;j++){
if(source[j][0] == i){
//1=观察对象2=心率 3=收缩压 4=舒张压 5=体重
t.getX1Source().add(source[j][1]);
t.getX2Source().add(source[j][3]);
}
}
all[i-1] = t;
}
//计算每个子组的 x1barx2barS11S12S22
System.out.println();
for(int i=0;i<all.length;i++){
T2GraphEntity t2 = all[i];
double[] x1Source = ListTodouble(t2.getX1Source());
double[] x2Source = ListTodouble(t2.getX2Source());
double x1bar = getBar(x1Source);
double x2bar = getBar(x2Source);
t2.setX1bar(x1bar);
t2.setX2bar(x2bar);
t2.setS11(forS11(x1Source,x1bar));
t2.setS12(forS12(x1Source,x1bar,x2Source,x2bar));
t2.setS22(forS22(x2Source,x2bar));
}
//计算母体的 x1barbarx2barbarS11barS12barS22bar
double x1barbar = 0;
double x2barbar = 0;
double s11bar = 0;
double s12bar = 0;
double s22bar = 0;
for(int i=0;i<all.length;i++){
T2GraphEntity t2 = all[i];
x1barbar += t2.getX1bar();
x2barbar += t2.getX2bar();
s11bar += t2.getS11();
s12bar += t2.getS12();
s22bar += t2.getS22();
}
x1barbar /= all.length;
x2barbar /= all.length;
s11bar /= all.length;
s12bar /= all.length;
s22bar /= all.length;
// Ti2
double[][] sbar = new double[2][2];
sbar[0][0] = s11bar;
sbar[0][1] = s12bar;
sbar[1][0] = s12bar;
sbar[1][1] = s22bar;
double[][] inverse = inverseSE(sbar);
double[] xbarbar = new double[2];
xbarbar[0] = x1barbar;
xbarbar[1] = x2barbar;
for(int i=0;i<all.length;i++){
T2GraphEntity t2 = all[i];
double[] xibar = new double[2];
xibar[0] = t2.getX1bar();
xibar[1] = t2.getX2bar();
double ti = forTi2(xibar, xbarbar, inverse);
t2.setTi(ti*6);
}
System.out.println();
// ucl
//创建一个F分布对象参数为自由度
FDistribution fd = new FDistribution(2,59);
//当α=0.05时参数为1-α=0.95
double v = fd.inverseCumulativeProbability(0.99865);
//输出值
System.out.println("v: "+v);
double m = 12;
double n = 6;
double p = 2;
double head = (double) 110/(double)59;
double ucl = head*v;
System.out.println();
for(int i=0;i< all.length;i++){
T2GraphEntity t2GraphEntity = all[i];
System.out.println(i+" 位置: "+t2GraphEntity.getTi());
}
System.out.println("ucl:" + ucl);
}
public static double[] ListTodouble(List<Double> list){
Double[] doubles=new Double[list.size()];
list.toArray(doubles);
if(doubles==null){
return null;
}
double[] result=new double[doubles.length];
for(int i=0;i<doubles.length;i++){
result[i]=doubles[i].doubleValue();
}
return result;
}
public static double getBar(double[] d){
return Arrays.stream(d).average().getAsDouble();
}
public static double forS11(double[] source , double x1bar){
double all = 0;
for(int i=0;i<source.length;i++){
double c = source[i]-x1bar;
all += c*c;
}
return all/(source.length-1);
}
public static Double forS12(double[] source1 , double x1bar , double[] source2 , double x2bar){
double all = 0;
if(source1.length != source2.length){
return null;
}
for(int i=0;i<source1.length;i++){
double c1 = source1[i]-x1bar;
double c2 = source2[i]-x2bar;
all += c1*c2;
}
return all/(source1.length-1);
}
public static double forS22(double[] source , double x2bar){
double all = 0;
for(int i=0;i<source.length;i++){
double c = source[i]-x2bar;
all += c*c;
}
return all/(source.length-1);
}
public static double forTi2(double[] xibar,double[] xbarbar,double[][] inverse) {
double[] xf = new double[2];
xf[0] = xibar[0]-xbarbar[0];
xf[1] = xibar[1]-xbarbar[1];
double[] ff = new double[2];
ff[0] = xf[0]*inverse[0][0] + xf[1]*inverse[1][0];
ff[1] = xf[0]*inverse[0][1] + xf[1]*inverse[1][1];
return ff[0]*xf[0] + ff[1]*xf[1];
}
public static double formatDouble(double d) {
// 新方法如果不需要四舍五入可以使用RoundingMode.DOWN
BigDecimal bg = new BigDecimal(d).setScale(4, RoundingMode.UP);
return bg.doubleValue();
}
//2阶矩阵 求逆
public static double[][] inverseSE(double[][] source){
double a = source[0][0];
double b = source[0][1];
double c = source[1][0];
double d = source[1][1];
double to = 1/(a*d-b*c);
double[][] res = new double[2][2];
// res[0][0] = formatDouble(d*to);
// res[0][1] = formatDouble(b*to*-1);
// res[1][0] = formatDouble(c*to*-1);
// res[1][1] = formatDouble(a*to);
res[0][0] = d*to;
res[0][1] = b*to*-1;
res[1][0] = c*to*-1;
res[1][1] = a*to;
return res;
}
//获取矩阵的逆
public static int[][] inverse(int[][] A) {
int[][] B = new int[A.length][A[0].length];
for (int i = 0; i < A.length; i++) {
for (int j = 0; j < A[0].length; j++) {
B[i][j] = A[i][j];
}
}
int[][] C = new int[A.length][A[0].length];
for (int i = 0; i < A.length; i++) {
for (int j = 0; j < A[0].length; j++) {
C[i][j] = (int) java.lang.Math.pow(-1, i + j) * determinant(minor(B, j, i));
}
}
int[][] D = new int[A.length][A[0].length];
for (int i = 0; i < A.length; i++) {
for (int j = 0; j < A[0].length; j++) {
D[i][j] = C[i][j] / determinant(A);
}
}
return D;
}
//求解矩阵的行列式
private static int determinant(int[][] a) {
if (a.length == 1) {
return a[0][0];
}
int det = 0;
for (int i = 0; i < a[0].length; i++) {
det += (int) java.lang.Math.pow(-1, i) * a[0][i] * determinant(minor(a, 0, i));
}
return det;
}
//求解二维矩阵在某一位置的伴随矩阵
private static int[][] minor(int[][] b, int i, int j) {
int[][] a = new int[b.length - 1][b[0].length - 1];
for (int x = 0, y = 0; x < b.length; x++) {
if (x == i) {
continue;
}
for (int m = 0,n = 0; m < b[0].length; m++) {
if (m == j) {
continue;
}
a[y][n] = b[x][m];
n++;
}
y++;
}
return a;
}
}

View File

@ -1,5 +1,7 @@
package com.cnbm.common.spc.math;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -8,10 +10,13 @@ import lombok.Data;
* @DATE: 2022/7/25 15:23
*/
@Data
@ApiModel(value = "标准差结果类")
public class StandardDiviation {
//标准差
//组内标准差
@ApiModelProperty(value = "组内标准差")
private Double normal;
//总体标准差
@ApiModelProperty(value = "总体标准差")
private Double totality;
public StandardDiviation(Double normal, Double totality) {

View File

@ -0,0 +1,30 @@
package com.cnbm.common.spc.math.entity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2022/9/9 15:26
*/
@Data
public class T2GraphEntity {
private double x1bar;
private double x2bar;
private double s11;
private double s12;
private double s22;
private double ti;
private List<Double> x1Source;
private List<Double> x2Source;
public T2GraphEntity(){
x1Source = new ArrayList<>();
x2Source = new ArrayList<>();
}
}

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

@ -65,16 +65,16 @@ spring:
# username: postgres
# password: 123456
influx:
url: http://192.168.0.170:8086 # URL to connect to InfluxDB.
username: caixiang # Username to use in the basic auth.
password: 251128856 # Password to use in the basic auth.
token: lkBsC27QZr1W50BSPlGxpTqNNpwuUk5uz1dZZRPSPbCG5VmNDDUo8P3UkZIhGWwfJwkuz6ZGZ7Et4_KBaG3gHw== # Token to use for the authorization.
org: qgs # Default destination organization for writes and queries.
bucket: qgs-bucket # Default destination bucket for writes.
logLevel: BODY # The log level for logging the HTTP request and HTTP response. (Default: NONE)
readTimeout: 5s # Read timeout for OkHttpClient. (Default: 10s)
writeTimeout: 5s # Write timeout for OkHttpClient. (Default: 10s)
connectTimeout: 5s # Connection timeout for OkHttpClient. (Default: 10s)
#influx:
# url: http://192.168.0.170:8086 # URL to connect to InfluxDB.
# username: caixiang # Username to use in the basic auth.
# password: 251128856 # Password to use in the basic auth.
# token: lkBsC27QZr1W50BSPlGxpTqNNpwuUk5uz1dZZRPSPbCG5VmNDDUo8P3UkZIhGWwfJwkuz6ZGZ7Et4_KBaG3gHw== # Token to use for the authorization.
# org: qgs # Default destination organization for writes and queries.
# bucket: qgs-bucket # Default destination bucket for writes.
# logLevel: BODY # The log level for logging the HTTP request and HTTP response. (Default: NONE)
# readTimeout: 5s # Read timeout for OkHttpClient. (Default: 10s)
# writeTimeout: 5s # Write timeout for OkHttpClient. (Default: 10s)
# connectTimeout: 5s # Connection timeout for OkHttpClient. (Default: 10s)
# management.health.influx.enabled=true # Whether to enable InfluxDB 2.x health check.

View File

@ -19,7 +19,7 @@ public class CodeGenerator {
@Test
public void test(){
mybatisPlusGenerator(new String[]{"product_type"});
mybatisPlusGenerator(new String[]{"inspection_sheet"});
}
public static void mybatisPlusGenerator(String[] include){

View File

@ -0,0 +1,118 @@
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.InspectionSheetDTO;
import com.cnbm.generator.code.excel.InspectionSheetExcel;
import com.cnbm.generator.code.service.IInspectionSheetService;
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-12-07
*/
@RestController
@RequestMapping("/code/inspectionSheet")
@Api(tags="检验单 表")
public class InspectionSheetController {
@Autowired
private IInspectionSheetService inspectionSheetService;
@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:inspectionSheet:page')")
public Result<PageData<InspectionSheetDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<InspectionSheetDTO> page = inspectionSheetService.page(params);
return new Result<PageData<InspectionSheetDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:info')")
public Result<InspectionSheetDTO> get(@PathVariable("id") Long id){
InspectionSheetDTO data = inspectionSheetService.get(id);
return new Result<InspectionSheetDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:save')")
public Result<Long> save(@RequestBody InspectionSheetDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
try {
inspectionSheetService.save(dto);
}catch (Exception e){
return new Result<Long>().error(1,"没有发现检验参数");
}
return new Result<Long>().ok(dto.getId());
}
@PutMapping
@ApiOperation("修改")
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:update')")
public Result<Long> update(@RequestBody InspectionSheetDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
inspectionSheetService.update(dto);
return new Result<Long>().ok(dto.getId());
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
inspectionSheetService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<InspectionSheetDTO> list = inspectionSheetService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, InspectionSheetExcel.class);
}
}

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.ProductFeaturesDTO;
import com.cnbm.generator.code.excel.ProductFeaturesExcel;
import com.cnbm.generator.code.service.IProductFeaturesService;
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-23
*/
@RestController
@RequestMapping("/code/productFeatures")
@Api(tags="产品特性 表")
public class ProductFeaturesController {
@Autowired
private IProductFeaturesService productFeaturesService;
@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:productFeatures:page')")
public Result<PageData<ProductFeaturesDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<ProductFeaturesDTO> page = productFeaturesService.page(params);
return new Result<PageData<ProductFeaturesDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@PreAuthorize("@ex.hasAuthority('code:productFeatures:info')")
public Result<ProductFeaturesDTO> get(@PathVariable("id") Long id){
ProductFeaturesDTO data = productFeaturesService.get(id);
return new Result<ProductFeaturesDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('code:productFeatures:save')")
public Result<Long> save(@RequestBody ProductFeaturesDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
productFeaturesService.save(dto);
return new Result<Long>().ok(dto.getId());
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@PreAuthorize("@ex.hasAuthority('code:productFeatures:update')")
public Result<Long> update(@RequestBody ProductFeaturesDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
productFeaturesService.update(dto);
return new Result<Long>().ok(dto.getId());
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@PreAuthorize("@ex.hasAuthority('code:productFeatures:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
productFeaturesService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@PreAuthorize("@ex.hasAuthority('code:productFeatures:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ProductFeaturesDTO> list = productFeaturesService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ProductFeaturesExcel.class);
}
}

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.ProductTypeDTO;
import com.cnbm.generator.code.excel.ProductTypeExcel;
import com.cnbm.generator.code.service.IProductTypeService;
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-23
*/
@RestController
@RequestMapping("/code/productType")
@Api(tags="产品类型 表")
public class ProductTypeController {
@Autowired
private IProductTypeService productTypeService;
@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:productType:page')")
public Result<PageData<ProductTypeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<ProductTypeDTO> page = productTypeService.page(params);
return new Result<PageData<ProductTypeDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@PreAuthorize("@ex.hasAuthority('code:productType:info')")
public Result<ProductTypeDTO> get(@PathVariable("id") Long id){
ProductTypeDTO data = productTypeService.get(id);
return new Result<ProductTypeDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('code:productType:save')")
public Result<Long> save(@RequestBody ProductTypeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
productTypeService.save(dto);
return new Result<Long>().ok(dto.getId());
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@PreAuthorize("@ex.hasAuthority('code:productType:update')")
public Result<Long> update(@RequestBody ProductTypeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
productTypeService.update(dto);
return new Result<Long>().ok(dto.getId());
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@PreAuthorize("@ex.hasAuthority('code:productType:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
productTypeService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@PreAuthorize("@ex.hasAuthority('code:productType:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ProductTypeDTO> list = productTypeService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ProductTypeExcel.class);
}
}

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.UnitDTO;
import com.cnbm.generator.code.excel.UnitExcel;
import com.cnbm.generator.code.service.IUnitService;
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-06-30
*/
@RestController
@RequestMapping("/code/unit")
@Api(tags="单位 表")
public class UnitController {
@Autowired
private IUnitService unitService;
@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:unit:page')")
public Result<PageData<UnitDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<UnitDTO> page = unitService.page(params);
return new Result<PageData<UnitDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@PreAuthorize("@ex.hasAuthority('code:unit:info')")
public Result<UnitDTO> get(@PathVariable("id") Long id){
UnitDTO data = unitService.get(id);
return new Result<UnitDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('code:unit:save')")
public Result save(@RequestBody UnitDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
unitService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@PreAuthorize("@ex.hasAuthority('code:unit:update')")
public Result update(@RequestBody UnitDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
unitService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@PreAuthorize("@ex.hasAuthority('code:unit:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
unitService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@PreAuthorize("@ex.hasAuthority('code:unit:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<UnitDTO> list = unitService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, UnitExcel.class);
}
}

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.UserDTO;
import com.cnbm.generator.code.excel.UserExcel;
import com.cnbm.generator.code.service.IUserService;
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-23
*/
@RestController
@RequestMapping("/code/user")
@Api(tags="系统用户")
public class UserController {
@Autowired
private IUserService userService;
@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:user:page')")
public Result<PageData<UserDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<UserDTO> page = userService.page(params);
return new Result<PageData<UserDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@PreAuthorize("@ex.hasAuthority('code:user:info')")
public Result<UserDTO> get(@PathVariable("id") Long id){
UserDTO data = userService.get(id);
return new Result<UserDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('code:user:save')")
public Result<Long> save(@RequestBody UserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
userService.save(dto);
return new Result<Long>().ok(dto.getId());
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@PreAuthorize("@ex.hasAuthority('code:user:update')")
public Result<Long> update(@RequestBody UserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
userService.update(dto);
return new Result<Long>().ok(dto.getId());
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@PreAuthorize("@ex.hasAuthority('code:user:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
userService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@PreAuthorize("@ex.hasAuthority('code:user:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<UserDTO> list = userService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, UserExcel.class);
}
}

View File

@ -0,0 +1,104 @@
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-12-07
*/
@Data
@ApiModel(value = "检验单 表DTO对象")
public class InspectionSheetDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
private Long id;
@ApiModelProperty(value = "订单号,手动输入")
private String orderNumber;
@ApiModelProperty(value = "批次号,手填")
private String batchNumber;
@ApiModelProperty(value = "检验站点,手填")
private String inspectionSite;
@ApiModelProperty(value = "产品id关联product表")
private Long productId;
@ApiModelProperty(value = "检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验")
private Integer inspectionStage;
@ApiModelProperty(value = "工序id关联working_procedure表")
private Long workingProcedureId;
@ApiModelProperty(value = "机台id关联machine表")
private Long machineId;
@ApiModelProperty(value = "班次id关联shift表")
private Long shiftId;
@ApiModelProperty(value = "分组样本数(就是这个产品下所有检测参数 的 最大样本数),只给用户查看,值是后台自动计算的")
private Integer numberOfGroupedSamples;
@ApiModelProperty(value = "样本大小(就是检验单(母体)下的子样个数),只给用户查看,值是后台自动计算的")
private Integer numberOfSamples;
@ApiModelProperty(value = "缺陷数量,只给用户查看,值是后台自动计算的(是以 这个检验单下 样本子样 为单位的 ")
private Integer numberOfDefects;
@ApiModelProperty(value = "不良数量,只给用户查看,值是后台自动计算的(是以 这个检验单下 样本子样 为单位的 ")
private Integer defectiveQuantity;
@ApiModelProperty(value = "生产人")
private String producer;
@ApiModelProperty(value = "检验人")
private String inspector;
@ApiModelProperty(value = "产品特性类型1 计量型2 计数型")
private Integer type;
@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,113 @@
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-23
*/
@Data
@ApiModel(value = "产品特性 表DTO对象")
public class ProductFeaturesDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
private Long id;
@ApiModelProperty(value = "")
private Long productId;
@ApiModelProperty(value = "")
private Long measureToolId;
@ApiModelProperty(value = "")
private Long unitId;
@ApiModelProperty(value = "产品特性 名")
private String name;
@ApiModelProperty(value = "产品特性 编码")
private String code;
@ApiModelProperty(value = "产品特性类型1 计量型2 计数型")
private Integer type;
@ApiModelProperty(value = "缺陷等级1 致命缺陷2 严重缺陷3.轻微缺陷")
private Integer defectLevel;
@ApiModelProperty(value = "产品特性 规格")
private String specifications;
@ApiModelProperty(value = "检验参数 规格下线")
private Float lsl;
@ApiModelProperty(value = "检验参数 规格中心线")
private Float sl;
@ApiModelProperty(value = "检验参数 规格上线")
private Float usl;
@ApiModelProperty(value = "")
private Long workingProcedureId;
@ApiModelProperty(value = "")
private Long controlGraphId;
@ApiModelProperty(value = "是否需要spc分析1 yes;0 no")
private Integer isSpc;
@ApiModelProperty(value = "样本大小一般2-25之间。 会依据这个size 把所有待分析的数据 组成一个一个样本")
private Integer sampleSize;
@ApiModelProperty(value = "采样频率,只用于展示")
private String samplingFrequency;
@ApiModelProperty(value = "小数位数(限制 检验参数小数点后面位数),这个先放着后续再说。")
private Integer decimalPlaces;
@ApiModelProperty(value = "目标cpk")
private Float targetCpk;
@ApiModelProperty(value = "目标cpk")
private Float targetPpk;
@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,68 @@
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-23
*/
@Data
@ApiModel(value = "产品类型 表DTO对象")
public class ProductTypeDTO 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 descs;
@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,68 @@
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-06-30
*/
@Data
@ApiModel(value = "单位 表DTO对象")
public class UnitDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
private BigDecimal id;
@ApiModelProperty(value = "单位 名")
private String name;
@ApiModelProperty(value = "单位 编码")
private String code;
@ApiModelProperty(value = "单位类型1 可计数2 不可计数")
private BigDecimal type;
@ApiModelProperty(value = "1 可用0 不可用")
private BigDecimal status;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "删除标志,是否有效:1 可用 0不可用")
private BigDecimal valid;
@ApiModelProperty(value = "创建人")
private BigDecimal creatorId;
@ApiModelProperty(value = "创建人姓名")
private String creatorName;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "更新人")
private BigDecimal updaterId;
@ApiModelProperty(value = "更新人姓名")
private String updaterName;
@ApiModelProperty(value = "更新时间")
private LocalDateTime updateTime;
@ApiModelProperty(value = "版本号")
private BigDecimal version;
}

View File

@ -0,0 +1,71 @@
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-23
*/
@Data
@ApiModel(value = "系统用户DTO对象")
public class UserDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "用户名")
private String username;
@ApiModelProperty(value = "密码")
private String password;
@ApiModelProperty(value = "姓名")
private String realName;
@ApiModelProperty(value = "头像")
private String headUrl;
@ApiModelProperty(value = "性别 0男 1女 2保密")
private Integer gender;
@ApiModelProperty(value = "邮箱")
private String email;
@ApiModelProperty(value = "手机号")
private String mobile;
@ApiModelProperty(value = "部门ID")
private Long deptId;
@ApiModelProperty(value = "超级管理员 0否 1")
private Integer superAdmin;
@ApiModelProperty(value = "状态 0停用 1正常")
private Integer status;
@ApiModelProperty(value = "创建者")
private Long creator;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createDate;
@ApiModelProperty(value = "更新者")
private Long updater;
@ApiModelProperty(value = "更新时间")
private LocalDateTime updateDate;
}

View File

@ -0,0 +1,106 @@
package com.cnbm.generator.code.entity;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
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-12-07
*/
@Data
@TableName("inspection_sheet")
@ApiModel(value = "InspectionSheet对象", description = "检验单 表")
public class InspectionSheet implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("ID")
private Long id;
@ApiModelProperty("订单号,手动输入")
private String orderNumber;
@ApiModelProperty("批次号,手填")
private String batchNumber;
@ApiModelProperty("检验站点,手填")
private String inspectionSite;
@ApiModelProperty("产品id关联product表")
private Long productId;
@ApiModelProperty("检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验")
private Integer inspectionStage;
@ApiModelProperty("工序id关联working_procedure表")
private Long workingProcedureId;
@ApiModelProperty("机台id关联machine表")
private Long machineId;
@ApiModelProperty("班次id关联shift表")
private Long shiftId;
@ApiModelProperty("分组样本数(就是这个产品下所有检测参数 的 最大样本数),只给用户查看,值是后台自动计算的")
private Integer numberOfGroupedSamples;
@ApiModelProperty("样本大小(就是检验单(母体)下的子样个数),只给用户查看,值是后台自动计算的")
private Integer numberOfSamples;
@ApiModelProperty("缺陷数量,只给用户查看,值是后台自动计算的(是以 这个检验单下 样本子样 为单位的 ")
private Integer numberOfDefects;
@ApiModelProperty("不良数量,只给用户查看,值是后台自动计算的(是以 这个检验单下 样本子样 为单位的 ")
private Integer defectiveQuantity;
@ApiModelProperty("生产人")
private String producer;
@ApiModelProperty("检验人")
private String inspector;
@ApiModelProperty("产品特性类型1 计量型2 计数型")
private Integer type;
@ApiModelProperty("1 可用0 不可用")
private Integer status;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
@TableLogic
private Integer valid;
@ApiModelProperty("创建人")
private Long creatorId;
@ApiModelProperty("创建人姓名")
private String creatorName;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("更新人")
private Long updaterId;
@ApiModelProperty("更新人姓名")
private String updaterName;
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
@ApiModelProperty("版本号")
private Integer version;
}

View File

@ -0,0 +1,105 @@
package com.cnbm.generator.code.entity;
import com.baomidou.mybatisplus.annotation.TableName;
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-23
*/
@Data
@TableName("product_features")
@ApiModel(value = "ProductFeatures对象", description = "产品特性 表")
public class ProductFeatures implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Long productId;
private Long measureToolId;
private Long unitId;
@ApiModelProperty("产品特性 名")
private String name;
@ApiModelProperty("产品特性 编码")
private String code;
@ApiModelProperty("产品特性类型1 计量型2 计数型")
private Integer type;
@ApiModelProperty("缺陷等级1 致命缺陷2 严重缺陷3.轻微缺陷")
private Integer defectLevel;
@ApiModelProperty("产品特性 规格")
private String specifications;
@ApiModelProperty("检验参数 规格下线")
private Float lsl;
@ApiModelProperty("检验参数 规格中心线")
private Float sl;
@ApiModelProperty("检验参数 规格上线")
private Float usl;
private Long workingProcedureId;
private Long controlGraphId;
@ApiModelProperty("是否需要spc分析1 yes;0 no")
private Integer isSpc;
@ApiModelProperty("样本大小一般2-25之间。 会依据这个size 把所有待分析的数据 组成一个一个样本")
private Integer sampleSize;
@ApiModelProperty("采样频率,只用于展示")
private String samplingFrequency;
@ApiModelProperty("小数位数(限制 检验参数小数点后面位数),这个先放着后续再说。")
private Integer decimalPlaces;
@ApiModelProperty("目标cpk")
private Float targetCpk;
@ApiModelProperty("目标cpk")
private Float targetPpk;
@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,67 @@
package com.cnbm.generator.code.entity;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
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-23
*/
@Data
@TableName("product_type")
@ApiModel(value = "ProductType对象", description = "产品类型 表")
public class ProductType implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty("产品类型 名")
private String name;
@ApiModelProperty("产品类型 编码")
private String code;
@ApiModelProperty("描述")
private String descs;
@ApiModelProperty("1 可用0 不可用")
private Integer status;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
@TableLogic
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,67 @@
package com.cnbm.generator.code.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
* 单位
* </p>
*
* @author why
* @since 2022-06-30
*/
@Data
@ApiModel(value = "Unit对象", description = "单位 表")
public class Unit implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("ID")
private BigDecimal id;
@ApiModelProperty("单位 名")
private String name;
@ApiModelProperty("单位 编码")
private String code;
@ApiModelProperty("单位类型1 可计数2 不可计数")
private BigDecimal type;
@ApiModelProperty("1 可用0 不可用")
private BigDecimal status;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
private BigDecimal valid;
@ApiModelProperty("创建人")
private BigDecimal creatorId;
@ApiModelProperty("创建人姓名")
private String creatorName;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("更新人")
private BigDecimal updaterId;
@ApiModelProperty("更新人姓名")
private String updaterName;
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
@ApiModelProperty("版本号")
private BigDecimal version;
}

View File

@ -0,0 +1,71 @@
package com.cnbm.generator.code.entity;
import com.baomidou.mybatisplus.annotation.TableName;
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-23
*/
@Data
@TableName("sys_user")
@ApiModel(value = "User对象", description = "系统用户")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("用户名")
private String username;
@ApiModelProperty("密码")
private String password;
@ApiModelProperty("姓名")
private String realName;
@ApiModelProperty("头像")
private String headUrl;
@ApiModelProperty("性别 0男 1女 2保密")
private Integer gender;
@ApiModelProperty("邮箱")
private String email;
@ApiModelProperty("手机号")
private String mobile;
@ApiModelProperty("部门ID")
private Long deptId;
@ApiModelProperty("超级管理员 0否 1")
private Integer superAdmin;
@ApiModelProperty("状态 0停用 1正常")
private Integer status;
@ApiModelProperty("创建者")
private Long creator;
@ApiModelProperty("创建时间")
private LocalDateTime createDate;
@ApiModelProperty("更新者")
private Long updater;
@ApiModelProperty("更新时间")
private LocalDateTime updateDate;
}

View File

@ -0,0 +1,72 @@
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-12-07
*/
@Data
public class InspectionSheetExcel {
@Excel(name = "ID")
private Long id;
@Excel(name = "订单号,手动输入")
private String orderNumber;
@Excel(name = "批次号,手填")
private String batchNumber;
@Excel(name = "检验站点,手填")
private String inspectionSite;
@Excel(name = "产品id关联product表")
private Long productId;
@Excel(name = "检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验")
private Integer inspectionStage;
@Excel(name = "工序id关联working_procedure表")
private Long workingProcedureId;
@Excel(name = "机台id关联machine表")
private Long machineId;
@Excel(name = "班次id关联shift表")
private Long shiftId;
@Excel(name = "分组样本数(就是这个产品下所有检测参数 的 最大样本数),只给用户查看,值是后台自动计算的")
private Integer numberOfGroupedSamples;
@Excel(name = "样本大小(就是检验单(母体)下的子样个数),只给用户查看,值是后台自动计算的")
private Integer numberOfSamples;
@Excel(name = "缺陷数量,只给用户查看,值是后台自动计算的(是以 这个检验单下 样本子样 为单位的 ")
private Integer numberOfDefects;
@Excel(name = "不良数量,只给用户查看,值是后台自动计算的(是以 这个检验单下 样本子样 为单位的 ")
private Integer defectiveQuantity;
@Excel(name = "生产人")
private String producer;
@Excel(name = "检验人")
private String inspector;
@Excel(name = "产品特性类型1 计量型2 计数型")
private Integer type;
@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,78 @@
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-23
*/
@Data
public class ProductFeaturesExcel {
@Excel(name = "")
private Long id;
@Excel(name = "")
private Long productId;
@Excel(name = "")
private Long measureToolId;
@Excel(name = "")
private Long unitId;
@Excel(name = "产品特性 名")
private String name;
@Excel(name = "产品特性 编码")
private String code;
@Excel(name = "产品特性类型1 计量型2 计数型")
private Integer type;
@Excel(name = "缺陷等级1 致命缺陷2 严重缺陷3.轻微缺陷")
private Integer defectLevel;
@Excel(name = "产品特性 规格")
private String specifications;
@Excel(name = "检验参数 规格下线")
private Float lsl;
@Excel(name = "检验参数 规格中心线")
private Float sl;
@Excel(name = "检验参数 规格上线")
private Float usl;
@Excel(name = "")
private Long workingProcedureId;
@Excel(name = "")
private Long controlGraphId;
@Excel(name = "是否需要spc分析1 yes;0 no")
private Integer isSpc;
@Excel(name = "样本大小一般2-25之间。 会依据这个size 把所有待分析的数据 组成一个一个样本")
private Integer sampleSize;
@Excel(name = "采样频率,只用于展示")
private String samplingFrequency;
@Excel(name = "小数位数(限制 检验参数小数点后面位数),这个先放着后续再说。")
private Integer decimalPlaces;
@Excel(name = "目标cpk")
private Float targetCpk;
@Excel(name = "目标cpk")
private Float targetPpk;
@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,48 @@
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-23
*/
@Data
public class ProductTypeExcel {
@Excel(name = "")
private Long id;
@Excel(name = "产品类型 名")
private String name;
@Excel(name = "产品类型 编码")
private String code;
@Excel(name = "描述")
private String descs;
@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,48 @@
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-06-30
*/
@Data
public class UnitExcel {
@Excel(name = "ID")
private BigDecimal id;
@Excel(name = "单位 名")
private String name;
@Excel(name = "单位 编码")
private String code;
@Excel(name = "单位类型1 可计数2 不可计数")
private BigDecimal type;
@Excel(name = "1 可用0 不可用")
private BigDecimal status;
@Excel(name = "备注")
private String remark;
@Excel(name = "删除标志,是否有效:1 可用 0不可用")
private BigDecimal valid;
@Excel(name = "创建人")
private BigDecimal creatorId;
@Excel(name = "创建人姓名")
private String creatorName;
@Excel(name = "创建时间")
private LocalDateTime createTime;
@Excel(name = "更新人")
private BigDecimal updaterId;
@Excel(name = "更新人姓名")
private String updaterName;
@Excel(name = "更新时间")
private LocalDateTime updateTime;
@Excel(name = "版本号")
private BigDecimal version;
}

View File

@ -0,0 +1,50 @@
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-23
*/
@Data
public class UserExcel {
@Excel(name = "id")
private Long id;
@Excel(name = "用户名")
private String username;
@Excel(name = "密码")
private String password;
@Excel(name = "姓名")
private String realName;
@Excel(name = "头像")
private String headUrl;
@Excel(name = "性别 0男 1女 2保密")
private Integer gender;
@Excel(name = "邮箱")
private String email;
@Excel(name = "手机号")
private String mobile;
@Excel(name = "部门ID")
private Long deptId;
@Excel(name = "超级管理员 0否 1")
private Integer superAdmin;
@Excel(name = "状态 0停用 1正常")
private Integer status;
@Excel(name = "创建者")
private Long creator;
@Excel(name = "创建时间")
private LocalDateTime createDate;
@Excel(name = "更新者")
private Long updater;
@Excel(name = "更新时间")
private LocalDateTime updateDate;
}

View File

@ -0,0 +1,16 @@
package com.cnbm.generator.code.mapper;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.generator.code.entity.InspectionSheet;
import org.apache.ibatis.annotations.Mapper;
/**
* 检验单
*
* @author why
* @since 2022-12-07
*/
@Mapper
public interface InspectionSheetMapper extends BaseDao<InspectionSheet> {
}

View File

@ -0,0 +1,33 @@
<?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.InspectionSheetMapper">
<resultMap type="com.cnbm.generator.code.entity.InspectionSheet" id="InspectionSheetMap">
<id column="id" property="id" />
<id column="order_number" property="orderNumber" />
<id column="batch_number" property="batchNumber" />
<id column="inspection_site" property="inspectionSite" />
<id column="product_id" property="productId" />
<id column="inspection_stage" property="inspectionStage" />
<id column="working_procedure_id" property="workingProcedureId" />
<id column="machine_id" property="machineId" />
<id column="shift_id" property="shiftId" />
<id column="number_of_grouped_samples" property="numberOfGroupedSamples" />
<id column="number_of_samples" property="numberOfSamples" />
<id column="number_of_defects" property="numberOfDefects" />
<id column="defective_quantity" property="defectiveQuantity" />
<id column="producer" property="producer" />
<id column="inspector" property="inspector" />
<id column="type" property="type" />
<id column="status" property="status" />
<id column="remark" property="remark" />
<id column="valid" property="valid" />
<id column="creator_id" property="creatorId" />
<id column="creator_name" property="creatorName" />
<id column="create_time" property="createTime" />
<id column="updater_id" property="updaterId" />
<id column="updater_name" property="updaterName" />
<id column="update_time" property="updateTime" />
<id column="version" property="version" />
</resultMap>
</mapper>

View File

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

View File

@ -0,0 +1,36 @@
<?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.ProductFeaturesMapper">
<resultMap type="com.cnbm.generator.code.entity.ProductFeatures" id="ProductFeaturesMap">
<id column="id" property="id" />
<id column="product_id" property="productId" />
<id column="measure_tool_id" property="measureToolId" />
<id column="unit_id" property="unitId" />
<id column="name" property="name" />
<id column="code" property="code" />
<id column="type" property="type" />
<id column="defect_level" property="defectLevel" />
<id column="specifications" property="specifications" />
<id column="lsl" property="lsl" />
<id column="sl" property="sl" />
<id column="usl" property="usl" />
<id column="working_procedure_id" property="workingProcedureId" />
<id column="control_graph_id" property="controlGraphId" />
<id column="is_spc" property="isSpc" />
<id column="sample_size" property="sampleSize" />
<id column="sampling_frequency" property="samplingFrequency" />
<id column="decimal_places" property="decimalPlaces" />
<id column="target_cpk" property="targetCpk" />
<id column="target_ppk" property="targetPpk" />
<id column="remark" property="remark" />
<id column="valid" property="valid" />
<id column="creator_id" property="creatorId" />
<id column="creator_name" property="creatorName" />
<id column="create_time" property="createTime" />
<id column="updater_id" property="updaterId" />
<id column="updater_name" property="updaterName" />
<id column="update_time" property="updateTime" />
<id column="version" property="version" />
</resultMap>
</mapper>

View File

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

View File

@ -0,0 +1,21 @@
<?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.ProductTypeMapper">
<resultMap type="com.cnbm.generator.code.entity.ProductType" id="ProductTypeMap">
<id column="id" property="id" />
<id column="name" property="name" />
<id column="code" property="code" />
<id column="descs" property="descs" />
<id column="status" property="status" />
<id column="remark" property="remark" />
<id column="valid" property="valid" />
<id column="creator_id" property="creatorId" />
<id column="creator_name" property="creatorName" />
<id column="create_time" property="createTime" />
<id column="updater_id" property="updaterId" />
<id column="updater_name" property="updaterName" />
<id column="update_time" property="updateTime" />
<id column="version" property="version" />
</resultMap>
</mapper>

View File

@ -0,0 +1,16 @@
package com.cnbm.generator.code.mapper;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.generator.code.entity.Unit;
import org.apache.ibatis.annotations.Mapper;
/**
* 单位
*
* @author why
* @since 2022-06-30
*/
@Mapper
public interface UnitMapper extends BaseDao<Unit> {
}

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.UnitMapper">
</mapper>

View File

@ -0,0 +1,16 @@
package com.cnbm.generator.code.mapper;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.generator.code.entity.User;
import org.apache.ibatis.annotations.Mapper;
/**
* 系统用户
*
* @author why
* @since 2022-08-23
*/
@Mapper
public interface UserMapper extends BaseDao<User> {
}

View File

@ -0,0 +1,22 @@
<?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.UserMapper">
<resultMap type="com.cnbm.generator.code.entity.User" id="UserMap">
<id column="id" property="id" />
<id column="username" property="username" />
<id column="password" property="password" />
<id column="real_name" property="realName" />
<id column="head_url" property="headUrl" />
<id column="gender" property="gender" />
<id column="email" property="email" />
<id column="mobile" property="mobile" />
<id column="dept_id" property="deptId" />
<id column="super_admin" property="superAdmin" />
<id column="status" property="status" />
<id column="creator" property="creator" />
<id column="create_date" property="createDate" />
<id column="updater" property="updater" />
<id column="update_date" property="updateDate" />
</resultMap>
</mapper>

View File

@ -0,0 +1,7 @@
-- 菜单初始SQL
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1600308190230409218, 1067246875800000035, '检验单 表', 'code/inspectionSheet', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1600308190230409219, 1600308190230409218, '查看', NULL, 'code:inspectionSheet:page,code:inspectionSheet:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1600308190230409220, 1600308190230409218, '新增', NULL, 'code:inspectionSheet:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1600308190230409221, 1600308190230409218, '修改', NULL, 'code:inspectionSheet:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1600308190230409222, 1600308190230409218, '删除', NULL, 'code:inspectionSheet:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1600308190230409223, 1600308190230409218, '导出', NULL, 'code:inspectionSheet:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());

View File

@ -0,0 +1,7 @@
-- 菜单初始SQL
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1561967925485420546, 1067246875800000035, '产品类型 表', 'code/productType', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967925485420547, 1561967925485420546, '查看', NULL, 'code:productType:page,code:productType:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967925485420548, 1561967925485420546, '新增', NULL, 'code:productType:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967925485420549, 1561967925485420546, '修改', NULL, 'code:productType:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967925485420550, 1561967925485420546, '删除', NULL, 'code:productType:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967925485420551, 1561967925485420546, '导出', NULL, 'code:productType:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());

View File

@ -0,0 +1,7 @@
-- 菜单初始SQL
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1561967818685841409, 1067246875800000035, '系统用户', 'code/user', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967818685841410, 1561967818685841409, '查看', NULL, 'code:user:page,code:user:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967818685841411, 1561967818685841409, '新增', NULL, 'code:user:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967818685841412, 1561967818685841409, '修改', NULL, 'code:user:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967818685841413, 1561967818685841409, '删除', NULL, 'code:user:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1561967818685841414, 1561967818685841409, '导出', NULL, 'code:user:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());

View File

@ -0,0 +1,15 @@
package com.cnbm.generator.code.service;
import com.cnbm.common.service.CrudService;
import com.cnbm.generator.code.dto.InspectionSheetDTO;
import com.cnbm.generator.code.entity.InspectionSheet;
/**
* 检验单
*
* @author why
* @since 2022-12-07
*/
public interface IInspectionSheetService extends CrudService<InspectionSheet, InspectionSheetDTO> {
}

View File

@ -0,0 +1,15 @@
package com.cnbm.generator.code.service;
import com.cnbm.common.service.CrudService;
import com.cnbm.generator.code.dto.ProductFeaturesDTO;
import com.cnbm.generator.code.entity.ProductFeatures;
/**
* 产品特性
*
* @author why
* @since 2022-08-23
*/
public interface IProductFeaturesService extends CrudService<ProductFeatures, ProductFeaturesDTO> {
}

View File

@ -0,0 +1,15 @@
package com.cnbm.generator.code.service;
import com.cnbm.common.service.CrudService;
import com.cnbm.generator.code.dto.ProductTypeDTO;
import com.cnbm.generator.code.entity.ProductType;
/**
* 产品类型
*
* @author why
* @since 2022-08-23
*/
public interface IProductTypeService extends CrudService<ProductType, ProductTypeDTO> {
}

View File

@ -0,0 +1,15 @@
package com.cnbm.generator.code.service;
import com.cnbm.common.service.CrudService;
import com.cnbm.generator.code.dto.UnitDTO;
import com.cnbm.generator.code.entity.Unit;
/**
* 单位
*
* @author why
* @since 2022-06-30
*/
public interface IUnitService extends CrudService<Unit, UnitDTO> {
}

View File

@ -0,0 +1,15 @@
package com.cnbm.generator.code.service;
import com.cnbm.common.service.CrudService;
import com.cnbm.generator.code.dto.UserDTO;
import com.cnbm.generator.code.entity.User;
/**
* 系统用户
*
* @author why
* @since 2022-08-23
*/
public interface IUserService extends CrudService<User, UserDTO> {
}

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.InspectionSheetDTO;
import com.cnbm.generator.code.mapper.InspectionSheetMapper;
import com.cnbm.generator.code.entity.InspectionSheet;
import com.cnbm.generator.code.service.IInspectionSheetService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 检验单
*
* @author why
* @since 2022-12-07
*/
@Service
public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetMapper, InspectionSheet, InspectionSheetDTO> implements IInspectionSheetService {
@Override
public QueryWrapper<InspectionSheet> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<InspectionSheet> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}

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.ProductFeaturesDTO;
import com.cnbm.generator.code.mapper.ProductFeaturesMapper;
import com.cnbm.generator.code.entity.ProductFeatures;
import com.cnbm.generator.code.service.IProductFeaturesService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 产品特性
*
* @author why
* @since 2022-08-23
*/
@Service
public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesMapper, ProductFeatures, ProductFeaturesDTO> implements IProductFeaturesService {
@Override
public QueryWrapper<ProductFeatures> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<ProductFeatures> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}

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.ProductTypeDTO;
import com.cnbm.generator.code.mapper.ProductTypeMapper;
import com.cnbm.generator.code.entity.ProductType;
import com.cnbm.generator.code.service.IProductTypeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 产品类型
*
* @author why
* @since 2022-08-23
*/
@Service
public class ProductTypeServiceImpl extends CrudServiceImpl<ProductTypeMapper, ProductType, ProductTypeDTO> implements IProductTypeService {
@Override
public QueryWrapper<ProductType> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<ProductType> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}

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.UnitDTO;
import com.cnbm.generator.code.mapper.UnitMapper;
import com.cnbm.generator.code.entity.Unit;
import com.cnbm.generator.code.service.IUnitService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 单位
*
* @author why
* @since 2022-06-30
*/
@Service
public class UnitServiceImpl extends CrudServiceImpl<UnitMapper, Unit, UnitDTO> implements IUnitService {
@Override
public QueryWrapper<Unit> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<Unit> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}

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.UserDTO;
import com.cnbm.generator.code.mapper.UserMapper;
import com.cnbm.generator.code.entity.User;
import com.cnbm.generator.code.service.IUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 系统用户
*
* @author why
* @since 2022-08-23
*/
@Service
public class UserServiceImpl extends CrudServiceImpl<UserMapper, User, UserDTO> implements IUserService {
@Override
public QueryWrapper<User> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
QueryWrapper<User> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
return wrapper;
}
}

View File

@ -23,6 +23,8 @@
<artifactId>influxdb-client-java</artifactId>
<version>6.3.0</version>
</dependency>
<dependency>
<groupId>com.cnbm</groupId>
<artifactId>ym-common</artifactId>

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

@ -76,29 +76,65 @@ public enum InfluxClient {
return isConnected;
}
/**
* desc: 异步批量 写入数据/更新数据
* notes: 如果是更新数据要保证time字段不能改变
* auth: caixaing
* */
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.getSampleNumber()==null){
point = Point.measurement(measurement)
.addTag("transationId", event.getTransationId())
.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("sampleNumber", event.getSampleNumber())
.addTag("argName", event.getArgName())
.addField("argValue", event.getArgValue())
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
}
writeApi.writePoint(point);
}
//异步 批量写入数据
//如果要批量插入的话一次也只能写入
/**
* desc: 异步批量 写入数据/更新数据
* notes: 如果是更新数据要保证time字段不能改变
* auth: caixaing
* */
public void batchInsert(List<Event> events, String measurement){
List<Point> list = new ArrayList<>();
for(Event event:events){
Point 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);
Point point = null;
if(event.getSampleNumber()==null){
point = Point.measurement(measurement)
.addTag("transationId", event.getTransationId())
.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())
.addTag("sampleNumber", event.getSampleNumber())
//.addField("batchNum", event.getBatchNum())
.addTag("argName", event.getArgName())
.addField("argValue", event.getArgValue())
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
}
list.add(point);
}
writeApi.writePoints(list);
@ -110,14 +146,22 @@ public enum InfluxClient {
List<String> dropedTagNames = param.getDropedTagNames();
Range range = param.getRange();
String bucket = param.getBucket();
String tagName = param.getTag().getTagName();
String tagValue = param.getTag().getTagValue();
PageInfo pageInfo = param.getPageInfo();
String flux = "from(bucket:\""+bucket+"\")";
flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
if(param.getTag()!=null){
String tagName = param.getTag().getTagName();
String tagValue = param.getTag().getTagValue();
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
}
//调整时区查询出的结果 +8个小时
//flux += "|> timeShift(duration: 8h)";
for(String dropName:dropedTagNames){
flux += "|> drop(columns: [\""+dropName+"\"])";
}
@ -125,16 +169,32 @@ public enum InfluxClient {
if(pageInfo!=null){
flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")";
}
return queryApi.query(flux);
}
public List<FluxTable> queryByGroup(QueryDataParam param){
String measurement = param.getMeasurement();
List<String> dropedTagNames = param.getDropedTagNames();
Range range = param.getRange();
String bucket = param.getBucket();
String tagName = param.getTag().getTagName();
String tagValue = param.getTag().getTagValue();
String groupName = param.getGroupName();
PageInfo pageInfo = param.getPageInfo();
// List<FluxTable> tables = queryApi.query(flux);
// for (FluxTable fluxTable : tables) {
// List<FluxRecord> records = fluxTable.getRecords();
// for (FluxRecord fluxRecord : records) {
// System.out.println("time: "+fluxRecord.getTime() +" key:"+fluxRecord.getField()+" value: " + fluxRecord.getValueByKey("_value")+" measurement: " + fluxRecord.getMeasurement());
//
// }
// }
String flux = "from(bucket:\""+bucket+"\")";
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+"\"])";
}
flux += "|> sort(columns: [\"_time\"], desc: true)";
if(pageInfo!=null){
flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")";
}
return queryApi.query(flux);
}
@ -151,6 +211,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+"\"])";
}
@ -178,4 +239,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.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

@ -18,7 +18,7 @@ public class Constant {
public static final LogLevel readTimeout = LogLevel.BODY;
public static final LogLevel writeTimeout = LogLevel.BODY;
public static final LogLevel connectTimeout = LogLevel.BODY;
public static final String measurement = "WeightHeiHei";
public static final String measurement = "Weight";
}

View File

@ -2,6 +2,7 @@ package com.cnbm.influx.controller;
import com.cnbm.common.spc.util.DataUtils;
import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.constant.Constant;
import com.cnbm.influx.param.PageInfo;
import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.param.Range;
@ -17,7 +18,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;
@ -30,49 +30,9 @@ public class S7DemoController {
private static final Logger logger = LoggerFactory.getLogger(S7DemoController.class);
@PostMapping("/insertBatch")
public void insertBatch() throws InterruptedException {
List<Event> list = new ArrayList<>();
Random r = new Random();
for(int i=0;i<999;i++){
Thread.sleep(10);
Event event = new Event();
event.setTime(Instant.now());
event.setTransationId("asas"+i);
event.setArgName("LTWeight");
Double d = r.nextDouble() * 2.5 + 66;
event.setArgValue(d);
list.add(event);
}
InfluxClient.Client.batchInsert(list,"Weight");
}
@PostMapping("/insertBatchJYD")
public void insertBatchJYD() throws InterruptedException {
List<Event> list = new ArrayList<>();
Random r = new Random();
Instant instant = DataUtils.getBeforeDate(400).toInstant();
for(int j=0;j<10;j++){
for(int i=0;i<99;i++){
Thread.sleep(10);
Event event = new Event();
event.setTime(instant);
event.setTransationId("asas"+i);
event.setArgName("LTWeight");
Double d = r.nextDouble() * 2.5 + 66;
event.setInspectionSheetId(j+"");
event.setArgValue(d);
event.setBatchNum(i);
list.add(event);
}
}
InfluxClient.Client.batchInsert(list,"WeightHei");
}
@PostMapping("/insertBatchJYDForTest")
public void insertBatchJYDForTest() throws InterruptedException {
//for 常规计量型
@PostMapping("/insertDemoDataForMetering")
public void insertDemoDataForMetering() throws InterruptedException {
List<Event> list = new ArrayList<>();
Random r = new Random();
@ -81,105 +41,277 @@ public class S7DemoController {
Event event = new Event();
event.setTime(DataUtils.getAfterDate(i).toInstant());
event.setTransationId("asas"+i);
event.setArgName("LostDays");
event.setArgName("failDay");
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);
list.add(event);
}
InfluxClient.Client.batchInsert(list,"WeightHeiHei");
InfluxClient.Client.batchInsert(list,"Weight");
}
/**
* 测试连接是否正常
*
* @return
* true 服务正常健康
* false 异常
*/
@PostMapping("/ping")
public void ping() throws InterruptedException {
boolean ping = InfluxClient.Client.ping();
System.out.println(ping);
}
@PostMapping("/query")
public void query() throws InterruptedException {
@PostMapping("/insertDemoOne")
public void insertDemoOne() throws InterruptedException {
List<Event> list = new ArrayList<>();
Random r = new Random();
Thread.sleep(10);
Instant time = new Date().toInstant();
Event event = new Event();
event.setTime(time);
QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setBucket("qgs-bucket");
queryDataParam.setMeasurement("ASProcessCompleteEventAS");
event.setArgName("failDayDay");
event.setArgValue("1");
event.setSampleNumber("10001");
list.add(event);
Thread.sleep(1000);
Event event2 = new Event();
event2.setTime(time);
event2.setArgName("failDayDay");
event2.setArgValue("2");
event2.setSampleNumber("10001");
list.add(event2);
InfluxClient.Client.batchInsert(list,"Weight");
}
@PostMapping("/readDemoOne")
public void readDemoOne() throws InterruptedException {
List<String> dropNames = new ArrayList<>();
dropNames.add("transationId");
dropNames.add("inspectionSheetId");
dropNames.add("batchNum");
QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
queryDataParam.setDropedTagNames(dropNames);
queryDataParam.setTag(new Tag("argName","arg6"));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(),Instant.now()));
queryDataParam.setPageInfo(new PageInfo(1,10));
queryDataParam.setTag(new Tag("argName","failDayDay"));
queryDataParam.setBucket(Constant.bucket);
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
for (FluxTable fluxTable : query) {
List<FluxRecord> records = fluxTable.getRecords();
for (FluxRecord fluxRecord : records) {
System.out.println("value: " + fluxRecord.getValueByKey("_value"));
}
}
System.out.println();
}
public static void main(String[] args) {
//for 常规计数型
@PostMapping("/insertDemoDataForCount")
public void insertDemoDataForCount() throws InterruptedException {
List<Event> list = new ArrayList<>();
Random r = new Random();
QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setBucket("qgs-bucket");
queryDataParam.setMeasurement("ASProcessCompleteEventAS");
List<String> dropNames = new ArrayList<>();
dropNames.add("transationId");
dropNames.add("inspectionSheetId");
queryDataParam.setDropedTagNames(dropNames);
queryDataParam.setTag(new Tag("argName","arg7"));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(),Instant.now()));
queryDataParam.setPageInfo(new PageInfo(2,10));
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
for(int i=0;i<99;i++){
Thread.sleep(10);
Event event = new Event();
event.setTime(Instant.now());
event.setTransationId("forbatch"+i);
event.setArgName("LTWeight");
Double d = r.nextDouble() * 2.5 + 66;
event.setArgValue(d.toString());
for (FluxTable fluxTable : query) {
List<FluxRecord> records = fluxTable.getRecords();
for (FluxRecord fluxRecord : records) {
System.out.println("value: " + fluxRecord.getValueByKey("_value"));
}
event.setInspectionSheetId(i+"");
list.add(event);
}
InfluxClient.Client.batchInsert(list,"Weight");
}
public Point insert(Event event, String measurement){
Point point = Point.measurement(measurement)
.addTag("transationId", event.getTransationId())
.addTag("argName", event.getArgName())
.addField("argValue", event.getArgValue())
.time(event.getTime().toEpochMilli(), WritePrecision.MS);
return point;
}
@PostMapping("/insert")
public void insert() throws InterruptedException {
Event event = new Event();
event.setTime(Instant.now());
event.setTransationId("asasd11");
event.setArgName("argName11");
event.setArgValue(900001d);
Point asProcessCompleteEvent = insert(event, "ASProcessCompleteEvent");
InfluxClient.Client.insert(event,"ASProcessCompleteEvent");
}
//
// @PostMapping("/insertBatchJYD")
// public void insertBatchJYD() throws InterruptedException {
// List<Event> list = new ArrayList<>();
// Random r = new Random();
// Instant instant = DataUtils.getBeforeDate(400).toInstant();
//
// for(int j=0;j<10;j++){
// for(int i=0;i<99;i++){
// Thread.sleep(10);
// Event event = new Event();
// event.setTime(instant);
// event.setTransationId("asas"+i);
// event.setArgName("LTWeight");
// Double d = r.nextDouble() * 2.5 + 66;
// event.setInspectionSheetId(j+"");
// 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();
//
//// long l = System.currentTimeMillis();
//// System.out.println("l:"+l);
//// event.setTime(new Date(1669874900889l).toInstant());
////
// event.setTime(new Date().toInstant());
// event.setTransationId("4444");
// event.setBatchNum("44");
// event.setArgName("forUpdate");
// event.setArgValue("5555.1");
// InfluxClient.Client.insert(event,"FORUPDATECAIXIANG");
//// Thread.sleep(50000);
////
//// event.setArgValue(333.3);
//// InfluxClient.Client.insert(event,"FORUPDATE");
//
//
//// QueryDataParam queryDataParam = new QueryDataParam();
//// queryDataParam.setBucket("qgs-bucket");
//// queryDataParam.setMeasurement("FORUPDATECAIXIANG");
//// 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")
// public void insertBatchJYDForTest() throws InterruptedException {
// List<Event> list = new ArrayList<>();
// Random r = new Random();
//
// for(int i=0;i<999;i++){
// Thread.sleep(10);
// Event event = new Event();
// event.setTime(DataUtils.getAfterDate(i).toInstant());
// event.setTransationId("asas"+i);
// event.setArgName("LostDays");
// int i1 = r.nextInt(10);
// if(i1<4){
// event.setArgValue("0");
// }else {
// event.setArgValue("1");
// }
// event.setInspectionSheetId(i+"");
//
// event.setBatchNum(i+"");
// list.add(event);
// }
// InfluxClient.Client.batchInsert(list,"Weights");
// }
//
// @PostMapping("/insertBatchForNew")
// public void insertBatchForNew() throws InterruptedException {
// List<Event> list = new ArrayList<>();
// Random r = new Random();
//
// for(int i=0;i<999;i++){
// Thread.sleep(10);
// Event event = new Event();
// event.setTime(new Date().toInstant());
// event.setTransationId("asas"+i);
// event.setArgName("LiuWeight");
//// int i1 = r.nextInt(10);
//// if(i1<4){
//// event.setArgValue(new Double(0));
//// }else {
//// event.setArgValue(new Double(1));
//// }
// Double d = r.nextDouble() * 2.5 + 66;
// event.setArgValue(d.toString());
// event.setInspectionSheetId(i+"");
//
// event.setBatchNum(i+"");
// list.add(event);
// }
// InfluxClient.Client.batchInsert(list,"Weights");
// }
//
// /**
// * 测试连接是否正常
// *
// * @return
// * true 服务正常健康
// * false 异常
// */
// @PostMapping("/ping")
// public void ping() throws InterruptedException {
// boolean ping = InfluxClient.Client.ping();
// System.out.println(ping);
// }
//
// @PostMapping("/query")
// public void query() throws InterruptedException {
// List<Event> list = new ArrayList<>();
//
// QueryDataParam queryDataParam = new QueryDataParam();
// queryDataParam.setBucket("qgs-bucket");
// queryDataParam.setMeasurement("ASProcessCompleteEventAS");
// List<String> dropNames = new ArrayList<>();
// dropNames.add("transationId");
// dropNames.add("inspectionSheetId");
// queryDataParam.setDropedTagNames(dropNames);
// queryDataParam.setTag(new Tag("argName","arg6"));
// queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(),Instant.now()));
// queryDataParam.setPageInfo(new PageInfo(1,10));
// List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
//
//
// for (FluxTable fluxTable : query) {
// List<FluxRecord> records = fluxTable.getRecords();
// for (FluxRecord fluxRecord : records) {
// System.out.println("value: " + fluxRecord.getValueByKey("_value"));
// }
// }
// System.out.println();
// }
//
// public static void main(String[] args) {
// List<Event> list = new ArrayList<>();
//
// QueryDataParam queryDataParam = new QueryDataParam();
// queryDataParam.setBucket("qgs-bucket");
// queryDataParam.setMeasurement("ASProcessCompleteEventAS");
// List<String> dropNames = new ArrayList<>();
// dropNames.add("transationId");
// dropNames.add("inspectionSheetId");
// queryDataParam.setDropedTagNames(dropNames);
// queryDataParam.setTag(new Tag("argName","arg7"));
// queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(),Instant.now()));
// queryDataParam.setPageInfo(new PageInfo(2,10));
// List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
//
//
// for (FluxTable fluxTable : query) {
// List<FluxRecord> records = fluxTable.getRecords();
// for (FluxRecord fluxRecord : records) {
// System.out.println("value: " + fluxRecord.getValueByKey("_value"));
// }
// }
// }
//
//
// public Point insert(Event event, String measurement){
// Point point = Point.measurement(measurement)
// .addTag("transationId", event.getTransationId())
// .addTag("argName", event.getArgName())
// .addField("argValue", event.getArgValue())
// .time(event.getTime().toEpochMilli(), WritePrecision.MS);
// return point;
// }
//
// @PostMapping("/insert")
// public void insert() throws InterruptedException {
// Event event = new Event();
// event.setTime(Instant.now());
// event.setTransationId("asasd11");
// event.setArgName("argName11");
// event.setArgValue("900001");
// Point asProcessCompleteEvent = insert(event, "ASProcessCompleteEvent");
// InfluxClient.Client.insert(event,"ASProcessCompleteEvent");
// }
}

View File

@ -25,9 +25,12 @@ import java.util.List;
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class QueryDataParam extends BaseParam{
//如果tag不传就是查询所有
private Tag tag;
//查询的时候需要忽略的字段(transationId是唯一标识会对 最终的查询结果集产生影响)
private List<String> dropedTagNames;
private String bucket;
private String groupName;
//private String inspectionSheetId;
}

View File

@ -17,14 +17,23 @@ public class Event {
private Instant time;
private String inspectionSheetId;
private String transationId;
private String argName;
private Double argValue;
private String argValue;
//批次号可选的
private Integer batchNum;
//batchNum 舍弃了influxdb中不存批次号存在mysql - inspection_sheet表 中批次号字段
//private String batchNum;
private String inspectionSheetId;
private String sampleNumber;
public Event() {
//自动录入给个默认值
// this.batchNum = "-1";
this.inspectionSheetId = "-1";
this.sampleNumber = "-1";
}
}

View File

@ -14,6 +14,8 @@
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<!-- fastjson -->
<fastjson.version>1.2.75</fastjson.version>
</properties>
<dependencies>
@ -38,5 +40,10 @@
<artifactId>ym-quality-planning</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -1,6 +1,8 @@
package com.cnbm.processInspection.controller;
import com.alibaba.fastjson.JSONObject;
import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.basic.dto.FeaturesProcedureDTO;
import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData;
@ -12,8 +14,10 @@ import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.template.Event;
import com.cnbm.processInspection.dto.InspectionSampleDTO;
import com.cnbm.processInspection.dto.InspectionSheetDTO;
import com.cnbm.processInspection.entity.InspectionSheet;
import com.cnbm.processInspection.excel.InspectionSheetExcel;
import com.cnbm.processInspection.service.IInspectionSheetService;
import com.influxdb.query.FluxTable;
@ -86,9 +90,19 @@ public class InspectionSheetController {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
inspectionSheetService.save(dto);
return new Result<Long>().ok(dto.getId());
// try {
// inspectionSheetService.saveSheet(dto);
// }catch (Exception e){
// return new Result<Long>().error(1,"没有发现检验参数");
// }
InspectionSheet entity = inspectionSheetService.saveSheet(dto);
if(entity.getNumberOfSamples()!=null){
inspectionSheetService.insert(entity);
return new Result<Long>().ok(entity.getId());
}
else{
return new Result<Long>().error(1,"没有发现检验参数");
}
}
@PutMapping
@ -146,23 +160,46 @@ public class InspectionSheetController {
@PostMapping(value = "getFluxParamList")
@ApiOperation(value = "从influxdb中获取检测参数")
@ApiImplicitParams({
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "id", value = "检验单号", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "workingProcedureName", value = "工序名称", paramType = "query", dataTypeClass = String.class)
})
List<FluxTable> getFluxParamList(@ApiIgnore @RequestParam Map<String, Object> params){
return inspectionSheetService.getFluxParamList(params);
// @ApiImplicitParams({
// @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataTypeClass = LocalDateTime.class),
// @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class),
// @ApiImplicitParam(name = "inspectionSheetId", value = "检验单号", paramType = "query", dataTypeClass = String.class),
// @ApiImplicitParam(name = "workingProcedureName", value = "工序名称", paramType = "query", dataTypeClass = String.class)
// })
// List<Event> getFluxParamList(@ApiIgnore @RequestParam Map<String, Object> params){
// return inspectionSheetService.getFluxParamList(params);
// }
List<InspectionSampleDTO> getFluxParamList(@RequestParam("inspectionSheetId") Long inspectionSheetId){
return inspectionSheetService.getFluxParamList(inspectionSheetId);
}
@PutMapping("saveFluxParamList")
@PostMapping("saveFluxParamList")
@ApiOperation("将样本检测参数写入influxdb")
public Result saveFluxParamList(@RequestBody InspectionSampleDTO[] lists){
inspectionSheetService.saveFluxParamList(lists);
//样本数据更新后 计算检验单缺陷数不良数
inspectionSheetService.calculate(Long.valueOf(lists[0].getInspectionSheetId()));
return new Result();
}
@PostMapping("getInspectionSheetFeaturesList")
@ApiOperation("获取检验单对应检验属性")
@ApiImplicitParams({
@ApiImplicitParam(name = "productId", value = "产品", paramType = "query", dataTypeClass = Long.class),
@ApiImplicitParam(name = "workingProcedureId", value = "工序", paramType = "query", dataTypeClass = Long.class),
@ApiImplicitParam(name = "inspectionStage", value = "检测阶段", paramType = "query", dataTypeClass = Integer.class)
})
public Result getInspectionSheetFeaturesList(@ApiIgnore @RequestParam Map<String, Object> params){
List<ProductFeaturesDTO> list = inspectionSheetService.getInspectionSheetFeaturesList(params);
return new Result<List<ProductFeaturesDTO>>().ok(list);
}
@PostMapping(value = "calculate")
@ApiOperation(value = "检验单统计计算")
public Result<Long> calculate(@RequestParam("inspectionSheetId") Long inspectionSheetId){
inspectionSheetService.calculate(inspectionSheetId);
return new Result<Long>().ok(inspectionSheetId);
}
}

View File

@ -6,10 +6,13 @@ import com.cnbm.basic.service.IProductFeaturesService;
import com.cnbm.common.spc.math.StandardDiviation;
import com.cnbm.common.spc.util.DataUtils;
import com.cnbm.common.vo.R;
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.Range;
import com.cnbm.influx.param.Tag;
import com.cnbm.influx.template.Event;
import com.cnbm.processInspection.dto.*;
import com.cnbm.processInspection.graphAnalyzed.forCount.c.CGraph;
import com.cnbm.processInspection.graphAnalyzed.forCount.np.NPGraph;
@ -18,6 +21,9 @@ import com.cnbm.processInspection.graphAnalyzed.forCount.u.UGraph;
import com.cnbm.processInspection.graphAnalyzed.forMeterage.mr.MeanRGraph;
import com.cnbm.processInspection.graphAnalyzed.forMeterage.ms.MeanStandardDeviationGraph;
import com.cnbm.processInspection.graphAnalyzed.forMeterage.xmr.XMRGraph;
import com.cnbm.qualityPlanning.entity.ControlLimitDetail;
import com.influxdb.query.FluxRecord;
import com.influxdb.query.FluxTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@ -30,6 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@RestController
@RequestMapping("/processInspection")
@ -42,9 +49,9 @@ public class ProcessInspectionController {
@PostMapping("/XbarSGraphTest")
public R<XbarSGraphData> xbarSGraphTest() throws Exception {
ProductFeatures productFeatures = new ProductFeatures();
productFeatures.setSl(new Float(5));
productFeatures.setUsl(new Float(10));
productFeatures.setLsl(new Float(1));
productFeatures.setSl(new Float(65));
productFeatures.setUsl(new Float(66));
productFeatures.setLsl(new Float(69));
productFeatures.setName("LTWeight");
productFeatures.setSampleSize(10);
@ -58,16 +65,16 @@ public class ProcessInspectionController {
QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(), Instant.now()));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
meanStandardDeviationGraph.initialDate(queryDataParam);
XbarSGraphData xbarSGraphData = new XbarSGraphData(
meanStandardDeviationGraph.getMsdGraphEntity(),
meanStandardDeviationGraph.getXbarCL(),
meanStandardDeviationGraph.getSCL(),
meanStandardDeviationGraph.getSpecificationLimit(),
meanStandardDeviationGraph.getProcessCapacity(),
new StandardDiviation(meanStandardDeviationGraph.getXigma(),meanStandardDeviationGraph.getTotalXigma())
meanStandardDeviationGraph.getMsdGraphEntity()==null?null:meanStandardDeviationGraph.getMsdGraphEntity(),
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())
);
return R.ok("成功",xbarSGraphData);
@ -75,10 +82,11 @@ public class ProcessInspectionController {
@PostMapping("/XbarRGraphTest")
public R<XbarRGraphData> XbarRGraphTest() throws Exception {
//todo SL/USL/LSL sampleSize 需要从外面传过来
ProductFeatures productFeatures = new ProductFeatures();
productFeatures.setSl(new Float(5));
productFeatures.setUsl(new Float(10));
productFeatures.setLsl(new Float(1));
productFeatures.setSl(new Float(65));
productFeatures.setUsl(new Float(66));
productFeatures.setLsl(new Float(69));
productFeatures.setName("LTWeight");
productFeatures.setSampleSize(10);
@ -92,16 +100,18 @@ public class ProcessInspectionController {
QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(), Instant.now()));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
meanRGraph.initialDate(queryDataParam);
XbarRGraphData xbarSGraphData = new XbarRGraphData(
meanRGraph.getMrGraphEntity(),
meanRGraph.getXbarCL(),
meanRGraph.getRCL(),
meanRGraph.getSpecificationLimit(),
meanRGraph.getProcessCapacity(),
new StandardDiviation(meanRGraph.getXigma(),meanRGraph.getTotalXigma())
meanRGraph.getMrGraphEntity()==null?null:meanRGraph.getMrGraphEntity(),
meanRGraph.getXbarCL()==null?null:new ControlLimitDetail(meanRGraph.getXbarCL().getUCL(), meanRGraph.getXbarCL().getCL(), meanRGraph.getXbarCL().getLCL()),
meanRGraph.getRCL()==null?null:new ControlLimitDetail(meanRGraph.getRCL().getUCL(), meanRGraph.getRCL().getCL(), meanRGraph.getRCL().getLCL()),
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);
@ -109,9 +119,9 @@ public class ProcessInspectionController {
@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.setSl(new Float(65));
productFeatures.setUsl(new Float(66));
productFeatures.setLsl(new Float(69));
productFeatures.setName("LTWeight");
productFeatures.setSampleSize(1);
@ -125,41 +135,80 @@ public class ProcessInspectionController {
QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(), Instant.now()));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
xmrGraph.initialDate(queryDataParam);
XMRGraphData xmrGraphData = new XMRGraphData(
xmrGraph.getXmrGraphEntity(),
xmrGraph.getXCL(),
xmrGraph.getRSCL(),
xmrGraph.getSpecificationLimit(),
xmrGraph.getProcessCapacity(),
new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma())
xmrGraph.getXmrGraphEntity()==null?null:xmrGraph.getXmrGraphEntity(),
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())
);
return R.ok("成功",xmrGraphData);
}
@PostMapping("/getBatchs")
public R<List<String>> getBatchs() throws InterruptedException {
List<Event> list = new ArrayList<>();
Random r = new Random();
Instant instant = DataUtils.getBeforeDate(400).toInstant();
List<String> res = new ArrayList<>();
QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setBucket("qgs-bucket");
queryDataParam.setMeasurement("Weight");
List<String> dropNames = new ArrayList<>();
dropNames.add("transationId");
dropNames.add("_value");
dropNames.add("_start");
dropNames.add("_stop");
dropNames.add("_time");
dropNames.add("_field");
dropNames.add("_measurement");
dropNames.add("inspectionSheetId");
dropNames.add("argName");
queryDataParam.setDropedTagNames(dropNames);
queryDataParam.setTag(new Tag("argName","LTWeight"));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(100).toInstant(),Instant.now()));
// queryDataParam.setPageInfo(new PageInfo(1,10));
List<FluxTable> query = InfluxClient.Client.queryByGroup(queryDataParam);
for (FluxTable fluxTable : query) {
List<FluxRecord> records = fluxTable.getRecords();
if(records.size()!=0){
res.add((String) records.get(0).getValueByKey("batchNum"));
continue;
}
}
return R.ok(res);
}
@PostMapping("/NPGraphTest")
public R<NPGraphData> NPGraphTest() throws Exception {
ProductFeatures productFeatures = new ProductFeatures();
productFeatures.setSl(new Float(5));
productFeatures.setUsl(new Float(10));
productFeatures.setLsl(new Float(1));
productFeatures.setSl(new Float(65));
productFeatures.setUsl(new Float(66));
productFeatures.setLsl(new Float(69));
productFeatures.setName("LostDays");
productFeatures.setName("failDay");
NPGraph npGraph = new NPGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setRange(new Range( Instant.now() , 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(
npGraph.getList(),
npGraph.getSpecificationLimit(),
npGraph.getArgName()
npGraph.getList()==null?null:npGraph.getList(),
npGraph.getArgName()==null?null:npGraph.getArgName()
);
return R.ok("成功",npGraph1);
@ -167,24 +216,23 @@ public class ProcessInspectionController {
@PostMapping("/PGraphTest")
public R<PGraphData> PGraphTest() throws Exception {
ProductFeatures productFeatures = new ProductFeatures();
productFeatures.setSl(new Float(5));
productFeatures.setUsl(new Float(10));
productFeatures.setLsl(new Float(1));
productFeatures.setSl(new Float(65));
productFeatures.setUsl(new Float(66));
productFeatures.setLsl(new Float(69));
productFeatures.setName("LostDays");
productFeatures.setName("failDay");
PGraph pGraph = new PGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setRange(new Range( Instant.now() , DataUtils.getAfterDate(999).toInstant() ));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
queryDataParam.setTimeType(2);
pGraph.initialDate(queryDataParam);
PGraphData npGraph1 = new PGraphData(
pGraph.getList(),
pGraph.getSpecificationLimit(),
pGraph.getArgName()
pGraph.getList()==null?null:pGraph.getList(),
pGraph.getArgName()==null?null:pGraph.getArgName()
);
return R.ok("成功",npGraph1);
@ -192,24 +240,25 @@ public class ProcessInspectionController {
@PostMapping("/CGraphTest")
public R<CGraphData> CGraphTest() throws Exception {
ProductFeatures productFeatures = new ProductFeatures();
productFeatures.setSl(new Float(5));
productFeatures.setUsl(new Float(10));
productFeatures.setLsl(new Float(1));
productFeatures.setSl(new Float(65));
productFeatures.setUsl(new Float(66));
productFeatures.setLsl(new Float(69));
productFeatures.setName("LostDays");
productFeatures.setName("failDay");
CGraph cGraph = new CGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
//到时候 要看前端 传的这里的measurement 其实就是 设备名
queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setRange(new Range( Instant.now() , DataUtils.getAfterDate(999).toInstant() ));
// queryDataParam.setRange(new Range(DataUtils.getBeforeDate(10).toInstant(), Instant.now()));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
queryDataParam.setTimeType(2);
cGraph.initialDate(queryDataParam);
CGraphData npGraph1 = new CGraphData(
cGraph.getList(),
cGraph.getSpecificationLimit(),
cGraph.getArgName()
cGraph.getList()==null?null:cGraph.getList(),
cGraph.getArgName()==null?null:cGraph.getArgName()
);
return R.ok("成功",npGraph1);
@ -218,24 +267,23 @@ public class ProcessInspectionController {
@PostMapping("/UGraphTest")
public R<UGraphData> UGraphTest() throws Exception {
ProductFeatures productFeatures = new ProductFeatures();
productFeatures.setSl(new Float(5));
productFeatures.setUsl(new Float(10));
productFeatures.setLsl(new Float(1));
productFeatures.setSl(new Float(65));
productFeatures.setUsl(new Float(66));
productFeatures.setLsl(new Float(69));
productFeatures.setName("LostDays");
productFeatures.setName("failDay");
UGraph uGraph = new UGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setRange(new Range( Instant.now() , DataUtils.getAfterDate(999).toInstant() ));
queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
queryDataParam.setTimeType(2);
uGraph.initialDate(queryDataParam);
UGraphData npGraph1 = new UGraphData(
uGraph.getList(),
uGraph.getSpecificationLimit(),
uGraph.getArgName()
uGraph.getList()==null?null:uGraph.getList(),
uGraph.getArgName()==null?null:uGraph.getArgName()
);
return R.ok("成功",npGraph1);
@ -273,12 +321,12 @@ public class ProcessInspectionController {
meanStandardDeviationGraph.initialDate(queryDataParam);
XbarSGraphData xbarSGraphData = new XbarSGraphData(
meanStandardDeviationGraph.getMsdGraphEntity(),
meanStandardDeviationGraph.getXbarCL(),
meanStandardDeviationGraph.getSCL(),
meanStandardDeviationGraph.getSpecificationLimit(),
meanStandardDeviationGraph.getProcessCapacity(),
new StandardDiviation(meanStandardDeviationGraph.getXigma(),meanStandardDeviationGraph.getTotalXigma())
meanStandardDeviationGraph.getMsdGraphEntity()==null?null:meanStandardDeviationGraph.getMsdGraphEntity(),
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())
);
return R.ok("成功",xbarSGraphData);
@ -300,13 +348,18 @@ public class ProcessInspectionController {
queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
meanRGraph.initialDate(queryDataParam);
XbarRGraphData xbarSGraphData = new XbarRGraphData(
meanRGraph.getMrGraphEntity(),
meanRGraph.getXbarCL(),
meanRGraph.getRCL(),
meanRGraph.getSpecificationLimit(),
meanRGraph.getProcessCapacity(),
new StandardDiviation(meanRGraph.getXigma(),meanRGraph.getTotalXigma())
meanRGraph.getMrGraphEntity()==null?null:meanRGraph.getMrGraphEntity(),
meanRGraph.getXbarCL()==null?null:new ControlLimitDetail(meanRGraph.getXbarCL().getUCL(), meanRGraph.getXbarCL().getCL(), meanRGraph.getXbarCL().getLCL()),
meanRGraph.getRCL()==null?null:new ControlLimitDetail(meanRGraph.getRCL().getUCL(), meanRGraph.getRCL().getCL(), meanRGraph.getRCL().getLCL()),
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);
@ -329,12 +382,13 @@ public class ProcessInspectionController {
xmrGraph.initialDate(queryDataParam);
XMRGraphData xmrGraphData = new XMRGraphData(
xmrGraph.getXmrGraphEntity(),
xmrGraph.getXCL(),
xmrGraph.getRSCL(),
xmrGraph.getSpecificationLimit(),
xmrGraph.getProcessCapacity(),
new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma())
xmrGraph.getXmrGraphEntity()==null?null:xmrGraph.getXmrGraphEntity(),
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())
);
return R.ok("成功",xmrGraphData);
@ -354,9 +408,8 @@ public class ProcessInspectionController {
npGraph.initialDate(queryDataParam);
NPGraphData npGraph1 = new NPGraphData(
npGraph.getList(),
npGraph.getSpecificationLimit(),
npGraph.getArgName()
npGraph.getList()==null?null:npGraph.getList(),
npGraph.getArgName()==null?null:npGraph.getArgName()
);
return R.ok("成功",npGraph1);
}
@ -375,9 +428,8 @@ public class ProcessInspectionController {
pGraph.initialDate(queryDataParam);
PGraphData npGraph1 = new PGraphData(
pGraph.getList(),
pGraph.getSpecificationLimit(),
pGraph.getArgName()
pGraph.getList()==null?null:pGraph.getList(),
pGraph.getArgName()==null?null:pGraph.getArgName()
);
return R.ok("成功",npGraph1);
}
@ -395,9 +447,8 @@ public class ProcessInspectionController {
cGraph.initialDate(queryDataParam);
CGraphData npGraph1 = new CGraphData(
cGraph.getList(),
cGraph.getSpecificationLimit(),
cGraph.getArgName()
cGraph.getList()==null?null:cGraph.getList(),
cGraph.getArgName()==null?null:cGraph.getArgName()
);
return R.ok("成功",npGraph1);
}
@ -416,9 +467,8 @@ public class ProcessInspectionController {
uGraph.initialDate(queryDataParam);
UGraphData uGraphData = new UGraphData(
uGraph.getList(),
uGraph.getSpecificationLimit(),
uGraph.getArgName()
uGraph.getList()==null?null:uGraph.getList(),
uGraph.getArgName()==null?null:uGraph.getArgName()
);
return R.ok("成功",uGraphData);
}

View File

@ -17,16 +17,17 @@ import java.util.List;
@Data
@ApiModel(value = "C控制图 结果类")
public class CGraphData {
@ApiModelProperty(value = "P控制图list数据")
@ApiModelProperty(value = "C控制图list数据")
private List<CPoint> list;
@ApiModelProperty(value = "P控制图 规格线")
private SpecificationLimit specificationLimit;
@ApiModelProperty(value = "P控制图 参数名")
//计数类参数不需要显示规格线
// @ApiModelProperty(value = "C控制图 规格线")
// private SpecificationLimit specificationLimit;
@ApiModelProperty(value = "C控制图 参数名")
private String argName;
public CGraphData(List<CPoint> list, SpecificationLimit specificationLimit, String argName) {
public CGraphData(List<CPoint> list, String argName) {
this.list = list;
this.specificationLimit = specificationLimit;
// this.specificationLimit = specificationLimit;
this.argName = argName;
}
}

View File

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 检验样本
@ -22,4 +23,16 @@ public class InspectionSampleDTO implements Serializable {
@ApiModelProperty(value = "检验单id")
private String inspectionSheetId;
@ApiModelProperty(value = "检验参数json格式")
private String jsonData;
@ApiModelProperty(value = "批次号")
private String batchNum;
@ApiModelProperty(value = "取样时间")
private LocalDateTime sampleTime;
@ApiModelProperty(value = "样本号")
private String sampleNumber;
}

View File

@ -39,8 +39,8 @@ public class InspectionSheetDTO implements Serializable {
@ApiModelProperty(value = "产品名称关联product表")
private String productName;
@ApiModelProperty(value = "检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;; 如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
private String inspectionStage;
@ApiModelProperty(value = "检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验")
private Integer inspectionStage;
@ApiModelProperty(value = "工序id关联working_procedure表")
private Long workingProcedureId;

View File

@ -22,14 +22,14 @@ import java.util.List;
public class NPGraphData {
@ApiModelProperty(value = "NP控制图list数据")
private List<NPPoint> list;
@ApiModelProperty(value = "NP控制图 规格线")
private SpecificationLimit specificationLimit;
// @ApiModelProperty(value = "NP控制图 规格线")
// private SpecificationLimit specificationLimit;
@ApiModelProperty(value = "NP控制图 参数名")
private String argName;
public NPGraphData(List<NPPoint> list, SpecificationLimit specificationLimit, String argName) {
public NPGraphData(List<NPPoint> list, String argName) {
this.list = list;
this.specificationLimit = specificationLimit;
// this.specificationLimit = specificationLimit;
this.argName = argName;
}
}

View File

@ -19,14 +19,14 @@ import java.util.List;
public class PGraphData {
@ApiModelProperty(value = "P控制图list数据")
private List<PPoint> list;
@ApiModelProperty(value = "P控制图 规格线")
private SpecificationLimit specificationLimit;
// @ApiModelProperty(value = "P控制图 规格线")
// private SpecificationLimit specificationLimit;
@ApiModelProperty(value = "P控制图 参数名")
private String argName;
public PGraphData(List<PPoint> list, SpecificationLimit specificationLimit, String argName) {
public PGraphData(List<PPoint> list, String argName) {
this.list = list;
this.specificationLimit = specificationLimit;
// this.specificationLimit = specificationLimit;
this.argName = argName;
}
}

View File

@ -19,14 +19,14 @@ import java.util.List;
public class UGraphData {
@ApiModelProperty(value = "U控制图list数据")
private List<UPoint> list;
@ApiModelProperty(value = "U控制图 规格线")
private SpecificationLimit specificationLimit;
// @ApiModelProperty(value = "U控制图 规格线")
// private SpecificationLimit specificationLimit;
@ApiModelProperty(value = "U控制图 参数名")
private String argName;
public UGraphData(List<UPoint> list, SpecificationLimit specificationLimit, String argName) {
public UGraphData(List<UPoint> list, String argName) {
this.list = list;
this.specificationLimit = specificationLimit;
//this.specificationLimit = specificationLimit;
this.argName = argName;
}
}

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;
@ -15,14 +16,14 @@ import lombok.Data;
* @DATE: 2022/7/22 14:18
*/
@Data
@ApiModel(value = "均值极差控制图 结果类")
@ApiModel(value = "单值-移动极差 结果类")
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

@ -2,27 +2,31 @@ package com.cnbm.processInspection.dto;
import com.cnbm.common.spc.math.StandardDiviation;
import com.cnbm.processInspection.graphAnalyzed.forMeterage.mr.MRGraphEntity;
import com.cnbm.qualityPlanning.entity.ControlLimit;
import com.cnbm.qualityPlanning.entity.ProcessCapability;
import com.cnbm.qualityPlanning.entity.SpecificationLimit;
import com.cnbm.qualityPlanning.entity.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2022/7/22 14:18
*/
@Data
@ApiModel(value = "均值极差控制图 结果类")
@ApiModel(value = "均值-极差控制图 结果类")
public class XbarRGraphData {
@ApiModelProperty(value = "控制图list数据")
private MRGraphEntity mrGraphEntity;
@ApiModelProperty(value = "xbar控制图 控制限")
private ControlLimit XBarCL;
private ControlLimitDetail XBarCL;
@ApiModelProperty(value = "R控制图 控制限")
private ControlLimit RCL;
private ControlLimitDetail RCL;
@ApiModelProperty(value = "工艺规格限")
private SpecificationLimit SL;
@ -34,12 +38,14 @@ public class XbarRGraphData {
private StandardDiviation standardDiviation;
public XbarRGraphData(MRGraphEntity mrGraphEntity, ControlLimit xBarCL, ControlLimit rCL, SpecificationLimit sl, ProcessCapability processCapability, StandardDiviation standardDiviation){
public XbarRGraphData(MRGraphEntity mrGraphEntity, ControlLimitDetail xBarCLDetail , ControlLimitDetail rCLDetail, SpecificationLimit sl, ProcessCapability processCapability, StandardDiviation standardDiviation){
this.mrGraphEntity = mrGraphEntity;
this.XBarCL = xBarCL;
this.RCL = rCL;
this.XBarCL = xBarCLDetail;
this.RCL = rCLDetail;
this.SL = sl;
this.processCapability = processCapability;
this.standardDiviation = standardDiviation;
}
}

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;
@ -15,14 +16,14 @@ import lombok.Data;
* @DATE: 2022/7/22 14:18
*/
@Data
@ApiModel(value = "均值标准差控制图 结果类")
@ApiModel(value = "均值-标准差控制图 结果类")
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

@ -38,8 +38,8 @@ public class InspectionSheet implements Serializable {
@ApiModelProperty("产品id关联product表")
private Long productId;
@ApiModelProperty("检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;; 如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
private String inspectionStage;
@ApiModelProperty("检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验")
private Integer inspectionStage;
@ApiModelProperty("工序id关联working_procedure表")
private Long workingProcedureId;

View File

@ -23,8 +23,8 @@ public class InspectionSheetExcel {
private String inspectionSite;
@Excel(name = "产品id关联product表")
private Long productId;
@Excel(name = "检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;; 如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
private String inspectionStage;
@Excel(name = "检验阶段1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验")
private Integer inspectionStage;
@Excel(name = "工序id关联working_procedure表")
private Long workingProcedureId;
@Excel(name = "机台id关联machine表")

View File

@ -8,7 +8,7 @@ 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.ControlLimitDetail;
import com.cnbm.qualityPlanning.entity.SpecificationLimit;
import com.influxdb.query.FluxRecord;
import com.influxdb.query.FluxTable;
@ -140,11 +140,11 @@ public class CGraph {
* desc: get Xbar控制图 的控制限
* 注意此函数 要在 initialDate()函数执行之后
* */
public ControlLimit getCL(){
public ControlLimitDetail getCL(){
Double mul = 3 * Math.sqrt( this.cbar );
Double lcl = (this.cbar-mul)<0?0:(this.cbar-mul);
return new ControlLimit(
return new ControlLimitDetail(
this.cbar + mul,
this.cbar,
lcl

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;
@ -143,11 +136,11 @@ public class NPGraph {
* desc: get Xbar控制图 的控制限
* 注意此函数 要在 initialDate()函数执行之后
* */
public ControlLimit getCL(Double n){
public ControlLimitDetail getCL(Double n){
Double npbar = n * this.pbar;
Double mul = 3 * Math.sqrt(npbar*(1-this.pbar));
Double lcl = (npbar-mul)<0?0:(npbar-mul);
return new ControlLimit(
return new ControlLimitDetail(
npbar + mul,
npbar,
lcl

View File

@ -7,7 +7,7 @@ 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.ControlLimitDetail;
import com.cnbm.qualityPlanning.entity.PPoint;
import com.cnbm.qualityPlanning.entity.SpecificationLimit;
import com.influxdb.query.FluxRecord;
@ -15,7 +15,6 @@ import com.influxdb.query.FluxTable;
import lombok.Data;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -150,11 +149,11 @@ public class PGraph {
* desc: get Xbar控制图 的控制限
* 注意此函数 要在 initialDate()函数执行之后
* */
public ControlLimit getCL(Double n){
public ControlLimitDetail getCL(Double n){
Double mul = 3 * Math.sqrt( ( this.pbar * (1-this.pbar) ) / n );
Double lcl = (this.pbar-mul)<0?0:(this.pbar-mul);
return new ControlLimit(
return new ControlLimitDetail(
this.pbar + mul,
this.pbar,
lcl

View File

@ -7,7 +7,7 @@ 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.ControlLimitDetail;
import com.cnbm.qualityPlanning.entity.SpecificationLimit;
import com.cnbm.qualityPlanning.entity.UPoint;
import com.influxdb.query.FluxRecord;
@ -148,11 +148,11 @@ public class UGraph {
* desc: get Xbar控制图 的控制限
* 注意此函数 要在 initialDate()函数执行之后
* */
public ControlLimit getCL(Double n){
public ControlLimitDetail getCL(Double n){
Double mul = 3 * Math.sqrt( this.ubar / n );
Double lcl = (this.ubar-mul)<0?0:(this.ubar-mul);
return new ControlLimit(
return new ControlLimitDetail(
this.ubar + mul,
this.ubar,
lcl

View File

@ -107,6 +107,9 @@ public class MeanRGraph {
queryDataParam.setTag(new Tag("argName",argName));
List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
if(query.size() == 0){
return;
}
//1. 先从fluxdb 里面提取原始数据
List<Double> originData = new ArrayList<>();
for (FluxTable fluxTable : query) {
@ -217,6 +220,9 @@ public class MeanRGraph {
* 注意此函数 要在 initialDate()函数执行之后
* */
public ControlLimit getXbarCL(){
if(this.mrGraphEntity == null){
return null;
}
return new ControlLimit(
(this.mrGraphEntity.getXbarbar() + a2*this.mrGraphEntity.getRbar()),
this.mrGraphEntity.getXbarbar(),
@ -229,6 +235,9 @@ public class MeanRGraph {
* 注意此函数 要在 initialDate()函数执行之后
* */
public ControlLimit getRCL(){
if(this.mrGraphEntity==null){
return null;
}
return new ControlLimit(
( d4 * this.mrGraphEntity.getRbar() ) ,
this.mrGraphEntity.getRbar() ,
@ -241,6 +250,10 @@ public class MeanRGraph {
* 注意此函数 要在 initialDate()函数执行之后
* */
public ProcessCapability getProcessCapacity(){
if(this.miu==null || this.xigma==null || this.specificationLimit==null){
return null;
}
SpecificationLimit sp = this.specificationLimit;
List<String> warming = new ArrayList<>();
Float usl = sp.getUSL();

View File

@ -1,5 +1,6 @@
package com.cnbm.processInspection.mapper;
import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.processInspection.dto.InspectionSheetDTO;
import com.cnbm.processInspection.entity.InspectionSheet;
@ -17,4 +18,6 @@ import java.util.Map;
@Mapper
public interface InspectionSheetMapper extends BaseDao<InspectionSheet> {
List<InspectionSheetDTO> list(Map<String, Object> params);
// Integer getNumberOfSamples(Map<String, Object> params);
List<ProductFeaturesDTO> getInspectionSheetFeaturesList(Map<String, Object> params);
}

Some files were not shown because too many files have changed in this diff Show More