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.
4146 lines
180 KiB
4146 lines
180 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.gaotao.modules.pms.mapper.QcMapper">
|
|
|
|
<!-- ================================================= FAI检验维护 ================================================= -->
|
|
|
|
<!-- 查询FAI基础数据 -->
|
|
<select id="selectFAIBasicData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
top 1
|
|
a.orderno as orderNo,
|
|
j.partNo,
|
|
j.PartDescription as part_desc,
|
|
c.operationDesc,
|
|
b.approve_qty as rollQty,
|
|
a.s_resourceid as resourceId,
|
|
DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
|
|
a.itemno as itemNo,
|
|
a.id as ssrId
|
|
FROM soscheduledrouting as a
|
|
inner join ShopOrder as so on a.site = so.site and a.orderno = so.orderNo
|
|
LEFT JOIN sfdc as b
|
|
ON a.site = b.site and a.seqno = b.assjob_seq_no and b.id in (
|
|
select min(sfdc.id)
|
|
from sfdc
|
|
group by sfdc.assjob_seq_no, site
|
|
)
|
|
LEFT JOIN view_SO_Routing as c ON c.site = a.site and c.orderNo = a.orderno and a.itemno = c.itemNo
|
|
LEFT JOIN part j ON so.site = j.site and so.PartNo = j.partNo
|
|
WHERE a.itemno = '10'
|
|
AND a.id not in (select ssr_id from qc_fai_record)
|
|
AND b.approve_qty is not null
|
|
ORDER BY a.id desc
|
|
</select>
|
|
|
|
<!-- 获取该物料属性下维护的iqc -->
|
|
<select id="selectPartAttributeByPartNo" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
qat.site,
|
|
qat.bu_no,
|
|
qat.attribute_no,
|
|
qat.template_id,
|
|
qat.sampling_level_no,
|
|
qsil.sampling_level_desc,
|
|
qat.inspection_cycle,
|
|
qat.sampling_programme_no,
|
|
qsip.sampling_programme_desc,
|
|
qat.AQL,
|
|
qat.AC,
|
|
qat.RE,
|
|
qt.default_sampling_quantity,
|
|
qt.default_sampling_proportion
|
|
FROM qc_attribute_template as qat
|
|
LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site and qat.bu_no = qt.bu_no
|
|
LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no and qat.site = qsil.site and qat.bu_no = qsil.bu_no
|
|
LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no and qat.site = qsip.site and qat.bu_no = qsip.bu_no
|
|
WHERE qat.site = #{site} and qat.bu_no = #{buNo}
|
|
AND qat.attribute_no = #{partNo}
|
|
AND qat.attribute_type = #{attributeType}
|
|
AND qt.inspection_type_no = #{inspectionTypeNo}
|
|
AND qat.manufacturer_id = #{supplierNo}
|
|
</select>
|
|
|
|
<!-- 获取该物料属性下维护的ipqc -->
|
|
<select id="selectPartAttributeByOperationAndResource" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
qat.site,
|
|
qat.bu_no,
|
|
qat.attribute_no,
|
|
qat.template_id,
|
|
qat.sampling_level_no,
|
|
qsil.sampling_level_desc,
|
|
qat.inspection_cycle,
|
|
qat.sampling_programme_no,
|
|
qsip.sampling_programme_desc,
|
|
qat.AQL,
|
|
qat.AC,
|
|
qat.RE,
|
|
qt.default_sampling_quantity,
|
|
qt.default_sampling_proportion
|
|
FROM qc_attribute_template as qat
|
|
LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site and qat.bu_no = qt.bu_no
|
|
LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no and qat.site = qsil.site and qat.bu_no = qsil.bu_no
|
|
LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no and qat.site = qsip.site and qat.bu_no = qsip.bu_no
|
|
WHERE qat.site = #{site} and qat.bu_no = #{buNo}
|
|
AND qat.attribute_no = #{partNo}
|
|
AND qat.attribute_type = #{attributeType1}
|
|
AND qt.inspection_type_no = #{inspectionTypeNo}
|
|
AND qat.operation = #{operationDesc}
|
|
AND qat.resource_id = #{resourceId}
|
|
</select>
|
|
|
|
<!-- 获取模板详情 -->
|
|
<select id="selectTemplate" resultType="com.gaotao.modules.pms.data.QcFAIRecordData" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
qt.site,
|
|
qt.bu_no,
|
|
qt.template_id,
|
|
qt.sampling_level_no,
|
|
qsil.sampling_level_desc,
|
|
qt.inspection_cycle,
|
|
qt.sampling_programme_no,
|
|
qsip.sampling_programme_desc,
|
|
qt.AQL,
|
|
qt.AC,
|
|
qt.RE,
|
|
qt.default_sampling_quantity,
|
|
qt.default_sampling_proportion
|
|
FROM qc_template as qt
|
|
LEFT JOIN qc_sampling_inspection_level as qsil ON qt.sampling_level_no = qsil.sampling_level_no and qt.site = qsil.site and qt.bu_no = qsil.bu_no
|
|
LEFT JOIN qc_sampling_inspection_programme as qsip ON qt.sampling_programme_no = qsip.sampling_programme_no and qt.site = qsip.site and qt.bu_no = qsip.bu_no
|
|
WHERE qt.site = #{site} and qt.template_id = #{templateId} and qt.bu_no = #{buNo}
|
|
</select>
|
|
|
|
|
|
<!-- 新增FAI主记录信息 -->
|
|
<insert id="saveFAIRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
INSERT INTO qc_fai_record (inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id, part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id)
|
|
VALUES(#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId}, #{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId})
|
|
</insert>
|
|
|
|
<insert id="saveFAIDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
INSERT INTO qc_fai_detailed_record
|
|
(inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
|
|
AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
|
|
max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
|
|
VALUES
|
|
(#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc},
|
|
#{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL},
|
|
#{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo},#{orderId,jdbcType=INTEGER})
|
|
</insert>
|
|
|
|
<!-- 新增FAI明细记录信息 -->
|
|
<insert id="saveFAIDetailedRecords">
|
|
INSERT INTO qc_fai_detailed_record
|
|
(inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
|
|
AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
|
|
max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.inspectionNo}, #{item.orderNo}, #{item.templateId}, #{item.samplingLevelNo}, #{item.samplingLevelDesc}, #{item.samplingProgrammeNo}, #{item.samplingProgrammeDesc},
|
|
#{item.aql,jdbcType=DECIMAL}, #{item.ac,jdbcType=DECIMAL}, #{item.re,jdbcType=DECIMAL}, #{item.itemNo}, #{item.itemDesc}, #{item.objectId}, #{item.objectDesc}, #{item.defaultValue}, #{item.minValue,jdbcType=DECIMAL},
|
|
#{item.maxValue,jdbcType=DECIMAL}, #{item.valueTypeDb}, #{item.valueType}, #{item.site}, #{item.samplingQty,jdbcType=DECIMAL}, #{item.buNo}, #{item.orderId})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 查询FAI主记录信息 -->
|
|
<select id="qcFAIInspectionSearch" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.task_date,
|
|
a.inspection_type_no,
|
|
dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) as inspectionTypeName,
|
|
a.inspection_cycle,
|
|
a.order_no,
|
|
a.operation_desc,
|
|
a.resource_id,
|
|
r.resourceDesc,
|
|
a.part_no,
|
|
d.PartDescription as part_desc,
|
|
d.cinv_source_code as cinvSourceCode,
|
|
d.sku as sku,
|
|
d.PartType as invdefinetype,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
u.user_display as inspectorName,
|
|
a.ssr_id,
|
|
a.unqualified_qty,
|
|
a.submit_flag,
|
|
a.seq_no,
|
|
a.batch_roll_no,
|
|
a.special_requirements,
|
|
a.work_center_no,
|
|
a.roll_no,
|
|
a.um_id,
|
|
um.UMName as umName,
|
|
a.action_date,
|
|
a.action_by,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
|
|
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
|
|
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
|
|
a.pass_qty,
|
|
a.not_pass_qty,
|
|
a.batch_qualified_qty
|
|
FROM qc_fai_record as a
|
|
left join part as d on a.site = d.site and a.bu_no = d.bu_no and a.part_no = d.partNo
|
|
left join sys_user as u on a.inspector_no = u.username
|
|
left join WorkCenterResource as r on a.site = r.site and a.resource_id = r.resourceId and a.work_center_no = r.workCenterNo
|
|
left join UM as um on a.site = um.site and a.um_id = um.UMID
|
|
<where>
|
|
a.site in (select site from AccessSite where userID = #{query.userName})
|
|
and a.bu_no in (select bu_no from AccessBu where username = #{query.userName})
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND d.PartDescription LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "query.sku != null and query.sku != ''">
|
|
AND d.sku LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.orderNo != null and query.orderNo != ''">
|
|
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test = "query.seqNo != null and query.seqNo != ''">
|
|
AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
|
|
</if>
|
|
<if test = "query.operationDesc != null and query.operationDesc != ''">
|
|
AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.task_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.task_date
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '待检验' THEN 1
|
|
WHEN a.state = '待审核' THEN 2
|
|
WHEN a.state = '已完成' THEN 3
|
|
END, a.task_date desc
|
|
</select>
|
|
|
|
<!-- 获取物料的类别编码 -->
|
|
<select id="selectFamilyIdByPartNo" parameterType="string" resultType="string">
|
|
SELECT FamilyID
|
|
FROM part
|
|
WHERE partNo = #{partNo} AND site = #{site}
|
|
</select>
|
|
|
|
<!-- FAI明细记录查询 -->
|
|
<select id="faiDetailSearch" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.inspection_no,
|
|
a.order_no,
|
|
a.template_id,
|
|
a.sampling_level_no,
|
|
a.sampling_level_desc,
|
|
a.sampling_programme_no,
|
|
a.sampling_programme_desc,
|
|
a.AQL,
|
|
a.AC,
|
|
a.RE,
|
|
a.item_no,
|
|
a.item_desc,
|
|
a.object_id,
|
|
a.object_desc,
|
|
a.default_value,
|
|
a.min_value,
|
|
a.max_value,
|
|
a.text_value,
|
|
a.number_value,
|
|
a.value_type_db,
|
|
a.value_type,
|
|
case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
|
|
a.is_submit,
|
|
isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
|
|
a.sampling_qty,
|
|
dbo.qc_get_fai_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
|
|
c.method_no,
|
|
c.method_name,
|
|
c.method_remark
|
|
FROM qc_fai_detailed_record as a
|
|
LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
|
|
LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
|
|
WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
|
|
|
|
order by a.order_id
|
|
</select>
|
|
|
|
<!-- 修改FAI主记录信息 -->
|
|
<update id="updateFAIMasterRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fai_record
|
|
SET disposal_measures = #{disposalMeasures},
|
|
disposal_remark = #{disposalRemark},
|
|
inspection_result = #{inspectionResult},
|
|
inspector_no = #{inspectorNo},
|
|
state = #{state},
|
|
inspection_remark = #{inspectionRemark},
|
|
inspector_date = getDate(),
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
roll_qty = #{rollQty,jdbcType=DECIMAL},
|
|
unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
|
|
pass_qty = #{passQty,jdbcType=DECIMAL},
|
|
not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
|
|
batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
|
|
submit_date = getDate()
|
|
WHERE site = #{site} AND inspection_no = #{inspectionNo} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改FAI明细记录信息 -->
|
|
<update id="updateFAIDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fai_detailed_record
|
|
SET item_result = #{itemResult},
|
|
unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
text_value = #{textValue},
|
|
number_value = #{numberValue,jdbcType=DECIMAL}
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改子明细提交标识 -->
|
|
<update id="updateSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fai_sub_detail_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<!-- 删除FAI检验记录 -->
|
|
<delete id="deleteFAIRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_fai_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 删除FAI明细记录信息 -->
|
|
<delete id="deleteFAIDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_fai_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 删除FAI子明细记录信息 -->
|
|
<delete id="deleteFAISubDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_fai_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 修改FAI主记录标识为已提交 -->
|
|
<update id="updateFAIMasterSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fai_record
|
|
SET submit_flag = 'Y',
|
|
state = '已完成',
|
|
submit_date = getDate()
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改FAI明细记录标识为已提交 -->
|
|
<update id="updateFAIDetailSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fai_detailed_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改子明细记录标识为已提交 -->
|
|
<update id="updateFAISubDetailSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fai_sub_detail_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 查询FAI检验记录是否已提交 -->
|
|
<select id="checkFAIIsSubmit" parameterType="com.gaotao.modules.pms.data.SubDetailValues" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT submit_flag
|
|
FROM qc_fai_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 查询FAI检验记录状态(用于保存前校验) -->
|
|
<select id="getFAIRecordStatus" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT submit_flag, state
|
|
FROM qc_fai_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 删除子明细的老数据 -->
|
|
<delete id="delFAISubDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcSubDetailInformationData">
|
|
DELETE FROM qc_fai_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 新增FAI子明细信息 -->
|
|
<insert id="saveFAISubDetailed">
|
|
INSERT INTO qc_fai_sub_detail_record
|
|
(inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 查询FAI的子明细 -->
|
|
<select id="selectFAISubDetailedRecord" parameterType="com.gaotao.modules.pms.data.SubDetailValues" resultType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
sub_detail_value,
|
|
sampling_location,
|
|
is_submit,
|
|
sampling_location_b,
|
|
num,
|
|
sub_detail_value_b,
|
|
sub_detail_value_c,
|
|
sub_detail_value_d,
|
|
sub_detail_value_e
|
|
FROM qc_fai_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
<if test = "collectionDataContent != null and collectionDataContent != ''">
|
|
AND sub_detail_value ${collectionDataContent}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 获取该项目的子明细值 -->
|
|
<select id="selectFAISubDetailValue" parameterType="string" resultType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
SELECT sub_detail_value,
|
|
sampling_location,
|
|
is_submit
|
|
FROM qc_fai_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- ================================================= IPQC检验维护 ================================================= -->
|
|
|
|
<!-- 查询IPQC基础数据 -->
|
|
<select id="selectIPQCBasicData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
top 1
|
|
a.orderno as orderNo,
|
|
j.partNo,
|
|
j.PartDescription as partDesc,
|
|
c.operationDesc,
|
|
b.approve_qty as rollQty,
|
|
a.s_resourceid as resourceId,
|
|
DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
|
|
a.itemno as itemNo,
|
|
a.id as ssrId
|
|
FROM soscheduledrouting as a
|
|
inner join ShopOrder as so on a.site = so.site and a.orderno = so.orderNo
|
|
LEFT JOIN sfdc as b
|
|
ON a.site = b.site and a.seqno = b.assjob_seq_no and b.id in (
|
|
select max(sfdc.id)
|
|
from sfdc
|
|
group by sfdc.assjob_seq_no, site
|
|
)
|
|
LEFT JOIN view_SO_Routing as c ON c.site = a.site and c.orderNo = a.orderno and a.itemno = c.itemNo
|
|
LEFT JOIN part j ON so.site = j.site and so.partno = j.partNo
|
|
LEFT JOIN (select ssr_id from qc_ipqc_record where check_type = '末件检') as temp
|
|
ON a.id = temp.ssr_id
|
|
WHERE b.approve_qty is not null and temp.ssr_id is null
|
|
ORDER BY a.id desc
|
|
</select>
|
|
|
|
<select id="qcExec" resultType="com.gaotao.modules.pms.data.QcFAIRecordData" parameterType="string" statementType="CALLABLE">
|
|
{CALL
|
|
getIpqcRecord(#{site,mode=IN,jdbcType=VARCHAR})
|
|
}
|
|
</select>
|
|
|
|
<insert id="saveIPQCDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
INSERT INTO qc_ipqc_detailed_record
|
|
(inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
|
|
AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
|
|
max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
|
|
VALUES
|
|
(#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc},
|
|
#{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL},
|
|
#{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo},#{orderId,jdbcType=INTEGER})
|
|
</insert>
|
|
|
|
<!-- 新增IPQC明细记录信息 -->
|
|
<insert id="saveIPQCDetailedRecords">
|
|
INSERT INTO qc_ipqc_detailed_record
|
|
(inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
|
|
AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
|
|
max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.inspectionNo}, #{item.orderNo}, #{item.templateId}, #{item.samplingLevelNo}, #{item.samplingLevelDesc}, #{item.samplingProgrammeNo}, #{item.samplingProgrammeDesc},
|
|
#{item.aql,jdbcType=DECIMAL}, #{item.ac,jdbcType=DECIMAL}, #{item.re,jdbcType=DECIMAL}, #{item.itemNo}, #{item.itemDesc}, #{item.objectId}, #{item.objectDesc}, #{item.defaultValue}, #{item.minValue,jdbcType=DECIMAL},
|
|
#{item.maxValue,jdbcType=DECIMAL}, #{item.valueTypeDb}, #{item.valueType}, #{item.site}, #{item.samplingQty,jdbcType=DECIMAL}, #{item.buNo}, #{item.orderId})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 新增IPQC主记录信息 -->
|
|
<insert id="saveIPQCRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
INSERT INTO qc_ipqc_record
|
|
(inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id,
|
|
part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id)
|
|
VALUES
|
|
(#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId},
|
|
#{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId})
|
|
</insert>
|
|
|
|
<!-- 查询IPQC主记录信息 -->
|
|
<select id="qcIPQCInspectionSearch" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.task_date,
|
|
a.inspection_type_no,
|
|
a.inspection_cycle,
|
|
a.order_no,
|
|
a.operation_desc,
|
|
a.resource_id,
|
|
r.resourceDesc,
|
|
a.part_no,
|
|
d.PartDescription as part_desc,
|
|
d.cinv_source_code as cinvSourceCode,
|
|
d.sku as sku,
|
|
d.PartType as invdefinetype,
|
|
d.spec,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
u.user_display as inspectorName,
|
|
a.ssr_id,
|
|
a.unqualified_qty,
|
|
a.submit_flag,
|
|
a.seq_no,
|
|
a.batch_roll_no,
|
|
a.special_requirements,
|
|
a.work_center_no,
|
|
a.roll_no,
|
|
a.um_id,
|
|
um.UMName as umName,
|
|
a.action_date,
|
|
a.action_by,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
|
|
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
|
|
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
|
|
a.pass_qty,
|
|
a.not_pass_qty,
|
|
a.batch_qualified_qty,
|
|
w.WorkCenterDesc
|
|
FROM qc_ipqc_record as a
|
|
left join part as d on a.site = d.site and a.bu_no = d.bu_no and a.part_no = d.partNo
|
|
left join sys_user as u on a.inspector_no = u.username
|
|
left join WorkCenterResource as r on a.site = r.site and a.resource_id = r.resourceId and a.work_center_no = r.workCenterNo
|
|
left join WorkCenter as w on a.site = w.site and a.work_center_no = w.workCenterNo and a.bu_no = w.bu_no
|
|
left join UM as um on a.site = um.site and a.um_id = um.UMID
|
|
<where>
|
|
a.site in (select site from AccessSite where userID = #{query.userName})
|
|
and a.bu_no in (select bu_no from AccessBu where username = #{query.userName})
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND d.PartDescription LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "query.sku != null and query.sku != ''">
|
|
AND d.sku LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionTypeNo != null and query.inspectionTypeNo != ''">
|
|
AND a.inspection_type_no = #{query.inspectionTypeNo}
|
|
</if>
|
|
<if test = "query.inspectionTypeNos != null and query.inspectionTypeNos.size > 0">
|
|
AND a.inspection_type_no in
|
|
<foreach item="item" collection="query.inspectionTypeNos" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
|
|
</if>
|
|
<if test = "query.orderNo != null and query.orderNo != ''">
|
|
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test = "query.seqNo != null and query.seqNo != ''">
|
|
AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
|
|
</if>
|
|
<if test = "query.operationDesc != null and query.operationDesc != ''">
|
|
AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
|
|
</if>
|
|
<if test = "query.resourceId != null and query.resourceId != ''">
|
|
AND a.resource_id = #{query.resourceId}
|
|
</if>
|
|
<if test = "query.workCenterNo != null and query.workCenterNo != ''">
|
|
AND a.work_center_no = #{query.workCenterNo}
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.task_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.task_date
|
|
</if>
|
|
<if test = "query.spec != null and query.spec != ''">
|
|
AND d.spec LIKE '%' + #{query.spec} + '%'
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '未开始' THEN 1
|
|
WHEN a.state = '待检验' THEN 2
|
|
END, a.action_date,a.task_date,a.inspector_date desc
|
|
</select>
|
|
|
|
<!-- IPQC明细记录查询 -->
|
|
<select id="ipqcDetailSearch" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.inspection_no,
|
|
a.order_no,
|
|
a.template_id,
|
|
a.sampling_level_no,
|
|
a.sampling_level_desc,
|
|
a.sampling_programme_no,
|
|
a.sampling_programme_desc,
|
|
a.AQL,
|
|
a.AC,
|
|
a.RE,
|
|
a.item_no,
|
|
a.item_desc,
|
|
a.object_id,
|
|
a.object_desc,
|
|
a.default_value,
|
|
a.min_value,
|
|
a.max_value,
|
|
a.text_value,
|
|
a.number_value,
|
|
a.value_type_db,
|
|
a.value_type,
|
|
case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
|
|
a.is_submit,
|
|
isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
|
|
a.sampling_qty,
|
|
dbo.qc_get_ipqc_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
|
|
dbo.qc_get_record_image_num(a.site, a.bu_no, a.inspection_no, a.item_no) as detailImageNum,
|
|
c.method_no,
|
|
c.method_name,
|
|
c.method_remark
|
|
FROM qc_ipqc_detailed_record as a
|
|
LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
|
|
LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
|
|
WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
|
|
order by a.order_id
|
|
</select>
|
|
|
|
<!-- 删除IPQC检验记录 -->
|
|
<delete id="deleteIPQCRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_ipqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 删除IPQC明细记录信息 -->
|
|
<delete id="deleteIPQCDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_ipqc_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 删除IPQC子明细记录信息 -->
|
|
<delete id="deleteIPQCSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_ipqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 修改IPQC主记录信息 -->
|
|
<update id="updateIPQCMasterRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_ipqc_record
|
|
SET disposal_measures = #{disposalMeasures},
|
|
disposal_remark = #{disposalRemark},
|
|
inspection_result = #{inspectionResult},
|
|
inspector_no = #{inspectorNo},
|
|
state = #{state},
|
|
inspection_remark = #{inspectionRemark},
|
|
inspector_date = getDate(),
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
roll_qty = #{rollQty,jdbcType=DECIMAL},
|
|
unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
|
|
pass_qty = #{passQty,jdbcType=DECIMAL},
|
|
not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
|
|
batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
|
|
submit_date = getDate()
|
|
WHERE site = #{site} and inspection_no = #{inspectionNo} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改IPQC明细记录信息 -->
|
|
<update id="updateIPQCDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_ipqc_detailed_record
|
|
SET item_result = #{itemResult},
|
|
unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
text_value = #{textValue},
|
|
number_value = #{numberValue,jdbcType=DECIMAL},
|
|
default_value = #{defaultValue},
|
|
min_value = #{minValue,jdbcType=DECIMAL},
|
|
max_value = #{maxValue,jdbcType=DECIMAL}
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改IPQC主记录标识为已提交 -->
|
|
<update id="updateIPQCMasterSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_ipqc_record
|
|
SET submit_flag = 'Y',
|
|
state = '已完成',
|
|
submit_date = getDate()
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改IPQC明细记录标识为已提交 -->
|
|
<update id="updateIPQCDetailSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_ipqc_detailed_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改IPQC子明细记录标识为已提交 -->
|
|
<update id="updateIPQCSubDetailSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_ipqc_sub_detail_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 删除IPQC子明细的老数据 -->
|
|
<delete id="delIPQCSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcSubDetailInformationData">
|
|
DELETE FROM qc_ipqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 新增IPQC子明细信息 -->
|
|
<insert id="saveIPQCSubDetailed">
|
|
INSERT INTO qc_ipqc_sub_detail_record
|
|
(inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 查询IPQC的子明细 -->
|
|
<select id="selectIPQCSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.SubDetailValues" resultType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
sub_detail_value,
|
|
sampling_location,
|
|
is_submit,
|
|
sampling_location_b,
|
|
num,
|
|
sub_detail_value_b,
|
|
sub_detail_value_c,
|
|
sub_detail_value_d,
|
|
sub_detail_value_e
|
|
FROM qc_ipqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
<if test = "collectionDataContent != null and collectionDataContent != ''">
|
|
AND sub_detail_value ${collectionDataContent}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 查询IPQC检验记录是否已提交 -->
|
|
<select id="checkIPQCIsSubmit" parameterType="com.gaotao.modules.pms.data.SubDetailValues" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT submit_flag
|
|
FROM qc_ipqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 查询IPQC检验记录状态(用于保存前校验) -->
|
|
<select id="getIPQCRecordStatus" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT submit_flag, state
|
|
FROM qc_ipqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 获取该项目的子明细值 -->
|
|
<select id="selectIPQCSubDetailValue" parameterType="string" resultType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
SELECT sub_detail_value,
|
|
sampling_location,
|
|
is_submit
|
|
FROM qc_ipqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 查询工序列表 -->
|
|
<select id="getOperationList" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
DISTINCT
|
|
a.seqno as seqNo,
|
|
a.orderno as orderNo,
|
|
j.partNo,
|
|
j.PartDescription as partDesc,
|
|
j.PartType as invdefinetype,
|
|
j.sku,
|
|
c.operationDesc as operationDesc,
|
|
a.itemno as operationNo,
|
|
a.s_resourceid as resourceId,
|
|
DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
|
|
c.WorkCenterNo
|
|
FROM soscheduledrouting as a
|
|
inner join ShopOrder as so on a.site = so.site and a.orderno = so.orderNo
|
|
LEFT JOIN view_SO_Routing as c ON c.site = a.site and c.orderNo = a.orderno and a.itemno = c.itemNo
|
|
LEFT JOIN part j ON so.site = j.site and so.partno = j.partNo
|
|
WHERE a.site = #{site} and a.seqno = #{seqNo}
|
|
</select>
|
|
|
|
<!-- 根据工单号和工序号查出所有数据 -->
|
|
<select id="getResourceList" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.s_resourceid as resourceId,
|
|
DBO.getResourceDesc(a.site, a.s_resourceid) as resourceDesc,
|
|
c.workCenterNo
|
|
FROM soscheduledrouting as a
|
|
LEFT JOIN sfdc as b ON a.site = b.site and a.seqno = b.assjob_seq_no
|
|
LEFT JOIN view_SO_Routing as c ON c.site = a.site and c.orderNo = a.orderno and a.itemno = c.itemNo
|
|
<!-- LEFT JOIN part j ON a.site = j.site and a.part_no = j.partNo-->
|
|
WHERE a.site = #{site} and b.approve_qty is not null and a.seqno = #{seqNo}
|
|
ORDER BY a.id desc
|
|
</select>
|
|
|
|
<!-- 查询机台名称 -->
|
|
<select id="selectResourceDesc" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT distinct
|
|
resourceDesc
|
|
FROM WorkCenterResource
|
|
WHERE site = #{site} and resourceId = #{resourceId}
|
|
</select>
|
|
|
|
<!-- 查询物料名称 -->
|
|
<select id="selectPartDesc" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT distinct
|
|
PartDescription as part_desc
|
|
FROM part
|
|
WHERE site = #{site} and partNo = #{partNo}
|
|
</select>
|
|
|
|
<!-- ================================================= IQC检验维护 ================================================= -->
|
|
<!-- 查询IQC基础数据 -->
|
|
<select id="selectIQCBasicData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
qir.inspection_no,
|
|
qir.state,
|
|
qir.create_date as taskDate,
|
|
qir.roll_no,
|
|
qir.part_no,
|
|
p.PartDescription as part_desc,
|
|
p.cinv_source_code,
|
|
p.sku as sku,
|
|
qir.roll_qty,
|
|
qir.print_flag,
|
|
qir.create_by,
|
|
qir.supplier_no,
|
|
qir.site,
|
|
qir.bu_no,
|
|
qir.po_orderNo,
|
|
qir.po_itemNo,
|
|
qir.roll_count,
|
|
qir.document_no
|
|
FROM qc_iqc_record as qir
|
|
LEFT JOIN part p ON qir.part_no = p.partNo and qir.site = p.site
|
|
WHERE qir.site in (select site from AccessSite where userID = #{userName})
|
|
and qir.bu_no in (select bu_no from AccessBu where username = #{userName})
|
|
and qir.detail_flag = 'N'
|
|
</select>
|
|
|
|
<!-- 新增IQC明细记录信息 -->
|
|
<insert id="saveIQCDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
INSERT INTO qc_iqc_detailed_record (inspection_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc, AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value, max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
|
|
VALUES(#{inspectionNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL}, #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty}, #{buNo},#{orderId,jdbcType=INTEGER})
|
|
</insert>
|
|
|
|
<!-- 修改IQC检验记录 -->
|
|
<update id="updateIQCRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_iqc_record
|
|
SET inspection_type_no = #{inspectionTypeNo},
|
|
sampling_qty = #{samplingQty},
|
|
inspection_cycle = #{inspectionCycle},
|
|
part_desc = #{partDesc},
|
|
detail_flag = 'Y',
|
|
state = '未开始',
|
|
action_date = '',
|
|
action_by = ''
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 查询IQC主记录信息 -->
|
|
<select id="qcIQCInspectionSearch" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.create_date as taskDate,
|
|
a.inspection_type_no,
|
|
a.inspection_cycle,
|
|
a.part_no,
|
|
a.part_desc,
|
|
d.cinv_source_code as cinvSourceCode,
|
|
d.sku,
|
|
d.umid as umId,
|
|
um.UMName as umName,
|
|
d.PartType as invdefinetype,
|
|
d.spec,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
u.user_display as inspectorName,
|
|
a.unqualified_quantity,
|
|
a.submit_flag,
|
|
a.roll_no,
|
|
a.supplier_no,
|
|
s.SupplierName as supplierDesc,
|
|
a.po_orderNo,
|
|
a.po_itemNo,
|
|
a.roll_count,
|
|
dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) as orderType,
|
|
a.action_date,
|
|
a.action_by,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
|
|
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
|
|
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
|
|
a.submission_remark,
|
|
a.submission_type,
|
|
a.batch_no,
|
|
a.production_date,
|
|
a.expiration_warning_date,
|
|
a.expiration_date,
|
|
a.pass_qty,
|
|
a.not_pass_qty,
|
|
a.batch_qualified_qty,
|
|
a.document_no
|
|
FROM qc_iqc_record as a
|
|
left join part as d on a.site = d.site and a.bu_no = d.bu_no and a.part_no = d.partNo
|
|
left join view_Supplier as s on a.site = s.site and a.supplier_no = s.SupplierID
|
|
left join sys_user as u on a.inspector_no = u.username
|
|
left join um as um on d.site = um.site and d.umid = um.UMID
|
|
<where>
|
|
a.site in (select site from AccessSite where userID = #{query.userName})
|
|
and a.bu_no in (select bu_no from AccessBu where username = #{query.userName})
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND a.part_desc LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "query.sku != null and query.sku != ''">
|
|
AND d.sku LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test = "query.supplierDesc != null and query.supplierDesc != ''">
|
|
AND s.SupplierName LIKE '%' + #{query.supplierDesc} + '%'
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
|
|
</if>
|
|
<if test = "query.inspectorName != null and query.inspectorName != ''">
|
|
u.user_display LIKE '%' + #{query.inspectorName} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.create_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.create_date
|
|
</if>
|
|
<if test = "query.poOrderNo != null and query.poOrderNo != ''">
|
|
AND a.po_orderNo LIKE '%' + #{query.poOrderNo} + '%'
|
|
</if>
|
|
<if test = "query.poItemNo != null and query.poItemNo != ''">
|
|
AND a.po_itemNo LIKE '%' + #{query.poItemNo} + '%'
|
|
</if>
|
|
<if test = "query.orderType != null and query.orderType != ''">
|
|
AND dbo.qc_get_order_type(a.site, a.po_orderNo, a.po_itemNo) = #{query.orderType}
|
|
</if>
|
|
<if test = "query.submissionType != null and query.submissionType != ''">
|
|
AND a.submission_type = #{query.submissionType}
|
|
</if>
|
|
<if test = "query.invdefinetype != null and query.invdefinetype != ''">
|
|
AND d.PartType LIKE '%' + #{query.invdefinetype} + '%'
|
|
</if>
|
|
<if test = "query.spec != null and query.spec != ''">
|
|
AND d.spec LIKE '%' + #{query.spec} + '%'
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '待检验' THEN 1
|
|
WHEN a.state = '待审核' THEN 2
|
|
WHEN a.state = '已完成' THEN 3
|
|
END, a.create_date desc
|
|
</select>
|
|
|
|
<!-- IQC明细记录查询 -->
|
|
<select id="iqcDetailSearch" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.inspection_no,
|
|
a.template_id,
|
|
a.sampling_level_no,
|
|
a.sampling_level_desc,
|
|
a.sampling_programme_no,
|
|
a.sampling_programme_desc,
|
|
a.AQL,
|
|
a.AC,
|
|
a.RE,
|
|
a.item_no,
|
|
a.item_desc,
|
|
a.object_id,
|
|
a.object_desc,
|
|
a.default_value,
|
|
a.min_value,
|
|
a.max_value,
|
|
a.text_value,
|
|
a.number_value,
|
|
a.value_type_db,
|
|
a.value_type,
|
|
case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
|
|
a.is_submit,
|
|
isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
|
|
dbo.qc_get_iqc_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
|
|
dbo.qc_get_record_image_num(a.site, a.bu_no, a.inspection_no, a.item_no) as detailImageNum,
|
|
c.method_no,
|
|
c.method_name,
|
|
c.method_remark,
|
|
a.sampling_qty
|
|
FROM qc_iqc_detailed_record as a
|
|
LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
|
|
LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
|
|
WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
|
|
order by a.order_id
|
|
</select>
|
|
|
|
<!-- 查询IQC的子明细 -->
|
|
<select id="selectIQCSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.SubDetailValues" resultType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
sub_detail_value,
|
|
sampling_location,
|
|
is_submit,
|
|
sampling_location_b,
|
|
num,
|
|
sub_detail_value_b,
|
|
sub_detail_value_c,
|
|
sub_detail_value_d,
|
|
sub_detail_value_e
|
|
FROM qc_iqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
<if test = "collectionDataContent != null and collectionDataContent != ''">
|
|
AND sub_detail_value ${collectionDataContent}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 获取该项目的子明细值 -->
|
|
<select id="selectIQCSubDetailValue" parameterType="string" resultType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
SELECT sub_detail_value,
|
|
sampling_location,
|
|
is_submit
|
|
FROM qc_iqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 修改IQC主记录信息 -->
|
|
<update id="updateIQCMasterRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_iqc_record
|
|
SET disposal_measures = #{disposalMeasures},
|
|
disposal_remark = #{disposalRemark},
|
|
inspection_result = #{inspectionResult},
|
|
inspector_no = #{inspectorNo},
|
|
state = #{state},
|
|
inspection_remark = #{inspectionRemark},
|
|
inspector_date = getDate(),
|
|
roll_count = #{rollCount,jdbcType=DECIMAL},
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
|
|
pass_qty = #{passQty,jdbcType=DECIMAL},
|
|
not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
|
|
batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
|
|
submit_date = getDate()
|
|
WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<!-- 修改IQC明细记录信息 -->
|
|
<update id="updateIQCDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_iqc_detailed_record
|
|
SET item_result = #{itemResult},
|
|
unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
text_value = #{textValue},
|
|
number_value = #{numberValue,jdbcType=DECIMAL},
|
|
default_value = #{defaultValue},
|
|
min_value = #{minValue,jdbcType=DECIMAL},
|
|
max_value = #{maxValue,jdbcType=DECIMAL}
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 查询该记录明细是否已存在 -->
|
|
<select id="checkIQCDetail" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT inspection_no,
|
|
template_id
|
|
FROM qc_iqc_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 查询IQC检验记录是否已提交 -->
|
|
<select id="checkIQCIsSubmit" parameterType="com.gaotao.modules.pms.data.SubDetailValues" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT submit_flag
|
|
FROM qc_iqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 查询IQC检验记录状态(用于保存前校验) -->
|
|
<select id="getIQCRecordStatus" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT submit_flag, state
|
|
FROM qc_iqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 删除IQC子明细的老数据 -->
|
|
<delete id="delIQCSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcSubDetailInformationData">
|
|
DELETE FROM qc_iqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 新增IQC子明细信息 -->
|
|
<insert id="saveIQCSubDetailed">
|
|
INSERT INTO qc_iqc_sub_detail_record
|
|
(inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 修改IQC主记录标识为已提交 -->
|
|
<update id="updateIQCMasterSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_iqc_record
|
|
SET submit_flag = 'Y',
|
|
state = '已完成',
|
|
submit_date = getDate()
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改IQC明细记录标识为已提交 -->
|
|
<update id="updateIQCDetailSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_iqc_detailed_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改IQC子明细记录标识为已提交 -->
|
|
<update id="updateIQCSubDetailSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_iqc_sub_detail_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 删除IQC检验记录 -->
|
|
<delete id="deleteIQCRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_iqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 删除IQC明细记录信息 -->
|
|
<delete id="deleteIQCDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_iqc_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 删除IQC子明细记录信息 -->
|
|
<delete id="deleteIQCSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_iqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 查询文件ID -->
|
|
<select id="queryFileId" parameterType="com.gaotao.modules.oss.entity.SysOssEntity" resultType="com.gaotao.modules.oss.entity.SysOssEntity">
|
|
SELECT id, file_name
|
|
FROM sys_oss
|
|
WHERE order_ref1 = #{orderRef1} and order_ref2 = #{orderRef2}
|
|
</select>
|
|
|
|
<!-- 获取工序列表 -->
|
|
<select id="getOperationDescList" parameterType="com.gaotao.modules.pms.data.QcPartAttributeData" resultType="com.gaotao.modules.pms.data.QcPartAttributeData">
|
|
SELECT distinct
|
|
operationDesc
|
|
FROM view_SO_Routing
|
|
<where>
|
|
<if test = "operationDesc != null and operationDesc != ''">
|
|
AND operationDesc LIKE '%' + #{operationDesc} + '%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 获取供应商列表 -->
|
|
<select id="getManufacturerList" parameterType="com.gaotao.modules.pms.data.QcPartAttributeData" resultType="com.gaotao.modules.pms.data.QcPartAttributeData">
|
|
SELECT
|
|
supplierID as manufacturerID,
|
|
supplierName as manufacturerName
|
|
FROM view_Supplier
|
|
<where>
|
|
site = #{site}
|
|
<if test = "manufacturerID != null and manufacturerID != ''">
|
|
AND supplierID LIKE '%' + #{manufacturerID} + '%'
|
|
</if>
|
|
<if test = "manufacturerName != null and manufacturerName != ''">
|
|
AND supplierName LIKE '%' + #{manufacturerName} + '%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 获取机台列表 -->
|
|
<select id="getAllResourceList" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT distinct
|
|
resourceId,
|
|
resourceDesc
|
|
FROM WorkCenterResource
|
|
<where>
|
|
site = #{site}
|
|
<if test = "resourceId != null and resourceId != ''">
|
|
AND resourceId LIKE '%' + #{resourceId} + '%'
|
|
</if>
|
|
<if test = "resourceDesc != null and resourceDesc != ''">
|
|
AND resourceDesc LIKE '%' + #{resourceDesc} + '%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 获取工单列表 -->
|
|
<select id="getOrderNoList" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT DISTINCT
|
|
a.orderno as orderNo
|
|
FROM soscheduledrouting as a
|
|
LEFT JOIN sfdc as b ON a.site = b.site and a.seqno = b.assjob_seq_no
|
|
LEFT JOIN view_SO_Routing as c ON c.site = a.site and c.orderNo = a.orderno and a.itemno = c.itemNo
|
|
<!-- LEFT JOIN part j ON a.site = j.site and a.part_no = j.partNo-->
|
|
<where>
|
|
a.site = #{site}
|
|
AND b.approve_qty is not null
|
|
<if test = "orderNo != null and orderNo != ''">
|
|
AND a.orderno LIKE '%' + #{orderNo} + '%'
|
|
</if>
|
|
</where>
|
|
order by a.orderno DESC
|
|
</select>
|
|
|
|
<!-- 查询FQC主记录信息 -->
|
|
<select id="qcFQCInspectionSearch" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.task_date,
|
|
a.inspection_type_no,
|
|
dbo.qc_get_inspection_type_name(a.site, a.inspection_type_no) as inspectionTypeName,
|
|
a.inspection_cycle,
|
|
a.order_no,
|
|
a.operation_desc,
|
|
a.resource_id,
|
|
r.resourceDesc,
|
|
a.part_no,
|
|
d.PartDescription as part_desc,
|
|
d.cinv_source_code as cinvSourceCode,
|
|
d.sku as sku,
|
|
d.PartType as invdefinetype,
|
|
d.spec,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.inspector_no,
|
|
u.user_display as inspectorName,
|
|
a.ssr_id,
|
|
a.unqualified_qty,
|
|
a.submit_flag,
|
|
a.seq_no,
|
|
a.batch_roll_no,
|
|
a.special_requirements,
|
|
a.work_center_no,
|
|
a.roll_no,
|
|
a.um_id,
|
|
um.UMName as umName,
|
|
a.action_date,
|
|
a.action_by,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
|
|
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
|
|
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
|
|
a.pass_qty,
|
|
a.not_pass_qty,
|
|
a.batch_qualified_qty,
|
|
a.document_no
|
|
FROM qc_fqc_record as a
|
|
left join part as d on a.site = d.site and a.bu_no = d.bu_no and a.part_no = d.partNo
|
|
left join sys_user as u on a.inspector_no = u.username
|
|
left join WorkCenterResource as r on a.site = r.site and a.resource_id = r.resourceId and a.work_center_no = r.workCenterNo
|
|
left join UM as um on a.site = um.site and a.um_id = um.UMID
|
|
<where>
|
|
a.site in (select site from AccessSite where userID = #{query.userName})
|
|
and a.bu_no in (select bu_no from AccessBu where username = #{query.userName})
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND d.PartDescription LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND d.cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
<if test = "query.sku != null and query.sku != ''">
|
|
AND d.sku LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.orderNo != null and query.orderNo != ''">
|
|
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test = "query.seqNo != null and query.seqNo != ''">
|
|
AND a.seq_no LIKE '%' + #{query.seqNo} + '%'
|
|
</if>
|
|
<if test = "query.operationDesc != null and query.operationDesc != ''">
|
|
AND a.operation_desc LIKE '%' + #{query.operationDesc} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.task_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.task_date
|
|
</if>
|
|
<if test = "query.spec != null and query.spec != ''">
|
|
AND d.spec LIKE '%' + #{query.spec} + '%'
|
|
</if>
|
|
<if test = "query.documentNo != null and query.documentNo != ''">
|
|
AND a.document_no LIKE '%' + #{query.documentNo} + '%'
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '待检验' THEN 1
|
|
WHEN a.state = '待审核' THEN 2
|
|
WHEN a.state = '已完成' THEN 3
|
|
END, a.task_date desc
|
|
</select>
|
|
|
|
<insert id="saveFQCDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
INSERT INTO qc_fqc_detailed_record
|
|
(inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
|
|
AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
|
|
max_value, value_type_db, value_type, site, sampling_qty, bu_no,order_id)
|
|
VALUES
|
|
(#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc},
|
|
#{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL},
|
|
#{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty,jdbcType=DECIMAL}, #{buNo},#{orderId,jdbcType=INTEGER})
|
|
</insert>
|
|
|
|
<!-- 新增FQC明细记录信息 -->
|
|
<insert id="saveFQCDetailedRecords">
|
|
INSERT INTO qc_fqc_detailed_record
|
|
(inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc,
|
|
AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value,
|
|
max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.inspectionNo}, #{item.orderNo}, #{item.templateId}, #{item.samplingLevelNo}, #{item.samplingLevelDesc}, #{item.samplingProgrammeNo}, #{item.samplingProgrammeDesc},
|
|
#{item.aql,jdbcType=DECIMAL}, #{item.ac,jdbcType=DECIMAL}, #{item.re,jdbcType=DECIMAL}, #{item.itemNo}, #{item.itemDesc}, #{item.objectId}, #{item.objectDesc}, #{item.defaultValue}, #{item.minValue,jdbcType=DECIMAL},
|
|
#{item.maxValue,jdbcType=DECIMAL}, #{item.valueTypeDb}, #{item.valueType}, #{item.site}, #{item.samplingQty,jdbcType=DECIMAL}, #{item.buNo}, #{item.orderId})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 新增FQC主记录信息 -->
|
|
<insert id="saveFQCRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
INSERT INTO qc_fqc_record
|
|
(inspection_no, site, bu_no, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id,
|
|
part_no, roll_qty, sampling_qty, ssr_id, seq_no, batch_roll_no, special_requirements, work_center_no, roll_no, um_id)
|
|
VALUES
|
|
(#{inspectionNo}, #{site}, #{buNo}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=DECIMAL}, #{orderNo}, #{operationDesc}, #{resourceId},
|
|
#{partNo}, #{rollQty}, #{samplingQty,jdbcType=DECIMAL}, #{ssrId}, #{seqNo}, #{batchRollNo}, #{specialRequirements}, #{workCenterNo}, #{rollNo}, #{umId})
|
|
</insert>
|
|
|
|
<!-- FQC明细记录查询 -->
|
|
<select id="fqcDetailSearch" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.inspection_no,
|
|
a.order_no,
|
|
a.template_id,
|
|
a.sampling_level_no,
|
|
a.sampling_level_desc,
|
|
a.sampling_programme_no,
|
|
a.sampling_programme_desc,
|
|
a.AQL,
|
|
a.AC,
|
|
a.RE,
|
|
a.item_no,
|
|
a.item_desc,
|
|
a.object_id,
|
|
a.object_desc,
|
|
a.default_value,
|
|
a.min_value,
|
|
a.max_value,
|
|
a.text_value,
|
|
a.number_value,
|
|
a.value_type_db,
|
|
a.value_type,
|
|
case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
|
|
a.is_submit,
|
|
isnull(a.unqualified_quantity,0) as unqualifiedQuantity,
|
|
a.sampling_qty,
|
|
dbo.qc_get_fqc_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
|
|
dbo.qc_get_record_image_num(a.site, a.bu_no, a.inspection_no, a.item_no) as detailImageNum,
|
|
c.method_no,
|
|
c.method_name,
|
|
c.method_remark
|
|
FROM qc_fqc_detailed_record as a
|
|
LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
|
|
LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
|
|
WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
|
|
order by a.order_id
|
|
</select>
|
|
|
|
<!-- 删除FQC检验记录 -->
|
|
<delete id="deleteFQCRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_fqc_record
|
|
WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</delete>
|
|
|
|
<!-- 删除FQC明细记录信息 -->
|
|
<delete id="deleteFQCDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_fqc_detailed_record
|
|
WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</delete>
|
|
|
|
<!-- 删除FQC子明细记录信息 -->
|
|
<delete id="deleteFQCSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_fqc_sub_detail_record
|
|
WHERE site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</delete>
|
|
|
|
<!-- 修改FQC主记录信息 -->
|
|
<update id="updateFQCMasterRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fqc_record
|
|
SET disposal_measures = #{disposalMeasures},
|
|
disposal_remark = #{disposalRemark},
|
|
inspection_result = #{inspectionResult},
|
|
inspector_no = #{inspectorNo},
|
|
state = #{state},
|
|
inspection_remark = #{inspectionRemark},
|
|
inspector_date = getDate(),
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
roll_qty = #{rollQty,jdbcType=DECIMAL},
|
|
unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
|
|
pass_qty = #{passQty,jdbcType=DECIMAL},
|
|
not_pass_qty = #{notPassQty,jdbcType=DECIMAL},
|
|
batch_qualified_qty = #{batchQualifiedQty,jdbcType=DECIMAL},
|
|
submit_date = getDate()
|
|
WHERE site = #{site} and inspection_no = #{inspectionNo} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改FQC明细记录信息 -->
|
|
<update id="updateFQCDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fqc_detailed_record
|
|
SET item_result = #{itemResult},
|
|
unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
text_value = #{textValue},
|
|
number_value = #{numberValue,jdbcType=DECIMAL},
|
|
default_value = #{defaultValue},
|
|
min_value = #{minValue,jdbcType=DECIMAL},
|
|
max_value = #{maxValue,jdbcType=DECIMAL}
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改FQC主记录标识为已提交 -->
|
|
<update id="updateFQCMasterSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fqc_record
|
|
SET submit_flag = 'Y',
|
|
state = '已完成',
|
|
submit_date = getDate()
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改FAI明细记录标识为已提交 -->
|
|
<update id="updateFQCDetailSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fqc_detailed_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改子明细记录标识为已提交 -->
|
|
<update id="updateFQCSubDetailSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fqc_sub_detail_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 删除子明细的老数据 -->
|
|
<delete id="delFQCSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcSubDetailInformationData">
|
|
DELETE FROM qc_fqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 新增子明细信息 -->
|
|
<insert id="saveFQCSubDetailed">
|
|
INSERT INTO qc_fqc_sub_detail_record
|
|
(inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no, num, sub_detail_value_b, sub_detail_value_c, sub_detail_value_d, sub_detail_value_e)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo}, #{item.num}, #{item.subDetailValueB}, #{item.subDetailValueC}, #{item.subDetailValueD}, #{item.subDetailValueE})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 查询FQC的子明细 -->
|
|
<select id="selectFQCSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.SubDetailValues" resultType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
sub_detail_value,
|
|
sampling_location,
|
|
is_submit,
|
|
sampling_location_b,
|
|
num,
|
|
sub_detail_value_b,
|
|
sub_detail_value_c,
|
|
sub_detail_value_d,
|
|
sub_detail_value_e
|
|
FROM qc_fqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
<if test = "collectionDataContent != null and collectionDataContent != ''">
|
|
AND sub_detail_value ${collectionDataContent}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 查询FQC检验记录是否已提交 -->
|
|
<select id="checkFQCIsSubmit" parameterType="com.gaotao.modules.pms.data.SubDetailValues" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT submit_flag
|
|
FROM qc_fqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 查询FQC检验记录状态(用于保存前校验) -->
|
|
<select id="getFQCRecordStatus" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT submit_flag, state
|
|
FROM qc_fqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 获取该项目的子明细值 -->
|
|
<select id="selectFQCSubDetailValue" parameterType="string" resultType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
SELECT sub_detail_value,
|
|
sampling_location,
|
|
is_submit
|
|
FROM qc_fqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 生成FQC检验单号 -->
|
|
<select id="selectFQCInspectionNo" resultType="string" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,4,10))),0)+1),8)
|
|
FROM qc_fqc_record
|
|
WHERE site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 生成IPQC检验单号 -->
|
|
<select id="selectIPQCInspectionNo" resultType="string" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,5,10))),0)+1),8)
|
|
FROM qc_ipqc_record
|
|
WHERE site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 生成FAI检验单号 -->
|
|
<select id="selectFAIInspectionNo" resultType="string" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(inspection_no,4,10))),0)+1),8)
|
|
FROM qc_fai_record
|
|
WHERE site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 根据 site、po_orderNo、po_itemNo 从 view_po_order 中查出数据 -->
|
|
<select id="queryDataFromViewPoOrder" resultType="com.gaotao.modules.pms.data.PoOrderData" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
site,
|
|
order_no,
|
|
item_no,
|
|
part_no,
|
|
part_desc,
|
|
spec,
|
|
supplier_id,
|
|
supplier_name,
|
|
order_qty,
|
|
created_date,
|
|
status,
|
|
citem_code,
|
|
citem_class,
|
|
sendto_address,
|
|
order_type
|
|
FROM view_po_order
|
|
WHERE site = #{site} and order_no = #{poOrderNo} and item_no = #{poItemNo}
|
|
</select>
|
|
|
|
<!-- 向收货任务表里添加数据 -->
|
|
<insert id="saveReceivingTask" parameterType="com.gaotao.modules.pms.data.PoOrderData">
|
|
INSERT INTO receiving_task (site, order_no, item_no, part_no, part_desc, spec, supplier_id, supplier_name, order_qty, created_date, status, citem_code, citem_class, sendto_address, order_type, inspection_no, batch_no, production_date, expiration_warning_date, expiration_date)
|
|
VALUES (#{site}, #{orderNo}, #{itemNo}, #{partNo}, #{partDesc}, #{spec}, #{supplierId}, #{supplierName}, #{orderQty}, getDate(), #{status}, #{citemCode}, #{citemClass}, #{sendtoAddress}, #{orderType}, #{inspectionNo}, #{batchNo}, #{productionDate}, #{expirationWarningDate}, #{expirationDate})
|
|
</insert>
|
|
|
|
<!-- 检查动控是否开启 -->
|
|
<select id="queryController" parameterType="com.gaotao.modules.sys.entity.SysSceneDynamicControlModelEntity" resultType="com.gaotao.modules.sys.entity.SysSceneDynamicControlModelEntity">
|
|
SELECT
|
|
type,
|
|
base_data,
|
|
base_desc,
|
|
status,
|
|
remark,
|
|
third_type,
|
|
second_type,
|
|
page_control,
|
|
control_style
|
|
FROM sys_scene_dynamic_control_model
|
|
where site = #{site} and control_no = #{controlNo}
|
|
</select>
|
|
|
|
<!-- 查询检验模板列表 -->
|
|
<select id="queryTemplateList" resultType="com.gaotao.modules.pms.data.QcTemplateData" parameterType="com.gaotao.modules.pms.data.QcTemplateData">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
template_id as templateId,
|
|
template_name as templateName,
|
|
dbo.qc_get_inspection_type_name(site, inspection_type_no) as inspectionTypeName
|
|
FROM qc_template
|
|
<where>
|
|
site = #{site} and bu_no = #{buNo} and dbo.qc_get_inspection_type_name(site, inspection_type_no) = #{inspectionTypeName}
|
|
<if test = "templateId != null and templateId != ''">
|
|
AND template_id LIKE '%' + #{templateId}+'%'
|
|
</if>
|
|
<if test = "templateName != null and templateName != ''">
|
|
AND template_name LIKE '%' + #{templateName}+'%'
|
|
</if>
|
|
<if test = "inspectionTypeNo != null and inspectionTypeNo != ''">
|
|
AND inspection_type_no = #{inspectionTypeNo}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询检验模板列表 -->
|
|
<select id="getPartInformation" resultType="com.gaotao.modules.pms.data.QcFAIRecordData" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
select
|
|
partNo,
|
|
PartDescription as partDesc,
|
|
spec,
|
|
sku,
|
|
DefaultWarehouseID as defaultWarehouseId
|
|
from part
|
|
where site = #{site} and partNo = #{partNo}
|
|
</select>
|
|
|
|
<!-- 获取特殊工序列表 -->
|
|
<select id="getSpecialOperationList" resultType="com.gaotao.modules.pms.data.QcFAIRecordData" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
select
|
|
site,
|
|
operation_no,
|
|
operation_desc
|
|
from qc_special_task_operation
|
|
where site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取处置措施列表 -->
|
|
<select id="disposalMeasuresSearch" resultType="com.gaotao.modules.pms.data.QcFAIRecordData" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
id,
|
|
disposal_measures
|
|
FROM qc_disposal_measures
|
|
<where>
|
|
<if test = "inspectionTypeNo != '101'">
|
|
inspection_type != 'IPQC'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询文件路径 -->
|
|
<select id="searchItemFileUrl" resultType="com.gaotao.modules.oss.entity.SysOssEntity" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
id,
|
|
url,
|
|
file_name
|
|
FROM sys_oss
|
|
WHERE order_ref1 = #{site} and order_ref2 = #{inspectionNo} and order_ref3 = #{itemNo} and order_ref4 = #{buNo}
|
|
</select>
|
|
|
|
<!-- 删除图片-->
|
|
<delete id="imageDelete" parameterType="com.gaotao.modules.oss.entity.SysOssEntity">
|
|
DELETE FROM sys_oss
|
|
WHERE id = #{id}
|
|
</delete>
|
|
|
|
<!-- 模糊查询标签号 -->
|
|
<select id="getRollNo" resultType="com.gaotao.modules.pms.data.QcFAIRecordData" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT DISTINCT top 3
|
|
a.seqno,
|
|
a.orderno,
|
|
b.RollNo
|
|
FROM soscheduledrouting AS a
|
|
LEFT JOIN sfdc_rolls AS b ON a.site = b.site AND a.seqno = b.CreatedOpsSeqNo
|
|
WHERE a.site = #{site} and b.RollNo like '%' + #{rollNo} + '%'
|
|
</select>
|
|
|
|
<!-- 标签号回车事件 -->
|
|
<select id="rollNoEnter" resultType="com.gaotao.modules.pms.data.QcFAIRecordData" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.site,
|
|
a.seqno as seqNo,
|
|
a.orderno as orderNo,
|
|
b.RollNo,
|
|
#{inspectionTypeNo} as inspectionTypeNo
|
|
FROM soscheduledrouting AS a
|
|
LEFT JOIN sfdc_rolls AS b ON a.site = b.site AND a.seqno = b.CreatedOpsSeqNo
|
|
WHERE a.site = #{site} and b.RollNo = #{rollNo}
|
|
</select>
|
|
|
|
<!-- 查询物料列表 -->
|
|
<select id="queryPartList" resultType="com.gaotao.modules.pms.data.QcFAIRecordData" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
site,
|
|
partNo,
|
|
PartDescription as part_desc,
|
|
sku,
|
|
spec
|
|
FROM part
|
|
<where>
|
|
site = #{site}
|
|
<if test = "partNo != null and partNo != ''">
|
|
AND partNo LIKE '%' + #{partNo} + '%'
|
|
</if>
|
|
<if test = "partDesc != null and partDesc != ''">
|
|
AND PartDescription LIKE '%' + #{partDesc} + '%'
|
|
</if>
|
|
<if test = "sku != null and sku != ''">
|
|
AND sku LIKE '%' + #{sku} + '%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询单位列表 -->
|
|
<select id="umSearch" resultType="com.gaotao.modules.pms.data.QcFAIRecordData" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
site,
|
|
UMID as umId,
|
|
UMName as umName
|
|
FROM UM
|
|
WHERE site = #{site} and active = #{active}
|
|
</select>
|
|
|
|
<!-- 查询单位列表 -->
|
|
<select id="checkItem" resultType="com.gaotao.modules.pms.data.SubDetailValues" parameterType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
inspection_no,
|
|
item_no,
|
|
value_type_db,
|
|
min_value,
|
|
max_value
|
|
<if test = "flag == 'IPQC'">
|
|
FROM qc_ipqc_detailed_record
|
|
</if>
|
|
<if test = "flag == 'IQC'">
|
|
FROM qc_iqc_detailed_record
|
|
</if>
|
|
<if test = "flag == 'FQC'">
|
|
FROM qc_fqc_detailed_record
|
|
</if>
|
|
<if test = "flag == 'FAI'">
|
|
FROM qc_fai_detailed_record
|
|
</if>
|
|
WHERE site = #{site} and inspection_no = #{inspectionNo} and item_no = #{itemNo} and bu_no = #{buNo}
|
|
|
|
order by order_id
|
|
</select>
|
|
|
|
<!-- 修改detailFlag字段为N -->
|
|
<update id="updateIQCDetailFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_iqc_record
|
|
SET detail_flag = 'N'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<select id="searchSeqInfo" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.seqno,
|
|
a.orderno,
|
|
J.partNo,
|
|
J.PartDescription as partDesc,
|
|
j.PartType as invdefinetype,
|
|
t.lotsize,--订单数量
|
|
a.QtyReported, --完工数量
|
|
c.operationDesc,
|
|
sum(roll_qty) as sjzs, --送检总数
|
|
work_center_no,
|
|
a.S_ResourceID as resourceId,
|
|
D.ResourceDesc as resourceDesc
|
|
FROM shoporder T
|
|
INNER JOIN soscheduledrouting a ON a.site = t.site AND t.orderno = a.orderno
|
|
INNER JOIN SORouting c ON c.site = a.site and c.orderNo = a.orderno and a.itemno = c.itemNo
|
|
INNER JOIN WorkCenterResource D ON C.Site = D.SITE AND C.WorkCenterNo = D.WorkCenterNo AND a.S_ResourceID = D.ResourceID
|
|
INNER JOIN part J ON t.site = J.site AND t.partNo = J.partNo
|
|
left join qc_ipqc_record r on a.site = r.site and a.seqno = r.seq_no
|
|
WHERE
|
|
a.site = #{query.site} and J.bu_no = #{query.buNo}
|
|
<if test="query.status != null and query.status != ''">
|
|
AND t.status = #{query.status}
|
|
</if>
|
|
<if test="query.orderNo != null and query.orderNo != ''">
|
|
AND a.orderno LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test="query.seqNo != null and query.seqNo != ''">
|
|
AND a.seqno LIKE '%' + #{query.seqNo} + '%'
|
|
</if>
|
|
<if test="query.sku != null and query.sku != ''">
|
|
AND j.sku LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test="query.partNo != null and query.partNo != ''">
|
|
AND J.partNo LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test="query.partDesc != null and query.partDesc != ''">
|
|
AND J.PartDescription LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test="query.operationDesc != null and query.operationDesc != ''">
|
|
AND c.operationDesc LIKE '%' + #{query.operationDesc} + '%'
|
|
</if>
|
|
group by a.seqno, a.orderno, J.partNo, J.PartDescription, t.lotsize, a.QtyReported, c.operationDesc ,work_center_no ,PartType,a.S_ResourceID,D.ResourceDesc,C.ItemNo
|
|
</select>
|
|
<select id="searchPartInfo" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
select
|
|
partNo,
|
|
PartDescription as partDesc,
|
|
sku,
|
|
<!-- cinv_source_code,-->
|
|
bu_no
|
|
from
|
|
part
|
|
where
|
|
bu_no = #{query.buNo}
|
|
<if test="query.partNo != null and query.partNo != ''">
|
|
AND partNo LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test="query.partDesc != null and query.partDesc != ''">
|
|
AND PartDescription LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test="query.sku != null and query.sku != ''">
|
|
AND sku LIKE '%' + #{query.sku} + '%'
|
|
</if>
|
|
<if test="query.cinvSourceCode != null and query.cinvSourceCode != ''">
|
|
AND cinv_source_code LIKE '%' + #{query.cinvSourceCode} + '%'
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getInterfaceTimeData" parameterType="String" resultType="com.gaotao.modules.pms.data.InterfaceTimeData">
|
|
SELECT
|
|
id,
|
|
start_time,
|
|
end_time,
|
|
del_flag
|
|
FROM interface_time
|
|
WHERE del_flag = 'N' and site = #{site}
|
|
</select>
|
|
|
|
<update id="updateInterfaceTimeData" parameterType="com.gaotao.modules.pms.data.InterfaceTimeData">
|
|
UPDATE interface_time
|
|
set
|
|
updated_by = #{updatedBy},
|
|
updated_date = #{updatedDate},
|
|
del_flag = #{delFlag}
|
|
</update>
|
|
|
|
<select id="getInterfaceRdStyleData" parameterType="String" resultType="com.gaotao.modules.pms.data.RdStyleData">
|
|
SELECT
|
|
crdcode,
|
|
crdname,
|
|
iRdGrade,
|
|
rdtype,
|
|
brdend
|
|
FROM view_custdev_mes_rdstyle
|
|
WHERE crdname = #{crdName}
|
|
</select>
|
|
|
|
<insert id="insertHardtagPurchaseInStorageData" parameterType="com.gaotao.modules.pms.data.HardtagPurchaseInStorageCountData" useGeneratedKeys="true" keyProperty="id">
|
|
INSERT INTO purchase_in_storage_count
|
|
(site, trans_no, created_date, created_by, erp_flag, toacc, logindate, cordercode, cdepcode, cwhcode, crdcode, coutcode, ddate, bredvouch,
|
|
cmemo, verify, irowno, cinvcode, iquantity, citemcode, erp_remark, trans_date, csource, trans_type)
|
|
values (#{site}, #{transNo}, #{createdDate}, #{createdBy}, #{erpFlag}, #{toacc}, #{logindate}, #{cordercode}, #{cdepcode}, #{cwhcode}, #{crdcode}, #{coutcode}, #{ddate}, #{bredvouch},
|
|
#{cmemo}, #{verify}, #{irowno}, #{cinvcode}, #{iquantity}, #{citemcode}, #{erpRemark}, #{transDate}, #{csource}, #{transType})
|
|
</insert>
|
|
|
|
<insert id="batchSaveHrdtagTransHeader" parameterType="com.gaotao.modules.pms.data.HardtagTransHeaderData">
|
|
insert into TransHeader
|
|
(TransNo, Site, WarehouseID, TransDate, TransType_DB, TransType, UserName, Receiver, TransYear, TransMonth, PartnerID, PartnerType, AuthorizeFlag, AuthorizeDate, Authorizor, TransferFlag, TransferDate,
|
|
TransferGuys, VoucherDate, ProjectID, EnterDate, Remark, UseLocation, OrderRef1, LinkOrderFlag, DelAddID, Status, ProjectName, PartnerName, erp_warehouse_id, ERP,
|
|
department_no, picking_status, scan_type, inCategory, pmProject, remarks, item_no_mat, remark3, location_id, count_id)
|
|
values (#{TransNo}, #{Site}, #{WarehouseID}, #{TransDate}, #{TransTypeDB}, #{TransType}, #{UserName}, #{Receiver}, #{TransYear}, #{TransMonth}, #{PartnerID}, #{PartnerType}, #{AuthorizeFlag}, #{AuthorizeDate}, #{Authorizor}, #{TransferFlag}, #{TransferDate},
|
|
#{TransferGuys}, #{VoucherDate}, #{ProjectID}, #{EnterDate}, #{Remark}, #{UseLocation}, #{OrderRef1}, #{LinkOrderFlag}, #{DelAddID}, #{Status}, #{ProjectName}, #{PartnerName}, #{erpWarehouseId}, #{ERP},
|
|
#{departmentNo}, #{pickingStatus}, #{scanType}, #{inCategory}, #{pmProject}, #{remarks}, #{itemNoMat}, #{remark3}, #{locationId}, #{countId})
|
|
</insert>
|
|
|
|
<insert id="batchSaveHardtagTransDetail" parameterType="com.gaotao.modules.pms.data.HardtagTransDetailData">
|
|
INSERT INTO TransDetail
|
|
(TransNo, Site, PartNo, LocationID, TransQty, Direction, OrderRef1, ItemNo, OrderRef2, OrderRef3, OrderRef5, Remark, citem_code)
|
|
values
|
|
(#{TransNo}, #{Site}, #{PartNo}, #{LocationID}, #{TransQty}, #{Direction}, #{OrderRef1}, #{ItemNo}, #{OrderRef2}, #{OrderRef3}, #{OrderRef5}, #{Remark}, #{citemCode})
|
|
</insert>
|
|
|
|
<select id="getSendMailAddress" parameterType="String" resultType="com.gaotao.modules.pms.data.MailAddressData">
|
|
SELECT
|
|
id,
|
|
site,
|
|
bu_no,
|
|
mail_address,
|
|
send_type,
|
|
del_flag,
|
|
created_by,
|
|
created_date,
|
|
orderref1
|
|
FROM mailAddress
|
|
WHERE site = #{site} and send_type = #{type} and del_flag = 'N'
|
|
<if test="buNo != null and buNo != ''">
|
|
AND bu_no = #{buNo}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getSendMailFromAddress" resultType="com.gaotao.modules.pms.data.MailSendAddressData">
|
|
SELECT
|
|
port,
|
|
host,
|
|
username,
|
|
password,
|
|
emailForm,
|
|
timeout,
|
|
personal,
|
|
id
|
|
FROM mailSendAddress
|
|
where delFlag = 'N'
|
|
</select>
|
|
|
|
<!-- 新增发送邮件记录 -->
|
|
<insert id="saveSendMailRecord" parameterType="com.gaotao.modules.pms.data.SendMailRecord">
|
|
insert into send_mail_record
|
|
(site, bu_no, document_no, sender, recipient, send_date, type)
|
|
values
|
|
(#{site}, #{buNo}, #{documentNo}, #{sender}, #{recipient}, getDate(), #{type})
|
|
</insert>
|
|
|
|
<select id="orderTypeSearch" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT distinct
|
|
order_type
|
|
FROM view_po_order
|
|
</select>
|
|
|
|
<update id="actionIQCInspection" parameterType="com.gaotao.modules.pms.data.EamObjectInData">
|
|
update qc_iqc_record
|
|
set action_date = getDate(),
|
|
action_by = #{actionBy},
|
|
state = #{state}
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<update id="actionFAIInspection" parameterType="com.gaotao.modules.pms.data.EamObjectInData">
|
|
update qc_fai_record
|
|
set action_date = getDate(),
|
|
action_by = #{actionBy},
|
|
state = #{state}
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<update id="actionIPQCInspection" parameterType="com.gaotao.modules.pms.data.EamObjectInData">
|
|
update qc_ipqc_record
|
|
set action_date = getDate(),
|
|
action_by = #{actionBy},
|
|
state = #{state}
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<update id="actionFQCInspection" parameterType="com.gaotao.modules.pms.data.EamObjectInData">
|
|
update qc_fqc_record
|
|
set action_date = getDate(),
|
|
action_by = #{actionBy},
|
|
state = #{state}
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<insert id="addEquipmentDataAcquisition">
|
|
insert into Equipment_data_acquisition
|
|
(site, bu_no, equipment_no, inspection_no, create_date, create_by, item_no, collection_source, collection_method)
|
|
values
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.site}, #{item.buNo}, #{item.equipmentNo}, #{item.inspectionNo}, getDate(), #{item.actionBy}, #{item.itemNo}, #{item.collectionSource}, #{item.collectionMethod})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 新增人员信息 -->
|
|
<insert id="saveOperator" >
|
|
INSERT INTO eam_actual_operator
|
|
(site, order_no, function_type, operator, bu_no)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.site}, #{item.orderNo}, #{item.functionType}, #{item.operator}, #{item.buNo})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 删除之前的人员-->
|
|
<delete id="delOperator" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM eam_actual_operator
|
|
WHERE site = #{site} and order_no = #{inspectionNo} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<select id="getInspectionNo" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.EquipmentDataAcquisitionData">
|
|
select distinct
|
|
site,
|
|
bu_no,
|
|
equipment_no,
|
|
inspection_no,
|
|
item_no,
|
|
collection_source,
|
|
collection_method
|
|
from Equipment_data_acquisition
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<select id="getInspectionNoByItem" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.EquipmentDataAcquisitionData">
|
|
select distinct
|
|
site,
|
|
bu_no,
|
|
equipment_no,
|
|
inspection_no,
|
|
item_no,
|
|
collection_source,
|
|
collection_method
|
|
from Equipment_data_acquisition
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo} and item_no = #{itemNo}
|
|
</select>
|
|
|
|
<select id="dataAcquisition" parameterType="com.gaotao.modules.pms.data.EquipmentDataAcquisitionData" resultType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
select
|
|
id,
|
|
site,
|
|
bu_no,
|
|
#{inspectionNo} as inspectionNo,
|
|
#{itemNo} as itemNo,
|
|
<if test='subDetailValueType == 0'>
|
|
${collectionSource} as subDetailValue,
|
|
</if>
|
|
<if test='subDetailValueType == 1'>
|
|
${collectionSource} as subDetailValueB,
|
|
</if>
|
|
<if test='subDetailValueType == 2'>
|
|
${collectionSource} as subDetailValueC,
|
|
</if>
|
|
<if test='subDetailValueType == 3'>
|
|
${collectionSource} as subDetailValueD,
|
|
</if>
|
|
<if test='subDetailValueType == 4'>
|
|
${collectionSource} as subDetailValueE,
|
|
</if>
|
|
num,
|
|
#{collectionSource} as collectionSource,
|
|
#{collectionMethod} as collectionMethod
|
|
from Equipment_data_detail
|
|
where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo} and ${collectionSource} is not null and ${collectionSource} <![CDATA[<>]]> ''
|
|
<if test='collectionMethod == "plc"'>
|
|
AND inspection_no = #{inspectionNo}
|
|
</if>
|
|
<if test='collectionMethod == "RS232"'>
|
|
AND (inspection_no is null or inspection_no = '')
|
|
</if>
|
|
<if test = "collectionDataContent != null and collectionDataContent != ''">
|
|
AND ${collectionSource} ${collectionDataContent}
|
|
</if>
|
|
and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo})
|
|
</select>
|
|
|
|
<select id="dataAcquisitionB" parameterType="com.gaotao.modules.pms.data.EquipmentDataAcquisitionData" resultType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
select
|
|
id,
|
|
site,
|
|
bu_no,
|
|
#{inspectionNo} as inspectionNo,
|
|
#{itemNo} as itemNo,
|
|
${collectionSource} as subDetailValueB,
|
|
num,
|
|
#{collectionSource} as collectionSource
|
|
from Equipment_data_detail
|
|
where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo} and ${collectionSource} is not null and ${collectionSource} <![CDATA[<>]]> ''
|
|
<if test='collectionMethod == "plc"'>
|
|
AND inspection_no = #{inspectionNo}
|
|
</if>
|
|
<if test='collectionMethod == "RS232"'>
|
|
AND (inspection_no is null or inspection_no = '')
|
|
</if>
|
|
and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo})
|
|
</select>
|
|
|
|
<select id="dataAcquisition2" parameterType="com.gaotao.modules.pms.data.EquipmentDataAcquisitionData" resultType="com.gaotao.modules.oss.entity.SysOssEntity">
|
|
select
|
|
site as orderRef1,
|
|
bu_no as orderRef4,
|
|
#{inspectionNo} as orderRef2,
|
|
#{itemNo} as orderRef3,
|
|
${collectionSource} as url
|
|
from Equipment_data_detail
|
|
where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo} and ${collectionSource} is not null and ${collectionSource} <![CDATA[<>]]> ''
|
|
and batch_no = (select MAX(batch_no) from Equipment_data_detail where site = #{site} and bu_no = #{buNo} and equipment_no = #{equipmentNo})
|
|
</select>
|
|
|
|
<select id="getIQCDetail" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.EquipmentDataAcquisitionData">
|
|
select
|
|
a.site,
|
|
a.bu_no,
|
|
b.collection_condition as equipmentNo,
|
|
#{inspectionNo} as inspectionNo,
|
|
a.item_no,
|
|
b.collection_source,
|
|
#{actionBy} as actionBy,
|
|
b.collection_method
|
|
from qc_iqc_detailed_record as a
|
|
left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
|
|
where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '105' and b.collection_flag = 'Y'
|
|
order by a.order_id
|
|
</select>
|
|
|
|
<select id="getFAIDetail" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.EquipmentDataAcquisitionData">
|
|
select
|
|
a.site,
|
|
a.bu_no,
|
|
b.collection_condition as equipmentNo,
|
|
#{inspectionNo} as inspectionNo,
|
|
a.item_no,
|
|
b.collection_source,
|
|
#{actionBy} as actionBy,
|
|
b.collection_method
|
|
from qc_fai_detailed_record as a
|
|
left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
|
|
where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '106' and b.collection_flag = 'Y'
|
|
order by order_id
|
|
|
|
</select>
|
|
|
|
<select id="getIPQCDetail" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.EquipmentDataAcquisitionData">
|
|
select
|
|
a.site,
|
|
a.bu_no,
|
|
b.collection_condition as equipmentNo,
|
|
#{inspectionNo} as inspectionNo,
|
|
a.item_no,
|
|
b.collection_source,
|
|
#{actionBy} as actionBy,
|
|
b.collection_method
|
|
from qc_ipqc_detailed_record as a
|
|
left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
|
|
where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '101' and b.collection_flag = 'Y'
|
|
order by a.order_id
|
|
</select>
|
|
|
|
<select id="getFQCDetail" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.EquipmentDataAcquisitionData">
|
|
select
|
|
a.site,
|
|
a.bu_no,
|
|
b.collection_condition as equipmentNo,
|
|
#{inspectionNo} as inspectionNo,
|
|
a.item_no,
|
|
b.collection_source,
|
|
#{actionBy} as actionBy,
|
|
b.collection_method
|
|
from qc_fqc_detailed_record as a
|
|
left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
|
|
where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '107' and b.collection_flag = 'Y'
|
|
order by a.order_id
|
|
</select>
|
|
|
|
<select id="querySubDetails" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
select
|
|
b.site,
|
|
b.bu_no,
|
|
b.inspection_no,
|
|
b.item_no,
|
|
b.default_value,
|
|
b.min_value,
|
|
b.max_value,
|
|
b.value_type_db,
|
|
a.sub_detail_value
|
|
<if test="flag == 'iqc'">
|
|
from qc_iqc_sub_detail_record as a
|
|
left join qc_iqc_detailed_record as b on a.site = b.site and a.bu_no = b.bu_no and a.inspection_no = b.inspection_no and a.item_no = b.item_no
|
|
</if>
|
|
<if test="flag == 'ipqc'">
|
|
from qc_ipqc_sub_detail_record as a
|
|
left join qc_ipqc_detailed_record as b on a.site = b.site and a.bu_no = b.bu_no and a.inspection_no = b.inspection_no and a.item_no = b.item_no
|
|
</if>
|
|
<if test="flag == 'fqc'">
|
|
from qc_fqc_sub_detail_record as a
|
|
left join qc_fqc_detailed_record as b on a.site = b.site and a.bu_no = b.bu_no and a.inspection_no = b.inspection_no and a.item_no = b.item_no
|
|
</if>
|
|
<if test="flag == 'fai'">
|
|
from qc_fai_sub_detail_record as a
|
|
left join qc_fai_detailed_record as b on a.site = b.site and a.bu_no = b.bu_no and a.inspection_no = b.inspection_no and a.item_no = b.item_no
|
|
</if>
|
|
where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and a.item_no = #{itemNo}
|
|
order by b.order_id
|
|
</select>
|
|
|
|
<insert id="saveFileList">
|
|
INSERT INTO sys_oss
|
|
(url, create_date, file_name, new_file_name, order_ref1, order_ref2, order_ref3, order_ref4)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.url}, getDate(), #{item.fileName}, #{item.newFileName}, #{item.orderRef1}, #{item.orderRef2}, #{item.orderRef3}, #{item.orderRef4})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="getEquipmentNoList" parameterType="com.gaotao.modules.pms.data.EquipmentFolderLocationData" resultType="com.gaotao.modules.pms.data.EquipmentFolderLocationData">
|
|
select
|
|
equipment_no
|
|
from Equipment_folder_location
|
|
where site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 获取责任人员列表 -->
|
|
<select id="getResponsibleOperatorList" resultType="com.gaotao.modules.pms.data.EamAdminData" parameterType="com.gaotao.modules.pms.data.EamAdminData">
|
|
SELECT
|
|
operator_id as adminID,
|
|
operator_name as adminName
|
|
FROM operator
|
|
<where>
|
|
site in (select site from AccessSite where userID = #{userName})
|
|
<if test = "adminID != null and adminID != ''">
|
|
AND operator_id LIKE '%' + #{adminID} + '%'
|
|
</if>
|
|
<if test = "adminName != null and adminName != ''">
|
|
AND operator_name LIKE '%' + #{adminName} + '%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getDataContentList" parameterType="com.gaotao.modules.pms.data.QcCollectionDataContentData" resultType="com.gaotao.modules.pms.data.QcCollectionDataContentData">
|
|
select
|
|
content_desc
|
|
from qc_collection_data_content
|
|
where site = #{site} and bu_no = #{buNo} and active = 'Y'
|
|
</select>
|
|
|
|
<select id="getItemCollectionDataContent" parameterType="com.gaotao.modules.pms.data.SubDetailValues" resultType="string">
|
|
select
|
|
collection_data_content
|
|
from eam_properties_item
|
|
where site = #{site} and bu_no = #{buNo} and ItemNo = #{itemNo}
|
|
</select>
|
|
|
|
<!-- 获取当前项目不包含的设备 -->
|
|
<select id="getObjectList1" resultType="com.gaotao.modules.pms.data.EamObjectInData" parameterType="com.gaotao.modules.pms.data.EamObjectInData">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.ObjectID,
|
|
a.ObjectDesc
|
|
FROM eam_object as a
|
|
left join qc_item_object as b on a.site = b.site and a.bu_no = b.bu_no and a.ObjectID = b.ObjectID and b.ItemNo = #{itemNo}
|
|
where a.site = #{site} and a.bu_no = #{buNo} and b.ItemNo is null and a.active = 'Y'
|
|
</select>
|
|
|
|
<!-- 获取当前项目所包含的设备 -->
|
|
<select id="getObjectList2" resultType="com.gaotao.modules.pms.data.EamObjectInData" parameterType="com.gaotao.modules.pms.data.EamObjectInData">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.ObjectID,
|
|
b.ObjectDesc,
|
|
a.default_flag
|
|
FROM qc_item_object a
|
|
LEFT JOIN eam_object b ON a.site = b.site and a.bu_no = b.bu_no and a.ObjectID = b.ObjectID
|
|
WHERE a.site = #{site} and a.bu_no = #{buNo} and a.ItemNo = #{itemNo}
|
|
</select>
|
|
|
|
<!-- 获取当前项目不包含的设备 -->
|
|
<select id="getObjectListBy" resultType="com.gaotao.modules.pms.data.EamObjectInData" parameterType="com.gaotao.modules.pms.data.EamObjectInData">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.ObjectID,
|
|
a.ObjectDesc
|
|
FROM eam_object as a
|
|
left join qc_item_object as b on a.site = b.site and a.bu_no = b.bu_no and a.ObjectID = b.ObjectID and b.ItemNo = #{itemNo}
|
|
<where>
|
|
a.site = #{site} and a.bu_no = #{buNo} and b.ItemNo is null and a.active = 'Y'
|
|
<if test = "objectID != null and objectID != ''">
|
|
AND a.ObjectID LIKE '%' + #{objectID} + '%'
|
|
</if>
|
|
<if test = "objectDesc != null and objectDesc != ''">
|
|
AND a.ObjectDesc LIKE '%' + #{objectDesc} + '%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 新增项目设备 -->
|
|
<insert id="addItemObject">
|
|
INSERT INTO qc_item_object
|
|
(site, bu_no, ItemNo, ObjectID, default_flag)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.site}, #{item.buNo}, #{item.itemNo}, #{item.objectID}, #{item.defaultFlag})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<delete id="deleteItemObject">
|
|
DELETE FROM qc_item_object
|
|
WHERE
|
|
<foreach collection="list" item="item" separator=" or " index="index">
|
|
(site = #{item.site} and bu_no = #{item.buNo} and ItemNo = #{item.itemNo} and ObjectID = #{item.objectID})
|
|
</foreach>
|
|
</delete>
|
|
|
|
<update id="updateItemObject">
|
|
UPDATE qc_item_object
|
|
SET default_flag = #{defaultFlag}
|
|
WHERE site = #{site} and bu_no = #{buNo} and ItemNo = #{itemNo} and ObjectID = #{objectID}
|
|
</update>
|
|
|
|
<select id="getIQCInspectionDetail" parameterType="com.gaotao.modules.pms.data.EamObjectInData" resultType="com.gaotao.modules.pms.data.EamObjectInData">
|
|
select
|
|
a.site,
|
|
a.bu_no,
|
|
a.inspection_no,
|
|
a.item_no,
|
|
a.item_desc,
|
|
b.collection_source,
|
|
b.collection_method
|
|
from qc_iqc_detailed_record as a
|
|
left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
|
|
where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '105' and b.collection_flag = 'Y'
|
|
order by a.order_id
|
|
</select>
|
|
|
|
<select id="getFAIInspectionDetail" parameterType="com.gaotao.modules.pms.data.EamObjectInData" resultType="com.gaotao.modules.pms.data.EamObjectInData">
|
|
select
|
|
a.site,
|
|
a.bu_no,
|
|
a.inspection_no,
|
|
a.item_no,
|
|
a.item_desc,
|
|
b.collection_source,
|
|
b.collection_method
|
|
from qc_fai_detailed_record as a
|
|
left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
|
|
where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '106' and b.collection_flag = 'Y'
|
|
order by a.order_id
|
|
</select>
|
|
|
|
<select id="getFQCInspectionDetail" parameterType="com.gaotao.modules.pms.data.EamObjectInData" resultType="com.gaotao.modules.pms.data.EamObjectInData">
|
|
select
|
|
a.site,
|
|
a.bu_no,
|
|
a.inspection_no,
|
|
a.item_no,
|
|
a.item_desc,
|
|
b.collection_source,
|
|
b.collection_method
|
|
from qc_fqc_detailed_record as a
|
|
left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
|
|
where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '107' and b.collection_flag = 'Y'
|
|
order by a.order_id
|
|
</select>
|
|
|
|
<select id="getIPQCInspectionDetail" parameterType="com.gaotao.modules.pms.data.EamObjectInData" resultType="com.gaotao.modules.pms.data.EamObjectInData">
|
|
select
|
|
a.site,
|
|
a.bu_no,
|
|
a.inspection_no,
|
|
a.item_no,
|
|
a.item_desc,
|
|
b.collection_source,
|
|
b.collection_method
|
|
from qc_ipqc_detailed_record as a
|
|
left join eam_properties_item as b on a.site = b.site and a.bu_no = b.bu_no and a.item_no = b.ItemNo
|
|
where a.site = #{site} and a.bu_no = #{buNo} and a.inspection_no = #{inspectionNo} and b.ItemType = 'D' and b.inspection_type_no = '101' and b.collection_flag = 'Y'
|
|
order by a.order_id
|
|
</select>
|
|
|
|
<delete id="deleteEquipmentDataAcquisition" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
delete from Equipment_data_acquisition
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</delete>
|
|
|
|
<!-- IPQC检验项目操作相关SQL -->
|
|
<!-- 查询可选的IPQC检验项目(未添加到当前检验单的) -->
|
|
<select id="getIPQCAvailableItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT
|
|
ItemNo as itemNo,
|
|
ItemDesc as itemDesc,
|
|
DefaultValue as defaultValue,
|
|
MaxValue as maxValue,
|
|
MinValue as minValue,
|
|
ValueType as valueType,
|
|
ValueType_DB as valueTypeDb
|
|
FROM eam_properties_item
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_type_no = '101'
|
|
<if test="itemNo != null and itemNo != ''">
|
|
AND ItemNo LIKE '%' + #{itemNo} + '%'
|
|
</if>
|
|
<if test="itemDesc != null and itemDesc != ''">
|
|
AND ItemDesc LIKE '%' + #{itemDesc} + '%'
|
|
</if>
|
|
AND ItemNo NOT IN (
|
|
SELECT item_no
|
|
FROM qc_ipqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
)
|
|
ORDER BY ItemNo
|
|
</select>
|
|
|
|
<!-- 查询已有的IPQC检验项目(当前检验单已添加的) -->
|
|
<select id="getIPQCSelectedItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT
|
|
d.item_no as itemNo,
|
|
d.item_desc as itemDesc
|
|
FROM qc_ipqc_detailed_record d
|
|
WHERE d.site = #{site}
|
|
AND d.bu_no = #{buNo}
|
|
AND d.inspection_no = #{inspectionNo}
|
|
ORDER BY d.item_no
|
|
</select>
|
|
|
|
<!-- 查询当前检验单已有的项目(用于获取template_id) -->
|
|
<select id="getExistingIPQCItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT TOP 1
|
|
template_id as templateId,
|
|
item_no as itemNo,
|
|
item_desc as itemDesc
|
|
FROM qc_ipqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
ORDER BY item_no
|
|
</select>
|
|
|
|
<!-- 插入IPQC检验项目明细 -->
|
|
<insert id="insertIPQCItemDetail" parameterType="java.util.Map">
|
|
INSERT INTO qc_ipqc_detailed_record (
|
|
inspection_no,
|
|
order_no,
|
|
template_id,
|
|
item_no,
|
|
item_desc,
|
|
default_value,
|
|
min_value,
|
|
max_value,
|
|
value_type_db,
|
|
value_type,
|
|
site,
|
|
bu_no,
|
|
foreign_flag,
|
|
order_id
|
|
) VALUES (
|
|
#{inspectionNo},
|
|
#{orderNo},
|
|
#{templateId},
|
|
#{itemNo},
|
|
#{itemDesc},
|
|
#{defaultValue},
|
|
#{minValue},
|
|
#{maxValue},
|
|
#{valueTypeDb},
|
|
#{valueType},
|
|
#{site},
|
|
#{buNo},
|
|
#{foreignFlag},
|
|
#{orderId}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 获取检验单中最大的order_id -->
|
|
<select id="getMaxOrderIdForIPQC" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
SELECT ISNULL(MAX(order_id), 0)
|
|
FROM qc_ipqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<!-- 删除IPQC检验项目明细 -->
|
|
<delete id="deleteIPQCItemDetail" parameterType="java.util.Map">
|
|
DELETE FROM qc_ipqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
AND item_no = #{itemNo}
|
|
</delete>
|
|
|
|
<!-- 删除IPQC检验项目的子明细 -->
|
|
<delete id="deleteIPQCSubDetailByItem" parameterType="java.util.Map">
|
|
DELETE FROM qc_ipqc_sub_detail_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
AND item_no = #{itemNo}
|
|
</delete>
|
|
|
|
<!-- IPQC模板导入相关SQL -->
|
|
<!-- 查询IPQC模板列表 -->
|
|
<select id="getIPQCTemplateList" parameterType="java.util.Map" resultType="java.util.HashMap">
|
|
SELECT
|
|
t.template_id as templateId,
|
|
t.template_name as templateName,
|
|
t.template_remark as remark,
|
|
(SELECT COUNT(*) FROM qc_template_detailed d
|
|
WHERE d.site = t.site AND d.bu_no = t.bu_no AND d.template_id = t.template_id) as itemCount
|
|
FROM qc_template t
|
|
WHERE t.site = #{site}
|
|
AND t.bu_no = #{buNo}
|
|
AND t.inspection_type_no = '101'
|
|
<if test="templateId != null and templateId != ''">
|
|
AND t.template_id LIKE '%' + #{templateId} + '%'
|
|
</if>
|
|
<if test="templateDesc != null and templateDesc != ''">
|
|
AND t.template_name LIKE '%' + #{templateDesc} + '%'
|
|
</if>
|
|
ORDER BY t.template_id
|
|
</select>
|
|
|
|
<!-- 查询模板的所有检验项目(按order_id排序) -->
|
|
<select id="getTemplateItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT
|
|
d.ItemNo as itemNo,
|
|
p.ItemDesc as itemDesc,
|
|
d.default_value as defaultValue,
|
|
d.max_value as maxValue,
|
|
d.min_value as minValue,
|
|
p.ValueType as valueType,
|
|
p.ValueType_DB as valueTypeDb,
|
|
d.order_id as orderId
|
|
FROM qc_template_detailed d
|
|
LEFT JOIN eam_properties_item p
|
|
ON d.site = p.site
|
|
AND d.bu_no = p.bu_no
|
|
AND d.ItemNo = p.ItemNo
|
|
WHERE d.site = #{site}
|
|
AND d.bu_no = #{buNo}
|
|
AND d.template_id = #{templateId}
|
|
ORDER BY COALESCE(d.order_id, 99999) ASC, d.ItemNo ASC
|
|
</select>
|
|
|
|
<!-- 查询检验单已有的项目编码列表 -->
|
|
<select id="getExistingItemNos" parameterType="java.util.Map" resultType="java.lang.String">
|
|
SELECT item_no
|
|
FROM qc_ipqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<!-- ======================== IQC检验项目操作和模板导入 ======================== -->
|
|
<!-- 查询IQC可选的检验项目 -->
|
|
<select id="getIQCAvailableItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT
|
|
ItemNo as itemNo,
|
|
ItemDesc as itemDesc,
|
|
DefaultValue as defaultValue,
|
|
MaxValue as maxValue,
|
|
MinValue as minValue,
|
|
ValueType as valueType,
|
|
ValueType_DB as valueTypeDb
|
|
FROM eam_properties_item
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_type_no = '105'
|
|
<if test="itemNo != null and itemNo != ''">
|
|
AND ItemNo LIKE '%' + #{itemNo} + '%'
|
|
</if>
|
|
<if test="itemDesc != null and itemDesc != ''">
|
|
AND ItemDesc LIKE '%' + #{itemDesc} + '%'
|
|
</if>
|
|
AND ItemNo NOT IN (
|
|
SELECT item_no
|
|
FROM qc_iqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
)
|
|
ORDER BY ItemNo
|
|
</select>
|
|
|
|
<!-- 查询IQC已选的检验项目 -->
|
|
<select id="getIQCSelectedItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT
|
|
d.item_no as itemNo,
|
|
d.item_desc as itemDesc
|
|
FROM qc_iqc_detailed_record d
|
|
WHERE d.site = #{site}
|
|
AND d.bu_no = #{buNo}
|
|
AND d.inspection_no = #{inspectionNo}
|
|
ORDER BY d.item_no
|
|
</select>
|
|
|
|
<!-- 查询当前IQC检验单已有的项目 -->
|
|
<select id="getExistingIQCItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT TOP 1
|
|
template_id as templateId,
|
|
item_no as itemNo,
|
|
foreign_flag as foreignFlag
|
|
FROM qc_iqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<!-- 插入IQC检验项目 -->
|
|
<insert id="insertIQCItemDetail" parameterType="java.util.Map">
|
|
INSERT INTO qc_iqc_detailed_record (
|
|
inspection_no,
|
|
template_id,
|
|
item_no,
|
|
item_desc,
|
|
default_value,
|
|
min_value,
|
|
max_value,
|
|
value_type_db,
|
|
value_type,
|
|
site,
|
|
bu_no,
|
|
foreign_flag,
|
|
order_id
|
|
) VALUES (
|
|
#{inspectionNo},
|
|
#{templateId},
|
|
#{itemNo},
|
|
(SELECT ItemDesc FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT DefaultValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT MinValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT MaxValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT ValueType_DB FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT ValueType FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
#{site},
|
|
#{buNo},
|
|
#{foreignFlag},
|
|
#{orderId}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 获取IQC检验单中最大的order_id -->
|
|
<select id="getMaxOrderIdForIQC" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
SELECT ISNULL(MAX(order_id), 0)
|
|
FROM qc_iqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<!-- 删除IQC检验项目 -->
|
|
<delete id="deleteIQCItemDetail" parameterType="java.util.Map">
|
|
DELETE FROM qc_iqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
AND item_no = #{itemNo}
|
|
</delete>
|
|
|
|
<!-- 删除IQC检验项目的子明细 -->
|
|
<delete id="deleteIQCSubDetailByItem" parameterType="java.util.Map">
|
|
DELETE FROM qc_iqc_sub_detail_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
AND item_no = #{itemNo}
|
|
</delete>
|
|
|
|
<!-- 查询IQC模板列表 -->
|
|
<select id="getIQCTemplateList" parameterType="java.util.Map" resultType="java.util.HashMap">
|
|
SELECT
|
|
t.template_id as templateId,
|
|
t.template_name as templateName,
|
|
t.template_remark as remark,
|
|
(SELECT COUNT(*) FROM qc_template_detailed d
|
|
WHERE d.site = t.site AND d.bu_no = t.bu_no AND d.template_id = t.template_id) as itemCount
|
|
FROM qc_template t
|
|
WHERE t.site = #{site}
|
|
AND t.bu_no = #{buNo}
|
|
AND t.inspection_type_no = '105'
|
|
<if test="templateId != null and templateId != ''">
|
|
AND t.template_id LIKE '%' + #{templateId} + '%'
|
|
</if>
|
|
<if test="templateDesc != null and templateDesc != ''">
|
|
AND t.template_name LIKE '%' + #{templateDesc} + '%'
|
|
</if>
|
|
ORDER BY t.template_id
|
|
</select>
|
|
|
|
<!-- 查询IQC检验单已有的项目编码 -->
|
|
<select id="getExistingIQCItemNos" parameterType="java.util.Map" resultType="java.lang.String">
|
|
SELECT item_no
|
|
FROM qc_iqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<!-- ======================== FQC检验项目操作和模板导入 ======================== -->
|
|
<!-- 查询FQC可选的检验项目 -->
|
|
<select id="getFQCAvailableItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT
|
|
ItemNo as itemNo,
|
|
ItemDesc as itemDesc,
|
|
DefaultValue as defaultValue,
|
|
MaxValue as maxValue,
|
|
MinValue as minValue,
|
|
ValueType as valueType,
|
|
ValueType_DB as valueTypeDb
|
|
FROM eam_properties_item
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_type_no = '107'
|
|
<if test="itemNo != null and itemNo != ''">
|
|
AND ItemNo LIKE '%' + #{itemNo} + '%'
|
|
</if>
|
|
<if test="itemDesc != null and itemDesc != ''">
|
|
AND ItemDesc LIKE '%' + #{itemDesc} + '%'
|
|
</if>
|
|
AND ItemNo NOT IN (
|
|
SELECT item_no
|
|
FROM qc_fqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
)
|
|
ORDER BY ItemNo
|
|
</select>
|
|
|
|
<!-- 查询FQC已选的检验项目 -->
|
|
<select id="getFQCSelectedItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT
|
|
d.item_no as itemNo,
|
|
d.item_desc as itemDesc
|
|
FROM qc_fqc_detailed_record d
|
|
WHERE d.site = #{site}
|
|
AND d.bu_no = #{buNo}
|
|
AND d.inspection_no = #{inspectionNo}
|
|
ORDER BY d.item_no
|
|
</select>
|
|
|
|
<!-- 查询当前FQC检验单已有的项目 -->
|
|
<select id="getExistingFQCItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT TOP 1
|
|
template_id as templateId,
|
|
item_no as itemNo,
|
|
foreign_flag as foreignFlag
|
|
FROM qc_fqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<!-- 插入FQC检验项目 -->
|
|
<insert id="insertFQCItemDetail" parameterType="java.util.Map">
|
|
INSERT INTO qc_fqc_detailed_record (
|
|
inspection_no,
|
|
template_id,
|
|
item_no,
|
|
item_desc,
|
|
default_value,
|
|
min_value,
|
|
max_value,
|
|
value_type_db,
|
|
value_type,
|
|
site,
|
|
bu_no,
|
|
foreign_flag,
|
|
order_id
|
|
) VALUES (
|
|
#{inspectionNo},
|
|
#{templateId},
|
|
#{itemNo},
|
|
(SELECT ItemDesc FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT DefaultValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT MinValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT MaxValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT ValueType_DB FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT ValueType FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
#{site},
|
|
#{buNo},
|
|
#{foreignFlag},
|
|
#{orderId}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 获取FQC检验单中最大的order_id -->
|
|
<select id="getMaxOrderIdForFQC" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
SELECT ISNULL(MAX(order_id), 0)
|
|
FROM qc_fqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<!-- 删除FQC检验项目 -->
|
|
<delete id="deleteFQCItemDetail" parameterType="java.util.Map">
|
|
DELETE FROM qc_fqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
AND item_no = #{itemNo}
|
|
</delete>
|
|
|
|
<!-- 删除FQC检验项目的子明细 -->
|
|
<delete id="deleteFQCSubDetailByItem" parameterType="java.util.Map">
|
|
DELETE FROM qc_fqc_sub_detail_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
AND item_no = #{itemNo}
|
|
</delete>
|
|
|
|
<!-- 查询FQC模板列表 -->
|
|
<select id="getFQCTemplateList" parameterType="java.util.Map" resultType="java.util.HashMap">
|
|
SELECT
|
|
t.template_id as templateId,
|
|
t.template_name as templateName,
|
|
t.template_remark as remark,
|
|
(SELECT COUNT(*) FROM qc_template_detailed d
|
|
WHERE d.site = t.site AND d.bu_no = t.bu_no AND d.template_id = t.template_id) as itemCount
|
|
FROM qc_template t
|
|
WHERE t.site = #{site}
|
|
AND t.bu_no = #{buNo}
|
|
AND t.inspection_type_no = '107'
|
|
<if test="templateId != null and templateId != ''">
|
|
AND t.template_id LIKE '%' + #{templateId} + '%'
|
|
</if>
|
|
<if test="templateDesc != null and templateDesc != ''">
|
|
AND t.template_name LIKE '%' + #{templateDesc} + '%'
|
|
</if>
|
|
ORDER BY t.template_id
|
|
</select>
|
|
|
|
<!-- 查询FQC检验单已有的项目编码 -->
|
|
<select id="getExistingFQCItemNos" parameterType="java.util.Map" resultType="java.lang.String">
|
|
SELECT item_no
|
|
FROM qc_fqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<!-- ======================== OQC检验项目操作和模板导入 ======================== -->
|
|
<!-- 查询OQC可选的检验项目 -->
|
|
<select id="getOQCAvailableItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT
|
|
ItemNo as itemNo,
|
|
ItemDesc as itemDesc,
|
|
DefaultValue as defaultValue,
|
|
MaxValue as maxValue,
|
|
MinValue as minValue,
|
|
ValueType as valueType,
|
|
ValueType_DB as valueTypeDb
|
|
FROM eam_properties_item
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_type_no = '109'
|
|
<if test="itemNo != null and itemNo != ''">
|
|
AND ItemNo LIKE '%' + #{itemNo} + '%'
|
|
</if>
|
|
<if test="itemDesc != null and itemDesc != ''">
|
|
AND ItemDesc LIKE '%' + #{itemDesc} + '%'
|
|
</if>
|
|
AND ItemNo NOT IN (
|
|
SELECT item_no
|
|
FROM qc_oqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
)
|
|
ORDER BY ItemNo
|
|
</select>
|
|
|
|
<!-- 查询OQC已选的检验项目 -->
|
|
<select id="getOQCSelectedItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT
|
|
d.item_no as itemNo,
|
|
d.item_desc as itemDesc
|
|
FROM qc_oqc_detailed_record d
|
|
WHERE d.site = #{site}
|
|
AND d.bu_no = #{buNo}
|
|
AND d.inspection_no = #{inspectionNo}
|
|
ORDER BY d.item_no
|
|
</select>
|
|
|
|
<!-- 查询当前OQC检验单已有的项目 -->
|
|
<select id="getExistingOQCItems" parameterType="java.util.Map" resultType="com.gaotao.modules.pms.data.EamPropertiesItemData">
|
|
SELECT TOP 1
|
|
template_id as templateId,
|
|
item_no as itemNo,
|
|
foreign_flag as foreignFlag
|
|
FROM qc_oqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<!-- 插入OQC检验项目 -->
|
|
<insert id="insertOQCItemDetail" parameterType="java.util.Map">
|
|
INSERT INTO qc_oqc_detailed_record (
|
|
inspection_no,
|
|
template_id,
|
|
item_no,
|
|
item_desc,
|
|
default_value,
|
|
min_value,
|
|
max_value,
|
|
value_type_db,
|
|
value_type,
|
|
site,
|
|
bu_no,
|
|
foreign_flag,
|
|
order_id
|
|
) VALUES (
|
|
#{inspectionNo},
|
|
#{templateId},
|
|
#{itemNo},
|
|
(SELECT ItemDesc FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT DefaultValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT MinValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT MaxValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT ValueType_DB FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
(SELECT ValueType FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}),
|
|
#{site},
|
|
#{buNo},
|
|
#{foreignFlag},
|
|
#{orderId}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 获取OQC检验单中最大的order_id -->
|
|
<select id="getMaxOrderIdForOQC" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
SELECT ISNULL(MAX(order_id), 0)
|
|
FROM qc_oqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<!-- 删除OQC检验项目 -->
|
|
<delete id="deleteOQCItemDetail" parameterType="java.util.Map">
|
|
DELETE FROM qc_oqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
AND item_no = #{itemNo}
|
|
</delete>
|
|
|
|
<!-- 删除OQC检验项目的子明细 -->
|
|
<delete id="deleteOQCSubDetailByItem" parameterType="java.util.Map">
|
|
DELETE FROM qc_oqc_sub_detail_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
AND item_no = #{itemNo}
|
|
</delete>
|
|
|
|
<!-- 查询OQC模板列表 -->
|
|
<select id="getOQCTemplateList" parameterType="java.util.Map" resultType="java.util.HashMap">
|
|
SELECT
|
|
t.template_id as templateId,
|
|
t.template_name as templateName,
|
|
t.template_remark as remark,
|
|
(SELECT COUNT(*) FROM qc_template_detailed d
|
|
WHERE d.site = t.site AND d.bu_no = t.bu_no AND d.template_id = t.template_id) as itemCount
|
|
FROM qc_template t
|
|
WHERE t.site = #{site}
|
|
AND t.bu_no = #{buNo}
|
|
AND t.inspection_type_no = '109'
|
|
<if test="templateId != null and templateId != ''">
|
|
AND t.template_id LIKE '%' + #{templateId} + '%'
|
|
</if>
|
|
<if test="templateDesc != null and templateDesc != ''">
|
|
AND t.template_name LIKE '%' + #{templateDesc} + '%'
|
|
</if>
|
|
ORDER BY t.template_id
|
|
</select>
|
|
|
|
<!-- 查询OQC检验单已有的项目编码 -->
|
|
<select id="getExistingOQCItemNos" parameterType="java.util.Map" resultType="java.lang.String">
|
|
SELECT item_no
|
|
FROM qc_oqc_detailed_record
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<select id="getInspectionStandards" parameterType="com.gaotao.modules.pms.data.QcInspectionStandardData" resultType="com.gaotao.modules.pms.data.QcInspectionStandardData">
|
|
select
|
|
site,
|
|
bu_no,
|
|
template_id,
|
|
item_no,
|
|
default_value,
|
|
min_value,
|
|
max_value,
|
|
condition,
|
|
collection_source,
|
|
seq_no
|
|
from qc_inspection_standards
|
|
where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo}
|
|
</select>
|
|
|
|
<delete id="deleteInspectionStandard" parameterType="com.gaotao.modules.pms.data.QcInspectionStandardData">
|
|
delete from qc_inspection_standards
|
|
where site = #{site} and bu_no = #{buNo} and template_id = #{templateId} and item_no = #{itemNo}
|
|
</delete>
|
|
|
|
<insert id="saveInspectionStandard">
|
|
INSERT INTO qc_inspection_standards
|
|
(site, bu_no, template_id, item_no, default_value, min_value, max_value, condition, collection_source, seq_no)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.site}, #{item.buNo}, #{item.templateId}, #{item.itemNo}, #{item.defaultValue}, #{item.minValue}, #{item.maxValue}, #{item.condition}, #{item.collectionSource}, #{item.seqNo})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="getInspectionTemplateDetail" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcInspectionStandardData">
|
|
select
|
|
site,
|
|
bu_no,
|
|
template_id,
|
|
item_no
|
|
<if test="flag == 'iqc'">
|
|
from qc_iqc_detailed_record
|
|
</if>
|
|
<if test="flag == 'ipqc'">
|
|
from qc_ipqc_detailed_record
|
|
</if>
|
|
<if test="flag == 'fqc'">
|
|
from qc_fqc_detailed_record
|
|
</if>
|
|
<if test="flag == 'fai'">
|
|
from qc_fai_detailed_record
|
|
</if>
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
order by order_id
|
|
</select>
|
|
|
|
<update id="updateEquipmentDataDetailInspectionNo" parameterType="com.gaotao.modules.pms.data.SubDetailValues">
|
|
update Equipment_data_detail
|
|
set inspection_no = #{inspectionNo}
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteInspectionFiles" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
delete sys_oss
|
|
where order_ref1 = #{site} and order_ref2 = #{inspectionNo} and order_ref4 = #{buNo}
|
|
</delete>
|
|
|
|
<select id="getUpItemdata" resultType="com.gaotao.modules.pms.data.QcTemplateData">
|
|
select
|
|
top 1
|
|
site,
|
|
bu_no,
|
|
template_id,
|
|
ItemNo,
|
|
order_id
|
|
from qc_template_detailed
|
|
where #{orderId} > order_id
|
|
and site = #{site}
|
|
and bu_no= #{buNo}
|
|
and template_id = #{templateId}
|
|
order by order_id desc
|
|
</select>
|
|
|
|
|
|
<select id="getDownItemdata" resultType="com.gaotao.modules.pms.data.QcTemplateData">
|
|
select
|
|
top 1
|
|
site,
|
|
bu_no,
|
|
template_id,
|
|
ItemNo,
|
|
order_id
|
|
from qc_template_detailed
|
|
where order_id > #{orderId}
|
|
and site = #{site}
|
|
and bu_no= #{buNo}
|
|
and template_id = #{templateId}
|
|
order by order_id
|
|
</select>
|
|
|
|
<update id="updateQcItemOrder">
|
|
update qc_template_detailed
|
|
set order_id=#{orderId}
|
|
where site = #{site}
|
|
and bu_no= #{buNo}
|
|
and template_id = #{templateId}
|
|
and ItemNo = #{itemNo}
|
|
</update>
|
|
|
|
<select id="selectInfoByInspectionNo" resultType="com.gaotao.modules.pms.data.PoOrderRollNoData" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
select
|
|
site,
|
|
bu_no,
|
|
inspection_no
|
|
from po_order_roll_no
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<update id="updateIQCMasterSubmitFlag2" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_iqc_record
|
|
SET submit_flag = 'N',
|
|
state = '待检验',
|
|
cancel_check_by = #{updateBy},
|
|
cancel_check_date = getDate()
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateIQCDetailSubmitFlag2" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_iqc_detailed_record
|
|
SET is_submit = 'N'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateIQCSubDetailSubmitFlag2" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_iqc_sub_detail_record
|
|
SET is_submit = 'N'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateFAIMasterSubmitFlag2" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fai_record
|
|
SET submit_flag = 'N',
|
|
state = '待检验',
|
|
cancel_check_by = #{updateBy},
|
|
cancel_check_date = getDate()
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateFAIDetailSubmitFlag2" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fai_detailed_record
|
|
SET is_submit = 'N'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateFAISubDetailSubmitFlag2" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fai_sub_detail_record
|
|
SET is_submit = 'N'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateIPQCMasterSubmitFlag2" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_ipqc_record
|
|
SET submit_flag = 'N',
|
|
state = '待检验',
|
|
cancel_check_by = #{updateBy},
|
|
cancel_check_date = getDate()
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateIPQCDetailSubmitFlag2" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_ipqc_detailed_record
|
|
SET is_submit = 'N'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateIPQCSubDetailSubmitFlag2" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_ipqc_sub_detail_record
|
|
SET is_submit = 'N'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateFQCMasterSubmitFlag2" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fqc_record
|
|
SET submit_flag = 'N',
|
|
state = '待检验',
|
|
cancel_check_by = #{updateBy},
|
|
cancel_check_date = getDate()
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateFQCDetailSubmitFlag2" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fqc_detailed_record
|
|
SET is_submit = 'N'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateFQCSubDetailSubmitFlag2" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_fqc_sub_detail_record
|
|
SET is_submit = 'N'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<delete id="deleteReceivingTaskByInspectionNo" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
delete receiving_task
|
|
where site = #{site} and citem_code = #{buNo} and inspection_no = #{inspectionNo}
|
|
</delete>
|
|
|
|
<delete id="deleteObjectFile">
|
|
delete from sys_oss where id = #{id}
|
|
</delete>
|
|
|
|
<!-- 获取用户角色列表 -->
|
|
<select id="getUserRoleList" resultType="com.gaotao.modules.sys.entity.SysRoleEntity">
|
|
SELECT
|
|
role_id,
|
|
role_name
|
|
FROM sys_role
|
|
</select>
|
|
|
|
<select id="getOperatorListByOrder" resultType="com.gaotao.modules.pms.data.EamAdminData" parameterType="com.gaotao.modules.pms.data.EamAdminData">
|
|
SELECT
|
|
a.user_id, a.username AS adminID, a.email, a.mobile AS phone, a.user_display AS adminName,
|
|
d.role_id, e.role_name, c.site, c.bu_no,
|
|
-- 获取计划工单数
|
|
dbo.get_plan_order_count(c.site, c.bu_no, #{functionType}, a.username) AS planOrderCount,
|
|
-- 获取实际工单数
|
|
dbo.get_actual_order_count(c.site, c.bu_no, #{functionType}, a.username) AS actualOrderCount,
|
|
-- 负荷率(%)
|
|
CASE
|
|
WHEN dbo.get_plan_order_count(c.site, c.bu_no, #{functionType}, a.username) = 0 THEN 0
|
|
ELSE
|
|
CAST(
|
|
dbo.get_actual_order_count(c.site, c.bu_no, #{functionType}, a.username) * 100.0 /
|
|
dbo.get_plan_order_count(c.site, c.bu_no, #{functionType}, a.username)
|
|
AS DECIMAL(5,2))
|
|
END AS load_rate
|
|
FROM
|
|
sys_user AS a
|
|
LEFT JOIN AccessSite AS b ON a.username = b.userID
|
|
LEFT JOIN AccessBu AS c ON b.userID = c.username AND b.site = c.site
|
|
LEFT JOIN sys_user_role AS d ON a.user_id = d.user_id
|
|
LEFT JOIN sys_role AS e ON d.role_id = e.role_id
|
|
<where>
|
|
b.site = #{site} and c.bu_no = #{buNo}
|
|
<if test = "adminID != null and adminID != ''">
|
|
AND a.username LIKE '%' + #{adminID} + '%'
|
|
</if>
|
|
<if test = "adminName != null and adminName != ''">
|
|
AND a.user_display LIKE '%' + #{adminName} + '%'
|
|
</if>
|
|
<if test = "roleId != null and roleId != ''">
|
|
AND d.role_id = #{roleId}
|
|
</if>
|
|
<if test = "date != null and classesCode != null and classesCode != ''">
|
|
AND a.username IN (
|
|
SELECT tpm_scheduling_record.admin_id
|
|
FROM tpm_scheduling
|
|
join tpm_scheduling_record on tpm_scheduling.id = tpm_scheduling_record.head_id
|
|
WHERE tpm_scheduling.bu_no = #{buNo} and tpm_scheduling.site = #{site} and tpm_scheduling.date= #{date} and tpm_scheduling.classes_code = #{classesCode} and tpm_scheduling_record.isHoliday = 'N'
|
|
)
|
|
</if>
|
|
<if test = "date != null and (classesCode == null or classesCode == '')">
|
|
AND a.username IN (
|
|
SELECT tpm_scheduling_record.admin_id
|
|
FROM tpm_scheduling
|
|
join tpm_scheduling_record on tpm_scheduling.id = tpm_scheduling_record.head_id
|
|
WHERE tpm_scheduling.bu_no = #{buNo} and tpm_scheduling.site = #{site} and tpm_scheduling.date= #{date} and tpm_scheduling_record.isHoliday = 'N'
|
|
)
|
|
</if>
|
|
<if test = "classesCode != null and classesCode != '' and date == null">
|
|
AND a.username IN (
|
|
SELECT tpm_scheduling_record.admin_id
|
|
FROM tpm_scheduling
|
|
join tpm_scheduling_record on tpm_scheduling.id = tpm_scheduling_record.head_id
|
|
WHERE tpm_scheduling.bu_no = #{buNo} and tpm_scheduling.site = #{site} and tpm_scheduling.classes_code = #{classesCode} and tpm_scheduling_record.isHoliday = 'N'
|
|
)
|
|
</if>
|
|
</where>
|
|
order by load_rate desc
|
|
</select>
|
|
|
|
<!-- 查询OQC基础数据 -->
|
|
<select id="selectOQCBasicData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
qir.inspection_no,
|
|
qir.state,
|
|
qir.create_date as taskDate,
|
|
qir.roll_no,
|
|
qir.part_no,
|
|
dbo.Get_Part_DescSpec(qir.site, qir.part_no) as part_desc,
|
|
qir.roll_qty,
|
|
qir.print_flag,
|
|
qir.create_by,
|
|
qir.site,
|
|
qir.bu_no,
|
|
qir.roll_count
|
|
FROM qc_oqc_record as qir
|
|
LEFT JOIN part p ON qir.part_no = p.partNo and qir.site = p.site
|
|
WHERE qir.site in (select site from AccessSite where userID = #{userName})
|
|
and qir.bu_no in (select bu_no from AccessBu where username = #{userName})
|
|
and qir.detail_flag = 'N'
|
|
</select>
|
|
|
|
<select id="selectFQASPartAttributeByPartNo" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
qat.site,
|
|
qat.bu_no,
|
|
qat.attribute_no,
|
|
qat.template_id,
|
|
qat.sampling_level_no,
|
|
qsil.sampling_level_desc,
|
|
qat.inspection_cycle,
|
|
qat.sampling_programme_no,
|
|
qsip.sampling_programme_desc,
|
|
qat.AQL,
|
|
qat.AC,
|
|
qat.RE,
|
|
qt.default_sampling_quantity,
|
|
qt.default_sampling_proportion
|
|
FROM qc_attribute_template as qat
|
|
LEFT JOIN qc_template as qt ON qat.template_id = qt.template_id and qat.site = qt.site and qat.bu_no = qt.bu_no
|
|
LEFT JOIN qc_sampling_inspection_level as qsil ON qat.sampling_level_no = qsil.sampling_level_no and qat.site = qsil.site and qat.bu_no = qsil.bu_no
|
|
LEFT JOIN qc_sampling_inspection_programme as qsip ON qat.sampling_programme_no = qsip.sampling_programme_no and qat.site = qsip.site and qat.bu_no = qsip.bu_no
|
|
WHERE qat.site = #{site} and qat.bu_no = #{buNo}
|
|
AND qat.attribute_no = #{partNo}
|
|
AND qat.attribute_type = #{attributeType}
|
|
AND qt.inspection_type_no = #{inspectionTypeNo}
|
|
</select>
|
|
|
|
<!-- 新增OQC明细记录信息 -->
|
|
<insert id="saveFQASDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
INSERT INTO qc_oqc_detailed_record
|
|
(inspection_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc, AQL, AC, RE,
|
|
item_no, item_desc, object_id, object_desc, default_value, min_value, max_value, value_type_db, value_type, site, sampling_qty, bu_no, order_id)
|
|
VALUES
|
|
(#{inspectionNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=DECIMAL}, #{ac,jdbcType=DECIMAL}, #{re,jdbcType=DECIMAL},
|
|
#{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=DECIMAL}, #{maxValue,jdbcType=DECIMAL}, #{valueTypeDb}, #{valueType}, #{site}, #{samplingQty}, #{buNo}, #{orderId})
|
|
</insert>
|
|
|
|
<!-- 修改OQC检验记录 -->
|
|
<update id="updateFQASRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_oqc_record
|
|
SET inspection_type_no = #{inspectionTypeNo},
|
|
sampling_qty = #{samplingQty},
|
|
inspection_cycle = #{inspectionCycle},
|
|
part_desc = #{partDesc},
|
|
detail_flag = 'Y',
|
|
pass_qty = #{samplingQty},
|
|
not_pass_qty = 0
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 查询OQC主记录信息 -->
|
|
<select id="qcOQCInspectionSearch" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.inspection_no,
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.state,
|
|
a.inspection_result,
|
|
a.create_date as taskDate,
|
|
a.inspection_type_no,
|
|
a.inspection_cycle,
|
|
a.part_no,
|
|
a.part_desc,
|
|
d.umid as umId,
|
|
um.UMName as umName,
|
|
d.spec,
|
|
a.inspection_remark,
|
|
a.roll_qty,
|
|
a.sampling_qty,
|
|
a.disposal_measures,
|
|
a.disposal_remark,
|
|
a.inspector_date,
|
|
a.submit_flag,
|
|
a.roll_no,
|
|
a.roll_count,
|
|
a.action_date,
|
|
a.action_by,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operator,
|
|
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'coordination'), '') as operatorName,
|
|
isnull(dbo.joint_id(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePerson,
|
|
isnull(dbo.joint_name(a.site, a.bu_no, a.inspection_no, 'responsible'), '') as responsiblePersonName,
|
|
a.pass_qty,
|
|
a.not_pass_qty,
|
|
a.create_by,
|
|
a.customer_no,
|
|
dbo.Get_CustomerDesc(a.site, a.customer_no) as customerName,
|
|
a.po_orderNo,
|
|
a.po_itemNo,
|
|
a.document_no
|
|
FROM qc_oqc_record as a
|
|
left join part as d on a.site = d.site and a.bu_no = d.bu_no and a.part_no = d.partNo
|
|
left join um as um on d.site = um.site and d.umid = um.UMID
|
|
<where>
|
|
a.site in (select site from AccessSite where userID = #{query.userName})
|
|
and a.bu_no in (select bu_no from AccessBu where username = #{query.userName})
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{query.buDesc}
|
|
</if>
|
|
<if test = "query.inspectionNo != null and query.inspectionNo != ''">
|
|
AND a.inspection_no LIKE '%' + #{query.inspectionNo} + '%'
|
|
</if>
|
|
<if test = "query.states != null and query.states.size > 0">
|
|
AND a.state in
|
|
<foreach item="item" collection="query.states" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test = "query.inspectionResult != null and query.inspectionResult != ''">
|
|
AND a.inspection_result = #{query.inspectionResult}
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND a.part_desc LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test = "query.disposalMeasures != null and query.disposalMeasures != ''">
|
|
AND a.disposal_measures LIKE '%' + #{query.disposalMeasures} + '%'
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
AND a.inspector_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
AND #{query.endDate} >= a.inspector_date
|
|
</if>
|
|
<if test="query.startDate2 != null">
|
|
AND a.create_date >= #{query.startDate2}
|
|
</if>
|
|
<if test="query.endDate2 != null">
|
|
AND #{query.endDate2} >= a.create_date
|
|
</if>
|
|
<if test = "query.customerNo != null and query.customerNo != ''">
|
|
AND a.customer_no LIKE '%' + #{query.customerNo} + '%'
|
|
</if>
|
|
<if test = "query.customerName != null and query.customerName != ''">
|
|
AND dbo.Get_CustomerDesc(a.site, a.customer_no) LIKE '%' + #{query.customerName} + '%'
|
|
</if>
|
|
<if test = "query.poOrderNo != null and query.poOrderNo != ''">
|
|
AND a.po_orderNo LIKE '%' + #{query.poOrderNo} + '%'
|
|
</if>
|
|
<if test = "query.spec != null and query.spec != ''">
|
|
AND d.spec LIKE '%' + #{query.spec} + '%'
|
|
</if>
|
|
</where>
|
|
ORDER BY
|
|
CASE WHEN a.state = '待检验' THEN 1
|
|
WHEN a.state = '待审核' THEN 2
|
|
WHEN a.state = '已完成' THEN 3
|
|
END, a.create_date desc
|
|
</select>
|
|
|
|
<!-- IQC明细记录查询 -->
|
|
<select id="fqasDetailSearch" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.inspection_no,
|
|
a.template_id,
|
|
a.sampling_level_no,
|
|
a.sampling_level_desc,
|
|
a.sampling_programme_no,
|
|
a.sampling_programme_desc,
|
|
a.AQL,
|
|
a.AC,
|
|
a.RE,
|
|
a.item_no,
|
|
a.item_desc,
|
|
a.object_id,
|
|
a.object_desc,
|
|
a.default_value,
|
|
a.min_value,
|
|
a.max_value,
|
|
a.text_value,
|
|
a.number_value,
|
|
a.value_type_db,
|
|
a.value_type,
|
|
case when a.item_result = '' or a.item_result is null then 'Y' else a.item_result end as itemResult,
|
|
a.is_submit,
|
|
a.unqualified_quantity,
|
|
dbo.qc_get_fqas_sub_record_num(a.site, a.bu_no, a.inspection_no, a.item_no) as subDetailRecordNum,
|
|
dbo.qc_get_record_image_num(a.site, a.bu_no, a.inspection_no, a.item_no) as detailImageNum,
|
|
c.method_no,
|
|
c.method_name,
|
|
c.method_remark,
|
|
a.sampling_qty
|
|
FROM qc_oqc_detailed_record as a
|
|
LEFT JOIN qc_method_item as b on a.site = b.site and a.item_no = b.ItemNo and a.bu_no = b.bu_no
|
|
LEFT JOIN qc_method as c on b.site = c.site and b.method_no = c.method_no and b.bu_no = c.bu_no
|
|
WHERE a.inspection_no = #{inspectionNo} and a.site = #{site} and a.bu_no = #{buNo}
|
|
ORDER BY COALESCE(a.order_id, 99999) ASC
|
|
</select>
|
|
|
|
<!-- 查询FQAS的子明细 -->
|
|
<select id="selectFQASSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
sub_detail_value,
|
|
sampling_location,
|
|
is_submit,
|
|
sampling_location_b,
|
|
num,
|
|
sub_detail_value_b,
|
|
sub_detail_value_c,
|
|
sub_detail_value_d,
|
|
sub_detail_value_e
|
|
FROM qc_oqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<select id="getSupplier" parameterType="java.lang.String" resultType="com.gaotao.modules.base.entity.SupplierData">
|
|
SELECT
|
|
site,
|
|
SupplierID,
|
|
SupplierName
|
|
FROM Supplier
|
|
WHERE site = #{site} and SupplierID = #{supplierID} and Active = #{active}
|
|
</select>
|
|
|
|
<!-- 修改FQAS主记录信息 -->
|
|
<update id="updateFQASMasterRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_oqc_record
|
|
SET disposal_measures = #{disposalMeasures},
|
|
disposal_remark = #{disposalRemark},
|
|
inspection_result = #{inspectionResult},
|
|
inspector_no = #{inspectorNo},
|
|
state = #{state},
|
|
inspection_remark = #{inspectionRemark},
|
|
inspector_date = getDate(),
|
|
roll_count = #{rollCount,jdbcType=DECIMAL},
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
unqualified_qty = #{unqualifiedQty,jdbcType=DECIMAL},
|
|
pass_qty = #{passQty,jdbcType=DECIMAL},
|
|
not_pass_qty = #{notPassQty,jdbcType=DECIMAL}
|
|
WHERE site = #{site} and inspection_no = #{inspectionNo} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改FQAS明细记录信息 -->
|
|
<update id="updateFQASDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_oqc_detailed_record
|
|
SET item_result = #{itemResult},
|
|
unqualified_quantity = #{unqualifiedQuantity,jdbcType=DECIMAL},
|
|
sampling_qty = #{samplingQty,jdbcType=DECIMAL},
|
|
text_value = #{textValue},
|
|
number_value = #{numberValue,jdbcType=DECIMAL},
|
|
default_value = #{defaultValue},
|
|
min_value = #{minValue,jdbcType=DECIMAL},
|
|
max_value = #{maxValue,jdbcType=DECIMAL}
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 查询FQAS主记录信息 -->
|
|
<select id="getFQASInspectionRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
inspection_no,
|
|
not_pass_qty,
|
|
roll_count,
|
|
inspection_result,
|
|
disposal_measures,
|
|
part_no
|
|
FROM qc_oqc_record
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</select>
|
|
|
|
<!-- 修改FQAS主记录标识为已提交 -->
|
|
<update id="updateFQASMasterSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_oqc_record
|
|
SET submit_flag = 'Y',
|
|
state = '已完成'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改FQAS明细记录标识为已提交 -->
|
|
<update id="updateFQASDetailSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_oqc_detailed_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改FQAS子明细记录标识为已提交 -->
|
|
<update id="updateFQASSubDetailSubmitFlag" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
UPDATE qc_oqc_sub_detail_record
|
|
SET is_submit = 'Y'
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 查询FQAS检验记录是否已提交 -->
|
|
<select id="checkFQASIsSubmit" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT submit_flag
|
|
FROM qc_oqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 删除FQAS子明细的老数据 -->
|
|
<delete id="delFQASSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcSubDetailInformationData">
|
|
DELETE FROM qc_oqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 新增FQAS子明细信息 -->
|
|
<insert id="saveFQASSubDetailed">
|
|
INSERT INTO qc_oqc_sub_detail_record
|
|
(inspection_no, item_no, sub_detail_value, sampling_location, site, sampling_location_b, bu_no)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.inspectionNo}, #{item.itemNo}, #{item.subDetailValue}, #{item.samplingLocation}, #{item.site}, #{item.samplingLocationB}, #{item.buNo})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 删除FQAS检验记录 -->
|
|
<delete id="deleteFQASRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_oqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 删除FQAS明细记录信息 -->
|
|
<delete id="deleteFQASDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_oqc_detailed_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 删除FQAS子明细记录信息 -->
|
|
<delete id="deleteFQASSubDetailedRecord" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
DELETE FROM qc_oqc_sub_detail_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 查询FQAS(OQC)检验单当前状态 -->
|
|
<select id="getFQASRecordStatus" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData" resultType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
SELECT submit_flag, state
|
|
FROM qc_oqc_record
|
|
WHERE inspection_no = #{inspectionNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<update id="actionFQASInspection" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
update qc_oqc_record
|
|
set action_date = getDate(),
|
|
action_by = #{actionBy},
|
|
state = #{state}
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<update id="updateSamplingQty" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
update
|
|
<if test = "inspectionTypeNo == '105'">
|
|
qc_iqc_record
|
|
</if>
|
|
<if test = "inspectionTypeNo == '108'">
|
|
qc_oqc_record
|
|
</if>
|
|
set sampling_qty = #{samplingQty,jdbcType=DECIMAL}
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<update id="updateDetailSamplingQty" parameterType="com.gaotao.modules.pms.data.QcFAIRecordData">
|
|
update
|
|
<if test = "inspectionTypeNo == '105'">
|
|
qc_iqc_detailed_record
|
|
</if>
|
|
<if test = "inspectionTypeNo == '108'">
|
|
qc_oqc_detailed_record
|
|
</if>
|
|
set sampling_qty = #{samplingQty,jdbcType=DECIMAL}
|
|
where site = #{site} and bu_no = #{buNo} and inspection_no = #{inspectionNo}
|
|
</update>
|
|
|
|
<!-- 获取审核人员列表 -->
|
|
<select id="getCheckerList" resultType="com.gaotao.modules.pms.data.EamAdminData" parameterType="com.gaotao.modules.pms.data.EamAdminData">
|
|
SELECT
|
|
a.user_id,
|
|
a.username as adminID,
|
|
a.email,
|
|
a.mobile as phone,
|
|
a.user_display as adminName,
|
|
dbo.get_bu_desc(c.site,c.bu_no) as buDesc,
|
|
d.role_id,
|
|
e.role_name
|
|
FROM sys_user as a
|
|
LEFT JOIN AccessSite as b on a.username = b.userID
|
|
LEFT JOIN AccessBu as c on b.username = c.username and b.site = c.site
|
|
LEFT JOIN sys_user_role as d on a.user_id = d.user_id
|
|
LEFT JOIN sys_role as e on d.role_id = e.role_id
|
|
<where>
|
|
b.site = #{site} and c.bu_no = #{buNo}
|
|
<if test = "adminID != null and adminID != ''">
|
|
AND a.username LIKE '%' + #{adminID}+'%'
|
|
</if>
|
|
<if test = "adminName != null and adminName != ''">
|
|
AND a.user_display LIKE '%' + #{adminName}+'%'
|
|
</if>
|
|
<if test = "buDesc != null and buDesc != ''">
|
|
AND dbo.get_bu_desc(a.site,c.bu_no) LIKE '%' + #{buDesc} + '%'
|
|
</if>
|
|
<if test = "roleId != null and roleId != ''">
|
|
AND d.role_id = #{roleId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- ================================================= SOP清单相关SQL ================================================= -->
|
|
|
|
<!-- SOP清单查询 -->
|
|
<select id="sopListSearch" resultType="map">
|
|
<!-- SELECT-->
|
|
<!-- ps.site,-->
|
|
<!-- ps.bu_no as buNo,-->
|
|
<!-- ps.part_no as partNo,-->
|
|
<!-- ps.sop_no as sopNo,-->
|
|
<!-- ps.sop_name as sopName,-->
|
|
<!-- ps.sop_url as sopUrl,-->
|
|
<!-- ps.version,-->
|
|
<!-- ps.sop_status as sopStatus,-->
|
|
<!-- ps.phase_in_date as phaseInDate,-->
|
|
<!-- ps.phase_out_date as phaseOutDate,-->
|
|
<!-- ps.created_by as createdBy,-->
|
|
<!-- ps.creation_date as creationDate,-->
|
|
<!-- ps.sop_type as sopType,-->
|
|
<!-- ps.operation_desc as operationDesc-->
|
|
<!-- FROM part_sop ps-->
|
|
<!-- <where>-->
|
|
<!-- <if test="params.site != null and params.site != ''">-->
|
|
<!-- AND ps.site = #{params.site}-->
|
|
<!-- </if>-->
|
|
<!-- <if test="params.partNo != null and params.partNo != ''">-->
|
|
<!-- AND ps.part_no = #{params.partNo}-->
|
|
<!-- </if>-->
|
|
<!-- </where>-->
|
|
<!-- ORDER BY ps.creation_date DESC-->
|
|
|
|
|
|
SELECT DISTINCT
|
|
site,
|
|
buNo,
|
|
partNo,
|
|
sopNo,
|
|
sopName,
|
|
sopUrl,
|
|
[version],
|
|
sopStatus,
|
|
phaseInDate,
|
|
phaseOutDate,
|
|
createdBy,
|
|
creationDate,
|
|
sopType,
|
|
operationDesc
|
|
FROM (
|
|
-- 来源1: part_sop(零件SOP)
|
|
SELECT
|
|
ps.site,
|
|
ps.bu_no AS buNo,
|
|
ps.part_no AS partNo,
|
|
ps.sop_no AS sopNo,
|
|
ps.sop_name AS sopName,
|
|
ps.sop_url AS sopUrl,
|
|
ps.[version ] AS [version],
|
|
ps.sop_status AS sopStatus,
|
|
ps.phase_in_date AS phaseInDate,
|
|
ps.phase_out_date AS phaseOutDate,
|
|
ps.created_by AS createdBy,
|
|
ps.creation_date AS creationDate,
|
|
ps.sop_type AS sopType,
|
|
ps.operation_desc AS operationDesc
|
|
FROM part_sop ps
|
|
WHERE ps.site = #{params.site}
|
|
AND ps.part_no = #{params.partNo}
|
|
|
|
UNION ALL
|
|
|
|
-- 来源2: file_management(公共生产文件 或 订单关联文件)
|
|
SELECT
|
|
fm.site,
|
|
fm.bu_no AS buNo,
|
|
'' AS partNo,
|
|
fm.file_no AS sopNo,
|
|
fm.file_name AS sopName,
|
|
fm.url_add_ress AS sopUrl,
|
|
fm.sop_rev_no AS [version],
|
|
fm.status AS sopStatus,
|
|
fm.phase_in_date AS phaseInDate,
|
|
fm.phase_out_date AS phaseOutDate,
|
|
fm.created_by AS createdBy,
|
|
fm.create_date AS creationDate,
|
|
fm.file_type AS sopType,
|
|
fm.item_no AS operationDesc
|
|
FROM file_management fm
|
|
WHERE fm.site = #{params.site}
|
|
AND fm.file_type = '生产'
|
|
AND (
|
|
ISNULL(fm.public_flag, 'N') = 'Y'
|
|
OR fm.order_no = #{params.orderNo}
|
|
)
|
|
|
|
) AS CombinedResults
|
|
|
|
|
|
</select>
|
|
|
|
<!-- 查询检验页面的SOP文件列表(从file_management表) -->
|
|
<select id="searchQcSopFileList" resultType="map">
|
|
SELECT DISTINCT
|
|
fm.ID AS id,
|
|
fm.url_add_ress AS sopUrl,
|
|
fm.create_date AS creationDate,
|
|
fm.file_name AS sopName,
|
|
fm.new_file_name AS newFileName,
|
|
fm.created_by AS createdBy,
|
|
fm.file_type AS fileType,
|
|
fm.file_suffix AS fileSuffix,
|
|
fm.sop_rev_no AS version,
|
|
fm.phase_in_date AS phaseInDate,
|
|
fm.phase_out_date AS phaseOutDate
|
|
FROM file_management fm
|
|
WHERE fm.site = #{params.site}
|
|
AND fm.file_type = '质量'
|
|
AND (
|
|
ISNULL(fm.public_flag, 'N') = 'Y'
|
|
<if test="params.operationDesc != null and params.operationDesc != ''">
|
|
OR fm.item_no = #{params.operationDesc}
|
|
</if>
|
|
<if test="params.workcenterNo != null and params.workcenterNo != ''">
|
|
OR fm.workcenter_no = #{params.workcenterNo}
|
|
</if>
|
|
<if test="params.partNo != null and params.partNo != ''">
|
|
OR fm.part_no = #{params.partNo}
|
|
</if>
|
|
<if test="params.orderNo != null and params.orderNo != ''">
|
|
OR fm.order_no = #{params.orderNo}
|
|
</if>
|
|
)
|
|
ORDER BY fm.create_date DESC
|
|
</select>
|
|
|
|
<!-- 查询可用的SOP文件 -->
|
|
<select id="sopAvailableFiles" resultType="map">
|
|
SELECT
|
|
A.site,
|
|
A.bu_no as buNo,
|
|
A.file_no as fileNo,
|
|
A.file_name as fileName,
|
|
A.file_type as fileType,
|
|
A.file_suffix as fileSuffix,
|
|
A.sop_rev_no as sopRevNo,
|
|
A.url_add_ress as sopUrl,
|
|
A.sop_type as sopType,
|
|
A.source_system as sourceSystem
|
|
FROM file_management A
|
|
LEFT JOIN part_sop B ON A.SITE = B.SITE AND A.BU_NO = B.BU_NO AND A.FILE_NO = B.sop_no and b.part_no = #{params.partNo}
|
|
<where>
|
|
B.SITE IS NULL
|
|
AND A.status_tb = 0
|
|
and ISNULL(public_flag,'N') = 'Y'
|
|
<if test="params.site != null and params.site != ''">
|
|
AND A.site = #{params.site}
|
|
</if>
|
|
<if test="params.fileNo != null and params.fileNo != ''">
|
|
AND A.file_no LIKE '%' + #{params.fileNo} + '%'
|
|
</if>
|
|
<if test="params.fileName != null and params.fileName != ''">
|
|
AND A.file_name LIKE '%' + #{params.fileName} + '%'
|
|
</if>
|
|
<if test="params.fileType != null and params.fileType != ''">
|
|
AND A.file_type LIKE '%' + #{params.fileType} + '%'
|
|
</if>
|
|
<if test="params.sopRevNo != null and params.sopRevNo != ''">
|
|
AND A.sop_rev_no LIKE '%' + #{params.sopRevNo} + '%'
|
|
</if>
|
|
</where>
|
|
ORDER BY A.file_no
|
|
|
|
</select>
|
|
|
|
<!-- 插入SOP记录 -->
|
|
<insert id="insertSopRecord">
|
|
INSERT INTO part_sop (
|
|
site,
|
|
bu_no,
|
|
part_no,
|
|
sop_no,
|
|
sop_name,
|
|
sop_url,
|
|
sop_type,
|
|
version,
|
|
sop_status,
|
|
phase_in_date,
|
|
phase_out_date,
|
|
created_by,
|
|
creation_date,
|
|
operation_desc
|
|
) VALUES (
|
|
#{data.site},
|
|
#{data.buNo},
|
|
#{data.partNo},
|
|
#{data.sopNo},
|
|
#{data.sopName},
|
|
#{data.sopUrl},
|
|
#{data.sopType},
|
|
#{data.version},
|
|
#{data.sopStatus},
|
|
<choose>
|
|
<when test="data.phaseInDate != null and data.phaseInDate != ''">
|
|
CONVERT(DATE, #{data.phaseInDate})
|
|
</when>
|
|
<otherwise>
|
|
NULL
|
|
</otherwise>
|
|
</choose>,
|
|
<choose>
|
|
<when test="data.phaseOutDate != null and data.phaseOutDate != ''">
|
|
CONVERT(DATE, #{data.phaseOutDate})
|
|
</when>
|
|
<otherwise>
|
|
NULL
|
|
</otherwise>
|
|
</choose>,
|
|
#{data.createdBy},
|
|
<choose>
|
|
<when test="data.creationDate != null and data.creationDate != ''">
|
|
CONVERT(DATE, #{data.creationDate})
|
|
</when>
|
|
<otherwise>
|
|
GETDATE()
|
|
</otherwise>
|
|
</choose>,
|
|
#{data.operationDesc}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 删除SOP记录 -->
|
|
<delete id="deleteSopRecord">
|
|
DELETE FROM part_sop
|
|
<where>
|
|
<if test="params.site != null and params.site != ''">
|
|
AND site = #{params.site}
|
|
</if>
|
|
<if test="params.buNo != null and params.buNo != ''">
|
|
AND bu_no = #{params.buNo}
|
|
</if>
|
|
<if test="params.partNo != null and params.partNo != ''">
|
|
AND part_no = #{params.partNo}
|
|
</if>
|
|
<if test="params.sopNo != null and params.sopNo != ''">
|
|
AND sop_no = #{params.sopNo}
|
|
</if>
|
|
</where>
|
|
</delete>
|
|
|
|
<!-- ================================================= BOM清单相关SQL ================================================= -->
|
|
|
|
<!-- BOM清单查询 -->
|
|
<select id="bomListSearch" resultType="com.gaotao.modules.pms.data.BomListData">
|
|
SELECT
|
|
bh.site,
|
|
bh.bu_no as buNo,
|
|
bh.revno,
|
|
bh.bomtype,
|
|
bh.status,
|
|
bh.phaseindate,
|
|
bh.phaseoutdate
|
|
FROM BOMHeader bh
|
|
<where>
|
|
<if test="query.site != null and query.site != ''">
|
|
AND bh.site = #{query.site}
|
|
</if>
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND bh.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test="query.partNo != null and query.partNo != ''">
|
|
AND bh.bu_no = #{query.partNo}
|
|
</if>
|
|
</where>
|
|
ORDER BY bh.phaseindate DESC
|
|
</select>
|
|
|
|
<!-- ================================================= Routing清单相关SQL ================================================= -->
|
|
|
|
<!-- Routing清单查询 -->
|
|
<select id="routingListSearch" resultType="com.gaotao.modules.pms.data.RoutingListData">
|
|
SELECT
|
|
rh.site,
|
|
rh.bu_no as buNo,
|
|
rh.revno,
|
|
rh.routingtype,
|
|
rh.status,
|
|
rh.phaseindate,
|
|
rh.phaseoutdate
|
|
FROM RoutingHeader rh
|
|
<where>
|
|
<if test="query.site != null and query.site != ''">
|
|
AND rh.site = #{query.site}
|
|
</if>
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND rh.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test="query.partNo != null and query.partNo != ''">
|
|
AND rh.bu_no = #{query.partNo}
|
|
</if>
|
|
</where>
|
|
ORDER BY rh.phaseindate DESC
|
|
</select>
|
|
|
|
<update id="updateInboundNotificationStatus">
|
|
update inbound_notification_head
|
|
set order_status = #{status}
|
|
<if test="inspectionFlag != null and inspectionFlag != ''">
|
|
, inspection_flag = #{inspectionFlag}
|
|
</if>
|
|
where site = #{site} and bu_no = #{buNo} and order_no = #{documentNo}
|
|
</update>
|
|
|
|
<!-- 查询过程检验待检验记录数量(只统计首件检和自检类型) -->
|
|
<select id="checkProcessInspectionPendingCount" resultType="int">
|
|
SELECT COUNT(1)
|
|
FROM qc_ipqc_record
|
|
WHERE site = #{site}
|
|
AND order_no = #{orderNo}
|
|
AND state IN ('未开始', '待检验')
|
|
AND seq_no = #{seqNo}
|
|
AND inspection_type_no IN ('首件检', '自检')
|
|
</select>
|
|
<select id="queryResourceList3" resultType="com.gaotao.modules.pms.data.ResourceData">
|
|
select DISTINCT ResourceId,ResourceDesc from WorkCenterResource
|
|
</select>
|
|
|
|
<update id="updateSaleBoxManageStatus">
|
|
update outbound_notification_head
|
|
set order_status = #{status}
|
|
where site = #{site} and bu_no = #{buNo} and order_no = #{documentNo}
|
|
</update>
|
|
|
|
<update id="updateSaleBoxManageInspectionFlag">
|
|
update outbound_notification_detail
|
|
set inspection_flag = #{inspectionFlag}
|
|
where site = #{site} and bu_no = #{buNo} and order_no = #{documentNo}
|
|
</update>
|
|
</mapper>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|