You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
197 lines
8.7 KiB
197 lines
8.7 KiB
<?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.xujie.modules.inspection.mapper.InspectionRequestHeaderMapper">
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
<resultMap id="BaseResultMap" type="com.xujie.modules.inspection.entity.InspectionRequestHeader">
|
|
<id column="site" property="site" />
|
|
<id column="request_no" property="requestNo" />
|
|
<result column="request_date" property="requestDate" />
|
|
<result column="need_inspect_date" property="needInspectDate" />
|
|
<result column="supplier_no" property="supplierNo" />
|
|
<result column="create_by" property="createBy" />
|
|
<result column="create_date" property="createDate" />
|
|
<result column="inspect_address" property="inspectAddress" />
|
|
<result column="inspect_contract" property="inspectContract" />
|
|
<result column="remark" property="remark" />
|
|
<result column="status" property="status" />
|
|
<result column="status_db" property="statusDb" />
|
|
<result column="qc_operator" property="qcOperator" />
|
|
<result column="inspect_date" property="inspectDate" />
|
|
<result column="plan_start_date" property="planStartDate" />
|
|
<result column="plan_end_date" property="planEndDate" />
|
|
<result column="scheduled_date" property="scheduledDate" />
|
|
<result column="scheduled_by" property="scheduledBy" />
|
|
<result column="schedule_remark" property="scheduleRemark" />
|
|
<result column="supplier_name" property="supplierName" />
|
|
</resultMap>
|
|
|
|
<!-- 通用查询结果列 -->
|
|
<sql id="BaseColumnList">
|
|
h.site, h.request_no, h.request_date, h.need_inspect_date, h.supplier_no, h.create_by, h.create_date, h.inspect_address, h.inspect_contract, h.remark, h.status, h.status_db, h.qc_operator, h.inspect_date, h.plan_start_date, h.plan_end_date, h.scheduled_date, h.scheduled_by, h.schedule_remark, s.supplier_name
|
|
</sql>
|
|
|
|
<select id="myPage" resultType="com.xujie.modules.inspection.entity.InspectionRequestHeader">
|
|
select
|
|
<include refid="BaseColumnList"/>
|
|
from srm_inspection_request_header h
|
|
left join srm_supplier s on h.supplier_no = s.supplier_no and h.site = s.site
|
|
<where>
|
|
<if test="query.site != null and query.site != '' "> and h.site = #{query.site}</if>
|
|
<if test="query.requestNo != null and query.requestNo != '' "> and h.request_no like '%${query.requestNo}%'</if>
|
|
<if test="query.supplierNo != null and query.supplierNo != '' "> and h.supplier_no like '%${query.supplierNo}%'</if>
|
|
<if test="query.supplierName != null and query.supplierName != '' "> and s.supplier_name like '%${query.supplierName}%'</if>
|
|
<if test="query.status != null and query.status != '' "> and h.status_db = #{query.status}</if>
|
|
<if test="query.qcOperator != null and query.qcOperator != '' "> and h.qc_operator like '%${query.qcOperator}%'</if>
|
|
<if test="query.createBy != null and query.createBy != '' "> and h.create_by like '%${query.createBy}%'</if>
|
|
<if test="query.requestDateStart != null and query.requestDateStart != '' "> and h.request_date >= #{query.requestDateStart}</if>
|
|
<if test="query.requestDateEnd != null and query.requestDateEnd != '' "> and h.request_date <= #{query.requestDateEnd}</if>
|
|
<if test="query.needInspectDateStart != null and query.needInspectDateStart != '' "> and h.need_inspect_date >= #{query.needInspectDateStart}</if>
|
|
<if test="query.needInspectDateEnd != null and query.needInspectDateEnd != '' "> and h.need_inspect_date <= #{query.needInspectDateEnd}</if>
|
|
<if test="query.planStartDateStr != null and query.planStartDateStr != '' "> and h.plan_start_date >= #{query.planStartDateStr}</if>
|
|
<if test="query.planEndDateStr != null and query.planEndDateStr != '' "> and h.plan_end_date <= #{query.planEndDateStr}</if>
|
|
</where>
|
|
order by h.request_date desc
|
|
</select>
|
|
<select id="queryPoPage" resultType="com.xujie.modules.inspection.data.InspectionRequestItemVO">
|
|
SELECT
|
|
pod.site,
|
|
pod.order_no,
|
|
pod.item_no,
|
|
pod.part_no,
|
|
pod.order_ref1,
|
|
pod.order_ref2,
|
|
pod.qty,
|
|
pod.to_inspect_qty,
|
|
p.part_desc AS partDesc,
|
|
ISNULL(pod.to_inspect_qty,0)
|
|
AS toInspectQty,
|
|
(
|
|
pod.qty - ISNULL(pod.to_inspect_qty,0)
|
|
)
|
|
AS waitInspectQty,
|
|
ISNULL(pod.c_crd,pod.want_receive_date)
|
|
AS crd,
|
|
poh.ship_via AS shipMethod,
|
|
poh.supplier_no,
|
|
ss.supplier_name
|
|
FROM PODetail pod
|
|
INNER JOIN POHeader poh
|
|
ON poh.order_no = pod.order_no
|
|
AND poh.site = pod.site
|
|
LEFT JOIN srm_supplier ss
|
|
ON ss.site = pod.site
|
|
AND ss.supplier_no = poh.supplier_no
|
|
LEFT JOIN part p
|
|
ON pod.part_no = p.part_no
|
|
WHERE pod.site = #{query.site}
|
|
AND poh.status NOT IN ('Closed','Cancelled')
|
|
AND (
|
|
pod.qty - ISNULL(pod.to_inspect_qty,0)
|
|
) > 0
|
|
<if test="query.supplierNo != null and query.supplierNo != ''">
|
|
AND poh.supplier_no = #{query.supplierNo}
|
|
</if>
|
|
<if test="query.orderNo != null and query.orderNo != ''">
|
|
AND pod.order_no like concat('%',#{query.orderNo},'%')
|
|
</if>
|
|
<if test="query.partNo != null and query.partNo != ''">
|
|
AND pod.part_no like concat('%',#{query.partNo},'%')
|
|
</if>
|
|
ORDER BY pod.id DESC
|
|
</select>
|
|
|
|
<update id="cancel">
|
|
UPDATE srm_inspection_request_header
|
|
SET status = '已取消',
|
|
status_db = 'Cancelled'
|
|
WHERE site = #{site}
|
|
AND request_no = #{requestNo}
|
|
|
|
</update>
|
|
|
|
<select id="selectByRequestNo" resultType="com.xujie.modules.inspection.entity.InspectionRequestHeader">
|
|
SELECT <include refid="BaseColumnList"/>
|
|
FROM srm_inspection_request_header h
|
|
LEFT JOIN srm_supplier s ON h.supplier_no = s.supplier_no AND h.site = s.site
|
|
WHERE h.site = #{site}
|
|
AND h.request_no = #{requestNo}
|
|
</select>
|
|
<select id="getQcPersonList" resultType="com.xujie.modules.inspection.entity.QcPersonList">
|
|
SELECT username, user_display
|
|
FROM sys_user
|
|
<where>
|
|
<if test="qc.userName != null and qc.userName != ''">
|
|
AND username LIKE CONCAT('%', #{qc.userName}, '%')
|
|
</if>
|
|
<if test="qc.userDisplay != null and qc.userDisplay != ''">
|
|
AND user_display LIKE CONCAT('%', #{qc.userDisplay}, '%')
|
|
</if>
|
|
</where>
|
|
ORDER BY username
|
|
</select>
|
|
|
|
<delete id="deleteByRequestNo">
|
|
DELETE FROM srm_inspection_request_header
|
|
WHERE site = #{site}
|
|
AND request_no = #{requestNo}
|
|
</delete>
|
|
|
|
<update id="confirm">
|
|
UPDATE srm_inspection_request_header
|
|
SET status = '已确认',
|
|
status_db = 'Confirmed'
|
|
WHERE site = #{site}
|
|
AND request_no = #{requestNo}
|
|
</update>
|
|
|
|
<update id="audit">
|
|
UPDATE srm_inspection_request_header
|
|
SET status = '已审核',
|
|
status_db = 'Audited'
|
|
WHERE site = #{site}
|
|
AND request_no = #{requestNo}
|
|
</update>
|
|
|
|
<update id="batchSchedule">
|
|
UPDATE srm_inspection_request_header
|
|
SET
|
|
qc_operator = #{qcOperator},
|
|
plan_start_date = #{planStartDate},
|
|
plan_end_date = #{planEndDate},
|
|
scheduled_date = #{scheduledDate},
|
|
scheduled_by = #{scheduledBy},
|
|
schedule_remark = #{remark},
|
|
status = '已排程',
|
|
status_db = 'Scheduled'
|
|
WHERE request_no IN
|
|
<foreach collection="requestNos"
|
|
item="item"
|
|
open="("
|
|
separator=","
|
|
close=")">
|
|
#{item}
|
|
</foreach>
|
|
</update>
|
|
|
|
<select id="queryScheduleView"
|
|
resultType="com.xujie.modules.inspection.data.InspectionScheduleViewVO">
|
|
SELECT
|
|
h.request_no AS requestNo,
|
|
s.supplier_name AS supplierName,
|
|
h.inspect_address AS inspectAddress,
|
|
h.plan_start_date AS planStartDate,
|
|
h.plan_end_date AS planEndDate
|
|
FROM srm_inspection_request_header h
|
|
LEFT JOIN srm_supplier s
|
|
ON h.supplier_no = s.supplier_no
|
|
WHERE h.qc_operator = #{qcOperator}
|
|
AND h.status_db = 'Scheduled'
|
|
AND h.plan_start_date IS NOT NULL
|
|
AND h.plan_end_date IS NOT NULL
|
|
AND h.plan_end_date >= GETDATE()
|
|
ORDER BY h.plan_start_date ASC
|
|
|
|
</select>
|
|
|
|
</mapper>
|