Commit 5503ce41 authored by 李驰骋's avatar 李驰骋

异常原因不合格分布数据更换接口

parent 6c023a48
package com.ximai.mes.kanban.controller; package com.ximai.mes.kanban.controller;
import com.ximai.common.core.domain.AjaxResult; import com.ximai.common.core.domain.AjaxResult;
import com.ximai.mes.kanban.dto.abnormal.AbnormalMonthStatDto;
import com.ximai.mes.kanban.dto.task.TaskStatDto; import com.ximai.mes.kanban.dto.task.TaskStatDto;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -102,6 +103,27 @@ public class KanbanTaskController { ...@@ -102,6 +103,27 @@ public class KanbanTaskController {
processMonthlyIndexDto.setQualifiedRatio(new BigDecimal("95")); processMonthlyIndexDto.setQualifiedRatio(new BigDecimal("95"));
processMonthlyIndexDto.setMonthPlanConcludeRatio(new BigDecimal("35")); processMonthlyIndexDto.setMonthPlanConcludeRatio(new BigDecimal("35"));
rst.setProcessMonthlyIndexDto(processMonthlyIndexDto); rst.setProcessMonthlyIndexDto(processMonthlyIndexDto);
List<TaskStatDto.AbnormalCauseStat> abnormalCauseStats = new ArrayList<>();
abnormalCauseStats.add(new TaskStatDto.AbnormalCauseStat(){
{
setCause("停电");
setCt(2);
}
});
abnormalCauseStats.add(new TaskStatDto.AbnormalCauseStat(){
{
setCause("设备损坏");
setCt(4);
}
});
abnormalCauseStats.add(new TaskStatDto.AbnormalCauseStat(){
{
setCause("硬件故障");
setCt(0);
}
});
rst.setAbnormalCauseData(abnormalCauseStats);
return AjaxResult.success(rst); return AjaxResult.success(rst);
} }
......
...@@ -25,9 +25,6 @@ public class AbnormalMonthStatDto { ...@@ -25,9 +25,6 @@ public class AbnormalMonthStatDto {
@ApiModelProperty("设备近七天故障数,顺序为:索引0当天、1昨天、2前天") @ApiModelProperty("设备近七天故障数,顺序为:索引0当天、1昨天、2前天")
List<Integer> equipErrorArr=new ArrayList<>(); List<Integer> equipErrorArr=new ArrayList<>();
@ApiModelProperty("异常原因不合格分布")
List<AbnormalCauseStat> abnormalCauseData;
@Data @Data
public static class AbnormalMonthStatDetail{ public static class AbnormalMonthStatDetail{
@ApiModelProperty("异常总数") @ApiModelProperty("异常总数")
...@@ -38,15 +35,4 @@ public class AbnormalMonthStatDto { ...@@ -38,15 +35,4 @@ public class AbnormalMonthStatDto {
Integer expireUnClose=0; Integer expireUnClose=0;
} }
@Data
public static class AbnormalCauseStat{
@ApiModelProperty("异常原因")
String cause;
@ApiModelProperty("异常原因")
Integer ct=0;
}
} }
...@@ -18,6 +18,20 @@ public class TaskStatDto { ...@@ -18,6 +18,20 @@ public class TaskStatDto {
@ApiModelProperty("工序月统计指标") @ApiModelProperty("工序月统计指标")
ProcessMonthlyIndexDto processMonthlyIndexDto; ProcessMonthlyIndexDto processMonthlyIndexDto;
@ApiModelProperty("异常原因不合格分布")
List<AbnormalCauseStat> abnormalCauseData;
@Data
public static class AbnormalCauseStat{
@ApiModelProperty("异常原因")
String cause;
@ApiModelProperty("异常原因")
Integer ct=0;
}
@Data @Data
public static class ProcessOutput{ public static class ProcessOutput{
......
...@@ -68,32 +68,32 @@ public class KanbanAbnormalService { ...@@ -68,32 +68,32 @@ public class KanbanAbnormalService {
workunitQuery.eq("enable_flag", "Y"); workunitQuery.eq("enable_flag", "Y");
int workunitCt = workunitMapper.selectCount(workunitQuery); int workunitCt = workunitMapper.selectCount(workunitQuery);
rst.setEquipCt(workunitCt-abnormalEquipCt); rst.setEquipCt(workunitCt-abnormalEquipCt);
List<QcAbnormalReportDto> unqualifiedAbnormal = abnormalTypeMap.getOrDefault(QcAbnormalTypeEnum.UNQUALIFIED_REASON.getType(), new ArrayList<>()); // List<QcAbnormalReportDto> unqualifiedAbnormal = abnormalTypeMap.getOrDefault(QcAbnormalTypeEnum.UNQUALIFIED_REASON.getType(), new ArrayList<>());
//按不合格原因分组 // //按不合格原因分组
Map<String, List<QcAbnormalReportDto>> unqualifiedAbnormalMap = unqualifiedAbnormal.stream().collect(Collectors.groupingBy(s->s.getAbnormalReason())); // Map<String, List<QcAbnormalReportDto>> unqualifiedAbnormalMap = unqualifiedAbnormal.stream().collect(Collectors.groupingBy(s->s.getAbnormalReason()));
//查询不合格原因 // //查询不合格原因
QcAbnormalInformation qcAbnormalInformationQuery = new QcAbnormalInformation(); // QcAbnormalInformation qcAbnormalInformationQuery = new QcAbnormalInformation();
qcAbnormalInformationQuery.setAbnormalType(QcAbnormalTypeEnum.UNQUALIFIED_REASON.getType()); // qcAbnormalInformationQuery.setAbnormalType(QcAbnormalTypeEnum.UNQUALIFIED_REASON.getType());
List<QcAbnormalInformation> abnormalInfoList = abnormalInformationService.selectQcAbnormalInformationList(qcAbnormalInformationQuery); // List<QcAbnormalInformation> abnormalInfoList = abnormalInformationService.selectQcAbnormalInformationList(qcAbnormalInformationQuery);
LinkedHashMap<String, Integer> unqualifiedAbnormalRstMap = new LinkedHashMap<>(); // LinkedHashMap<String, Integer> unqualifiedAbnormalRstMap = new LinkedHashMap<>();
List<AbnormalMonthStatDto.AbnormalCauseStat> abnormalCauseStats = new ArrayList<>(); // List<AbnormalMonthStatDto.AbnormalCauseStat> abnormalCauseStats = new ArrayList<>();
abnormalInfoList.forEach(s->{ // abnormalInfoList.forEach(s->{
if(!unqualifiedAbnormalMap.containsKey(s.getAbnormalReason())){ // if(!unqualifiedAbnormalMap.containsKey(s.getAbnormalReason())){
unqualifiedAbnormalRstMap.put(s.getAbnormalReason(), 0); // unqualifiedAbnormalRstMap.put(s.getAbnormalReason(), 0);
}else { // }else {
unqualifiedAbnormalRstMap.put(s.getAbnormalReason(), unqualifiedAbnormalMap.get(s.getAbnormalReason()).size()); // unqualifiedAbnormalRstMap.put(s.getAbnormalReason(), unqualifiedAbnormalMap.get(s.getAbnormalReason()).size());
} // }
}); // });
Map<String,Integer> queueUnqualifiedMap = MapUtil.sortByValue(unqualifiedAbnormalRstMap, true); // Map<String,Integer> queueUnqualifiedMap = MapUtil.sortByValue(unqualifiedAbnormalRstMap, true);
queueUnqualifiedMap.forEach((k,v)->{ // queueUnqualifiedMap.forEach((k,v)->{
abnormalCauseStats.add(new AbnormalMonthStatDto.AbnormalCauseStat(){ // abnormalCauseStats.add(new AbnormalMonthStatDto.AbnormalCauseStat(){
{ // {
setCt(v); // setCt(v);
setCause(k); // setCause(k);
} // }
}); // });
}); // });
rst.setAbnormalCauseData(abnormalCauseStats); // rst.setAbnormalCauseData(abnormalCauseStats);
//查询七天内设备异常,按天统计 //查询七天内设备异常,按天统计
Calendar last7Day = Calendar.getInstance(); Calendar last7Day = Calendar.getInstance();
last7Day.set(Calendar.DATE, -6); last7Day.set(Calendar.DATE, -6);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment