<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="QCM_JHY_PHYRESULT （生成工具：代码生成工具4.0   访问地址：http://172.16.2.128/tool/）">
    <query id="QcmJhyPhyresultDAL.QueryPhyMinByBatchNo" desc="查询">
        <![CDATA[
SELECT D.CHECK_NO SAMPLE_ID,
       D.CHECK_NO,
       E.SAMPLE_NO,
       C.PHY_CODE_MIN,
       C.PHY_NAME_MIN,
       CASE
         WHEN MIN(C.RATE) = '408603' AND MIN(C.ATTACH_PERCENT) IS NOT NULL THEN
          MIN(C.ATTACH_COUNT)
         ELSE
          SUM(C.DESC_COUNT * C.SAMPLE_COUNT)
       END DESC_COUNT,
       D.LOT_NO,
       MIN(D.LOT_NO_GROUP) LOT_NO_GROUP,
       D.JUDGE_STOVE_NO,
       D.BATCH_NO,
       MIN(C.PROCESS_CODE) PROCESS_CODE,
       MIN(C2.PROCESS_DESC) PROCESS_DESC,
       C.PIC,
       MIN(E.NK_RESULT) NK_RESULT,
       MIN(E.JF_RESULT) JF_RESULT,
       (SELECT LISTAGG(F.STDMEMO) WITHIN GROUP(ORDER BY F.PHY_NAME)
          FROM CRAFT_ORD_DESIGN_STD_PIC F
         WHERE F.DESGIN_KEY = B.DESGIN_KEY
           AND F.MSC_PLINE = {2}
           AND F.PROCESS_CODE = {3}
           AND F.PIC = C.PIC
           AND F.PHY_CODE_MIN = C.PHY_CODE_MIN) STDMEMO,
       MIN(E.MAT_NO) MAT_NO,
       MIN(E.HEAD_MAT_NO) HEAD_MAT_NO,
       MIN(E.BAR_CODE) BAR_CODE,
       MIN(C.DESC_RATE) DESC_RATE,
       MIN(C.RATE) RATE,
       MIN(E.RESULT_SOURCE) RESULT_SOURCE,
       MIN(D.APPLY_RESAMPLE) APPLY_RESAMPLE,
       MIN(D.CYCLES_FLAG) CYCLES_FLAG,
       'False' CHK,
       MIN(E.OLD_JUDGE_STOVE_NO) OLD_JUDGE_STOVE_NO,
       MIN(E.OLD_BATCH_NO) OLD_BATCH_NO,
       DECODE(MIN(E.IS_MAIN), '0', '否', '是') IS_MAIN,
       DECODE(MIN(C.CRAFT_SOURCE), '2', '1', '0') CRAFT_SOURCE,
       DECODE(MIN(C.CRAFT_SOURCE), '2', '首日检', '生产样') CRAFT_SOURCE_DESC
  FROM CRAFT_ORD_DESIGN B, CRAFT_ORD_DESIGN_STD_PIC_SMP C
  LEFT JOIN (SELECT A.* FROM QCM_ZC_CHECKCONSIGN_DETAIL A LEFT JOIN QCM_ZC_CHECKCONSIGN B ON A.CHECK_NO = B.CHECK_NO
		AND A.BATCH_NO = B.BATCH_NO WHERE B.ORD_LN_DLY_PK LIKE {15} || '%') E
    ON EXISTS (SELECT 1
          FROM QCM_ZC_CHECKCONSIGN E2, PLN_SALEORD E3
         WHERE ({9} = '1'
               OR C.RATE IN ('408601', '408608')
               AND (E2.LOT_NO = {7} AND ({8} IS NULL OR E2.LOT_NO_GROUP = {8})
               OR C.LOOP_VALUE = '0'
               ) AND
               E2.CHECK_NO NOT LIKE '%P%' OR
               C.RATE = '408603' AND E2.JUDGE_STOVE_NO = {5} OR
               E2.JUDGE_STOVE_NO = {5} AND E2.BATCH_NO = {6})
           AND E2.PROCESS_CODE = {3}
           AND E3.ORD_LN_DLY_PK = E2.ORD_LN_DLY_PK
           AND E3.ORD_LN_PK = {15}
           AND ({16} IS NULL OR {16} = '0' AND EXISTS
                (SELECT 1
                   FROM QCM_GP_JUDGE_APPLY E4
                  WHERE E4.STOVE_NO = E2.STOVE_NO
                    AND E4.IS_FLAG = '0'
                    AND E4.PLINE_CODE NOT IN ('C063', 'C064')) OR
                {16} = '1' AND EXISTS
                (SELECT 1
                   FROM QCM_GP_JUDGE_APPLY E4
                  WHERE E4.STOVE_NO = E2.STOVE_NO
                    AND E4.IS_FLAG = '0'
                    AND E4.PLINE_CODE IN ('C063', 'C064')))
           AND E2.CRAFT_SOURCE = {9}
           AND E2.IS_FLAG = '0'
           AND E2.CYCLES_FLAG = {13}
           AND E2.PLINE_CODE = {14}
           AND E.CHECK_NO = E2.CHECK_NO
           AND E.BATCH_NO = E2.BATCH_NO)
   AND E.PHY_CODE_MAX = C.PHY_CODE_MIN
   AND E.VALIDFLAG = '1'
   AND ({12} IS NULL OR E.IS_MAIN = {12})
  LEFT JOIN QCM_ZC_CHECKCONSIGN D
    ON D.CHECK_NO = E.CHECK_NO
   AND D.BATCH_NO = E.BATCH_NO
  LEFT JOIN COM_BASE_PROCESS C2
    ON C2.PROCESS_CODE = C.PROCESS_CODE
 WHERE B.ORD_LN_PK = {0}
   AND B.CRAFT_SEQ = {1}
   AND C.DESGIN_KEY = B.DESGIN_KEY
   AND ({9} = '1' AND C.CRAFT_SOURCE = '2' AND C.PROCESS_CODE = {3} OR
       {9} = '0' AND C.MSC_PLINE = {2} AND C.PROCESS_CODE = {17} AND
       C.PIC = {4})
   AND ({10} = '0' OR C.PHY_CODE_MIN IN {11})
 GROUP BY D.LOT_NO,
          D.CHECK_NO,
          D.JUDGE_STOVE_NO,
          D.BATCH_NO,
          E.SAMPLE_NO,
          C.PHY_CODE_MIN,
          C.PHY_NAME_MIN,
          B.DESGIN_KEY,
          C.PIC
 ORDER BY D.JUDGE_STOVE_NO, D.BATCH_NO, C.PHY_NAME_MIN, E.SAMPLE_NO
        ]]>
    </query>

    <query id="QcmJhyPhyresultDAL.GetPhyMinByBatchNo" desc="查询">
        <![CDATA[
SELECT A.CHECK_NO SAMPLE_ID,
         A.CHECK_NO,
         B.SAMPLE_NO,
         A.LOT_NO,
         A.LOT_NO_GROUP,
         B.NK_RESULT,
         B.JF_RESULT,
         B.MAT_NO,
         B.HEAD_MAT_NO,
         B.BAR_CODE,
         B.RESULT_SOURCE,
         A.APPLY_RESAMPLE,
         A.CYCLES_FLAG,
         B.OLD_JUDGE_STOVE_NO,
         B.OLD_BATCH_NO,
         B.IS_MAIN,
         A.CRAFT_SOURCE
    FROM QCM_ZC_CHECKCONSIGN        A,
         QCM_ZC_CHECKCONSIGN_DETAIL B,
         SLM_ORDER_LINE_DELIVERY    C
   WHERE A.JUDGE_STOVE_NO = {0}
     AND A.BATCH_NO = {1}
     AND A.PROCESS_CODE {2}
     AND A.CRAFT_SOURCE = {3}
     AND A.CYCLES_FLAG = {4}
     AND A.PLINE_CODE = {5}
     AND A.IS_FLAG = '0'
     AND C.ORD_LN_DLY_PK = A.ORD_LN_DLY_PK
     AND C.ORD_LN_PK = {6}
     AND B.CHECK_NO = A.CHECK_NO
     AND B.BATCH_NO = A.BATCH_NO
     AND B.VALIDFLAG = '1'
     AND B.PHY_CODE_MAX = {7}
     AND ({8} IS NULL OR E.IS_MAIN = {8})
        ]]>
    </query>
    
    <query id="QcmJhyPhyresultDAL.QueryPhyMinByCheckNo" desc="通过检验编号查询试样组结果">
        <![CDATA[
SELECT T.CHECK_NO,
       T.CHECK_NO SAMPLE_ID,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.SAMPLE_NO,
       T.PHY_NAME_MIN,
       T.PHY_CODE_MIN,
       T.PHY_CODE_MAX,
       MIN(T.RATE) RATE,
       MIN(T.DESC_RATE) DESC_RATE,
       MIN(T.RESULT_SOURCE) RESULT_SOURCE,
       MIN(T.MAT_NO) MAT_NO,
       MIN(T.HEAD_MAT_NO) HEAD_MAT_NO,
       MIN(T.BAR_CODE) BAR_CODE,
       MIN(T.APPLY_RESAMPLE) APPLY_RESAMPLE,
       MIN(T.CYCLES_FLAG) CYCLES_FLAG,
       T.LOT_NO,
       MIN(T.LOT_NO_GROUP) LOT_NO_GROUP,
       MIN(T.PROCESS_DESC) PROCESS_DESC,
       MIN(T.PROCESS_CODE) PROCESS_CODE,
       MIN(T.NK_RESULT) NK_RESULT,
       MIN(T.JF_RESULT) JF_RESULT,
       (SELECT LISTAGG(D2.STDMEMO) WITHIN GROUP(ORDER BY D2.PHY_NAME)
          FROM CRAFT_ORD_DESIGN_STD_PIC D2
         WHERE D2.DESGIN_KEY = A5.DESGIN_KEY
           AND D2.MSC_PLINE = T.MSC_PLINE
           AND D2.PROCESS_CODE = T.PROCESS_CODE
           AND D2.PIC = T.PIC
           AND D2.PHY_CODE_MIN = T.PHY_CODE_MIN) STDMEMO,
       CASE
         WHEN T.PHY_CODE_MIN = 'HX' THEN
          CASE
            WHEN {5} = '1' THEN
             MIN(A8.PRODUCT_CNT_FD)
            ELSE
             DECODE(MIN(A7.PRODUCT_CNT_N),
                    NULL,
                    MIN(A7.PRODUCT_CNT),
                    MIN(A7.PRODUCT_CNT_N))
          END
         ELSE
          CASE
            WHEN MIN(A6.RATE) = '408603' AND MIN(A6.ATTACH_PERCENT) IS NOT NULL THEN
             MIN(A6.ATTACH_COUNT)
            ELSE
             SUM(A6.DESC_COUNT * A6.SAMPLE_COUNT)
          END
       END DESC_COUNT,
       CASE
         WHEN MIN(T.CRAFT_SOURCE) = '1' THEN
          DECODE(T.PHY_CODE_MIN, 'HX', 'CIC', 'PIC')
         ELSE
          T.PIC
       END PIC,
       'False' CHK,
       MIN(T.OLD_JUDGE_STOVE_NO) OLD_JUDGE_STOVE_NO,
       MIN(T.OLD_BATCH_NO) OLD_BATCH_NO,
       DECODE(MIN(T.IS_MAIN), '0', '否', '是') IS_MAIN,
       MIN(T.CRAFT_SOURCE) CRAFT_SOURCE
  FROM (SELECT A.CHECK_NO,
               A.CHECK_NO SAMPLE_ID,
               B.JUDGE_STOVE_NO,
               A.BATCH_NO,
               A.SAMPLE_NO,
               A.PHY_NAME_MAX PHY_NAME_MIN,
               A.PHY_CODE_MAX PHY_CODE_MIN,
               A.PHY_CODE_MAX,
               DECODE(A.PHY_CODE_MAX, 'HX', '408603', A.RATE) RATE,
               DECODE(A.PHY_CODE_MAX, 'HX', '炉', A.DESC_RATE) DESC_RATE,
               A.RESULT_SOURCE,
               A.MAT_NO,
               A.HEAD_MAT_NO,
               A.BAR_CODE,
               B.APPLY_RESAMPLE,
               B.CYCLES_FLAG,
               B.LOT_NO,
               B.LOT_NO_GROUP,
               B2.PROCESS_DESC,
               B.PROCESS_CODE,
               B.ORD_LN_DLY_PK,
               B.CRAFT_SEQ,
               B.INDEX_SEQ MSC_PLINE,
               B.CIC,
               DECODE(A.PHY_CODE_MAX, 'HX', B.CIC, B.PIC) PIC,
               B.CRAFT_SOURCE,
               CASE
                 WHEN A.NK_RESULT IS NULL OR
                      A2.CHECK_NO IS NOT NULL AND A2.NK_RESULT IS NULL THEN
                  NULL
                 WHEN A.NK_RESULT = '0' OR
                      A2.CHECK_NO IS NOT NULL AND A2.NK_RESULT = '0' THEN
                  '0'
                 ELSE
                  '1'
               END NK_RESULT,
               CASE
                 WHEN A.JF_RESULT IS NULL OR
                      A2.CHECK_NO IS NOT NULL AND A2.JF_RESULT IS NULL THEN
                  NULL
                 WHEN A.JF_RESULT = '0' OR
                      A2.CHECK_NO IS NOT NULL AND A2.JF_RESULT = '0' THEN
                  '0'
                 ELSE
                  '1'
               END JF_RESULT,
               A.OLD_JUDGE_STOVE_NO,
               A.OLD_BATCH_NO,
               A.IS_MAIN
          FROM QCM_ZC_CHECKCONSIGN_DETAIL A
          LEFT JOIN QCM_ZC_CHECKCONSIGN_DETAIL A2
            ON A2.CHECK_NO = A.CHECK_NO
           AND A2.BATCH_NO = A.BATCH_NO
           AND A2.SAMPLE_NO = A.SAMPLE_NO
           AND A2.PHY_CODE_MAX = 'ONH'
           AND A2.VALIDFLAG = '1'
           AND A.PHY_CODE_MAX = 'HX', QCM_ZC_CHECKCONSIGN B
          LEFT JOIN COM_BASE_PROCESS B2
            ON B2.PROCESS_CODE = B.PROCESS_CODE
         WHERE A.CHECK_NO = {0}
           AND B.JUDGE_STOVE_NO = {1}
           AND A.BATCH_NO = {2}
           AND A.CHECK_NO = B.CHECK_NO
           AND A.BATCH_NO = B.BATCH_NO
           AND A.PHY_CODE_MAX <> 'ONH'
           AND A.VALIDFLAG = '1'
           AND ({3} = '0' OR A.PHY_CODE_MAX IN {4})) T
  LEFT JOIN QCM_BC_PHYJUDGE A2
    ON A2.SAMPLE_ID = T.CHECK_NO
   AND A2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND A2.BATCH_NO = T.BATCH_NO
   AND A2.SAMPLE_NO = T.SAMPLE_NO
   AND A2.VALIDFLAG = '1'
  LEFT JOIN PLN_SALEORD A4
    ON A4.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
  LEFT JOIN CRAFT_ORD_DESIGN A5
    ON A5.ORD_LN_PK = A4.ORD_LN_PK
   AND A5.CRAFT_SEQ = T.CRAFT_SEQ
  LEFT JOIN CRAFT_ORD_DESIGN_STD_PIC_SMP A6
    ON A6.DESGIN_KEY = A5.DESGIN_KEY
   AND ({5} = '1' AND A6.CRAFT_SOURCE = '2' OR {5} <> '1' AND
       A6.MSC_PLINE = T.MSC_PLINE AND A6.PROCESS_CODE = {6} AND
       A6.PIC = T.PIC)
   AND A6.PHY_CODE_MIN = T.PHY_CODE_MIN
  LEFT JOIN CRAFT_ORD_DESIGN_STD A7
    ON A7.DESGIN_KEY = A5.DESGIN_KEY
  LEFT JOIN CRAFT_ORD_FD_CIC_COUNT A8
    ON A8.ORD_LN_PK = A4.ORD_LN_PK
 GROUP BY T.LOT_NO,
          T.CHECK_NO,
          T.JUDGE_STOVE_NO,
          T.BATCH_NO,
          T.SAMPLE_NO,
          T.PHY_CODE_MIN,
          T.PHY_NAME_MIN,
          A5.DESGIN_KEY,
          T.PIC,
          T.MSC_PLINE,
          T.PROCESS_CODE
 ORDER BY BATCH_NO, IS_MAIN DESC, OLD_JUDGE_STOVE_NO,
  OLD_BATCH_NO, PHY_NAME_MIN, SAMPLE_NO

        ]]>
    </query>
    
    <query id="QcmJhyPhyresultDAL.QueryByCheckNoBatchNo" desc="通过炉批查询">
        <![CDATA[
SELECT T.*
  FROM QCM_JHY_PHYRESULT T, COM_BASE_PLINE A, QCM_ZC_CHECKCONSIGN B
 WHERE A.PLINE_CODE = T.PLINE_CODE
   AND T.JUDGE_STOVE_NO = {0}
   AND T.BATCH_NO = {1}
   AND T.VALIDFLAG = '1'
   AND T.SAMPLE_ID = {2}
   AND A.PROCESS_CODE = {3}
   AND B.CHECK_NO = T.SAMPLE_ID
   AND B.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND B.BATCH_NO = T.BATCH_NO
        ]]>
    </query>
    
    <query id="QcmJhyPhyresultDAL.QueryByCheckNo" desc="通过炉批查询">
        <![CDATA[
SELECT T.*
  FROM QCM_JHY_PHYRESULT T, COM_BASE_PLINE A, QCM_ZC_CHECKCONSIGN B
 WHERE A.PLINE_CODE = T.PLINE_CODE
   AND T.JUDGE_STOVE_NO = {0}
   AND T.VALIDFLAG = '1'
   AND T.SAMPLE_ID = {1}
   AND A.PROCESS_CODE = {2}
   AND B.CHECK_NO = T.SAMPLE_ID
   AND B.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND B.BATCH_NO = T.BATCH_NO
        ]]>
    </query>
    
     <query id="QcmJhyPhyresultDAL.QueryByBatchNoPhyMin" desc="通过试样组和批号查询">
        <![CDATA[
SELECT T.SAMPLE_ID,
       T.SAMPLE_NO,
       max(T.INDEX_SEQ) INDEX_SEQ,
       T.LOT_NO,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.SAMPLE_TYPE,
       DECODE(T.SAMPLE_TYPE, '0', '初样', '1', '复样') SAMPLE_TYPE_DESC,
       T.CONSIGNER,
       T.PLINE_CODE,
       T.PHY_CODE_MAX,
       T.PHY_NAME_MAX,
       T.PHY_CODE_MIN,
       T.PHY_NAME_MIN,
       T.PHY_CODE,
       T.PHY_NAME,
       T.ITEM_CODE_F,
       T.ITEM_NAME_F,
       T.ITEM_CODE_W,
       T.ITEM_NAME_W,
       T.ITEM_CODE_S,
       T.ITEM_NAME_S,
       T.VALUE1,
       T.VALUE2,
       T.VALUE3,
       T.VALUE4,
       T.VALUE5,
       T.VALUE6,
       T.VALUE7,
       T.VALUE8,
       T.VALUE9,
       T.VALUE10,
       T.VALUE11,
       T.VALUE12,
       T.VALUE13,
       T.VALUE14,
       T.VALUE15,
       T.AVERAGE,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       A.PROCESS_CODE,
       A.PROCESS_DESC,
       T.FOR_CHECK_NO,
       T.ORIGINAL_AREA,
       T.IS_GOOD,
       T.IS_DEFECT,
       T.ISRCL,
       T.MAT_NO,
       T.HEAD_MAT_NO,
       T.BAR_CODE,
       T.CHECK_TEMP,
       T.HARDNESS_TYPE,
       T.PHY_CODE_DIR,
       T.PHY_NAME_DIR,
       T.SAMPLE_STYLE,
       T.SAMPLE_SIZE,
       T.LOT_NO_GROUP,
       T.CHECK_TEMP_CODE,
       T.SAMPLE_SIZE_CODE,
       T.REMARK,T.SAMPLE_JB,T.NOTCH_SHAPE
  FROM QCM_JHY_PHYRESULT T, COM_BASE_PLINE A
 WHERE A.PLINE_CODE = T.PLINE_CODE
   AND T.JUDGE_STOVE_NO = {0}
   AND T.BATCH_NO = {1}
   AND T.SAMPLE_ID = {2}
   AND T.SAMPLE_NO = {3}
   AND T.PHY_CODE_MIN = {4}
   AND T.VALIDFLAG = '1'
   AND A.PROCESS_CODE = {5}
   group by T.SAMPLE_ID,
       T.SAMPLE_NO,
       T.LOT_NO,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.SAMPLE_TYPE,
       T.SAMPLE_TYPE,
       T.CONSIGNER,
       T.PLINE_CODE,
       T.PHY_CODE_MAX,
       T.PHY_NAME_MAX,
       T.PHY_CODE_MIN,
       T.PHY_NAME_MIN,
       T.PHY_CODE,
       T.PHY_NAME,
       T.ITEM_CODE_F,
       T.ITEM_NAME_F,
       T.ITEM_CODE_W,
       T.ITEM_NAME_W,
       T.ITEM_CODE_S,
       T.ITEM_NAME_S,
       T.VALUE1,
       T.VALUE2,
       T.VALUE3,
       T.VALUE4,
       T.VALUE5,
       T.VALUE6,
       T.VALUE7,
       T.VALUE8,
       T.VALUE9,
       T.VALUE10,
       T.VALUE11,
       T.VALUE12,
       T.VALUE13,
       T.VALUE14,
       T.VALUE15,
       T.AVERAGE,
       T.CREATE_NAME,
       T.CREATE_TIME,
       T.UPDATE_NAME,
       T.UPDATE_TIME,
       T.DELETE_NAME,
       T.DELETE_TIME,
       A.PROCESS_CODE,
       A.PROCESS_DESC,
       T.FOR_CHECK_NO,
       T.ORIGINAL_AREA,
       T.IS_GOOD,
       T.IS_DEFECT,
       T.ISRCL,
       T.MAT_NO,
       T.HEAD_MAT_NO,
       T.BAR_CODE,
       T.CHECK_TEMP,
       T.HARDNESS_TYPE,
       T.PHY_CODE_DIR,
       T.PHY_NAME_DIR,
       T.SAMPLE_STYLE,
       T.SAMPLE_SIZE,
       T.LOT_NO_GROUP,
       T.CHECK_TEMP_CODE,
       T.SAMPLE_SIZE_CODE,
       T.REMARK,T.SAMPLE_JB,T.NOTCH_SHAPE
 ORDER BY PHY_NAME
        ]]>
    </query>
    <query id="QcmJhyPhyresultDAL.QueryByBatchNoSampleNo" desc="查询">
        <![CDATA[
SELECT T.SAMPLE_ID,
       T.SAMPLE_NO,
       T.INDEX_SEQ,
       T.LOT_NO,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.SAMPLE_TYPE,
       DECODE(T.SAMPLE_TYPE, '0', '初样', '1', '复样') SAMPLE_TYPE_DESC,
       T.CONSIGNER,
       T.PLINE_CODE,
       T.PHY_CODE_MAX,
       T.PHY_NAME_MAX,
       T.PHY_CODE_MIN,
       T.PHY_NAME_MIN,
       T.PHY_CODE,
       T.PHY_NAME,
       T.ITEM_CODE_F,
       T.ITEM_NAME_F,
       T.ITEM_CODE_W,
       T.ITEM_NAME_W,
       T.ITEM_CODE_S,
       T.ITEM_NAME_S,
       T.VALUE1,
       T.VALUE2,
       T.VALUE3,
       T.VALUE4,
       T.VALUE5,
       T.VALUE6,
       T.VALUE7,
       T.VALUE8,
       T.VALUE9,
       T.VALUE10,
       T.VALUE11,
       T.VALUE12,
       T.VALUE13,
       T.VALUE14,
       T.VALUE15,
       T.AVERAGE,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       T.FOR_CHECK_NO,
       T.RATE,
       T.ORIGINAL_AREA,
       T.IS_GOOD,
       T.IS_DEFECT,
       T.CHECK_TEMP,
       T.HARDNESS_TYPE,
       T.PHY_CODE_DIR,
       T.PHY_NAME_DIR,
       T.SAMPLE_STYLE,
       T.SAMPLE_SIZE,
       T.REMARK
  FROM QCM_JHY_PHYRESULT T, COM_BASE_PLINE A, QCM_ZC_CHECKCONSIGN_DETAIL B
 WHERE A.PLINE_CODE = T.PLINE_CODE
   AND A.PROCESS_CODE = {0}
   AND T.SAMPLE_ID = {1}
   AND T.JUDGE_STOVE_NO = {2}
   AND T.BATCH_NO = {3}
   AND T.SAMPLE_NO = {4}
   AND B.CHECK_NO = T.SAMPLE_ID
   AND B.BATCH_NO = T.BATCH_NO
   AND B.SAMPLE_NO = T.SAMPLE_NO
   AND B.PHY_CODE_MAX = T.PHY_CODE_MIN
   AND B.VALIDFLAG = '1'
        ]]>
    </query>
    
    <query id="QcmJhyPhyresultDAL.QueryLgColligate" desc="查询综合判定">
        <![CDATA[
SELECT A.LOT_NO,
       A.STOVE_NO,
       A.JUDGE_STOVE_NO,
       A.BATCH_NO,
       A.PHY_CODE_MAX,
       A.PHY_NAME_MAX,
       A.PHY_CODE_MIN,
       A.PHY_NAME_MIN,
       A.PHY_CODE,
       A.PHY_NAME,
       A.ITEM_CODE_F,
       A.ITEM_NAME_F,
       A.ITEM_CODE_W,
       A.ITEM_NAME_W,
       A.ITEM_CODE_S,
       A.ITEM_NAME_S,
       A.VALUE1,
       A.VALUE2,
       A.VALUE3,
       A.VALUE4,
       A.VALUE5,
       A.VALUE6,
       A.VALUE7,
       A.VALUE8,
       A.VALUE9,
       A.VALUE10,
       A.VALUE11,
       A.VALUE12,
       A.VALUE13,
       A.VALUE14,
       A.VALUE15,
       A.AVERAGE,
       A.CREATE_NAME,
       TO_CHAR(A.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       A.UPDATE_NAME,
       TO_CHAR(A.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       A.DELETE_NAME,
       TO_CHAR(A.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       DECODE(C.SAMPLE_TYPE, '0', '初样', '1', '复样') SAMPLE_TYPE_DESC
  FROM QCM_ZG_PHYJUDGE T, QCM_ZG_PHYRESULT A, QCM_JHY_PHYRESULT C
 WHERE T.PHY_JUDGE_ID = (SELECT MAX(B.PHY_JUDGE_ID)
                           FROM QCM_ZG_PHYJUDGE B
                          WHERE B.STOVE_NO = T.STOVE_NO)
   AND A.STOVE_NO = T.STOVE_NO
   AND T.PROCESS_CDOE = {0}
   AND T.PHY_RESULT_ID = A.PHY_RESULT_ID
   AND C.SAMPLE_ID = A.SAMPLE_ID
   AND C.INDEX_SEQ = A.INDEX_SEQ
        ]]>
    </query>
    <query id="QcmJhyPhyresultDAL.QueryZgColligate" desc="查询轧管判定">
        <![CDATA[
SELECT A.LOT_NO,
       A.STOVE_NO,
       A.JUDGE_STOVE_NO,
       A.BATCH_NO,
       A.PHY_CODE_MAX,
       A.PHY_NAME_MAX,
       A.PHY_CODE_MIN,
       A.PHY_NAME_MIN,
       A.PHY_CODE,
       A.PHY_NAME,
       A.ITEM_CODE_F,
       A.ITEM_NAME_F,
       A.ITEM_CODE_W,
       A.ITEM_NAME_W,
       A.ITEM_CODE_S,
       A.ITEM_NAME_S,
       A.VALUE1,
       A.VALUE2,
       A.VALUE3,
       A.VALUE4,
       A.VALUE5,
       A.VALUE6,
       A.VALUE7,
       A.VALUE8,
       A.VALUE9,
       A.VALUE10,
       A.VALUE11,
       A.VALUE12,
       A.VALUE13,
       A.VALUE14,
       A.VALUE15,
       A.AVERAGE,
       A.CREATE_NAME,
       TO_CHAR(A.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       A.UPDATE_NAME,
       TO_CHAR(A.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       A.DELETE_NAME,
       TO_CHAR(A.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       DECODE(C.SAMPLE_TYPE, '0', '初样', '1', '复样') SAMPLE_TYPE_DESC
  FROM QCM_ZG_PHYJUDGE T, QCM_ZG_PHYRESULT A, QCM_JHY_PHYRESULT C
 WHERE T.PHY_JUDGE_ID = (SELECT MAX(B.PHY_JUDGE_ID)
                           FROM QCM_ZG_PHYJUDGE B
                          WHERE B.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO)
   AND A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND T.PROCESS_CDOE = {0}
   AND T.PHY_RESULT_ID = A.PHY_RESULT_ID
   AND C.SAMPLE_ID = A.SAMPLE_ID
   AND C.INDEX_SEQ = A.INDEX_SEQ
        ]]>
    </query>
    <query id="QcmJhyPhyresultDAL.QueryByPk" desc="通过主键查询">
        <![CDATA[
 SELECT 
       T.SAMPLE_ID,
       T.SAMPLE_NO,
       T.INDEX_SEQ,
       T.LOT_NO,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.SAMPLE_TYPE,
       T.CONSIGNER,
       T.PLINE_CODE,
       T.PHY_CODE_MAX,
       T.PHY_NAME_MAX,
       T.PHY_CODE_MIN,
       T.PHY_NAME_MIN,
       T.PHY_CODE,
       T.PHY_NAME,
       T.ITEM_CODE_F,
       T.ITEM_NAME_F,
       T.ITEM_CODE_W,
       T.ITEM_NAME_W,
       T.ITEM_CODE_S,
       T.ITEM_NAME_S,
       T.VALUE1,
       T.VALUE2,
       T.VALUE3,
       T.VALUE4,
       T.VALUE5,
       T.VALUE6,
       T.VALUE7,
       T.VALUE8,
       T.VALUE9,
       T.VALUE10,
       T.VALUE11,
       T.VALUE12,
       T.VALUE13,
       T.VALUE14,
       T.VALUE15,
       T.AVERAGE,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME
 FROM QCM_JHY_PHYRESULT T
 WHERE
       T.SAMPLE_ID = {0}
       AND T.SAMPLE_NO = {1}
       AND T.INDEX_SEQ = {2}
        ]]>
    </query>
    <query id="QcmJhyPhyresultDAL.queryCraftResultPic" desc="查询">
        <![CDATA[
SELECT *
  FROM (SELECT DESGIN_KEY,
               PIC,
               USE_CODE,
               USE_DESC,
               '1' SPECL_FL,
               INDEX_SEQ,
               PHY_CODE_MAX,
               PHY_NAME_MAX,
               PHY_CODE_MIN,
               PHY_NAME_MIN,
               PHY_CODE,
               PHY_NAME,
               ITEM_CODE_F,
               ITEM_NAME_F,
               ITEM_CODE_W,
               ITEM_NAME_W,
               ITEM_CODE_S,
               ITEM_NAME_S,
               GROUP_SEQ,
               ISCHECK,
               ISQUOTE,
               RESULT_COUNT,
               ISJUDGE,
               PHY_TYPE,
               PHY_FORMULA,
               STDMIN_SIGN,
               STDMIN,
               STDMAX_SIGN,
               STDMAX,
               JUDGE_BASIS,
               DELIVERYSTATE,
               MODEL_CODE,
               MODEL_DESC,
               STDMEMO,
               SIZE_CODE,
               SIZE_NAME,
               SIZE_MIN_SIGN,
               SIZE_MIN,
               SIZE_MAX_SIGN,
               SIZE_MAX,
               SIZE_CODE2,
               SIZE_NAME2,
               SIZE_MIN_SIGN2,
               SIZE_MIN2,
               SIZE_MAX_SIGN2,
               SIZE_MAX2,
               SPEC_JG,
               SPEC_JG_DESC,
               ADDCONDITION,
               ADDSTDCON_CODE,
               ADDSTD_MIN_SIGN,
               ADDSTD_MIN,
               ADDSTD_MAX_SIGN,
               ADDSTD_MAX,
               ADDPERCENT,
               STDMIN_SIGN2,
               STDMIN2,
               STDMAX_SIGN2,
               STDMAX2,
               STD_CHOOSE,
               MSC_PLINE,
               PROCESS_CODE,
               BILLET_SAMPLE,
               CREATE_NAME,
               CREATE_TIME,
               UPDATE_NAME,
               UPDATE_TIME,
               CRAFT_SOURCE,
               PIC_MEMO,
               FORMULA,
               MIN_F,
               MIN_F_SIGN,
               MAX_F,
               MAX_F_SIGN
          FROM CRAFT_ORD_DESIGN_STD_PIC T
         WHERE T.DESGIN_KEY = {0}
           AND T.SPECL_FL = '1'
        UNION ALL
        SELECT DESGIN_KEY,
               PIC,
               USE_CODE,
               USE_DESC,
               '1' SPECL_FL,
               INDEX_SEQ,
               PHY_CODE_MAX,
               PHY_NAME_MAX,
               PHY_CODE_MIN,
               PHY_NAME_MIN,
               PHY_CODE,
               PHY_NAME,
               ITEM_CODE_F,
               ITEM_NAME_F,
               ITEM_CODE_W,
               ITEM_NAME_W,
               ITEM_CODE_S,
               ITEM_NAME_S,
               GROUP_SEQ,
               ISCHECK,
               ISQUOTE,
               RESULT_COUNT,
               ISJUDGE,
               PHY_TYPE,
               PHY_FORMULA,
               STDMIN_SIGN,
               STDMIN,
               STDMAX_SIGN,
               STDMAX,
               JUDGE_BASIS,
               DELIVERYSTATE,
               MODEL_CODE,
               MODEL_DESC,
               STDMEMO,
               SIZE_CODE,
               SIZE_NAME,
               SIZE_MIN_SIGN,
               SIZE_MIN,
               SIZE_MAX_SIGN,
               SIZE_MAX,
               SIZE_CODE2,
               SIZE_NAME2,
               SIZE_MIN_SIGN2,
               SIZE_MIN2,
               SIZE_MAX_SIGN2,
               SIZE_MAX2,
               SPEC_JG,
               SPEC_JG_DESC,
               ADDCONDITION,
               ADDSTDCON_CODE,
               ADDSTD_MIN_SIGN,
               ADDSTD_MIN,
               ADDSTD_MAX_SIGN,
               ADDSTD_MAX,
               ADDPERCENT,
               STDMIN_SIGN2,
               STDMIN2,
               STDMAX_SIGN2,
               STDMAX2,
               STD_CHOOSE,
               MSC_PLINE,
               PROCESS_CODE,
               BILLET_SAMPLE,
               CREATE_NAME,
               CREATE_TIME,
               UPDATE_NAME,
               UPDATE_TIME,
               CRAFT_SOURCE,
               PIC_MEMO,
               FORMULA,
               MIN_F,
               MIN_F_SIGN,
               MAX_F,
               MAX_F_SIGN
          FROM CRAFT_ORD_DESIGN_STD_PIC T
         WHERE T.DESGIN_KEY = {0}
           AND T.SPECL_FL = '0'
           AND NOT EXISTS
         (SELECT 1
                  FROM CRAFT_ORD_DESIGN_STD_PIC T2
                 WHERE T2.DESGIN_KEY = T.DESGIN_KEY
                   AND T2.SPECL_FL = '1'
                   AND T2.PHY_CODE = T.PHY_CODE
                   AND NVL(T2.ITEM_CODE_F, '1') = NVL(T.ITEM_CODE_F, '1')
                   AND NVL(T2.ITEM_CODE_W, '1') = NVL(T.ITEM_CODE_W, '1')
                   AND NVL(T2.ITEM_CODE_S, '1') = NVL(T.ITEM_CODE_S, '1'))
        UNION ALL
        SELECT DESGIN_KEY,
               PIC,
               USE_CODE,
               USE_DESC,
               SPECL_FL,
               INDEX_SEQ,
               PHY_CODE_MAX,
               PHY_NAME_MAX,
               PHY_CODE_MIN,
               PHY_NAME_MIN,
               PHY_CODE,
               PHY_NAME,
               ITEM_CODE_F,
               ITEM_NAME_F,
               ITEM_CODE_W,
               ITEM_NAME_W,
               ITEM_CODE_S,
               ITEM_NAME_S,
               GROUP_SEQ,
               ISCHECK,
               ISQUOTE,
               RESULT_COUNT,
               ISJUDGE,
               PHY_TYPE,
               PHY_FORMULA,
               STDMIN_SIGN,
               STDMIN,
               STDMAX_SIGN,
               STDMAX,
               JUDGE_BASIS,
               DELIVERYSTATE,
               MODEL_CODE,
               MODEL_DESC,
               STDMEMO,
               SIZE_CODE,
               SIZE_NAME,
               SIZE_MIN_SIGN,
               SIZE_MIN,
               SIZE_MAX_SIGN,
               SIZE_MAX,
               SIZE_CODE2,
               SIZE_NAME2,
               SIZE_MIN_SIGN2,
               SIZE_MIN2,
               SIZE_MAX_SIGN2,
               SIZE_MAX2,
               SPEC_JG,
               SPEC_JG_DESC,
               ADDCONDITION,
               ADDSTDCON_CODE,
               ADDSTD_MIN_SIGN,
               ADDSTD_MIN,
               ADDSTD_MAX_SIGN,
               ADDSTD_MAX,
               ADDPERCENT,
               STDMIN_SIGN2,
               STDMIN2,
               STDMAX_SIGN2,
               STDMAX2,
               STD_CHOOSE,
               MSC_PLINE,
               PROCESS_CODE,
               BILLET_SAMPLE,
               CREATE_NAME,
               CREATE_TIME,
               UPDATE_NAME,
               UPDATE_TIME,
               CRAFT_SOURCE,
               PIC_MEMO,
               FORMULA,
               MIN_F,
               MIN_F_SIGN,
               MAX_F,
               MAX_F_SIGN
          FROM CRAFT_ORD_DESIGN_STD_PIC T
         WHERE T.DESGIN_KEY = {0}
           AND MSC_PLINE = {1}
           AND PROCESS_CODE = {2}
           AND PIC = {3})
 WHERE ({4} = '0' OR PHY_CODE_MAX IN {5})
 ORDER BY SPECL_FL DESC
        ]]>
    </query>
    <query id="QcmJhyPhyresultDAL.queryOrderLineByPk" desc="查询">
        <![CDATA[
SELECT T.HEIGHT FROM SLM_ORDER_LINE T WHERE T.ORD_LN_PK = {0}
        ]]>
    </query>
    <query id="QcmJhyPhyresultDAL.getBcChemCByJudgeStoveNo" desc="通过批号查询最大的C元素值">
        <![CDATA[
SELECT MAX(A.CHEM_VALUE) C
  FROM QCM_BC_CHEMJUDGE T, QCM_BC_CHEM_RESULT A
 WHERE T.CHEM_JUDGE_ID = A.CHEM_JUDGE_ID
   AND T.JUDGE_SEQ = A.JUDGE_SEQ
   AND T.JUDGE_STOVE_NO = {0}
   AND T.PROCESS_CDOE = {1}
   AND T.VALIDFLAG = '1'
   AND A.CHEM_NAME = 'C'
   AND (T.SAMPLE_ID LIKE '%F%'
   OR NOT EXISTS(SELECT 1 FROM QCM_BC_CHEMJUDGE T2
   WHERE T2.CHEM_JUDGE_ID = T.CHEM_JUDGE_ID
   AND T2.SAMPLE_ID LIKE '%F%'))
   AND A.CHEM_VALUE IS NOT NULL
UNION ALL
SELECT MIN(A.CHEM_VALUE) C
  FROM QCM_BC_CHEMJUDGE T, QCM_BC_CHEM_RESULT A
 WHERE T.CHEM_JUDGE_ID = A.CHEM_JUDGE_ID
   AND T.JUDGE_SEQ = A.JUDGE_SEQ
   AND T.JUDGE_STOVE_NO = {0}
   AND T.PROCESS_CDOE = {1}
   AND T.VALIDFLAG = '1'
   AND A.CHEM_NAME = 'C'
   AND (T.SAMPLE_ID LIKE '%F%'
   OR NOT EXISTS(SELECT 1 FROM QCM_BC_CHEMJUDGE T2
   WHERE T2.CHEM_JUDGE_ID = T.CHEM_JUDGE_ID
   AND T2.SAMPLE_ID LIKE '%F%'))
   AND A.CHEM_VALUE IS NOT NULL
        ]]>
    </query>
    
    <query id="QcmJhyPhyresultDAL.getLgChemCByJudgeStoveNo" desc="通过批号查询最大的C元素值">
        <![CDATA[
SELECT MAX(TO_NUMBER(A.CHEM_VALUE)) C
  FROM QCM_LG_CHEMJUDGE T, QCM_LG_CHEM_RESULT A
 WHERE T.CHEM_JUDGE_ID = A.CHEM_JUDGE_ID
   AND T.JUDGE_SEQ = A.JUDGE_SEQ
   AND T.JUDGE_STOVE_NO = {0}
   AND T.PROCESS_CDOE = 'B'
   AND T.VALIDFLAG = '1'
   AND A.CHEM_NAME = 'C'
   AND (T.SAMPLE_NO LIKE '60_F%'
   OR NOT EXISTS(SELECT 1 FROM QCM_LG_CHEMJUDGE T2
   WHERE T2.CHEM_JUDGE_ID = T.CHEM_JUDGE_ID
   AND T2.SAMPLE_NO LIKE '60_F%'))
   AND A.CHEM_VALUE IS NOT NULL
 UNION ALL
 SELECT MIN(TO_NUMBER(A.CHEM_VALUE)) C
  FROM QCM_LG_CHEMJUDGE T, QCM_LG_CHEM_RESULT A
 WHERE T.CHEM_JUDGE_ID = A.CHEM_JUDGE_ID
   AND T.JUDGE_SEQ = A.JUDGE_SEQ
   AND T.JUDGE_STOVE_NO = {0}
   AND T.PROCESS_CDOE = 'B'
   AND T.VALIDFLAG = '1'
   AND A.CHEM_NAME = 'C'
   AND (T.SAMPLE_NO LIKE '60_F%'
   OR NOT EXISTS(SELECT 1 FROM QCM_LG_CHEMJUDGE T2
   WHERE T2.CHEM_JUDGE_ID = T.CHEM_JUDGE_ID
   AND T2.SAMPLE_NO LIKE '60_F%'))
   AND A.CHEM_VALUE IS NOT NULL
        ]]>
    </query>
    
    <query id="QcmJhyPhyresultDAL.updateJudgeFlagByBatchNo" desc="通过批号修改判定状态">
        <![CDATA[
UPDATE QCM_JHY_PHYRESULT T
   SET T.JUDGE_FLAG = {4}
 WHERE T.SAMPLE_ID = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND EXISTS (SELECT 1
          FROM COM_BASE_PLINE A
         WHERE A.PLINE_CODE = T.PLINE_CODE
           AND A.PROCESS_CODE = {3})
        ]]>
    </query>
    
    <query id="QcmJhyPhyresultDAL.deleteJhyPhyByCheckNo" desc="删除检化验理化实绩">
		<![CDATA[
DELETE FROM QCM_JHY_PHYRESULT T
 WHERE T.SAMPLE_ID = {0}
 AND T.JUDGE_STOVE_NO = {1}
 AND T.BATCH_NO = {2}
 AND T.PHY_CODE_MIN NOT IN ('C0030', 'C0031', 'C0032',
 'C0033', 'C0133', 'C0147', 'C0007', 'C0146','C0150','C0061','C0065','C0148')
		]]>
	</query>
	
	<query id="QcmJhyPhyresultDAL.deleteJhyPhySscByCheckNo" desc="删除检化验理化实绩">
		<![CDATA[
DELETE FROM QCM_JHY_PHYRESULT T
 WHERE T.SAMPLE_ID = {0}
 AND T.JUDGE_STOVE_NO = {1}
 AND T.BATCH_NO = {2}
 AND T.PHY_CODE_MIN IN ('C0030', 'C0031', 'C0032', 'C0033', 'C0133', 'C0147','C0150')
		]]>
	</query>
	
	<query id="QcmJhyPhyresultDAL.deleteJhyPhyHicByCheckNo" desc="删除检化验理化实绩">
		<![CDATA[
DELETE FROM QCM_JHY_PHYRESULT T
 WHERE T.SAMPLE_ID = {0}
 AND T.JUDGE_STOVE_NO = {1}
 AND T.BATCH_NO = {2}
 AND T.PHY_CODE_MIN IN ('C0007', 'C0146')
		]]>
	</query>
	
	<query id="QcmJhyPhyresultDAL.queryJhyCnt" desc="是否有理化信息">
		<![CDATA[
 SELECT COUNT(1) COUNT
   FROM QCM_JHY_PHYRESULT T, COM_BASE_PLINE A
  WHERE T.JUDGE_STOVE_NO = {0}
    AND T.BATCH_NO = {1}
    AND T.PLINE_CODE = A.PLINE_CODE
    AND A.PROCESS_CODE = {2}
		]]>
	</query>
	
	<query id="QcmJhyPhyresultDAL.queryIsrcl" desc="是否有小样热处理">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM QCM_JHY_PHYRESULT T, COM_BASE_PLINE A
 WHERE T.SAMPLE_ID = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND A.PLINE_CODE = T.PLINE_CODE
   AND A.PROCESS_CODE = {3}
   AND T.ISRCL <> '0'
   AND T.VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QcmJhyPhyresultDAL.copyByBatchNo" desc="通过批号复制">
		<![CDATA[
INSERT INTO QCM_JHY_PHYRESULT
  (SAMPLE_ID,
   SAMPLE_NO,
   INDEX_SEQ,
   LOT_NO,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   SAMPLE_TYPE,
   CONSIGNER,
   PLINE_CODE,
   PHY_CODE_MAX,
   PHY_NAME_MAX,
   PHY_CODE_MIN,
   PHY_NAME_MIN,
   PHY_CODE,
   PHY_NAME,
   ITEM_CODE_F,
   ITEM_NAME_F,
   ITEM_CODE_W,
   ITEM_NAME_W,
   ITEM_CODE_S,
   ITEM_NAME_S,
   VALUE1,
   VALUE2,
   VALUE3,
   VALUE4,
   VALUE5,
   VALUE6,
   VALUE7,
   VALUE8,
   VALUE9,
   VALUE10,
   VALUE11,
   VALUE12,
   VALUE13,
   VALUE14,
   VALUE15,
   AVERAGE,
   CREATE_NAME,
   CREATE_TIME,
   UPDATE_NAME,
   UPDATE_TIME,
   DELETE_NAME,
   DELETE_TIME,
   FILE_PATH,
   JUDGE_FLAG,
   VALIDFLAG,
   FOR_CHECK_NO,
   RATE,
   ORIGINAL_AREA,
   IS_GOOD,
   IS_DEFECT,
   ISRCL,
   MAT_NO,
   HEAD_MAT_NO,
   BAR_CODE,
   CHECK_TEMP,
   HARDNESS_TYPE,
   PHY_CODE_DIR,
   PHY_NAME_DIR,
   SAMPLE_STYLE,
   SAMPLE_SIZE,
   LOT_NO_GROUP)
  (SELECT T.SAMPLE_ID || 'G',
       T.SAMPLE_NO,
       T.INDEX_SEQ,
       T.LOT_NO,
       T.STOVE_NO,
       {5},
       {6},
       T.SAMPLE_TYPE,
       T.CONSIGNER,
       T.PLINE_CODE,
       T.PHY_CODE_MAX,
       T.PHY_NAME_MAX,
       T.PHY_CODE_MIN,
       T.PHY_NAME_MIN,
       T.PHY_CODE,
       T.PHY_NAME,
       T.ITEM_CODE_F,
       T.ITEM_NAME_F,
       T.ITEM_CODE_W,
       T.ITEM_NAME_W,
       T.ITEM_CODE_S,
       T.ITEM_NAME_S,
       T.VALUE1,
       T.VALUE2,
       T.VALUE3,
       T.VALUE4,
       T.VALUE5,
       T.VALUE6,
       T.VALUE7,
       T.VALUE8,
       T.VALUE9,
       T.VALUE10,
       T.VALUE11,
       T.VALUE12,
       T.VALUE13,
       T.VALUE14,
       T.VALUE15,
       T.AVERAGE,
       T.CREATE_NAME,
       T.CREATE_TIME,
       T.UPDATE_NAME,
       T.UPDATE_TIME,
       T.DELETE_NAME,
       T.DELETE_TIME,
       T.FILE_PATH,
       T.JUDGE_FLAG,
       T.VALIDFLAG,
       T.FOR_CHECK_NO,
       T.RATE,
       T.ORIGINAL_AREA,
       T.IS_GOOD,
       T.IS_DEFECT,
       T.ISRCL,
       T.MAT_NO,
       T.HEAD_MAT_NO,
       T.BAR_CODE,
       T.CHECK_TEMP,
       T.HARDNESS_TYPE,
       T.PHY_CODE_DIR,
       T.PHY_NAME_DIR,
       T.SAMPLE_STYLE,
       T.SAMPLE_SIZE,
       T.LOT_NO_GROUP
  FROM QCM_JHY_PHYRESULT T, QCM_ZC_CHECKCONSIGN A
 WHERE A.JUDGE_STOVE_NO = {0}
   AND A.BATCH_NO = {1}
   AND A.PROCESS_CODE = {2}
   AND A.CRAFT_SOURCE = {3}
   AND A.CHECK_NO = T.SAMPLE_ID
   AND A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND A.BATCH_NO = T.BATCH_NO
   AND A.ORD_LN_DLY_PK = {4})
		]]>
	</query>
	
	<query id="QcmJhyPhyresultDAL.deleteByBatchNoOrdLnDlyPkCheckNo" desc="通过炉批+交货行PK删除">
        <![CDATA[
DELETE FROM QCM_JHY_PHYRESULT A
   WHERE EXISTS (SELECT 1
            FROM QCM_ZC_CHECKCONSIGN T
           WHERE T.JUDGE_STOVE_NO = {0}
             AND T.BATCH_NO = {1}
             AND T.PROCESS_CODE = {2}
             AND T.CRAFT_SOURCE = {3}
             AND T.ORD_LN_DLY_PK = {4}
             AND T.CHECK_NO LIKE '%'||{5} || '%'
             AND T.CHECK_NO = A.SAMPLE_ID
             AND T.JUDGE_STOVE_NO = A.JUDGE_STOVE_NO
             AND T.BATCH_NO = A.BATCH_NO)
        ]]>
    </query>
    <query id="QcmJhyPhyresultDAL.deleteByBatchNoOrdLnDlyPkCheckNo1" desc="通过炉批+交货行PK删除">
        <![CDATA[
DELETE FROM QCM_JHY_PHYRESULT A
   WHERE A.SAMPLE_ID = {0}
        ]]>
    </query>
    <query id="QcmJhyPhyresultDAL.getByLotNoPhy" desc="通过生产批号和检验项查询">
        <![CDATA[
SELECT T.* FROM QCM_JHY_PHYRESULT T,
     QCM_ZC_CHECKCONSIGN A
 WHERE A.CHECK_NO = T.SAMPLE_ID
   AND A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND A.BATCH_NO = T.BATCH_NO
   AND A.PROCESS_CODE = {2}
   AND A.CRAFT_SOURCE = {3}
   AND A.ORD_LN_DLY_PK = {4}
   AND A.IS_FLAG = '0'
   AND A.LOT_NO = {0}
   AND ({1} IS NULL OR A.LOT_NO_GROUP = {1})
   AND T.PHY_CODE = {5}
   AND NVL(T.ITEM_CODE_F, '/') = NVL({6}, '/')
   AND NVL(T.ITEM_CODE_S, '/') = NVL({7}, '/')
   AND NVL(T.ITEM_CODE_W, '/') = NVL({8}, '/')
   AND T.VALIDFLAG = '1'
        ]]>
    </query>
    
    <query id="QcmJhyPhyresultDAL.getByBatchNoPhy" desc="通过批号号和检验项查询">
        <![CDATA[
SELECT T.* FROM QCM_JHY_PHYRESULT T,
     QCM_ZC_CHECKCONSIGN A
 WHERE A.CHECK_NO = T.SAMPLE_ID
   AND A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND A.BATCH_NO = T.BATCH_NO
   AND A.PROCESS_CODE = {2}
   AND A.CRAFT_SOURCE = {3}
   AND A.ORD_LN_DLY_PK = {4}
   AND A.IS_FLAG = '0'
   AND A.JUDGE_STOVE_NO = {0}
   AND A.BATCH_NO = {1}
   AND T.PHY_CODE = {5}
   AND NVL(T.ITEM_CODE_F, '/') = NVL({6}, '/')
   AND NVL(T.ITEM_CODE_S, '/') = NVL({7}, '/')
   AND NVL(T.ITEM_CODE_W, '/') = NVL({8}, '/')
   AND T.VALIDFLAG = '1'
        ]]>
    </query>
    
    <query id="QcmJhyPhyresultDAL.getByJudgeStoveNoPhy" desc="通过批号号和检验项查询">
        <![CDATA[
SELECT T.* FROM QCM_JHY_PHYRESULT T,
     QCM_ZC_CHECKCONSIGN A
 WHERE A.CHECK_NO = T.SAMPLE_ID
   AND A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND A.BATCH_NO = T.BATCH_NO
   AND A.PROCESS_CODE = {1}
   AND A.CRAFT_SOURCE = {2}
   AND A.ORD_LN_DLY_PK = {3}
   AND A.IS_FLAG = '0'
   AND A.JUDGE_STOVE_NO = {0}
   AND T.PHY_CODE = {4}
   AND NVL(T.ITEM_CODE_F, '/') = NVL({5}, '/')
   AND NVL(T.ITEM_CODE_S, '/') = NVL({6}, '/')
   AND NVL(T.ITEM_CODE_W, '/') = NVL({7}, '/')
   AND T.VALIDFLAG = '1'
        ]]>
    </query>
    
    <query id="QcmJhyPhyresultDAL.Insert" desc="新增">
        <![CDATA[
INSERT INTO QCM_JHY_PHYRESULT
  (SAMPLE_ID,
   SAMPLE_NO,
   INDEX_SEQ,
   LOT_NO,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   SAMPLE_TYPE,
   CONSIGNER,
   PLINE_CODE,
   PHY_CODE_MAX,
   PHY_NAME_MAX,
   PHY_CODE_MIN,
   PHY_NAME_MIN,
   PHY_CODE,
   PHY_NAME,
   ITEM_CODE_F,
   ITEM_NAME_F,
   ITEM_CODE_W,
   ITEM_NAME_W,
   ITEM_CODE_S,
   ITEM_NAME_S,
   VALUE1,
   VALUE2,
   VALUE3,
   VALUE4,
   VALUE5,
   VALUE6,
   VALUE7,
   VALUE8,
   VALUE9,
   VALUE10,
   VALUE11,
   VALUE12,
   VALUE13,
   VALUE14,
   VALUE15,
   AVERAGE,
   CREATE_NAME,
   CREATE_TIME,
   FILE_PATH,
   FOR_CHECK_NO,
   RATE,
   IS_GOOD,
   IS_DEFECT,
   ISRCL,
   MAT_NO,
   HEAD_MAT_NO,
   BAR_CODE,
   CHECK_TEMP,
   HARDNESS_TYPE,
   PHY_CODE_DIR,
   PHY_NAME_DIR,
   SAMPLE_STYLE,
   SAMPLE_SIZE,
   LOT_NO_GROUP)
VALUES
  ('#SAMPLE_ID#',
   '#SAMPLE_NO#',
   (SELECT NVL(MAX(T.INDEX_SEQ), 0) + 1
      FROM QCM_JHY_PHYRESULT T
     WHERE T.SAMPLE_ID = '#SAMPLE_ID#'
       AND T.SAMPLE_NO = '#SAMPLE_NO#'),
   '#LOT_NO#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#SAMPLE_TYPE#',
   '#CONSIGNER#',
   '#PLINE_CODE#',
   '#PHY_CODE_MAX#',
   '#PHY_NAME_MAX#',
   '#PHY_CODE_MIN#',
   '#PHY_NAME_MIN#',
   '#PHY_CODE#',
   '#PHY_NAME#',
   '#ITEM_CODE_F#',
   '#ITEM_NAME_F#',
   '#ITEM_CODE_W#',
   '#ITEM_NAME_W#',
   '#ITEM_CODE_S#',
   '#ITEM_NAME_S#',
   '#VALUE1#',
   '#VALUE2#',
   '#VALUE3#',
   '#VALUE4#',
   '#VALUE5#',
   '#VALUE6#',
   '#VALUE7#',
   '#VALUE8#',
   '#VALUE9#',
   '#VALUE10#',
   '#VALUE11#',
   '#VALUE12#',
   '#VALUE13#',
   '#VALUE14#',
   '#VALUE15#',
   '#AVERAGE#',
   '#CREATE_NAME#',
   SYSDATE,
   '#FILE_PATH#',
   '#FOR_CHECK_NO#',
   '#RATE#',
   '#IS_GOOD#',
   '#IS_DEFECT#',
   '#ISRCL#',
   '#MAT_NO#',
   '#HEAD_MAT_NO#',
   '#BAR_CODE#',
   '#CHECK_TEMP#',
   '#HARDNESS_TYPE#',
   '#PHY_CODE_DIR#',
   '#PHY_NAME_DIR#',
   '#SAMPLE_STYLE#',
   '#SAMPLE_SIZE#',
   '#LOT_NO_GROUP#')
        ]]>
    </query>
    
    <query id="QcmJhyPhyresultDAL.InsertAndFlag" desc="新增">
        <![CDATA[
INSERT INTO QCM_JHY_PHYRESULT
  (SAMPLE_ID,
   SAMPLE_NO,
   INDEX_SEQ,
   LOT_NO,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   SAMPLE_TYPE,
   CONSIGNER,
   PLINE_CODE,
   PHY_CODE_MAX,
   PHY_NAME_MAX,
   PHY_CODE_MIN,
   PHY_NAME_MIN,
   PHY_CODE,
   PHY_NAME,
   ITEM_CODE_F,
   ITEM_NAME_F,
   ITEM_CODE_W,
   ITEM_NAME_W,
   ITEM_CODE_S,
   ITEM_NAME_S,
   VALUE1,
   VALUE2,
   VALUE3,
   VALUE4,
   VALUE5,
   VALUE6,
   VALUE7,
   VALUE8,
   VALUE9,
   VALUE10,
   VALUE11,
   VALUE12,
   VALUE13,
   VALUE14,
   VALUE15,
   AVERAGE,
   CREATE_NAME,
   CREATE_TIME,
   FILE_PATH,
   FOR_CHECK_NO,
   RATE,
   IS_GOOD,
   IS_DEFECT,
   ISRCL,
   MAT_NO,
   HEAD_MAT_NO,
   BAR_CODE,
   CHECK_TEMP,
   HARDNESS_TYPE,
   PHY_CODE_DIR,
   PHY_NAME_DIR,
   SAMPLE_STYLE,
   SAMPLE_SIZE,
   LOT_NO_GROUP,
   JUDGE_FLAG)
VALUES
  ('#SAMPLE_ID#',
   '#SAMPLE_NO#',
   (SELECT NVL(MAX(T.INDEX_SEQ), 0) + 1
      FROM QCM_JHY_PHYRESULT T
     WHERE T.SAMPLE_ID = '#SAMPLE_ID#'
       AND T.SAMPLE_NO = '#SAMPLE_NO#'),
   '#LOT_NO#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#SAMPLE_TYPE#',
   '#CONSIGNER#',
   '#PLINE_CODE#',
   '#PHY_CODE_MAX#',
   '#PHY_NAME_MAX#',
   '#PHY_CODE_MIN#',
   '#PHY_NAME_MIN#',
   '#PHY_CODE#',
   '#PHY_NAME#',
   '#ITEM_CODE_F#',
   '#ITEM_NAME_F#',
   '#ITEM_CODE_W#',
   '#ITEM_NAME_W#',
   '#ITEM_CODE_S#',
   '#ITEM_NAME_S#',
   '#VALUE1#',
   '#VALUE2#',
   '#VALUE3#',
   '#VALUE4#',
   '#VALUE5#',
   '#VALUE6#',
   '#VALUE7#',
   '#VALUE8#',
   '#VALUE9#',
   '#VALUE10#',
   '#VALUE11#',
   '#VALUE12#',
   '#VALUE13#',
   '#VALUE14#',
   '#VALUE15#',
   '#AVERAGE#',
   '#CREATE_NAME#',
   SYSDATE,
   '#FILE_PATH#',
   '#FOR_CHECK_NO#',
   '#RATE#',
   '#IS_GOOD#',
   '#IS_DEFECT#',
   '#ISRCL#',
   '#MAT_NO#',
   '#HEAD_MAT_NO#',
   '#BAR_CODE#',
   '#CHECK_TEMP#',
   '#HARDNESS_TYPE#',
   '#PHY_CODE_DIR#',
   '#PHY_NAME_DIR#',
   '#SAMPLE_STYLE#',
   '#SAMPLE_SIZE#',
   '#LOT_NO_GROUP#',
   '#JUDGE_FLAG#')
        ]]>
    </query>
    
    <query id="QcmJhyPhyresultDAL.getZbsBySampleNoPhy" desc="通过试样号和检验项查找">
        <![CDATA[
SELECT T.VALUE_KSI, T.VALUE_PSI, T.VALUE_F2, T.VALUE_F3, T.AVERAGE_VALUE_F, T.ISRCL
  FROM QCM_JHY_PHYRESULT T
 WHERE T.SAMPLE_ID = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.PHY_CODE = {3}
        ]]>
    </query>
    
    <query id = "QcmJhyPhyresultDAL.QueryPipePhyDeial" desc = "查询检化验理化信息">
	SELECT T.* FROM PIPE_CHECKCONSIGN_PHYDETAIL T WHERE T.CHECK_NO = {0}
	</query>
	
	<query id = "QcmJhyPhyresultDAL.InsertPhyDetail" desc = "新增检化验理化信息">
	 INSERT INTO PIPE_CHECKCONSIGN_PHYDETAIL(
        CHECK_NO,
        BATCH_NO,
        SAMPLE_NO,
        INDEX_SEQ,
        DEPT_ID,
        PHY_CODE_MAX,
        PHY_NAME_MAX,
        PHY_CODE_MIN,
        PHY_NAME_MIN,
        PHY_CODE,
        PHY_NAME,
        PHY_UNIT,
        ITEM_CODE_F,
        ITEM_NAME_F,
        ITEM_CODE_W,
        ITEM_NAME_W,
        ITEM_CODE_S,
        ITEM_NAME_S,
        GROUP_SEQ,
        RESULT_COUNT,
        ISCHECK,
        ISJUDGE,
        ISQUOTE,
        PHY_TYPE,
        PHY_FORMULA,
        STDMIN_SIGN,
        STDMIN,
        STDMAX_SIGN,
        STDMAX,
        JUDGE_BASIS,
        STDMIN_SIGN2,
        STDMIN2,
        STDMAX_SIGN2,
        STDMAX2,
        STD_CHOOSE,
        STDMEMO,
        ADDCONDITION,
        ADDSTDCON_CODE,
        ADDSTD_MIN_SIGN,
        ADDSTD_MIN,
        ADDSTD_MAX_SIGN,
        ADDSTD_MAX,
        ADDPERCENT,
        BILLET_SAMPLE,
        REMARK,
        VALUE1,
        VALUE2,
        VALUE3,
        VALUE4,
        VALUE5,
        VALUE6,
        VALUE7,
        VALUE8,
        VALUE9,
        VALUE10,
        VALUE11,
        VALUE12,
        VALUE13,
        VALUE14,
        VALUE15,
        AVERAGE_VALUE,
        IS_GOOD,
        IS_DEFECT,
        CALCULATION_FORMULA,
        SEQ,
        PHY_CODE_DIR,
        PHY_NAME_DIR,
        SPLINE_ITEM_CODE_S,
        SPLINE_ITEM_NAME_S,
        SPLINE_ITEM_CODE_F,
        SPLINE_ITEM_NAME_F,
        VALUE_KSI,
        VALUE_PSI,
        VALUE_F2,
        VALUE_F3,
        AVERAGE_VALUE_F)
 VALUES( 
        '#CHECK_NO#',
        '#BATCH_NO#',
        '#SAMPLE_NO#',
        '#INDEX_SEQ#',
        '#DEPT_ID#',
        '#PHY_CODE_MAX#',
        '#PHY_NAME_MAX#',
        '#PHY_CODE_MIN#',
        '#PHY_NAME_MIN#',
        '#PHY_CODE#',
        '#PHY_NAME#',
        '#PHY_UNIT#',
        '#ITEM_CODE_F#',
        '#ITEM_NAME_F#',
        '#ITEM_CODE_W#',
        '#ITEM_NAME_W#',
        '#ITEM_CODE_S#',
        '#ITEM_NAME_S#',
        '#GROUP_SEQ#',
        '#RESULT_COUNT#',
        '#ISCHECK#',
        '#ISJUDGE#',
        '#ISQUOTE#',
        '#PHY_TYPE#',
        '#PHY_FORMULA#',
        '#STDMIN_SIGN#',
        '#STDMIN#',
        '#STDMAX_SIGN#',
        '#STDMAX#',
        '#JUDGE_BASIS#',
        '#STDMIN_SIGN2#',
        '#STDMIN2#',
        '#STDMAX_SIGN2#',
        '#STDMAX2#',
        '#STD_CHOOSE#',
        '#STDMEMO#',
        '#ADDCONDITION#',
        '#ADDSTDCON_CODE#',
        '#ADDSTD_MIN_SIGN#',
        '#ADDSTD_MIN#',
        '#ADDSTD_MAX_SIGN#',
        '#ADDSTD_MAX#',
        '#ADDPERCENT#',
        '#BILLET_SAMPLE#',
        '#REMARK#',
        '#VALUE1#',
        '#VALUE2#',
        '#VALUE3#',
        '#VALUE4#',
        '#VALUE5#',
        '#VALUE6#',
        '#VALUE7#',
        '#VALUE8#',
        '#VALUE9#',
        '#VALUE10#',
        '#VALUE11#',
        '#VALUE12#',
        '#VALUE13#',
        '#VALUE14#',
        '#VALUE15#',
        '#AVERAGE_VALUE#',
        '#IS_GOOD#',
        '#IS_DEFECT#',
        '#CALCULATION_FORMULA#',
        '#SEQ#',
        '#PHY_CODE_DIR#',
        '#PHY_NAME_DIR#',
        '#SPLINE_ITEM_CODE_S#',
        '#SPLINE_ITEM_NAME_S#',
        '#SPLINE_ITEM_CODE_F#',
        '#SPLINE_ITEM_NAME_F#',
        '#VALUE_KSI#',
        '#VALUE_PSI#',
        '#VALUE_F2#',
        '#VALUE_F3#',
        '#AVERAGE_VALUE_F#')
	</query>
</queryMap>