|
|
|
|
@ -1769,6 +1769,70 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
|
|
|
|
|
return dtos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List<Map<String,String>> getMonthOfDataDefectV2(QcStaticTable qcStaticTable) {
|
|
|
|
|
List<String> bpDefects = qcStaticTableMapper.getBpDefects(qcStaticTable);
|
|
|
|
|
List<QcCheckTaskDefect> list = qcStaticTableMapper.getBPDefectList(qcStaticTable);
|
|
|
|
|
List<Map<String,String>> result = new ArrayList<>();
|
|
|
|
|
for (String defect : bpDefects){
|
|
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
|
|
map.put("defect",defect);
|
|
|
|
|
int count = 0;
|
|
|
|
|
for (QcCheckTaskDefect data : list){
|
|
|
|
|
if (defect.equals(data.getDefectSubclass())){
|
|
|
|
|
map.put(data.getAttr1(),data.getAttr2());
|
|
|
|
|
if (StringUtils.isNotBlank(data.getAttr2())){
|
|
|
|
|
count = count + Integer.parseInt(data.getAttr2());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
map.put("count", Integer.toString(count));
|
|
|
|
|
result.add(map);
|
|
|
|
|
}
|
|
|
|
|
int count1 = 0;
|
|
|
|
|
int count2 = 0;
|
|
|
|
|
Map<String,String> map1 = new HashMap<>();
|
|
|
|
|
map1.put("defect","合计");
|
|
|
|
|
Map<String,String> map2 = new HashMap<>();
|
|
|
|
|
map2.put("defect","抽样数");
|
|
|
|
|
for (QcCheckTaskDefect data : list){
|
|
|
|
|
if ("合计".equals(data.getDefectSubclass())){
|
|
|
|
|
map1.put(data.getAttr1(),data.getAttr2());
|
|
|
|
|
map2.put(data.getAttr1(),data.getAttr3());
|
|
|
|
|
if (StringUtils.isNotBlank(data.getAttr2())){
|
|
|
|
|
count1 = count1 + Integer.parseInt(data.getAttr2());
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(data.getAttr3())){
|
|
|
|
|
count2 = count2 + Integer.parseInt(data.getAttr3().replace(".00",""));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
map1.put("count", Integer.toString(count1));
|
|
|
|
|
map2.put("count", Integer.toString(count2));
|
|
|
|
|
result.add(map1);
|
|
|
|
|
result.add(map2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List<Map<String, String>> getDefectItemDataV2(QcStaticTable qcStaticTable) {
|
|
|
|
|
List<Map<String, String>> dtos = new ArrayList<>();
|
|
|
|
|
//获取不良种类
|
|
|
|
|
List<String> bpDefects = qcStaticTableMapper.getBpDefects(qcStaticTable);
|
|
|
|
|
List<QcCheckTaskDefect> monthList = qcStaticTableMapper.getBPDefectMothMapV2(qcStaticTable);
|
|
|
|
|
qcStaticTable.setYearMonth(null);
|
|
|
|
|
List<QcCheckTaskDefect> totalList = qcStaticTableMapper.getBPDefectMothMapV2(qcStaticTable);
|
|
|
|
|
|
|
|
|
|
dtos.add(computerBpDefectsRate(monthList,"num","不良数", bpDefects));
|
|
|
|
|
dtos.add(computerBpDefectsRate(monthList,"rate","不良比例", bpDefects));
|
|
|
|
|
dtos.add(computerBpDefectsRate(totalList,"rate","累计不良比例", bpDefects));
|
|
|
|
|
return dtos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List<String> getDefectItemTitle(QcStaticTable qcStaticTable) {
|
|
|
|
|
@ -1888,6 +1952,80 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public Map<String,Object> getDefectItemLineV2(QcStaticTable qcStaticTable) {
|
|
|
|
|
Map<String,Object> result = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
//获取不良种类
|
|
|
|
|
List<String> bpDefects = qcStaticTableMapper.getBpDefects(qcStaticTable);
|
|
|
|
|
result.put("xData",bpDefects);
|
|
|
|
|
|
|
|
|
|
//当前查询月份的不良率
|
|
|
|
|
List<QcCheckTaskDefect> monthList = qcStaticTableMapper.getBPDefectMothMapV2(qcStaticTable);
|
|
|
|
|
//计算总不良率
|
|
|
|
|
//不良数
|
|
|
|
|
BigDecimal noOkQty = new BigDecimal(0);
|
|
|
|
|
//样品数
|
|
|
|
|
BigDecimal sampleQty = new BigDecimal(0);
|
|
|
|
|
for (QcCheckTaskDefect item : monthList){
|
|
|
|
|
if (StringUtils.isNotBlank(item.getAttr2())){
|
|
|
|
|
noOkQty = noOkQty.add(new BigDecimal(item.getAttr2()));
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(item.getAttr3())){
|
|
|
|
|
sampleQty = sampleQty.add(new BigDecimal(item.getAttr3()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//不良率
|
|
|
|
|
BigDecimal noOkRate = new BigDecimal(0);
|
|
|
|
|
if (sampleQty.compareTo(BigDecimal.ZERO) > 0){
|
|
|
|
|
noOkRate = noOkQty.divide(sampleQty,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
|
|
|
|
|
}
|
|
|
|
|
//合格率
|
|
|
|
|
BigDecimal okRate = new BigDecimal(100).subtract(noOkRate);
|
|
|
|
|
result.put("noOkQty",noOkQty);
|
|
|
|
|
result.put("sampleQty",sampleQty);
|
|
|
|
|
result.put("noOkRate",noOkRate);
|
|
|
|
|
result.put("okRate",okRate);
|
|
|
|
|
|
|
|
|
|
List<String> yDataLeft = new ArrayList<>();
|
|
|
|
|
for (String defect : bpDefects) {
|
|
|
|
|
boolean flag = true;
|
|
|
|
|
for (QcCheckTaskDefect item : monthList){
|
|
|
|
|
if (defect.equals(item.getDefectSubclass())){
|
|
|
|
|
yDataLeft.add(item.getAttr1());
|
|
|
|
|
flag = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag){
|
|
|
|
|
yDataLeft.add("0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.put("yDataLeft",yDataLeft);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//累计不良率
|
|
|
|
|
qcStaticTable.setYearMonth(null);
|
|
|
|
|
List<QcCheckTaskDefect> totalList = qcStaticTableMapper.getBPDefectMothMapV2(qcStaticTable);
|
|
|
|
|
List<String> yDataRight = new ArrayList<>();
|
|
|
|
|
for (String defect : bpDefects) {
|
|
|
|
|
boolean flag = true;
|
|
|
|
|
for (QcCheckTaskDefect item : totalList){
|
|
|
|
|
if (defect.equals(item.getDefectSubclass())){
|
|
|
|
|
yDataRight.add(item.getAttr1());
|
|
|
|
|
flag = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag){
|
|
|
|
|
yDataRight.add("0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.put("yDataRight",yDataRight);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List<Map<String, String>> getDefectItemDataPC(QcStaticTable qcStaticTable) {
|
|
|
|
|
@ -1933,6 +2071,55 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
|
|
|
|
|
return dtos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List<Map<String, String>> getDefectItemDataPCV2(QcStaticTable qcStaticTable) {
|
|
|
|
|
List<Map<String, String>> dtos = new ArrayList<>();
|
|
|
|
|
//获取不良种类
|
|
|
|
|
List<String> bpDefects = qcStaticTableMapper.getBpDefects(qcStaticTable);
|
|
|
|
|
List<QcCheckTaskDefect> monthList = qcStaticTableMapper.getBPDefectMothPCMapV2(qcStaticTable);
|
|
|
|
|
qcStaticTable.setYearMonth(null);
|
|
|
|
|
List<QcCheckTaskDefect> totalList = qcStaticTableMapper.getBPDefectMothPCMapV2(qcStaticTable);
|
|
|
|
|
|
|
|
|
|
dtos.add(computerBpDefectsRate(monthList,"num","不良数", bpDefects));
|
|
|
|
|
dtos.add(computerBpDefectsRate(monthList,"rate","不良比例", bpDefects));
|
|
|
|
|
dtos.add(computerBpDefectsRate(totalList,"rate","累计不良比例", bpDefects));
|
|
|
|
|
return dtos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//计算
|
|
|
|
|
private Map<String,String> computerBpDefectsRate(List<QcCheckTaskDefect> list, String type, String title, List<String> bpDefects ){
|
|
|
|
|
Map<String,String> result= new HashMap<>();
|
|
|
|
|
result.put("dataType",title);
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (String defect : bpDefects) {
|
|
|
|
|
for (QcCheckTaskDefect item : list){
|
|
|
|
|
if (defect.equals(item.getDefectSubclass())){
|
|
|
|
|
if (StringUtils.isNotBlank(item.getAttr1())){
|
|
|
|
|
if ("rate".equals(type)){
|
|
|
|
|
result.put("item"+i, item.getAttr1());
|
|
|
|
|
}else {
|
|
|
|
|
if (StringUtils.isNotBlank(item.getAttr2())){
|
|
|
|
|
result.put("item"+i,new BigDecimal(item.getAttr1()).divide(new BigDecimal(item.getAttr2()),2,RoundingMode.HALF_UP).toString());
|
|
|
|
|
}else {
|
|
|
|
|
result.put("item"+i,"100");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
result.put("item"+i,"0");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public QcStaticTable getDefectItemLinePC(QcStaticTable qcStaticTable) {
|
|
|
|
|
@ -2001,6 +2188,81 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public Map<String,Object> getDefectItemLinePCV2(QcStaticTable qcStaticTable) {
|
|
|
|
|
Map<String,Object> result = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
//获取不良种类
|
|
|
|
|
List<String> bpDefects = qcStaticTableMapper.getBpDefects(qcStaticTable);
|
|
|
|
|
result.put("xData",bpDefects);
|
|
|
|
|
|
|
|
|
|
//当前查询月份的不良率
|
|
|
|
|
List<QcCheckTaskDefect> monthList = qcStaticTableMapper.getBPDefectMothPCMapV2(qcStaticTable);
|
|
|
|
|
//计算总不良率
|
|
|
|
|
//不良数
|
|
|
|
|
BigDecimal noOkQty = new BigDecimal(0);
|
|
|
|
|
//样品数
|
|
|
|
|
BigDecimal sampleQty = new BigDecimal(0);
|
|
|
|
|
for (QcCheckTaskDefect item : monthList){
|
|
|
|
|
if (StringUtils.isNotBlank(item.getAttr2())){
|
|
|
|
|
noOkQty = noOkQty.add(new BigDecimal(item.getAttr2()));
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(item.getAttr3())){
|
|
|
|
|
sampleQty = sampleQty.add(new BigDecimal(item.getAttr3()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//不良率
|
|
|
|
|
BigDecimal noOkRate = new BigDecimal(0);
|
|
|
|
|
if (sampleQty.compareTo(BigDecimal.ZERO) > 0){
|
|
|
|
|
noOkRate = noOkQty.divide(sampleQty,4,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
|
|
|
|
|
}
|
|
|
|
|
//合格率
|
|
|
|
|
BigDecimal okRate = new BigDecimal(100).subtract(noOkRate);
|
|
|
|
|
result.put("noOkQty",noOkQty);
|
|
|
|
|
result.put("sampleQty",sampleQty);
|
|
|
|
|
result.put("noOkRate",noOkRate);
|
|
|
|
|
result.put("okRate",okRate);
|
|
|
|
|
|
|
|
|
|
List<String> yDataLeft = new ArrayList<>();
|
|
|
|
|
for (String defect : bpDefects) {
|
|
|
|
|
boolean flag = true;
|
|
|
|
|
for (QcCheckTaskDefect item : monthList){
|
|
|
|
|
if (defect.equals(item.getDefectSubclass())){
|
|
|
|
|
yDataLeft.add(item.getAttr1());
|
|
|
|
|
flag = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag){
|
|
|
|
|
yDataLeft.add("0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.put("yDataLeft",yDataLeft);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//累计不良率
|
|
|
|
|
qcStaticTable.setYearMonth(null);
|
|
|
|
|
List<QcCheckTaskDefect> totalList = qcStaticTableMapper.getBPDefectMothPCMapV2(qcStaticTable);
|
|
|
|
|
List<String> yDataRight = new ArrayList<>();
|
|
|
|
|
for (String defect : bpDefects) {
|
|
|
|
|
boolean flag = true;
|
|
|
|
|
for (QcCheckTaskDefect item : totalList){
|
|
|
|
|
if (defect.equals(item.getDefectSubclass())){
|
|
|
|
|
yDataRight.add(item.getAttr1());
|
|
|
|
|
flag = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag){
|
|
|
|
|
yDataRight.add("0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.put("yDataRight",yDataRight);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List<String> getCpDateTitle(QcStaticTable qcStaticTable) {
|
|
|
|
|
|