质量统计

highway
zhaoxiaolin 12 months ago
parent 60270136f7
commit 9c9da57bcf

@ -7,9 +7,7 @@ import javax.servlet.http.HttpServletResponse;
import com.op.common.core.utils.DateUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.QcBomComponent;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcSupplier;
import com.op.quality.domain.*;
import com.op.system.api.domain.SysRole;
import com.op.system.api.domain.SysUser;
import org.apache.commons.lang.StringUtils;
@ -25,7 +23,6 @@ import org.springframework.web.bind.annotation.RestController;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.service.IQcCheckTaskIncomeService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
@ -219,4 +216,10 @@ public class QcCheckTaskIncomeController extends BaseController {
return toAjax(qcCheckTaskIncomeService.commitCheckResult(qcCheckTaskIncome));
}
/**不良类型**/
@PutMapping("/getDefectList")
public List<QcDefectType> getDefectList(@RequestBody QcDefectType qcDefectType) {
return qcCheckTaskIncomeService.getDefectList(qcDefectType);
}
}

@ -9,6 +9,7 @@ import java.util.*;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.utils.DateUtils;
import com.op.system.api.domain.quality.ChartDTO;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -75,7 +76,7 @@ public class QcStaticTableController extends BaseController {
*/
@RequiresPermissions("quality:gcTableProduce:list")
@GetMapping("/getProduceChartData")
public QcStaticTable getProduceList(QcStaticTable qcStaticTable) {
public QcStaticTable getProduceChartData(QcStaticTable qcStaticTable) {
QcStaticTable resultdto = new QcStaticTable();
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcStaticTable.getYmArrayStart())){
@ -88,18 +89,22 @@ public class QcStaticTableController extends BaseController {
//xAxis;
if(qcStaticTable.getYmArrayStart().equals(qcStaticTable.getYmArrayEnd())){
/**月内每日**/
List<String> days = this.getXNames(qcStaticTable.getYmArrayStart(),qcStaticTable.getYmArrayEnd(),"ymd");
List<String> days = this.getXNames(qcStaticTable.getYmArrayStart()+"-01",
qcStaticTable.getYmArrayEnd()+"-01","ymd");
resultdto.setxAxis(days);
}else{
/**年内各月**/
List<String> months = this.getXNames(qcStaticTable.getYmArrayStart(),qcStaticTable.getYmArrayEnd(),"ym");
resultdto.setxAxis(months);
}
//series;//legend.data
List<QcStaticTable> seriesdtos= qcStaticTableService.getProduceChartData(qcStaticTable);
ChartDTO chartDTO = new ChartDTO();
for(QcStaticTable seriesdto:seriesdtos){
chartDTO.setName(seriesdto.getMaterialName());
chartDTO.setType("line");
}
List<QcStaticTable> seriesdto= qcStaticTableService.selectQcStaticTableList(qcStaticTable);
//legend.data
//series;
resultdto.setSeries(null);
return resultdto;
@ -110,30 +115,32 @@ public class QcStaticTableController extends BaseController {
List<String> days = new ArrayList<String>();
DateFormat dateFormat = null;
try {
Calendar tempStart = null;
Calendar tempEnd = null;
if("ymd".equals(type)){
dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date start = dateFormat.parse(startMonth);//开始
Date end = dateFormat.parse(endMonth);//结束
tempStart = Calendar.getInstance();
tempStart.setTime(start);
tempEnd = Calendar.getInstance();
tempEnd.setTime(end);
tempEnd.add(Calendar.MONTH, 1);
}else{
dateFormat = new SimpleDateFormat("yyyy-MM");
}
Date start = dateFormat.parse(startMonth);//开始
Date end = dateFormat.parse(endMonth);//结束
Date start = dateFormat.parse(startMonth);//开始
Date end = dateFormat.parse(endMonth);//结束
tempStart = Calendar.getInstance();
tempStart.setTime(start);
String endTimeStr1 = endMonth;
String[] endTime2 = endTimeStr1.split(" ");
String endTime3 = endTime2[1].split(":")[1];
if(Integer.parseInt(endTime3)!=0){
Calendar calendar = Calendar.getInstance();
calendar.setTime(end);
calendar.add(Calendar.MONTH, 1);
end = calendar.getTime();
tempEnd = Calendar.getInstance();
tempEnd.setTime(end);
tempEnd.add(Calendar.MONTH, 1);
}
Calendar tempStart = Calendar.getInstance();
tempStart.setTime(start);
Calendar tempEnd = Calendar.getInstance();
tempEnd.setTime(end);
while (tempStart.before(tempEnd)) {
days.add(dateFormat.format(tempStart.getTime()));
if("ymd".equals(type)) {

@ -94,6 +94,15 @@ public class QcCheckTaskDetail extends BaseEntity {
private Integer sampleNum;
private List<String> actualValues;
private String typeProjectId;
private String defectCode;
public String getDefectCode() {
return defectCode;
}
public void setDefectCode(String defectCode) {
this.defectCode = defectCode;
}
public String getTypeProjectId() {
return typeProjectId;

@ -4,6 +4,7 @@ import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import com.op.system.api.domain.quality.ChartDTO;
import java.math.BigDecimal;
import java.util.List;
/**
@ -42,6 +43,69 @@ public class QcStaticTable extends BaseEntity {
private List<String> legendData;
private List<String> xAxis;
private List<ChartDTO> series;
private String materialCode;
private String materialName;
private String sampleQuality;
private BigDecimal aNoOkquality;
private BigDecimal bNoOkquality;
private BigDecimal cNoOkquality;
private BigDecimal defectRate;//不良率
public BigDecimal getDefectRate() {
return defectRate;
}
public void setDefectRate(BigDecimal defectRate) {
this.defectRate = defectRate;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getSampleQuality() {
return sampleQuality;
}
public void setSampleQuality(String sampleQuality) {
this.sampleQuality = sampleQuality;
}
public BigDecimal getaNoOkquality() {
return aNoOkquality;
}
public void setaNoOkquality(BigDecimal aNoOkquality) {
this.aNoOkquality = aNoOkquality;
}
public BigDecimal getbNoOkquality() {
return bNoOkquality;
}
public void setbNoOkquality(BigDecimal bNoOkquality) {
this.bNoOkquality = bNoOkquality;
}
public BigDecimal getcNoOkquality() {
return cNoOkquality;
}
public void setcNoOkquality(BigDecimal cNoOkquality) {
this.cNoOkquality = cNoOkquality;
}
public String getYmArrayStart() {
return ymArrayStart;

@ -3,6 +3,7 @@ package com.op.quality.mapper;
import java.util.List;
import com.op.quality.domain.QcCheckUnqualified;
import com.op.quality.domain.QcDefectType;
import org.apache.ibatis.annotations.Mapper;
/**
@ -60,4 +61,6 @@ public interface QcCheckUnqualifiedMapper {
* @return
*/
public int deleteQcCheckUnqualifiedByIds(String[] ids);
public List<QcDefectType> getDefectList(QcDefectType qcDefectType);
}

@ -30,4 +30,6 @@ public interface QcStaticTableMapper {
@MapKey("supplierCode")
public Map<String, QcStaticTable> selectNumMap(@Param("qc")QcStaticTable qcStaticTable,
@Param("codes")List<QcStaticTable> tabledtos);
List<QcStaticTable> getProduceChartData(QcStaticTable qcStaticTable);
}

@ -2,10 +2,7 @@ package com.op.quality.service;
import java.util.List;
import com.op.quality.domain.QcBomComponent;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcSupplier;
import com.op.quality.domain.*;
import com.op.system.api.domain.SysUser;
/**
@ -78,4 +75,6 @@ public interface IQcCheckTaskIncomeService {
int commitActualValue(QcCheckTaskDetail qcCheckTaskDetail);
int commitCheckResult(QcCheckTaskIncome qcCheckTaskIncome);
List<QcDefectType> getDefectList(QcDefectType qcDefectType);
}

@ -19,4 +19,5 @@ public interface IQcStaticTableService {
*/
public List<QcStaticTable> selectQcStaticTableList(QcStaticTable qcStaticTable);
public List<QcStaticTable> getProduceChartData(QcStaticTable qcStaticTable);
}

@ -279,4 +279,10 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
return n ;
}
@Override
@DS("#header.poolName")
public List<QcDefectType> getDefectList(QcDefectType qcDefectType) {
return qcCheckUnqualifiedMapper.getDefectList(qcDefectType);
}
}

@ -104,4 +104,22 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
return tabledtos;
}
/**
* = (A*1+B*0.65+C*0.35)/
* @param qcStaticTable
* @return
*/
@Override
@DS("#header.poolName")
public List<QcStaticTable> getProduceChartData(QcStaticTable qcStaticTable) {
List<QcStaticTable> dtos = qcStaticTableMapper.getProduceChartData(qcStaticTable);
for(QcStaticTable dto:dtos){
BigDecimal defectRate = (dto.getaNoOkquality().add(dto.getbNoOkquality()).multiply(new BigDecimal("0.65"))
.add(dto.getcNoOkquality()).multiply(new BigDecimal(0.35)))
.divide(new BigDecimal(dto.getSampleQuality()));
dto.setDefectRate(defectRate);
}
return dtos;
}
}

@ -166,6 +166,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="defectCode != null">defect_code = #{defectCode},</if>
</trim>
where record_id = #{recordId}
</update>

@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
qct.check_man_code, qct.check_man_name,qct.check_time, qct.check_result, qct.status,
qct.create_by,qct.create_time, qct.update_by, qct.update_time,
qct.check_type,qct.sample_quality,qct.noOk_quality,
qct.aNoOkquality,qct.bNoOkquality,qct.cNoOkquality
qct.aNoOkquality,qct.bNoOkquality,qct.cNoOkquality,
q.type_code
from qc_check_task qct
left join qc_check_type q on q.id = qct.check_type

@ -67,8 +67,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join qc_check_type qtn on qtn.id = qct.check_type
where qcu.id = #{id}
</select>
<select id="getDefectList" resultType="com.op.quality.domain.QcDefectType">
select defect_code defectCode,
defect_subclass defectSubclass
from qc_defect_type
where defect_type = #{defectType} and del_flag='0'
</select>
<insert id="insertQcCheckUnqualified" parameterType="QcCheckUnqualified">
<insert id="insertQcCheckUnqualified" parameterType="QcCheckUnqualified">
insert into qc_check_unqualified
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>

@ -56,5 +56,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
group by qct.supplier_code,qct.supplier_name
</select>
<select id="getProduceChartData" resultType="com.op.quality.domain.QcStaticTable">
select material_code materialCode,
material_name materialName,
sample_quality sampleQuality,
aNoOkquality,
bNoOkquality,
cNoOkquality
from qc_check_task
where del_flag = '0'
</select>
</mapper>

Loading…
Cancel
Save