不良率统计报表

master
zhaoxiaolin 1 year ago
parent 4ee47b457c
commit a91af79c92

@ -11,6 +11,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.utils.DateUtils;
import com.op.quality.domain.QcCheckType;
import com.op.system.api.domain.quality.ChartDTO;
import com.op.system.api.domain.quality.ChartSeriesDTO;
import com.op.system.api.domain.quality.FactoryDto;
@ -228,6 +229,10 @@ public class QcStaticTableController extends BaseController {
return qcStaticTableService.getWorkcenterList(factoryDto);
}
@GetMapping("/getCheckTypeList/{typeCode}")
public List<QcCheckType> getCheckTypeList(@PathVariable("typeCode") String typeCode) {
return qcStaticTableService.getCheckTypeList(typeCode);
}
/**
*
*/
@ -266,4 +271,23 @@ public class QcStaticTableController extends BaseController {
ChartSeriesDTO dto = qcStaticTableService.getXJChartData(qcStaticTable);
return dto;
}
/**质检不良率统计**/
@RequiresPermissions("quality:qcProduceAnalysis:list")
@GetMapping("/getQmsRateTable")
public TableDataInfo getQmsRateTable(QcStaticTable qcStaticTable) {
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcStaticTable.getYmArrayStart())){
LocalDate date = LocalDate.now();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String ymStr = dtf.format(date);
qcStaticTable.setYmArrayStart(ymStr);
qcStaticTable.setYmArrayEnd(ymStr);
}
startPage();
List<QcStaticTable> list = qcStaticTableService.getQmsRateTable(qcStaticTable);
return getDataTable(list);
}
}

@ -86,6 +86,15 @@ public class QcStaticTable extends BaseEntity {
private String column200210;
private String startDateStr;
private String endDateStr;
private String checkType;
public String getCheckType() {
return checkType;
}
public void setCheckType(String checkType) {
this.checkType = checkType;
}
public String getStartDateStr() {
return startDateStr;

@ -3,6 +3,7 @@ package com.op.quality.mapper;
import java.util.List;
import java.util.Map;
import com.op.quality.domain.QcCheckType;
import com.op.quality.domain.QcStaticTable;
import com.op.system.api.domain.quality.FactoryDto;
import org.apache.ibatis.annotations.MapKey;
@ -51,4 +52,8 @@ public interface QcStaticTableMapper {
List<QcStaticTable> getLegendData(QcStaticTable qcStaticTable);
@MapKey("ymdms")
Map<String, QcStaticTable> getXJMapData(QcStaticTable qcStaticTable);
List<QcStaticTable> getQmsRateTable(QcStaticTable qcStaticTable);
List<QcCheckType> getCheckTypeList(String typeCode);
}

@ -3,6 +3,7 @@ package com.op.quality.service;
import java.util.List;
import java.util.Map;
import com.op.quality.domain.QcCheckType;
import com.op.quality.domain.QcStaticTable;
import com.op.system.api.domain.quality.ChartSeriesDTO;
import com.op.system.api.domain.quality.FactoryDto;
@ -36,4 +37,8 @@ public interface IQcStaticTableService {
List<QcStaticTable> getXJCheckTableDetail(QcStaticTable qcStaticTable);
ChartSeriesDTO getXJChartData(QcStaticTable qcStaticTable);
List<QcStaticTable> getQmsRateTable(QcStaticTable qcStaticTable);
List<QcCheckType> getCheckTypeList(String typeCode);
}

@ -4,15 +4,11 @@ import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcCheckType;
import com.op.system.api.domain.quality.ChartDTO;
import com.op.system.api.domain.quality.ChartSeriesDTO;
import com.op.system.api.domain.quality.FactoryDto;
@ -319,6 +315,45 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
return seriesDTO;
}
@Override
@DS("#header.poolName")
public List<QcStaticTable> getQmsRateTable(QcStaticTable qcStaticTable) {
List<QcStaticTable> dtos = qcStaticTableMapper.getQmsRateTable(qcStaticTable);
for(QcStaticTable dto:dtos){
if(StringUtils.isEmpty(dto.getOrderNo())){
dto.setOrderNo("-");
}
if(StringUtils.isEmpty(dto.getIncomeBatchNo())){
dto.setIncomeBatchNo("-");
}
if(StringUtils.isEmpty(dto.getMaterialCode())){
dto.setMaterialCode("-");
}
if(StringUtils.isEmpty(dto.getMaterialCode())){
dto.setMaterialCode("-");
}
if(StringUtils.isEmpty(dto.getMaterialName())){
dto.setMaterialName("-");
}
if(StringUtils.isNotBlank(dto.getSampleQuality())&&!"0.00".equals(dto.getSampleQuality())){
BigDecimal noOkRate = new BigDecimal(dto.getNoOkNums())
.multiply(new BigDecimal(100))
.divide(new BigDecimal(dto.getSampleQuality()),2,BigDecimal.ROUND_HALF_UP);
dto.setNoOkNumRate(noOkRate.toString()+"%");
}else{
dto.setNoOkNumRate("-");
}
}
return dtos;
}
@Override
@DS("#header.poolName")
public List<QcCheckType> getCheckTypeList(String typeCode) {
return qcStaticTableMapper.getCheckTypeList(typeCode);
}
private List<String> getHourProductionTitle(QcStaticTable qcStaticTable) {
// 返回的日期集合
@ -349,4 +384,6 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
return dayHours;
}
}

@ -182,4 +182,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialCode != null "> and qct.material_code like concat('%',#{materialCode},'%')</if>
group by qct.supplier_code,qct.supplier_name,CONVERT(VARCHAR(2), qct.check_time, 108)
</select>
<select id="getQmsRateTable" resultType="com.op.quality.domain.QcStaticTable">
select qct.supplier_code supplierCode,
qct.supplier_name supplierName,
<if test="orderNo != null ">qct.order_no orderNo, qct.unit,</if>
<if test="incomeBatchNo != null ">qct.income_batch_no,</if>
<if test="materialCode != null ">qct.material_code,qct.material_name,</if>
sum(quality) quality,
sum(qct.sample_quality) sampleQuality,
sum(qct.noOk_quality) noOkNums
from qc_check_task qct
where qct.del_flag = '0'
<if test="orderNo != null ">and qct.order_no = #{orderNo}</if>
<if test="incomeBatchNo != null ">and qct.income_batch_no like concat('%',#{incomeBatchNo},'%')</if>
<if test="materialCode != null ">and qct.material_code like concat('%',#{materialCode},'%')</if>
<if test="supplierCode != null ">and qct.supplier_code = #{supplierCode}</if>
<if test="typeCode != null ">and qct.type_code = #{typeCode}</if>
<if test="checkType != null ">and qct.check_type = #{checkType}</if>
<if test="ymArrayStart != null "> and CONVERT(varchar(10),qct.income_time, 120) >= CONVERT(varchar(10),#{ymArrayStart}, 120)</if>
<if test="ymArrayEnd != null "> and CONVERT(varchar(10),#{ymArrayEnd}, 120)>=CONVERT(varchar(10),qct.income_time, 120)</if>
group by qct.supplier_code,qct.supplier_name
<if test="orderNo != null ">,qct.order_no,qct.unit</if>
<if test="incomeBatchNo != null ">,qct.income_batch_no</if>
<if test="materialCode != null ">,qct.material_code,qct.material_name</if>
</select>
<select id="getCheckTypeList" resultType="com.op.quality.domain.QcCheckType">
select order_code checkType,
check_name checkName
from qc_check_type
where del_flag = '0' and type_code= #{typeCode}
</select>
</mapper>

Loading…
Cancel
Save