2026-04-24 08:52:54 +08:00
|
|
|
<?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">
|
|
|
|
|
<mapper namespace="com.nflg.wms.repository.mapper.QmsPdiInspectionResultsMapper">
|
|
|
|
|
|
|
|
|
|
<!-- 分页查询:以任务单为主体,关联规则表取机型、版本等 -->
|
|
|
|
|
<select id="search" resultType="com.nflg.wms.common.pojo.vo.QmsPdiInspectionResultsPageVO">
|
|
|
|
|
SELECT DISTINCT
|
|
|
|
|
t.id AS taskId,
|
|
|
|
|
r.machine_no AS machineNo,
|
|
|
|
|
t.order_no AS orderNo,
|
|
|
|
|
t.device_no AS deviceNo,
|
|
|
|
|
t.task_no AS taskNo,
|
|
|
|
|
r.inspection_version AS inspectionVersion,
|
|
|
|
|
t.submission_time AS submissionTime,
|
2026-05-08 08:17:46 +08:00
|
|
|
t.required_completion_time AS requiredCompletionTime,
|
|
|
|
|
t.inspection_enable AS inspectionEnable
|
2026-04-24 08:52:54 +08:00
|
|
|
FROM qms_pdi_task_record t
|
|
|
|
|
LEFT JOIN qms_pdi_detection_rules r ON r.id = t.detection_rules_id
|
|
|
|
|
<where>
|
|
|
|
|
<!-- 权限过滤:只能看自己是帮办人或质检负责人的任务单 -->
|
|
|
|
|
<if test="request.userId != null">
|
|
|
|
|
AND (t.assistant_id = #{request.userId} OR r.inspector_id = #{request.userId})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.machineNo != null and request.machineNo != ''">
|
|
|
|
|
AND r.machine_no = #{request.machineNo}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.orderNo != null and request.orderNo != ''">
|
|
|
|
|
AND t.order_no = #{request.orderNo}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.deviceNo != null and request.deviceNo != ''">
|
|
|
|
|
AND t.device_no = #{request.deviceNo}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.taskNo != null and request.taskNo != ''">
|
|
|
|
|
AND t.task_no = #{request.taskNo}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
ORDER BY t.id DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
2026-04-29 11:17:13 +08:00
|
|
|
<!-- 平板:检查任务列表分页查询(仅 taskStatus 筛选) -->
|
|
|
|
|
<select id="searchTaskList" resultType="com.nflg.wms.common.pojo.vo.QmsPdiInspectionResultsPageVO">
|
|
|
|
|
SELECT DISTINCT
|
|
|
|
|
t.id AS taskId,
|
|
|
|
|
r.machine_no AS machineNo,
|
|
|
|
|
t.order_no AS orderNo,
|
|
|
|
|
t.device_no AS deviceNo,
|
|
|
|
|
t.task_no AS taskNo,
|
|
|
|
|
r.inspection_version AS inspectionVersion,
|
|
|
|
|
t.submission_time AS submissionTime,
|
2026-05-07 16:55:17 +08:00
|
|
|
t.required_completion_time AS requiredCompletionTime,
|
|
|
|
|
t.inspection_enable AS inspectionEnable
|
2026-04-29 11:17:13 +08:00
|
|
|
FROM qms_pdi_task_record t
|
|
|
|
|
LEFT JOIN qms_pdi_detection_rules r ON r.id = t.detection_rules_id
|
|
|
|
|
<where>
|
|
|
|
|
<if test="request.userId != null">
|
|
|
|
|
AND (t.assistant_id = #{request.userId} OR r.inspector_id = #{request.userId})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.taskStatus != null and request.taskStatus != 3">
|
|
|
|
|
AND t.inspection_enable = #{request.taskStatus}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="request.taskStatus != null and request.taskStatus == 3">
|
|
|
|
|
AND t.overdue = true
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
ORDER BY t.id DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 平板:统计各状态数量(不受筛选条件影响,只受权限过滤) -->
|
|
|
|
|
<select id="countByStatus" resultType="map">
|
|
|
|
|
SELECT
|
|
|
|
|
COUNT(CASE WHEN t.inspection_enable = 0 THEN 1 END) AS "pendingCount",
|
|
|
|
|
COUNT(CASE WHEN t.inspection_enable = 1 THEN 1 END) AS "inProgressCount",
|
|
|
|
|
COUNT(CASE WHEN t.overdue = true THEN 1 END) AS "overdueCount",
|
2026-05-08 09:27:02 +08:00
|
|
|
COUNT(CASE WHEN t.inspection_enable = 2 THEN 1 END) AS "completedCount",
|
|
|
|
|
COUNT(CASE WHEN t.inspection_enable = 3 THEN 1 END) AS "pendingTransferCount"
|
2026-04-29 11:17:13 +08:00
|
|
|
FROM qms_pdi_task_record t
|
|
|
|
|
LEFT JOIN qms_pdi_detection_rules r ON r.id = t.detection_rules_id
|
|
|
|
|
<where>
|
|
|
|
|
<if test="userId != null">
|
|
|
|
|
AND (t.assistant_id = #{userId} OR r.inspector_id = #{userId})
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
2026-04-24 08:52:54 +08:00
|
|
|
</mapper>
|