You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
359 lines
19 KiB
XML
359 lines
19 KiB
XML
<?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.op.quality.mapper.QcProCheckMapper">
|
|
|
|
<resultMap type="QcProCheck" id="QcProCheckResult">
|
|
<result property="id" column="id"/>
|
|
<result property="rfid" column="rfid"/>
|
|
<result property="factoryId" column="factory_id"/>
|
|
<result property="factoryCode" column="factory_code"/>
|
|
<result property="workorderId" column="workorder_id" />
|
|
<result property="workorderCode" column="workorder_code" />
|
|
<result property="workorderName" column="workorder_name" />
|
|
<result property="orderId" column="order_id" />
|
|
<result property="orderCode" column="order_code" />
|
|
<result property="machineId" column="machine_id" />
|
|
<result property="machineCode" column="machine_code" />
|
|
<result property="machineName" column="machine_name" />
|
|
<result property="badMeg" column="bad_meg" />
|
|
<result property="productId" column="product_id" />
|
|
<result property="productCode" column="product_code" />
|
|
<result property="productName" column="product_name" />
|
|
<result property="productSpc" column="product_spc" />
|
|
<result property="isqua" column="isqua" />
|
|
<result property="fileId" column="file_id" />
|
|
<result property="attr1" column="attr1" />
|
|
<result property="attr2" column="attr2" />
|
|
<result property="attr3" column="attr3" />
|
|
<result property="attr4" column="attr4" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateTime" column="update_time" />
|
|
<collection property="fileList" column="id" select="queryImg"></collection>
|
|
|
|
</resultMap>
|
|
<resultMap type="QcCheckTaskIncome" id="QcCheckTaskIncomeResult">
|
|
<result property="recordId" column="record_id" />
|
|
<result property="checkNo" column="check_no" />
|
|
<result property="incomeBatchNo" column="income_batch_no" />
|
|
<result property="orderNo" column="order_no" />
|
|
<result property="materialCode" column="material_code" />
|
|
<result property="materialName" column="material_name" />
|
|
<result property="quality" column="quality" />
|
|
<result property="noOkQuality" column="noOk_quality" />
|
|
<result property="unit" column="unit" />
|
|
<result property="supplierCode" column="supplier_code" />
|
|
<result property="supplierName" column="supplier_name" />
|
|
<result property="incomeTime" column="income_time" />
|
|
<result property="checkLoc" column="check_loc" />
|
|
<result property="checkStatus" column="check_status" />
|
|
<result property="checkManCode" column="check_man_code" />
|
|
<result property="checkManName" column="check_man_name" />
|
|
<result property="checkTime" column="check_time" />
|
|
<result property="checkResult" column="check_result" />
|
|
<result property="status" column="status" />
|
|
<result property="attr1" column="attr1" />
|
|
<result property="attr2" column="attr2" />
|
|
<result property="attr3" column="attr3" />
|
|
<result property="attr4" column="attr4" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="factoryCode" column="factory_code" />
|
|
<result property="delFlag" column="del_flag" />
|
|
<result property="checkType" column="check_type" />
|
|
<result property="workorderCodeSap" column="workorderCodeSap" />
|
|
|
|
<result property="aNoOkquality" column="aNoOkquality" />
|
|
<result property="bNoOkquality" column="bNoOkquality" />
|
|
<result property="cNoOkquality" column="cNoOkquality" />
|
|
<result property="sampleQuality" column="sample_quality" />
|
|
</resultMap>
|
|
<sql id="selectQuaVo">
|
|
select id,rfid,factory_id,factory_code,order_id,machine_id,bad_meg,product_id,isqua,file_id,attr1,attr2,
|
|
attr3,attr4,create_by,create_time,update_by,update_time,order_code,machine_code,
|
|
workorder_id,workorder_code,workorder_name,product_code
|
|
from qc_pro_check
|
|
</sql>
|
|
|
|
<select id="selectQcProCheckList" parameterType="QcProCheck" resultMap="QcProCheckResult">
|
|
select qpc.id,qpc.rfid,qpc.factory_code,qpc.machine_id,qpc.bad_meg,
|
|
qpc.product_id,qpc.isqua,qpc.file_id,qpc.attr1,qpc.attr2,
|
|
qpc.attr3,qpc.attr4,qpc.create_by,qpc.create_time,qpc.update_by,
|
|
qpc.update_time,qpc.order_code,qpc.machine_code,qpc.machine_name,
|
|
qpc.workorder_id,qpc.workorder_code,qpc.workorder_name,qpc.product_code,
|
|
qpc.product_name,qpc.product_spc
|
|
from qc_pro_check qpc
|
|
<where>
|
|
<if test="rfid != null and rfid != ''"> and qpc.id = #{id}</if>
|
|
<if test="createBy != null and createBy != ''"> and qpc.create_by = #{createBy}</if>
|
|
</where>
|
|
order by qpc.create_time desc
|
|
</select>
|
|
|
|
<insert id="insertQcProCheck" parameterType="QcProCheck" useGeneratedKeys="true" keyProperty="id">
|
|
insert into qc_pro_check
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="rfid != null and rfid != ''">rfid,</if>
|
|
<if test="id != null and id != ''">id,</if>
|
|
<if test="factoryId != null and factoryId != ''">factory_id,</if>
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
|
|
<if test="workorderId != null and workorderId != ''">workorder_id,</if>
|
|
<if test="workorderCode != null and workorderCode != ''">workorder_code,</if>
|
|
<if test="workorderName != null and workorderName != ''">workorder_name,</if>
|
|
<if test="orderId != null and orderId != ''">order_id,</if>
|
|
<if test="orderCode != null and orderCode != ''">order_code,</if>
|
|
<if test="machineId != null">machine_id,</if>
|
|
<if test="machineCode != null">machine_code,</if>
|
|
<if test="machineName != null">machine_name,</if>
|
|
<if test="badMeg != null and badMeg != ''">bad_meg,</if>
|
|
<if test="productId != null">product_id,</if>
|
|
<if test="productCode != null">product_code,</if>
|
|
<if test="productName != null">product_name,</if>
|
|
<if test="productSpc != null">product_spc,</if>
|
|
<if test="attr1 != null">attr1,</if>
|
|
<if test="attr2 != null">attr2,</if>
|
|
<if test="attr3 != null">attr3,</if>
|
|
<if test="attr4 != null">attr4,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="isqua != null">isqua,</if>
|
|
<if test="fileId != null">file_id,</if>
|
|
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="rfid != null and rfid != ''">#{rfid},</if>
|
|
<if test="id != null and id != ''">#{id},</if>
|
|
<if test="factoryId != null and factoryId != ''">#{factoryId},</if>
|
|
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
|
|
<if test="workorderId != null and workorderId != ''">#{workorderId},</if>
|
|
<if test="workorderCode != null and workorderCode != ''">#{workorderCode},</if>
|
|
<if test="workorderName != null and workorderName != ''">#{workorderName},</if>
|
|
<if test="orderId != null and orderId != ''">#{orderId},</if>
|
|
<if test="orderCode != null and orderCode != ''">#{orderCode},</if>
|
|
<if test="machineId != null">#{machineId},</if>
|
|
<if test="machineCode != null">#{machineCode},</if>
|
|
<if test="machineName != null">#{machineName},</if>
|
|
<if test="badMeg != null and badMeg != ''">#{badMeg},</if>
|
|
<if test="productId != null">#{productId},</if>
|
|
<if test="productCode != null">#{productCode},</if>
|
|
<if test="productName != null">#{productName},</if>
|
|
<if test="productSpc != null">#{productSpc},</if>
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
<if test="attr2 != null">#{attr2},</if>
|
|
<if test="attr3 != null">#{attr3},</if>
|
|
<if test="attr4 != null">#{attr4},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="isqua != null">#{isqua},</if>
|
|
<if test="fileId != null">#{fileId},</if>
|
|
</trim>
|
|
</insert>
|
|
<insert id="insertBaseFileBatch">
|
|
INSERT INTO base_file(file_id, file_name, file_address, source_id, remark, create_by, create_time)
|
|
VALUES
|
|
<foreach collection="baseFiles" index="" item="baseFile" separator=",">
|
|
(
|
|
#{baseFile.fileId},
|
|
#{baseFile.fileName},
|
|
#{baseFile.fileAddress},
|
|
#{baseFile.sourceId},
|
|
#{baseFile.remark},
|
|
#{baseFile.createBy},
|
|
#{baseFile.createTime}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
|
|
<update id="updateQcProCheckById" parameterType="QcProCheck">
|
|
update qc_pro_check
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="id != null and id != ''">#{id},</if>
|
|
<if test="rfid != null and rfid != ''">#{rfid},</if>
|
|
<if test="factoryId != null and factoryId != ''">#{factoryId},</if>
|
|
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
|
|
<if test="workorderId != null and workorderId != ''">#{workorderId},</if>
|
|
<if test="workorderCode != null and workorderCode != ''">#{workorderCode},</if>
|
|
<if test="workorderName != null and workorderName != ''">#{workorderName},</if>
|
|
<if test="orderId != null and orderId != ''">#{orderId},</if>
|
|
<if test="orderCode != null and orderCode != ''">#{orderCode},</if>
|
|
<if test="machineId != null">#{machineId},</if>
|
|
<if test="machineCode != null">#{machineCode},</if>
|
|
<if test="badMeg != null and badMeg != ''">#{badMeg},</if>
|
|
<if test="productId != null">#{productId},</if>
|
|
<if test="productCode != null">#{productCode},</if>
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
<if test="attr2 != null">#{attr2},</if>
|
|
<if test="attr3 != null">#{attr3},</if>
|
|
<if test="attr4 != null">#{attr4},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="isqua != null">#{isqua},</if>
|
|
<if test="fileId != null">#{fileId},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteQcProCheckById" parameterType="String">
|
|
delete from qc_pro_check where id = #{id}
|
|
</delete>
|
|
|
|
<select id="queryImg" resultType="String">
|
|
SELECT
|
|
file_address fileAddress
|
|
FROM
|
|
base_file
|
|
WHERE
|
|
source_id=#{id}
|
|
</select>
|
|
<select id="getInfoByRfid" resultType="com.op.quality.domain.QcProCheck">
|
|
select
|
|
top 1
|
|
rfid.workorder_code workorderCode,
|
|
rfid.work_batch_code workBatchCode,
|
|
rfid.machine_code machineCode,
|
|
be.equipment_name machineName,
|
|
ow.product_code productCode,
|
|
ow.product_name productName,
|
|
ow.product_spc productSpc,
|
|
ow.order_code orderCode
|
|
from pro_rfid_process_detail rfid
|
|
left join base_equipment be on rfid.machine_code = be.equipment_code
|
|
left join pro_order_workorder ow on ow.workorder_code = rfid.workorder_code
|
|
where rfid.bind_status = '1'
|
|
and rfid.rfid = #{rfid}
|
|
order by rfid.create_time desc
|
|
</select>
|
|
<select id="getEquipmentList" resultType="com.op.quality.domain.QcProCheck">
|
|
select
|
|
equipment_code equipmentCode,
|
|
equipment_name equipmentName
|
|
from base_equipment
|
|
where equipment_type_code = #{equipmentTypeCode}
|
|
</select>
|
|
<select id="getDictList" resultType="com.op.quality.domain.QcProCheck">
|
|
select
|
|
dict_value itemCode,
|
|
dict_label itemName
|
|
from sys_dict_data
|
|
where dict_type = #{equipmentTypeCode}
|
|
</select>
|
|
<select id="getCheckTaskList" resultMap="QcCheckTaskIncomeResult">
|
|
select qct.record_id, qct.check_no, qct.income_batch_no, qct.order_no,
|
|
qct.material_code, qct.material_name, qct.quality, qct.unit,
|
|
qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_loc,
|
|
qct.check_status, qct.check_man_code,qct.check_man_name, qct.check_time, qct.check_result,
|
|
qct.status,qct.create_by,qct.create_time,qct.check_type,
|
|
qct.noOk_quality,qct.aNoOkquality,qct.bNoOkquality,qct.cNoOkquality,qct.sample_quality
|
|
,pow.workorder_code_sap workorderCodeSap
|
|
from qc_check_task qct
|
|
left join qc_check_task_user qctu on qctu.belong_to = qct.record_id
|
|
left join pro_order_workorder pow on pow.workorder_code = qct.order_no
|
|
<where>
|
|
and qct.del_flag = '0' and pow.del_flag = '0'
|
|
<if test="checkType != null and checkType != ''"> and qct.check_type = #{checkType}</if>
|
|
<if test="checkManCode != null and checkManCode != ''"> and qctu.check_man_code = #{checkManCode}</if>
|
|
<if test="checkStatus != null and checkStatus != ''"> and qct.check_status in (${checkStatus})</if>
|
|
</where>
|
|
order by qct.create_time desc
|
|
</select>
|
|
<select id="getQcProCheckList" resultType="com.op.quality.domain.QcProCheck">
|
|
SELECT q1.machine_code AS machineCode,
|
|
MIN(q1.machine_name) AS machineName,
|
|
SUM(q2.quality) AS 'acceptanceNumber',
|
|
SUM(q3.quality) AS 'unqualifiedNumber',
|
|
SUM(q2.quality) * 100 / (SUM(q2.quality) + SUM(q3.quality)) AS 'passRate'
|
|
FROM qc_pro_check q1
|
|
LEFT JOIN
|
|
qc_pro_check q2 ON q1.machine_code = q2.machine_code AND q2.isqua = '1'
|
|
LEFT JOIN
|
|
qc_pro_check q3 ON q1.machine_code = q3.machine_code AND q3.isqua = '0'
|
|
<where>
|
|
<if test="workorderCode != null and workorderCode != ''">and q1.workorder_code like concat('%', #{workorderCode}, '%')</if>
|
|
<if test="productCode != null and productCode != ''">and q1.product_code like concat('%', #{productCode}, '%')</if>
|
|
<if test="machineCode != null and machineCode != ''">and q1.machine_code like concat('%', #{machineCode}, '%')</if>
|
|
<if test="createTimeStart != null ">and CONVERT(datetime,q1.create_time) >= #{createTimeStart}</if>
|
|
<if test="createTimeEnd != null ">and #{createTimeEnd} >= CONVERT(datetime,q1.create_time)</if>
|
|
and q1.machine_name LIKE '%烘房%'
|
|
</where>
|
|
GROUP BY q1.machine_code
|
|
</select>
|
|
<select id="getHFnames" resultType="com.op.quality.domain.QcProCheck">
|
|
select
|
|
alls.machineName,
|
|
alls.machineCode,
|
|
alls.quality,
|
|
ok.okQuality
|
|
from(
|
|
select count(0) quality,
|
|
<if test='chartType =="hf"'>
|
|
q1.machine_code machineCode,
|
|
q1.machine_name machineName
|
|
</if>
|
|
<if test='chartType =="cp"'>
|
|
q1.product_code machineCode,
|
|
q1.product_name machineName
|
|
</if>
|
|
from qc_pro_check q1
|
|
left join pro_order_workorder pow on pow.workorder_code = q1.workorder_code
|
|
<where>
|
|
<if test="workorderCode != null and workorderCode != ''">and q1.workorder_code like concat('%', #{workorderCode}, '%')</if>
|
|
<if test="productCode != null and productCode != ''">and q1.product_code like concat('%', #{productCode}, '%')</if>
|
|
<if test="machineCode != null and machineCode != ''">and q1.machine_code like concat('%', #{machineCode}, '%')</if>
|
|
<if test="createTimeStart != null ">and CONVERT(datetime,q1.create_time) >= #{createTimeStart}</if>
|
|
<if test="createTimeEnd != null ">and #{createTimeEnd} >= CONVERT(datetime,q1.create_time)</if>
|
|
and q1.machine_name LIKE '烘房%'
|
|
<if test="shiftId != null ">and pow.shift_id = #{shiftId}</if>
|
|
</where>
|
|
<if test='chartType =="hf"'>
|
|
group by q1.machine_code, q1.machine_name
|
|
</if>
|
|
<if test='chartType =="cp"'>
|
|
group by q1.product_code, q1.product_name
|
|
</if>
|
|
) alls
|
|
left join (
|
|
select count(0) okQuality,
|
|
<if test='chartType =="hf"'>
|
|
q1.machine_code machineCode,
|
|
q1.machine_name machineName
|
|
</if>
|
|
<if test='chartType =="cp"'>
|
|
q1.product_code machineCode,
|
|
q1.product_name machineName
|
|
</if>
|
|
from qc_pro_check q1
|
|
left join pro_order_workorder pow on pow.workorder_code = q1.workorder_code
|
|
<where>
|
|
<if test="workorderCode != null and workorderCode != ''">and q1.workorder_code like concat('%', #{workorderCode}, '%')</if>
|
|
<if test="productCode != null and productCode != ''">and q1.product_code like concat('%', #{productCode}, '%')</if>
|
|
<if test="machineCode != null and machineCode != ''">and q1.machine_code like concat('%', #{machineCode}, '%')</if>
|
|
<if test="createTimeStart != null ">and CONVERT(datetime,q1.create_time) >= #{createTimeStart}</if>
|
|
<if test="createTimeEnd != null ">and #{createTimeEnd} >= CONVERT(datetime,q1.create_time)</if>
|
|
and q1.machine_name LIKE '烘房%'
|
|
<if test="shiftId != null ">and pow.shift_id = #{shiftId}</if>
|
|
and q1.isqua = '1'
|
|
</where>
|
|
<if test='chartType =="hf"'>
|
|
group by q1.machine_code, q1.machine_name
|
|
</if>
|
|
<if test='chartType =="cp"'>
|
|
group by q1.product_code, q1.product_name
|
|
</if>
|
|
) ok on alls.machineCode = ok.machineCode
|
|
order by alls.machineName
|
|
</select>
|
|
|
|
</mapper>
|