<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="">
    <query id="JdgMatBcQcmTrack.getByBatchNo" desc="通过批号查询">
        <![CDATA[
SELECT T.* FROM mat_bc_qcmtrack T
WHERE T.JUDGE_STOVE_NO = {0}
AND T.BATCH_NO = {1}
AND T.PROCESS_CDOE = {2}
        ]]>
    </query>
    
    <query id="JdgMatBcQcmTrack.getByBatchNoFirtRow" desc="通过批号查询">
        <![CDATA[
SELECT T.* FROM mat_bc_qcmtrack T
WHERE T.JUDGE_STOVE_NO = {0}
AND T.BATCH_NO = {1}
AND T.PROCESS_CDOE = {2}
AND ROWNUM <= 1
        ]]>
    </query>
    
    <query id="JdgMatBcQcmTrack.getByMatNo" desc="通过材料号查询">
        <![CDATA[
SELECT *
  FROM mat_bc_qcmtrack T
 WHERE T.MAT_NO = {0}
   AND T.PROCESS_CDOE = {1}
        ]]>
    </query>
    
    <query id="JdgMatBcQcmTrack.getByMatNoFirstRow" desc="通过材料号查询">
        <![CDATA[
SELECT *
  FROM mat_bc_qcmtrack T
 WHERE T.MAT_NO = {0}
   AND T.PROCESS_CDOE = {1}
   AND ROWNUM <= 1
        ]]>
    </query>
    
    <query id="JdgMatBcQcmTrack.getAllProcessResult" desc="获取所有工序判定结果">
        <![CDATA[
SELECT T.*
  FROM MAT_BC_QCMTRACK T
 WHERE T.MAT_NO = (SELECT T2.MAT_NO
                     FROM MAT_BC_QCMTRACK T2
                    WHERE T2.JUDGE_STOVE_NO = {0}
                      AND T2.BATCH_NO = {1}
                      AND T2.PROCESS_CDOE = {2}
                      AND T2.JUGDE_APPLY_CODE = {3}
                      AND ROWNUM <= 1)
 ORDER BY T.PROCESS_CDOE DESC
        ]]>
    </query>
    
    <query id="JdgMatBcQcmTrack.getJudgeIdByBatchNoNoProcess" desc="通过批号查询">
        <![CDATA[
SELECT T.PROCESS_CDOE,
       MIN(T.JUGDE_CONVICTED) JUGDE_CONVICTED,
       MIN(T.JUGDE_APPLY_CODE) JUGDE_APPLY_CODE
  FROM MAT_BC_QCMTRACK T
 WHERE T.JUDGE_STOVE_NO = {0}
   AND T.BATCH_NO = {1}
 GROUP BY T.PROCESS_CDOE
        ]]>
    </query>
    
    <query id="JdgMatBcQcmTrack.setJudgeResult" desc="修改判定结果">
        <![CDATA[
UPDATE MAT_BC_QCMTRACK T
   SET T.JUGDE_CONVICTED        = {4},
       T.JUDGE_STD_DES          = {5},
       T.JUDGE_RESULT_CODE      = {6},
       T.JUDGE_RESULT_TIME      = sysdate,
       T.JUDGE_MAKER            = {7},
       T.JUDGE_MEMO             = {8},
       T.PASS_APPLY_NO          = {9},
       T.UNIT_CODE              = {10},
       T.UNIT_DESC              = {11},
       T.APPLY_TIME             = TO_DATE(SUBSTR({12}, 1, 19),
                                          'YYYY-MM-DD HH24:MI:SS'),
       T.AUDIT_RESULT           = {13},
       T.AUDIT_MEMO             = {14},
       T.AUDIT_UNIT             = {15},
       T.AUDIT_NAME             = {16},
       T.AUDIT_TIME             = TO_DATE(SUBSTR({17}, 1, 19),
                                          'YYYY-MM-DD HH24:MI:SS'),
       T.FACE_RESULT_PATH       = {18},
       T.FACE_RESULT_PATH1      = {19},
       T.SPEC_RESULT_PATH       = {20},
       T.SPEC_RESULT_PATH1      = {21},
       T.DETECT_RESULT_PATH     = {22},
       T.DETECT_RESULT_PATH1    = {23},
       T.WPRESSURE_RESULT_PATH = {24},
       T.WPRESSURE_RESULT_PATH1 = {25},
       T.PROCESS_RESULT_PATH    = {26},
       T.PROCESS_RESULT_PATH1   = {27},
       T.FACE_RESULT_CODE = {28},
       T.SPEC_RESULT_CODE = {29},
       T.CHEM_RESULT_CODE = {30},
       T.PHY_RESULT_CODE = {31},
       T.DETECT_RESULT_CODE = {32},
       T.WPRESSURE_RESULT_CODE = {33},
       T.PROCESS_RESULT_CODE = {34}
 WHERE T.JUDGE_STOVE_NO = {0}
   AND T.BATCH_NO = {1}
   AND T.PROCESS_CDOE = {2}
   AND T.JUGDE_APPLY_CODE = {3}
        ]]>
    </query>
    
    <query id="JdgMatBcQcmTrack.setJudgeTolResult" desc="修改成品综合判定结果">
        <![CDATA[
UPDATE MAT_BC_QCMTRACK T
   SET T.JUGDE_TOLCONVICTED   = {4},
       T.JUDGE_TOLSTD_DES     = {5},
       T.JUDGE_TOLRESULT_CODE = {6},
       T.JUDGE_TOLRESULT_TIME = sysdate,
       T.JUDGE_TOLMAKER       = {7},
       T.JUDGE_TOLMEMO        = {8}
 WHERE T.JUDGE_STOVE_NO = {0}
   AND T.BATCH_NO = {1}
   AND T.PROCESS_CDOE = {2}
   AND T.JUGDE_APPLY_CODE = {3}
        ]]>
    </query>
    
    <query id="JdgMatBcQcmTrack.getJudgeStoveNoByJudgeStoveNo" desc="通过判定炉号获取轧管判定炉号">
        <![CDATA[
SELECT T.JUDGE_STOVE_NO, T.BATCH_NO
  FROM MAT_BC_QCMTRACK T
 WHERE T.MAT_NO = (SELECT MIN(T2.MAT_NO)
                     FROM MAT_BC_QCMTRACK T2
                    WHERE T2.JUDGE_STOVE_NO = {0}
                      AND T2.BATCH_NO = {1}
                      AND T2.PROCESS_CDOE = {2})
   AND T.PROCESS_CDOE = {3}
        ]]>
    </query>
</queryMap>