Merge remote-tracking branch 'origin/master'

master
陈恒杰 1 year ago
commit a0afd6a4fa

@ -0,0 +1,44 @@
package com.op.quality.controller;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.page.TableDataInfo;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.quality.domain.QcProCheck;
import com.op.quality.service.QcProCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@RestController
@RequestMapping("/qcProCheck")
public class QcProCheckController extends BaseController {
@Autowired
private QcProCheckService qcProCheckService;
@GetMapping("/list")
public List<QcProCheck> list(QcProCheck qcProCheck) {
List<QcProCheck> qcProChecks = qcProCheckService.selectQcCheckList(qcProCheck);
return qcProCheckService.selectQcCheckList(qcProCheck);
}
@Log(title = "白坯合格统计", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcProCheck qcProCheck) {
List<QcProCheck> list = qcProCheckService.selectQcCheckList(qcProCheck);
ExcelUtil<QcProCheck> util = new ExcelUtil<QcProCheck>(QcProCheck.class);
util.exportExcel(response, list, "白坯合格统计数据");
}
}

@ -16,59 +16,43 @@ import java.util.List;
public class QcProCheck extends BaseEntity {
private static final long serialVersionUID = 1L;
@Excel(name = "id")
private String id;
@Excel(name = "rfid")
private String rfid;
@Excel(name = "工厂id")
private String factoryId;
@Excel(name = "工厂编码")
private String factoryCode;
@Excel(name = "工单id")
private String workorderId;
@Excel(name = "工单编码")
private String workorderCode;
private String workorderName;
@Excel(name = "订单id")
private String orderId;
@Excel(name = "订单编码")
private String orderCode;
private String workBatchCode;
@Excel(name = "机台id")
private String machineId;
@Excel(name = "机台编码")
@Excel(name = "烘房编码")
private String machineCode;
@Excel(name = "烘房名称")
private String machineName;
@Excel(name = "不良描述")
private String badMeg;
@Excel(name = "产品id")
private String productId;
private String productCode;
private String productName;
private String productSpc;
@Excel(name = "是否合格")
private String isqua;
@Excel(name = "附件")
private List<BaseFile> fileList;
private String fileId;
@Excel(name = "创建者")
private String createBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@Excel(name = "更新者")
private String updateBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private String attr1;
@ -82,6 +66,70 @@ public class QcProCheck extends BaseEntity {
private String itemCode;
private String itemName;
// 创建日期范围list
private List<Date> createTimeArray;
// 创建日期开始
private String createTimeStart;
// 创建日期结束
private String createTimeEnd;
@Excel(name = "合格数")
private String acceptanceNumber;
@Excel(name = "不合格数")
private String unqualifiedNumber;
@Excel(name = "合格率")
private String passRate;
public String getAcceptanceNumber() {
return acceptanceNumber;
}
public void setAcceptanceNumber(String acceptanceNumber) {
this.acceptanceNumber = acceptanceNumber;
}
public String getUnqualifiedNumber() {
return unqualifiedNumber;
}
public void setUnqualifiedNumber(String unqualifiedNumber) {
this.unqualifiedNumber = unqualifiedNumber;
}
public String getPassRate() {
return passRate;
}
public void setPassRate(String passRate) {
this.passRate = passRate;
}
public List<Date> getCreateTimeArray() {
return createTimeArray;
}
public void setCreateTimeArray(List<Date> createTimeArray) {
this.createTimeArray = createTimeArray;
}
public String getCreateTimeStart() {
return createTimeStart;
}
public void setCreateTimeStart(String createTimeStart) {
this.createTimeStart = createTimeStart;
}
public String getCreateTimeEnd() {
return createTimeEnd;
}
public void setCreateTimeEnd(String createTimeEnd) {
this.createTimeEnd = createTimeEnd;
}
public String getItemCode() {
return itemCode;

@ -37,4 +37,6 @@ public interface QcProCheckMapper {
List<QcProCheck> getDictList(QcProCheck qcProCheck);
List<QcCheckTaskIncome> getCheckTaskList(QcCheckTaskIncome qcCheckTaskIncome);
List<QcProCheck> getQcProCheckList(QcProCheck qcProCheck);
}

@ -37,4 +37,6 @@ public interface QcProCheckService {
List<QcCheckTaskDetail > getCheckTaskDetailList(QcCheckTaskDetail qcCheckTaskDetail);
List<SysDictData> getQcUnitList(SysDictData sysDictData);
List<QcProCheck> selectQcCheckList(QcProCheck qcProCheck);
}

@ -19,10 +19,8 @@ import com.op.system.api.domain.SysDictData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @ClassName : quaServiceImpl
@ -136,4 +134,15 @@ public class QcProCheckServiceImpl implements QcProCheckService {
return qcCheckTaskIncomeMapper.getQcUnitList(sysDictData);
}
@DS("#header.poolName")
@Override
public List<QcProCheck> selectQcCheckList(QcProCheck qcProCheck) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (qcProCheck.getCreateTimeArray() != null) {
qcProCheck.setCreateTimeStart(formatter.format(qcProCheck.getCreateTimeArray().get(0)));
qcProCheck.setCreateTimeEnd(formatter.format(qcProCheck.getCreateTimeArray().get(1)));
}
return qcProCheckMapper.getQcProCheckList(qcProCheck);
}
}

@ -265,4 +265,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by qct.create_time desc
</select>
<select id="getQcProCheckList" resultType="com.op.quality.domain.QcProCheck">
SELECT q1.machine_code AS machineCode,
MIN(q1.machine_name) AS machineName,
SUM(q2.quality) AS 'acceptanceNumber',
SUM(q3.quality) AS 'unqualifiedNumber',
SUM(q2.quality) * 100 / (SUM(q2.quality) + SUM(q3.quality)) AS 'passRate'
FROM qc_pro_check q1
LEFT JOIN
qc_pro_check q2 ON q1.machine_code = q2.machine_code AND q2.isqua = '1'
LEFT JOIN
qc_pro_check q3 ON q1.machine_code = q3.machine_code AND q3.isqua = '0'
<where>
<if test="workorderCode != null and workorderCode != ''">and q1.workorder_code like concat('%', #{workorderCode}, '%')</if>
<if test="productCode != null and productCode != ''">and q1.product_code like concat('%', #{productCode}, '%')</if>
<if test="machineCode != null and machineCode != ''">and q1.machine_code like concat('%', #{machineCode}, '%')</if>
<if test="createTimeStart != null ">and CONVERT(datetime,q1.create_time) >= #{createTimeStart}</if>
<if test="createTimeEnd != null ">and #{createTimeEnd} >= CONVERT(datetime,q1.create_time)</if>
and q1.machine_name LIKE '%烘房%'
</where>
GROUP BY q1.machine_code
</select>
</mapper>

Loading…
Cancel
Save