质量看板接口

master
zhaoxiaolin 1 year ago
parent 551b3e8b7e
commit a4c58a143c

@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
*
@ -82,8 +83,47 @@ public class QcInterfaceController {
* @return
*/
@PostMapping("/getProduceStaticInfo")
public List<QcInterface> getProduceStaticInfo(@RequestBody QcInterface qcInterface) {
public Map<String,String> getProduceStaticInfo(@RequestBody QcInterface qcInterface) {
return qcInterfaceService.getProduceStaticInfo(qcInterface);
}
/**
* --
* @param qcInterface
* @return
*/
@PostMapping("/getProduceNoOkList")
public List<QcInterface> getProduceNoOkList(@RequestBody QcInterface qcInterface) {
return qcInterfaceService.getProduceNoOkList(qcInterface);
}
/**
* -
* @param qcInterface
* @return
*/
@PostMapping("/getProMonthNoOk")
public Map<String,List<String>> getProMonthNoOk(@RequestBody QcInterface qcInterface) {
return qcInterfaceService.getProMonthNoOk(qcInterface);
}
/**
* -
* @param qcInterface
* @return
*/
@PostMapping("/getLineDayNoOk")
public QcInterface getLineDayNoOk(@RequestBody QcInterface qcInterface) {
return qcInterfaceService.getLineDayNoOk(qcInterface);
}
/**
* -
* @param qcInterface
* @return
*/
@PostMapping("/getMonthOfYearContrast")
public List<QcInterface> getMonthOfYearContrast(@RequestBody QcInterface qcInterface) {
return qcInterfaceService.getMonthOfYearContrast(qcInterface);
}
}

@ -6,6 +6,8 @@ import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
/**
*
*
@ -14,7 +16,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
*/
public class QcInterface extends BaseEntity {
private static final long serialVersionUID = 1L;
private String ymdType;
private String ymdType;
private String ymdTypeName;
private String dictType;
private String factoryCode;
@ -33,6 +35,79 @@ public class QcInterface extends BaseEntity {
private String checkResult;
private String checkManName;
private String checkName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String checkTime;
private String sampleQuality;
private String noOkQuality;
private List<String> dayStr;
private List<QcInterface> series;
private String machineCode;
private String machineName;
private List<String> data;
public List<String> getData() {
return data;
}
public void setData(List<String> data) {
this.data = data;
}
public String getMachineCode() {
return machineCode;
}
public void setMachineCode(String machineCode) {
this.machineCode = machineCode;
}
public String getMachineName() {
return machineName;
}
public void setMachineName(String machineName) {
this.machineName = machineName;
}
public List<QcInterface> getSeries() {
return series;
}
public void setSeries(List<QcInterface> series) {
this.series = series;
}
public List<String> getDayStr() {
return dayStr;
}
public void setDayStr(List<String> dayStr) {
this.dayStr = dayStr;
}
public String getSampleQuality() {
return sampleQuality;
}
public void setSampleQuality(String sampleQuality) {
this.sampleQuality = sampleQuality;
}
public String getNoOkQuality() {
return noOkQuality;
}
public void setNoOkQuality(String noOkQuality) {
this.noOkQuality = noOkQuality;
}
public String getCheckTime() {
return checkTime;
}
public void setCheckTime(String checkTime) {
this.checkTime = checkTime;
}
public String getCheckNo() {
return checkNo;

@ -3,9 +3,12 @@ package com.op.quality.mapper;
import com.op.quality.domain.QcCheckProject;
import com.op.quality.domain.QcCheckType;
import com.op.quality.domain.QcInterface;
import com.op.quality.domain.QcProCheck;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* Mapper
@ -16,9 +19,9 @@ import java.util.List;
@Mapper
public interface QcInterfaceMapper {
List<QcInterface> getDictData(QcInterface qcInterface);
List<QcInterface> getDictData(QcInterface qcInterface);
List<QcInterface> getOverallInfo(QcInterface qcInterface);
List<QcInterface> getOverallInfo(QcInterface qcInterface);
List<QcInterface> getCheckProjectsPie(QcInterface qcInterface);
@ -27,4 +30,16 @@ public interface QcInterfaceMapper {
List<QcInterface> getSupplierTaskList(QcInterface qcInterface);
List<QcInterface> getSupplierNoOkList(QcInterface qcInterface);
List<QcInterface> getProduceNoOkList(QcInterface qcInterface);
QcInterface getProduceHz(QcInterface qcInterface);
@MapKey("ymd")
Map<String, QcInterface> getYearNoOkHz(QcInterface qcInterface);
List<QcProCheck> getLineNames();
@MapKey("ymd")
Map<String, QcInterface> getDayNoOkHz(QcInterface qcInterface);
@MapKey("ymd")
Map<String, QcInterface> getMothNoOkNum(QcInterface qcInterface);
}

@ -5,6 +5,7 @@ import com.op.quality.domain.QcCheckType;
import com.op.quality.domain.QcInterface;
import java.util.List;
import java.util.Map;
/**
*
@ -13,11 +14,11 @@ import java.util.List;
*/
public interface IQcInterfaceService {
List<QcInterface> getDictData(QcInterface qcInterface);
List<QcInterface> getDictData(QcInterface qcInterface);
List<QcInterface> getOverallInfo(QcInterface qcInterface);
List<QcInterface> getOverallInfo(QcInterface qcInterface);
List<QcInterface> getCheckProjectsPie(QcInterface qcInterface);
List<QcInterface> getCheckProjectsPie(QcInterface qcInterface);
List<QcInterface> getSupplierBadTOP5(QcInterface qcInterface);
@ -25,5 +26,13 @@ public interface IQcInterfaceService {
List<QcInterface> getSupplierNoOkList(QcInterface qcInterface);
List<QcInterface> getProduceStaticInfo(QcInterface qcInterface);
Map<String,String> getProduceStaticInfo(QcInterface qcInterface);
List<QcInterface> getProduceNoOkList(QcInterface qcInterface);
Map<String, List<String>> getProMonthNoOk(QcInterface qcInterface);
QcInterface getLineDayNoOk(QcInterface qcInterface);
List<QcInterface> getMonthOfYearContrast(QcInterface qcInterface);
}

@ -2,20 +2,22 @@ package com.op.quality.service.impl;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.utils.DateUtils;
import com.op.quality.domain.QcCheckType;
import com.op.quality.domain.QcInterface;
import com.op.quality.domain.QcProCheck;
import com.op.quality.mapper.QcInterfaceMapper;
import com.op.quality.service.IQcInterfaceService;
import com.op.system.api.domain.SysDictData;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Calendar;
import java.util.List;
import java.util.*;
/**
* Service
@ -90,7 +92,7 @@ public class QcInterfaceServiceImpl implements IQcInterfaceService {
Integer.parseInt(ymdArray[1]),
Integer.parseInt(ymdArray[2]));
LocalDate date2 = LocalDate.now();
if(date1.compareTo(date2)<0){
if(date1.compareTo(date2)<0){
dto.setCheckStatus("逾期未检");
}else {
dto.setCheckStatus("0".equals(dto.getCheckStatus()) ? "待检测" : "检测完成");
@ -114,14 +116,223 @@ public class QcInterfaceServiceImpl implements IQcInterfaceService {
}
@Override
public List<QcInterface> getProduceStaticInfo(QcInterface qcInterface) {
public Map<String,String> getProduceStaticInfo(QcInterface qcInterface) {
DynamicDataSourceContextHolder.push(qcInterface.getFactoryCode());
String nowYMD = DateUtils.getDate();
qcInterface.setYmd(nowYMD);
List<QcInterface> dtos = qcInterfaceMapper.getSupplierNoOkList(qcInterface);
Map<String,String> dtoMap = new HashMap<>();
qcInterface.setYmdType("dd");
QcInterface hz = qcInterfaceMapper.getProduceHz(qcInterface);
if(hz != null){
dtoMap.put("todayPro",hz.getQuality());
dtoMap.put("todaySample",hz.getSampleQuality());
dtoMap.put("todayNoOk",hz.getNoOkQuality());
BigDecimal tOkRate = (new BigDecimal(hz.getSampleQuality())
.subtract(new BigDecimal(hz.getNoOkQuality()))
)
.multiply(new BigDecimal(100))
.divide(new BigDecimal(hz.getQuality()),2, RoundingMode.HALF_UP);
dtoMap.put("todayOkRate",tOkRate+"%");
}
qcInterface.setYmdType("mm");
QcInterface hz2 = qcInterfaceMapper.getProduceHz(qcInterface);
if(hz2 != null){
dtoMap.put("monthPro",hz2.getQuality());
dtoMap.put("monthNoOk",hz2.getNoOkQuality());
BigDecimal tOkRate2 = (new BigDecimal(hz2.getSampleQuality())
.subtract(new BigDecimal(hz2.getNoOkQuality()))
)
.multiply(new BigDecimal(100))
.divide(new BigDecimal(hz2.getQuality()),2, RoundingMode.HALF_UP);
dtoMap.put("monthOkRate",tOkRate2+"%");
}
return dtoMap;
}
@Override
public List<QcInterface> getProduceNoOkList(QcInterface qcInterface) {
DynamicDataSourceContextHolder.push(qcInterface.getFactoryCode());
String nowYMD = DateUtils.getDate();
qcInterface.setYmd(nowYMD);
List<QcInterface> dtos = qcInterfaceMapper.getProduceNoOkList(qcInterface);
return dtos;
}
@Override
public Map<String, List<String>> getProMonthNoOk(QcInterface qcInterface) {
DynamicDataSourceContextHolder.push(qcInterface.getFactoryCode());
Map<String, List<String>> dtoMap = new HashMap<>();
String nowYMD = DateUtils.getDate();
String[] nowYMDs = nowYMD.split("-");
int nowMonth = Integer.parseInt(nowYMDs[1]);
List<String> monthNames = new ArrayList<>();
qcInterface.setYmd(nowYMD);
qcInterface.setYmdType("yyyy");
Map<String,QcInterface> noOkHzs = qcInterfaceMapper.getYearNoOkHz(qcInterface);
List<String> monthData = new ArrayList<>();
for(int mh = 1;mh<=nowMonth;mh++){
String yyyymm = nowYMDs[1]+"-"+String.format("%02d",mh);
monthNames.add(yyyymm);
if(noOkHzs != null) {
monthData.add(noOkHzs.get(yyyymm).getNoOkQuality());
}else{
monthData.add("0");
}
}
dtoMap.put("month",monthNames);
dtoMap.put("monthData",monthData);
return dtoMap;
}
@Override
public QcInterface getLineDayNoOk(QcInterface qcInterface) {
DynamicDataSourceContextHolder.push(qcInterface.getFactoryCode());
QcInterface dto = new QcInterface();
Calendar calendar = Calendar.getInstance();
Date now = calendar.getTime();
calendar.set(Calendar.DAY_OF_MONTH, 1);
Date firstDayOfMonth = calendar.getTime();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String startTime = dateFormat.format(firstDayOfMonth);
String endTime = dateFormat.format(now);
//日期名称数组
List<String> xAxisDatas = getDays(startTime,endTime);
dto.setDayStr(xAxisDatas);//
//通过报工获取到真实参与生产的线体
List<QcProCheck> lines = qcInterfaceMapper.getLineNames();
if(CollectionUtils.isEmpty(lines)){
return null;
}
String nowYMD = DateUtils.getDate();
qcInterface.setYmd(nowYMD);
qcInterface.setYmdType("yyyy");
Map<String,QcInterface> noOkHzs = qcInterfaceMapper.getDayNoOkHz(qcInterface);
if(noOkHzs==null){
return null;
}
List<QcInterface> series = new ArrayList<>();
QcInterface serie = null;
for(QcProCheck line:lines){
serie = new QcInterface();
List<String> data = new ArrayList<>();
serie.setMachineName(line.getMachineName());
for(String dayStr:xAxisDatas){
QcInterface dayInfo = noOkHzs.get(line.getMachineCode()+dayStr);
if(dayInfo!=null){
data.add(dayInfo.getNoOkQuality());
}else{
data.add("0");
}
}
serie.setData(data);
series.add(serie);
}
dto.setSeries(series);//
return dto;
}
@Override
public List<QcInterface> getMonthOfYearContrast(QcInterface qcInterface) {
DynamicDataSourceContextHolder.push(qcInterface.getFactoryCode());
List<QcInterface> dtos = new ArrayList<>();
QcInterface nowYM = new QcInterface();
QcInterface lastYM = new QcInterface();
String nowYMD = DateUtils.getDate();
String[] nowYMDs = nowYMD.split("-");
int nowYear = Integer.parseInt(nowYMDs[0]);
int lastYear = nowYear-1;
List<String> daystr1 = new ArrayList<>();
List<String> daystr0 = new ArrayList<>();
for(int m=1;m<=12;m++){
daystr0.add(lastYear+"-"+String.format("%02d",m));
daystr1.add(nowYear+"-"+String.format("%02d",m));
}
lastYM.setDayStr(daystr0);
nowYM.setDayStr(daystr1);
qcInterface.setYmd("'"+nowYear+"','"+lastYear+"'");
Map<String,QcInterface> noOkNum = qcInterfaceMapper.getMothNoOkNum(qcInterface);
if(noOkNum==null){
return null;
}
List<String> data0 = new ArrayList<>();//不合规数量
List<String> dataStr0 = new ArrayList<>();//不合格率
for(String day0:daystr0){
QcInterface last = noOkNum.get(day0);
if(last != null){
data0.add(last.getNoOkQuality());
BigDecimal norate0 = new BigDecimal(last.getNoOkQuality()).multiply(new BigDecimal(100))
.divide(new BigDecimal(last.getQuality()),2,RoundingMode.HALF_UP);
dataStr0.add(norate0.toString());
}else{
data0.add("0");
dataStr0.add("0.00");
}
}
List<String> data1 = new ArrayList<>();//不合规数量
List<String> dataStr1 = new ArrayList<>();//不合格率
for(String day1:daystr1){
QcInterface now = noOkNum.get(day1);
if(now != null){
data1.add(now.getNoOkQuality());
BigDecimal norate0 = new BigDecimal(now.getNoOkQuality()).multiply(new BigDecimal(100))
.divide(new BigDecimal(now.getQuality()),2,RoundingMode.HALF_UP);
dataStr1.add(norate0.toString());
}else{
data1.add("0");
dataStr1.add("0.00");
}
}
lastYM.setData(data0);
lastYM.setDayStr(dataStr0);
nowYM.setData(data1);
nowYM.setDayStr(dataStr1);
dtos.add(lastYM);
dtos.add(nowYM);
return dtos;
}
/**两个日期之间的所有日期**/
public static List<String> getDays(String startTime,String endTime) {
// 返回的日期集合
List<String> days = new ArrayList<String>();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
Date start = dateFormat.parse(startTime);
Date end = dateFormat.parse(endTime);
Calendar tempStart = Calendar.getInstance();
tempStart.setTime(start);
Calendar tempEnd = Calendar.getInstance();
tempEnd.setTime(end);
tempEnd.add(Calendar.DATE, +1);// 日期加1(包含结束)
while (tempStart.before(tempEnd)) {
days.add(dateFormat.format(tempStart.getTime()));
tempStart.add(Calendar.DAY_OF_YEAR, 1);
}
} catch (ParseException e) {
e.printStackTrace();
}
return days;
}
}

@ -1,7 +1,7 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.quality.mapper.QcInterfaceMapper">
@ -15,34 +15,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(0) quality,'all' ymdTypeName
from wms_raw_order_in
where active_flag = '1'
<if test='ymdType=="yyyy"'>
and CONVERT(varchar(4),receipt_time, 120) = SUBSTRING(#{ymd},0,5)
</if>
<if test='ymdType=="mm"'>
and CONVERT(varchar(7),receipt_time, 120) =SUBSTRING(#{ymd},0,8)
</if>
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),receipt_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
<if test='ymdType=="yyyy"'>
and CONVERT(varchar(4),receipt_time, 120) = SUBSTRING(#{ymd},0,5)
</if>
<if test='ymdType=="mm"'>
and CONVERT(varchar(7),receipt_time, 120) =SUBSTRING(#{ymd},0,8)
</if>
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),receipt_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
union ALL
select count(0),'unOk'
from qc_check_unqualified qcu
left join qc_check_type qct on qcu.type = qct.order_code
where qct.type_code = #{typeCode} and qcu.del_flag = '0'
<if test='ymdType=="yyyy"'>
and CONVERT(varchar(4),qcu.create_time, 120) = SUBSTRING(#{ymd},0,5)
</if>
<if test='ymdType=="mm"'>
and CONVERT(varchar(7),qcu.create_time, 120) = SUBSTRING(#{ymd},0,8)
</if>
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),qcu.create_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
<if test='ymdType=="yyyy"'>
and CONVERT(varchar(4),qcu.create_time, 120) = SUBSTRING(#{ymd},0,5)
</if>
<if test='ymdType=="mm"'>
and CONVERT(varchar(7),qcu.create_time, 120) = SUBSTRING(#{ymd},0,8)
</if>
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),qcu.create_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
</select>
<select id="getCheckProjectsPie" resultType="com.op.quality.domain.QcInterface">
select count(0) quality,
qctd.project_no,
qctd.rule_name projectName
qctd.project_no,
qctd.rule_name projectName
from qc_check_task_detail qctd
left join qc_check_task qct on qctd.belong_to = qct.record_id
where qct.check_result = 'N' and qct.type_code = #{typeCode}
@ -57,61 +57,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
group by qctd.project_no,qctd.rule_name
</select>
<select id="getSupplierBadTOP5" resultType="com.op.quality.domain.QcInterface">
<select id="getSupplierBadTOP5" resultType="com.op.quality.domain.QcInterface">
select top 5 * from(
select
concat(t1.supplier_name,'-',t1.material_name) supplierName,
ROUND(t2.noOkNum*100.00/t1.allNum, 2) quality
from (
select count(0) allNum,
qct.supplier_code,qct.supplier_name,qct.material_code,qct.material_name
from qc_check_task qct
where qct.type_code = #{typeCode}
<if test='ymdType=="yyyy"'>
and CONVERT(varchar(4),qct.income_time, 120) = SUBSTRING(#{ymd},0,5)
</if>
<if test='ymdType=="mm"'>
and CONVERT(varchar(7),qct.income_time, 120) = SUBSTRING(#{ymd},0,8)
</if>
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),qct.income_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
group by
qct.supplier_code,qct.supplier_name,qct.material_code,qct.material_name
) t1
left join (
select
count(0) noOkNum,qct.supplier_code,qct.supplier_name,qct.material_code,qct.material_name
from qc_check_task qct
where qct.type_code = #{typeCode} and qct.check_result = 'N'
<if test='ymdType=="yyyy"'>
and CONVERT(varchar(4),qct.income_time, 120) = SUBSTRING(#{ymd},0,5)
</if>
<if test='ymdType=="mm"'>
and CONVERT(varchar(7),qct.income_time, 120) = SUBSTRING(#{ymd},0,8)
</if>
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),qct.income_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
group by
qct.supplier_code,qct.supplier_name,qct.material_code,qct.material_name
) t2 on t1.supplier_code = t2.supplier_code and t1.material_code = t2.material_code
select
concat(t1.supplier_name,'-',t1.material_name) supplierName,
ROUND(t2.noOkNum*100.00/t1.allNum, 2) quality
from (
select count(0) allNum,
qct.supplier_code,qct.supplier_name,qct.material_code,qct.material_name
from qc_check_task qct
where qct.type_code = #{typeCode}
<if test='ymdType=="yyyy"'>
and CONVERT(varchar(4),qct.income_time, 120) = SUBSTRING(#{ymd},0,5)
</if>
<if test='ymdType=="mm"'>
and CONVERT(varchar(7),qct.income_time, 120) = SUBSTRING(#{ymd},0,8)
</if>
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),qct.income_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
group by
qct.supplier_code,qct.supplier_name,qct.material_code,qct.material_name
) t1
left join (
select
count(0) noOkNum,qct.supplier_code,qct.supplier_name,qct.material_code,qct.material_name
from qc_check_task qct
where qct.type_code = #{typeCode} and qct.check_result = 'N'
<if test='ymdType=="yyyy"'>
and CONVERT(varchar(4),qct.income_time, 120) = SUBSTRING(#{ymd},0,5)
</if>
<if test='ymdType=="mm"'>
and CONVERT(varchar(7),qct.income_time, 120) = SUBSTRING(#{ymd},0,8)
</if>
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),qct.income_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
group by
qct.supplier_code,qct.supplier_name,qct.material_code,qct.material_name
) t2 on t1.supplier_code = t2.supplier_code and t1.material_code = t2.material_code
) t order by t.quality desc
</select>
<select id="getSupplierTaskList" resultType="com.op.quality.domain.QcInterface">
select
qct.check_no checkNo,
qct.income_batch_no incomeBatchNo,
qct.order_no orderNo,
qct.material_name materialName,
qct.quality,
qct.unit,
qct.supplier_name supplierName,
qct.income_time incomeTime,
qct.check_status checkStatus,
qct.check_result checkResult,
qct.check_man_name checkManName,
qc.check_name checkName
qct.check_no checkNo,
qct.income_batch_no incomeBatchNo,
qct.order_no orderNo,
qct.material_name materialName,
qct.quality,
qct.unit,
qct.supplier_name supplierName,
qct.income_time incomeTime,
qct.check_status checkStatus,
qct.check_result checkResult,
qct.check_man_name checkManName,
qc.check_name checkName
from qc_check_task qct
left join qc_check_type qc on qct.check_type = qc.order_code
where qct.del_flag = '0' and qct.status = '1'
@ -125,21 +125,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),qct.income_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
order by qct.income_time desc,qct.check_status asc
order by qct.income_time desc,qct.check_status asc
</select>
<select id="getSupplierNoOkList" resultType="com.op.quality.domain.QcInterface">
select
qct.check_no checkNo,
qct.income_batch_no incomeBatchNo,
qct.order_no orderNo,
qct.material_name materialName,
qct.quality,
qct.unit,
qct.supplier_name supplierName,
qct.income_time incomeTime,
qct.check_result checkResult,
qct.check_man_name checkManName,
qc.check_name checkName
qct.check_no checkNo,
qct.income_batch_no incomeBatchNo,
qct.order_no orderNo,
qct.material_name materialName,
qct.quality,
qct.unit,
qct.supplier_name supplierName,
qct.income_time incomeTime,
qct.check_result checkResult,
qct.check_man_name checkManName,
qc.check_name checkName
from qc_check_task qct
left join qc_check_type qc on qct.check_type = qc.order_code
where qct.type_code = #{typeCode} and qct.check_result = 'N'
@ -154,4 +154,84 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
order by qct.income_time desc
</select>
<select id="getProduceNoOkList" resultType="com.op.quality.domain.QcInterface">
select qctd.rule_name projectName,
qct.check_man_name checkManName,
qctd.update_time checkTime
from qc_check_task_detail qctd
left join qc_check_task qct on qctd.belong_to = qct.record_id
where qct.type_code = #{typeCode} and qctd.status = 'N'
and CONVERT(varchar(10),qct.income_time, 120) = SUBSTRING(#{ymd},0,11)
order by qctd.update_time desc
</select>
<select id="getProduceHz" resultType="com.op.quality.domain.QcInterface">
select sum(qct.quality) quality,
sum(sample_quality) sampleQuality,
sum(noOk_quality) noOkQuality
from qc_check_task qct
where qct.type_code = #{typeCode}
and qct.del_flag='0'
<if test='ymdType=="mm"'>
and CONVERT(varchar(7),qct.income_time, 120) = SUBSTRING(#{ymd},0,8)
</if>
<if test='ymdType=="dd"'>
and CONVERT(varchar(10),qct.income_time, 120) = SUBSTRING(#{ymd},0,11)
</if>
</select>
<select id="getYearNoOkHz" resultType="com.op.quality.domain.QcInterface">
select
t.ymd,
sum(t.noOk_quality) noOkQuality
from(
select CONVERT(varchar(7),qct.income_time, 120) ymd,
qct.noOk_quality
from qc_check_task qct
where qct.type_code = #{typeCode}
and qct.del_flag='0'
and CONVERT(varchar(4),qct.income_time, 120) = SUBSTRING(#{ymd},0,5)
) t
group by t.ymd
</select>
<select id="getLineNames" resultType="com.op.quality.domain.QcProCheck">
select DISTINCT machine_code machineCode,
machine_name machineName
from mes_report_work
where del_flag = '0'
and CONVERT(varchar(7),feedback_time, 120) = SUBSTRING(#{ymd},0,8)
</select>
<select id="getDayNoOkHz" resultType="com.op.quality.domain.QcInterface">
SELECT
concat(t.machine_code,t.ymd) ymd,
sum(t.noOk_quality) noOkQuality,
t.machine_code machineCode
from(
select CONVERT(varchar(10),qct.income_time, 120) ymd,
qct.noOk_quality,
mrw.machine_code
from qc_check_task qct
left join pro_order_workorder pow on qct.order_no = pow.workorder_code_sap
left join mes_report_work mrw on pow.workorder_code = mrw.workorder_code
where qct.type_code = #{typeCode}
and qct.del_flag='0'
and CONVERT(varchar(7),qct.income_time, 120) = SUBSTRING(#{ymd},0,8)
) t
group by t.machine_code,t.ymd
</select>
<select id="getMothNoOkNum" resultType="com.op.quality.domain.QcInterface">
select
t.ymd,
sum(t.quality) quality,
sum(t.noOk_quality) noOkQuality
from(
select CONVERT(varchar(7),qct.income_time, 120) ymd,
qct.quality,
qct.noOk_quality
from qc_check_task qct
where qct.type_code = #{typeCode}
and qct.del_flag='0'
and CONVERT(varchar(4),qct.income_time, 120) in (${ymd})
) t
group by t.ymd
</select>
</mapper>

Loading…
Cancel
Save