<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="QCM_GP_JUGDE_APPLY （生成工具：代码生成工具4.0   访问地址：http://172.16.2.128/tool/）">
    <query id="QcmGpJugdeApplyDAL.QueryP" desc="查询">
        <![CDATA[
SELECT 'False' CHK,
       T.JUGDE_APPLY_CODE,
       T.JUDGE_STOVE_NO,
       T.STOVE_NO,
       T.ACT_COUNT,
       T.GRADECODE,
       T.GRADENAME,
       T.ACT_DIMATER,
       T.LEN_GP_SINGLE,
       T.CHEM_RESULT_CODE,
       A.BASENAME CHEM_RESULT_DESC,
       T.PHY_RESULT_CODE,
       B.BASENAME PHY_RESULT_DESC,
       C.BASENAME DETECT_RESULT_DESC,
       T.JUDGE_RESULT,
       T.JUDGE_RESULT_CODE,
       SUM(T.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT,
       T.PRO_ORDER_ID,
       T.PRO_ORDER_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.MEMO
  FROM QCM_GP_JUDGE_APPLY T
  LEFT JOIN COM_BASE_INFO A
    ON A.BASECODE = T.CHEM_RESULT_CODE
  LEFT JOIN COM_BASE_INFO B
    ON B.BASECODE = T.PHY_RESULT_CODE
  LEFT JOIN COM_BASE_INFO C
    ON C.BASECODE = T.DETECT_RESULT_CODE
 WHERE ({0} IS NULL OR
       APPLY_TIME BETWEEN TO_DATE({0}, 'YYYY-MM-DD HH24:MI:SS') AND
       TO_DATE({1}, 'YYYY-MM-DD HH24:MI:SS'))
       AND T.IS_FLAG = '0'
   AND ({2} IS NULL OR PRO_ORDER_NO LIKE '%' || {2} || '%')
   AND ({3} IS NULL OR STOVE_NO LIKE '%' || {3} || '%')
   AND ({4} <> '1' OR {4} IS NULL OR CHEM_RESULT_CODE IS NOT NULL)
   AND ({4} <> '0' OR {4} IS NULL OR CHEM_RESULT_CODE IS NULL)
 GROUP BY T.JUGDE_APPLY_CODE,
          T.JUDGE_STOVE_NO,
          T.STOVE_NO,
          T.ACT_COUNT,
          T.GRADECODE,
          T.GRADENAME,
          T.ACT_DIMATER,
          T.LEN_GP_SINGLE,
          T.CHEM_RESULT_CODE,
          A.BASENAME,
          T.PHY_RESULT_CODE,
          T.JUDGE_RESULT,
          T.JUDGE_RESULT_CODE,
          B.BASENAME,
          T.PRO_ORDER_ID,
          T.PRO_ORDER_NO,
          T.PLINE_CODE,
          T.PLINE_NAME
        ]]>
    </query>
    
    <query id="QcmGpJugdeApplyDAL.QueryC" desc="查询">
        <![CDATA[
SELECT T.JUGDE_APPLY_CODE,
       T.ACT_COUNT,
       T.GRADECODE,
       T.GRADENAME,
       T.ACT_DIMATER,
       T.LEN_GP_SINGLE,
       T.MULTIPLE_NUM,
       T.ACT_LEN,
       T.ACT_THEORY_WEIGHT,
       T.CCMID,
       T.JUGDE_APPLY_SQE
  FROM QCM_GP_JUDGE_APPLY T
 WHERE JUGDE_APPLY_CODE = {0}
        ]]>
    </query>
    
    <query id="QcmGpJugdeApplyDAL.QuerySteelMakingP" desc="查询">
        <![CDATA[
SELECT 'FALSE' CHK,
       T.JUGDE_APPLY_CODE,
       T.JUGDE_APPLY_SQE,
       T.JUDGE_STOVE_NO,
       T.STOVE_NO,
       SUM(T.ACT_COUNT) ACT_COUNT,
       MAX(T.GRADECODE) GRADECODE,
       MAX(T.GRADENAME) GRADENAME,
       MAX(T.ACT_DIMATER) ACT_DIMATER,
       NVL(MAX(T.CHEM_RESULT_CODE),
           (SELECT MIN(H.JUDGERESULT_CHEM)
              FROM STL_INCISION H
             WHERE H.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO)) CHEM_RESULT_CODE,
       NVL(MAX(A.BASENAME),
           (SELECT MIN(H2.BASENAME)
              FROM STL_INCISION H, COM_BASE_INFO H2
             WHERE H.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
               AND H2.BASECODE = H.JUDGERESULT_CHEM)) CHEM_RESULT_DESC,
       MAX(T.PHY_RESULT_CODE) PHY_RESULT_CODE,
       MAX(B.BASENAME) PHY_RESULT_DESC,
       MAX(C.BASENAME) DETECT_RESULT_DESC,
       MAX(T.JUDGE_RESULT) JUDGE_RESULT,
       MAX(T.JUDGE_RESULT_CODE) JUDGE_RESULT_CODE,
       SUM(T.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT,
       MAX(T.PLINE_CODE) PLINE_CODE,
       MAX(T.PLINE_NAME) PLINE_NAME,
       MAX(T.FACE_RESULT_CODE) FACE_RESULT_CODE,
       MAX(D.CUT_NUM) CUT_NUM,
       MAX(E.MEMO) JUDGE_MEMO,
       MAX(T.JUDGE_MEMO) JUDGE_MEMO2,
       TO_CHAR(MAX(T.APPLY_TIME), 'YYYY-MM-DD HH24:MI:SS') APPLY_TIME,
       NVL(MIN(F2.BASENAME), '/') AUDIT_RESULT2,
       DECODE(MAX(F.TYPE), '0', '质量放行', '1', '紧急放行') PASS_TYPE,
       DECODE(MAX(F.TYPE), '0', '质量放行', '1', '紧急放行') PASS_TYPE2,
       MAX(T.STEEL_STANDRAD) STEEL_STANDRAD,
       MIN(F.PASS_APPLY_NO) PASS_APPLY_NO,
       CASE
         WHEN EXISTS (SELECT 1
                 FROM QCM_LG_JUDGE T2
                WHERE T2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                  AND T2.JUGDE_APPLY_CODE = T.JUGDE_APPLY_CODE
                  AND T2.JUGDE_APPLY_SQE = T.JUGDE_APPLY_SQE
                  AND T2.PROCESS_CDOE = 'B') AND
              MIN(T.VALIDFLAG) IN ('00', '10') THEN
          '已撤判'
         ELSE
          '无'
       END VALIDFLAG,
       MIN(T.OLD_GRADENAME) OLD_GRADENAME,
       MIN(T.OLD_CIC) OLD_CIC,
       MIN(T.AUTO_JUDGE) AUTO_JUDGE
  FROM QCM_GP_JUDGE_APPLY T
  LEFT JOIN QCM_LG_JUDGE E
    ON E.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND E.VALIDFLAG = '1'
  LEFT JOIN COM_BASE_INFO A
    ON A.BASECODE = T.CHEM_RESULT_CODE
  LEFT JOIN COM_BASE_INFO B
    ON B.BASECODE = T.PHY_RESULT_CODE
  LEFT JOIN COM_BASE_INFO C
    ON C.BASECODE = T.DETECT_RESULT_CODE
  LEFT JOIN PLN_STEELFOR_ORD D
    ON D.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
  LEFT JOIN QCM_GP_PASS_APPLY F
    ON F.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND F.VALIDFLAG = '1'
   AND F.PASS_APPLY_SEQ = '001'
   AND T.JUGDE_APPLY_CODE=F.JUGDE_APPLY_CODE
   AND T.JUGDE_APPLY_SQE=F.JUGDE_APPLY_SQE
  LEFT JOIN COM_BASE_INFO F2
    ON F2.BASECODE = F.AUDIT_RESULT2
  LEFT JOIN PLN_STEELFORFURNACE G
    ON G.STOVE_NO = T.STOVE_NO
 WHERE ({0} IS NULL OR
       T.APPLY_TIME BETWEEN TO_DATE({0}, 'YYYY-MM-DD HH24:MI:SS') AND
       TO_DATE({1}, 'YYYY-MM-DD HH24:MI:SS'))
   AND T.IS_FLAG = '0'
   AND ({2} IS NULL OR T.PRO_ORDER_NO LIKE '%' || {2} || '%')
   AND ({3} IS NULL OR T.STOVE_NO LIKE '%' || {3} || '%')
   AND ({4} IS NULL OR T.JUDGE_STOVE_NO LIKE '%' || {4} || '%')
   AND ({5} = '0' OR G.EF_PLINE_CODE IN {6})
   AND ({7} = '0' AND T.JUDGE_RESULT_CODE IS NULL OR
       {7} = '1' AND T.JUDGE_RESULT_CODE IS NOT NULL OR
       {7} NOT IN ('0', '1') AND T.JUDGE_RESULT_CODE = {7} OR {7} IS NULL)
   AND (D.JUDGE_STOVE_NO IS NULL OR D.CCM_PLN_TYPE = '00' OR
       T.PLINE_CODE IN ('C063', 'C064') OR T.GPTYPE = '2')
   AND ({8} IS NULL OR {8} = '1' AND T.PLINE_CODE NOT IN ('C063', 'C064') OR
       {8} = '2' AND T.PLINE_CODE IN ('C063', 'C064'))
   AND ({9} = '0' OR T.PLINE_CODE IN {10})
   AND ({11} IS NULL OR T.SUPPLY_UNIT_CODE IN {11})
 GROUP BY T.JUGDE_APPLY_CODE,
          T.JUGDE_APPLY_SQE,
          T.STOVE_NO,
          T.JUDGE_STOVE_NO
 ORDER BY T.STOVE_NO, CUT_NUM
        ]]>
    </query>
    
        <query id="QcmGpJugdeApplyDAL.QuerySteelMakingPTh" desc="查询">
        <![CDATA[
SELECT 'FALSE' CHK,
       T.JUGDE_APPLY_CODE,
       T.JUGDE_APPLY_SQE,
       T.JUDGE_STOVE_NO,
       T.STOVE_NO,
       SUM(T.ACT_COUNT) ACT_COUNT,
       MAX(T.GRADECODE) GRADECODE,
       MAX(T.GRADENAME) GRADENAME,
       MAX(T.ACT_DIMATER) ACT_DIMATER,
       NVL(MAX(T.CHEM_RESULT_CODE),
           (SELECT MIN(H.JUDGERESULT_CHEM)
              FROM STL_INCISION H
             WHERE H.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO)) CHEM_RESULT_CODE,
       NVL(MAX(A.BASENAME),
           (SELECT MIN(H2.BASENAME)
              FROM STL_INCISION H, COM_BASE_INFO H2
             WHERE H.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
               AND H2.BASECODE = H.JUDGERESULT_CHEM)) CHEM_RESULT_DESC,
       MAX(T.PHY_RESULT_CODE) PHY_RESULT_CODE,
       MAX(B.BASENAME) PHY_RESULT_DESC,
       MAX(C.BASENAME) DETECT_RESULT_DESC,
       MAX(T.JUDGE_RESULT) JUDGE_RESULT,
       MAX(T.JUDGE_RESULT_CODE) JUDGE_RESULT_CODE,
       SUM(T.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT,
       MAX(T.PLINE_CODE) PLINE_CODE,
       MAX(T.PLINE_NAME) PLINE_NAME,
       MAX(T.FACE_RESULT_CODE) FACE_RESULT_CODE,
       MAX(D.CUT_NUM) CUT_NUM,
       MAX(E.MEMO) JUDGE_MEMO,
       MAX(T.JUDGE_MEMO) JUDGE_MEMO2,
       TO_CHAR(MAX(T.APPLY_TIME), 'YYYY-MM-DD HH24:MI:SS') APPLY_TIME,
       NVL(MIN(F2.BASENAME), '/') AUDIT_RESULT2,
       DECODE(MAX(F.TYPE), '0', '质量放行', '1', '紧急放行') PASS_TYPE,
       DECODE(MAX(F.TYPE), '0', '质量放行', '1', '紧急放行') PASS_TYPE2,
       MAX(T.STEEL_STANDRAD) STEEL_STANDRAD,
       MIN(F.PASS_APPLY_NO) PASS_APPLY_NO,
       CASE
         WHEN EXISTS (SELECT 1
                 FROM QCM_LG_JUDGE T2
                WHERE T2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                  AND T2.JUGDE_APPLY_CODE = T.JUGDE_APPLY_CODE
                  AND T2.JUGDE_APPLY_SQE = T.JUGDE_APPLY_SQE
                  AND T2.PROCESS_CDOE = 'B') AND
              MIN(T.VALIDFLAG) IN ('00', '10') THEN
          '已撤判'
         ELSE
          '无'
       END VALIDFLAG,
       MIN(T.OLD_GRADENAME) OLD_GRADENAME,
       MIN(T.OLD_CIC) OLD_CIC,
       MIN(T.AUTO_JUDGE) AUTO_JUDGE
  FROM QCM_GP_JUDGE_APPLY T
  LEFT JOIN QCM_LG_JUDGE E
    ON E.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND E.VALIDFLAG = '1'
  LEFT JOIN COM_BASE_INFO A
    ON A.BASECODE = T.CHEM_RESULT_CODE
  LEFT JOIN COM_BASE_INFO B
    ON B.BASECODE = T.PHY_RESULT_CODE
  LEFT JOIN COM_BASE_INFO C
    ON C.BASECODE = T.DETECT_RESULT_CODE
  LEFT JOIN PLN_STEELFOR_ORD D
    ON D.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
  LEFT JOIN QCM_GP_PASS_APPLY F
    ON F.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND F.VALIDFLAG = '1'
   AND F.PASS_APPLY_SEQ = '001'
   AND T.JUGDE_APPLY_CODE=F.JUGDE_APPLY_CODE
   AND T.JUGDE_APPLY_SQE=F.JUGDE_APPLY_SQE
  LEFT JOIN COM_BASE_INFO F2
    ON F2.BASECODE = F.AUDIT_RESULT2
  LEFT JOIN PLN_STEELFORFURNACE G
    ON G.STOVE_NO = T.STOVE_NO
 WHERE ({0} IS NULL OR
       T.APPLY_TIME BETWEEN TO_DATE({0}, 'YYYY-MM-DD HH24:MI:SS') AND
       TO_DATE({1}, 'YYYY-MM-DD HH24:MI:SS'))
   AND T.IS_FLAG = '0'
   AND ({2} IS NULL OR T.PRO_ORDER_NO LIKE '%' || {2} || '%')
   AND ({3} IS NULL OR T.STOVE_NO LIKE '%' || {3} || '%')
   AND ({4} IS NULL OR T.JUDGE_STOVE_NO LIKE '%' || {4} || '%')
   AND ({5} = '0' OR G.EF_PLINE_CODE IN {6})
   AND ({7} = '0' AND T.JUDGE_RESULT_CODE IS NULL OR
       {7} = '1' AND T.JUDGE_RESULT_CODE IS NOT NULL OR
       {7} NOT IN ('0', '1') AND T.JUDGE_RESULT_CODE = {7} OR {7} IS NULL)
   AND (D.JUDGE_STOVE_NO IS NULL OR D.CCM_PLN_TYPE = '00' OR
       T.PLINE_CODE IN ('C063', 'C064') OR T.GPTYPE = '2')
   AND ({8} IS NULL OR {8} = '1' AND T.PLINE_CODE NOT IN ('C063', 'C064') OR
       {8} = '2' AND T.PLINE_CODE IN ('C063', 'C064'))
   AND ({9} = '0' OR T.PLINE_CODE IN {10})
   AND ({11} IS NULL OR T.SUPPLY_UNIT_CODE IN {11})
 GROUP BY T.JUGDE_APPLY_CODE,
          T.JUGDE_APPLY_SQE,
          T.STOVE_NO,
          T.JUDGE_STOVE_NO
 ORDER BY T.STOVE_NO, CUT_NUM
        ]]>
    </query>
    
    <query id="QcmGpJugdeApplyDAL.QueryByPk" desc="通过主键查询">
        <![CDATA[
SELECT T.JUGDE_APPLY_CODE,
       T.JUGDE_APPLY_SQE,
       T.STOVE_NO,
       T.CAST_NO,
       T.CCMID,
       T.JUDGE_STOVE_NO,
       T.BATCH_GROUD_NO,
       T.PROCESS_CODE,
       T.PLINE_CODE,
       T.LEN_GP_SINGLE,
       T.MULTIPLE_NUM,
       T.ACT_COUNT,
       T.ACT_DIMATER,
       T.ACT_LEN,
       T.ACT_WEIGHT,
       T.ACT_THEORY_WEIGHT,
       T.FACE_RESULT_CODE,
       T.SPEC_RESULT_CODE,
       T.CHEM_RESULT_CODE,
       T.PHY_RESULT_CODE,
       T.DETECT_RESULT_CODE,
       T.FACE_RESULT_PATH,
       T.SPEC_RESULT_PATH,
       T.CHEM_RESULT_PATH,
       T.PHY_RESULT_PATH,
       T.DETECT_RESULT_PATH,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.GRADECODE,
       T.GRADENAME,
       T.STD_CODE,
       T.STD_NAME,
       T.PLINE_NAME,
       T.PRO_ORDER_NO,
       T.MAT_GOWHERE_CODE,
       T.MAT_GOWHERE_NAME,
       T.JUDGE_RESULT_CODE,
       T.JUDGE_RESULT,
       TO_CHAR(T.JUDGE_RESULT_TIME, 'YYYY-MM-DD HH24:MI:SS') JUDGE_RESULT_TIME,
       T.JUDGE_MAKER,
       T.IF_SET_ZY_PLAN,
       T.ORD_LN_DLY_PK,
       T.APPLY_FLAG,
       T.BACK_JUGDE_MEMO,
       T.VALIDFLAG,
       T.APPLY_NAME,
       TO_CHAR(T.APPLY_TIME, 'YYYY-MM-DD HH24:MI:SS') APPLY_TIME,
       T.MEMO,
       T.BAL_YEAR_MONTH,
       T.IS_FLAG,
       T.IS_ALL_SCRAP,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.GPREQ_ID,
       T.BELONG_CODE_JUGDE,
       T.BELONG_NAME_JUGDE,
       T.FURNACENO,
       T.SEQUENCENO,
       T.CRAFT_NO,
       T.ISENDGX,
       T.GPTYPE,
       T.PRO_PLAN_ID_NEXT,
       T.GX_PLAN_NO_NEXT,
       T.JUGDE_APPLY_SEQUENO
  FROM QCM_GP_JUDGE_APPLY T
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUGDE_APPLY_SQE = {1}
   AND T.MULTIPLE_NUM = {2}
   AND T.JUDGE_STOVE_NO = {3}
        ]]>
    </query>
    <query id="QcmGpJugdeApplyDAL.QueryByJudgeApplyCode" desc="通过申请判定单号和炉号查询">
        <![CDATA[
 SELECT 
       T.JUGDE_APPLY_CODE,
       T.JUGDE_APPLY_SQE,
       T.STOVE_NO,
       T.CAST_NO,
       T.CCMID,
       T.JUDGE_STOVE_NO,
       T.BATCH_GROUD_NO,
       T.PROCESS_CODE,
       T.PLINE_CODE,
       T.LEN_GP_SINGLE,
       T.MULTIPLE_NUM,
       T.ACT_COUNT,
       T.ACT_DIMATER,
       T.ACT_LEN,
       T.ACT_WEIGHT,
       T.ACT_THEORY_WEIGHT,
       T.FACE_RESULT_CODE,
       T.SPEC_RESULT_CODE,
       T.CHEM_RESULT_CODE,
       T.PHY_RESULT_CODE,
       T.DETECT_RESULT_CODE,
       T.FACE_RESULT_PATH,
       T.SPEC_RESULT_PATH,
       T.CHEM_RESULT_PATH,
       T.PHY_RESULT_PATH,
       T.DETECT_RESULT_PATH,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       T.GRADECODE,
       T.GRADENAME,
       T.STD_CODE,
       T.STD_NAME,
       T.PLINE_NAME,
       T.PRO_ORDER_NO,
       T.MAT_GOWHERE_CODE,
       T.MAT_GOWHERE_NAME,
       T.JUDGE_RESULT_CODE,
       T.JUDGE_RESULT,
       TO_CHAR(T.JUDGE_RESULT_TIME, 'YYYY-MM-DD HH24:MI:SS') JUDGE_RESULT_TIME,
       T.JUDGE_MAKER,
       T.IF_SET_ZY_PLAN,
       T.ORD_LN_DLY_PK,
       T.APPLY_FLAG,
       T.BACK_JUGDE_MEMO,
       T.VALIDFLAG,
       T.APPLY_NAME,
       TO_CHAR(T.APPLY_TIME, 'YYYY-MM-DD HH24:MI:SS') APPLY_TIME,
       T.MEMO,
       T.BAL_YEAR_MONTH,
       T.IS_FLAG,
       T.IS_ALL_SCRAP,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.GPREQ_ID,
       T.BELONG_CODE_JUGDE,
       T.BELONG_NAME_JUGDE,
       T.FURNACENO,
       T.SEQUENCENO,
       T.CRAFT_NO,
       T.ISENDGX,
       T.GPTYPE
 FROM QCM_GP_JUDGE_APPLY T
 WHERE T.JUGDE_APPLY_CODE = {0}
       AND T.STOVE_NO = {1}
       AND T.IS_FLAG = '0'
        ]]>
    </query>
    <query id="QcmGpJugdeApplyDAL.Insert" desc="新增">
        <![CDATA[
 INSERT INTO QCM_GP_JUGDE_APPLY(
        JUGDE_APPLY_CODE,
        JUGDE_APPLY_SQE,
        STOVE_NO,
        CAST_NO,
        CCMID,
        JUDGE_STOVE_NO,
        BATCH_GROUD_NO,
        PROCESS_CODE,
        PLINE_CODE,
        LEN_GP_SINGLE,
        MULTIPLE_NUM,
        ACT_COUNT,
        ACT_DIMATER,
        ACT_LEN,
        ACT_WEIGHT,
        ACT_THEORY_WEIGHT,
        PRO_ORDER_ID,
        FACE_RESULT_CODE,
        SPEC_RESULT_CODE,
        CHEM_RESULT_CODE,
        PHY_RESULT_CODE,
        DETECT_RESULT_CODE,
        FACE_RESULT_PATH,
        SPEC_RESULT_PATH,
        CHEM_RESULT_PATH,
        PHY_RESULT_PATH,
        DETECT_RESULT_PATH,
        QUALITY_GROUP,
        MATERIAL_NO,
        MATERIAL_NAME,
        PRODUCCODE,
        PRODUCNAME,
        GRADECODE,
        GRADENAME,
        SPEC_CODE,
        SPEC_NAME,
        STD_CODE,
        STD_NAME,
        STD_STYLE,
        STD_STYLE_DESC,
        CRAF_NO,
        PLINE_NAME,
        PRO_ORDER_NO,
        MAT_GOWHERE_CODE,
        MAT_GOWHERE_NAME,
        JUDGE_RESULT_CODE,
        JUDGE_RESULT,
        JUDGE_RESULT_TIME,
        JUDGE_MAKER,
        IF_SET_ZY_PLAN,
        TESTING_GRADE,
        TESTING_TYPE,
        ORD_LN_DLY_PK,
        APPLY_FLAG,
        BACK_JUGDE_MEMO,
        VALIDFLAG,
        APPLY_NAME,
        APPLY_TIME,
        MEMO)
 VALUES( 
        '#JUGDE_APPLY_CODE#',
        '#JUGDE_APPLY_SQE#',
        '#STOVE_NO#',
        '#CAST_NO#',
        '#CCMID#',
        '#JUDGE_STOVE_NO#',
        '#BATCH_GROUD_NO#',
        '#PROCESS_CODE#',
        '#PLINE_CODE#',
        '#LEN_GP_SINGLE#',
        '#MULTIPLE_NUM#',
        '#ACT_COUNT#',
        '#ACT_DIMATER#',
        '#ACT_LEN#',
        '#ACT_WEIGHT#',
        '#ACT_THEORY_WEIGHT#',
        '#PRO_ORDER_ID#',
        '#FACE_RESULT_CODE#',
        '#SPEC_RESULT_CODE#',
        '#CHEM_RESULT_CODE#',
        '#PHY_RESULT_CODE#',
        '#DETECT_RESULT_CODE#',
        '#FACE_RESULT_PATH#',
        '#SPEC_RESULT_PATH#',
        '#CHEM_RESULT_PATH#',
        '#PHY_RESULT_PATH#',
        '#DETECT_RESULT_PATH#',
        '#QUALITY_GROUP#',
        '#MATERIAL_NO#',
        '#MATERIAL_NAME#',
        '#PRODUCCODE#',
        '#PRODUCNAME#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#SPEC_CODE#',
        '#SPEC_NAME#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#STD_STYLE#',
        '#STD_STYLE_DESC#',
        '#CRAF_NO#',
        '#PLINE_NAME#',
        '#PRO_ORDER_NO#',
        '#MAT_GOWHERE_CODE#',
        '#MAT_GOWHERE_NAME#',
        '#JUDGE_RESULT_CODE#',
        '#JUDGE_RESULT#',
        SYSDATE,
        '#JUDGE_MAKER#',
        '#IF_SET_ZY_PLAN#',
        '#TESTING_GRADE#',
        '#TESTING_TYPE#',
        '#ORD_LN_DLY_PK#',
        '#APPLY_FLAG#',
        '#BACK_JUGDE_MEMO#',
        '#VALIDFLAG#',
        '#APPLY_NAME#',
        SYSDATE,
        '#MEMO#')
        ]]>
    </query>
    <query id="QcmGpJugdeApplyDAL.Update" desc="修改">
        <![CDATA[
 UPDATE QCM_GP_JUGDE_APPLY T
   SET 
        T.JUGDE_APPLY_CODE = '#JUGDE_APPLY_CODE#',
        T.JUGDE_APPLY_SQE = '#JUGDE_APPLY_SQE#',
        T.STOVE_NO = '#STOVE_NO#',
        T.CAST_NO = '#CAST_NO#',
        T.CCMID = '#CCMID#',
        T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#',
        T.BATCH_GROUD_NO = '#BATCH_GROUD_NO#',
        T.PROCESS_CODE = '#PROCESS_CODE#',
        T.PLINE_CODE = '#PLINE_CODE#',
        T.LEN_GP_SINGLE = '#LEN_GP_SINGLE#',
        T.MULTIPLE_NUM = '#MULTIPLE_NUM#',
        T.ACT_COUNT = '#ACT_COUNT#',
        T.ACT_DIMATER = '#ACT_DIMATER#',
        T.ACT_LEN = '#ACT_LEN#',
        T.ACT_WEIGHT = '#ACT_WEIGHT#',
        T.ACT_THEORY_WEIGHT = '#ACT_THEORY_WEIGHT#',
        T.PRO_ORDER_ID = '#PRO_ORDER_ID#',
        T.FACE_RESULT_CODE = '#FACE_RESULT_CODE#',
        T.SPEC_RESULT_CODE = '#SPEC_RESULT_CODE#',
        T.CHEM_RESULT_CODE = '#CHEM_RESULT_CODE#',
        T.PHY_RESULT_CODE = '#PHY_RESULT_CODE#',
        T.DETECT_RESULT_CODE = '#DETECT_RESULT_CODE#',
        T.FACE_RESULT_PATH = '#FACE_RESULT_PATH#',
        T.SPEC_RESULT_PATH = '#SPEC_RESULT_PATH#',
        T.CHEM_RESULT_PATH = '#CHEM_RESULT_PATH#',
        T.PHY_RESULT_PATH = '#PHY_RESULT_PATH#',
        T.DETECT_RESULT_PATH = '#DETECT_RESULT_PATH#',
        T.QUALITY_GROUP = '#QUALITY_GROUP#',
        T.MATERIAL_NO = '#MATERIAL_NO#',
        T.MATERIAL_NAME = '#MATERIAL_NAME#',
        T.PRODUCCODE = '#PRODUCCODE#',
        T.PRODUCNAME = '#PRODUCNAME#',
        T.GRADECODE = '#GRADECODE#',
        T.GRADENAME = '#GRADENAME#',
        T.SPEC_CODE = '#SPEC_CODE#',
        T.SPEC_NAME = '#SPEC_NAME#',
        T.STD_CODE = '#STD_CODE#',
        T.STD_NAME = '#STD_NAME#',
        T.STD_STYLE = '#STD_STYLE#',
        T.STD_STYLE_DESC = '#STD_STYLE_DESC#',
        T.CRAF_NO = '#CRAF_NO#',
        T.PLINE_NAME = '#PLINE_NAME#',
        T.PRO_ORDER_NO = '#PRO_ORDER_NO#',
        T.MAT_GOWHERE_CODE = '#MAT_GOWHERE_CODE#',
        T.MAT_GOWHERE_NAME = '#MAT_GOWHERE_NAME#',
        T.JUDGE_RESULT_CODE = '#JUDGE_RESULT_CODE#',
        T.JUDGE_RESULT = '#JUDGE_RESULT#',
        T.JUDGE_RESULT_TIME = SYSDATE,
        T.JUDGE_MAKER = '#JUDGE_MAKER#',
        T.IF_SET_ZY_PLAN = '#IF_SET_ZY_PLAN#',
        T.TESTING_GRADE = '#TESTING_GRADE#',
        T.TESTING_TYPE = '#TESTING_TYPE#',
        T.ORD_LN_DLY_PK = '#ORD_LN_DLY_PK#',
        T.APPLY_FLAG = '#APPLY_FLAG#',
        T.BACK_JUGDE_MEMO = '#BACK_JUGDE_MEMO#',
        T.VALIDFLAG = '#VALIDFLAG#',
        T.APPLY_NAME = '#APPLY_NAME#',
        T.APPLY_TIME = SYSDATE,
        T.MEMO = '#MEMO#'
 WHERE
       T.JUGDE_APPLY_CODE = '#JUGDE_APPLY_CODE#'
       AND T.JUGDE_APPLY_SQE = '#JUGDE_APPLY_SQE#'
        ]]>
    </query>
    <query id="QcmGpJugdeApplyDAL.GetMaxPk" desc="获取最大主键">
        <![CDATA[
SELECT NVL(MAX(JUGDE_APPLY_CODE), 0) + 1 MAX_VALUE FROM QCM_GP_JUGDE_APPLY T
        ]]>
    </query>
    <query id="QcmGpJugdeApplyDAL.Delete" desc="作废">
        <![CDATA[
UPDATE QCM_GP_JUGDE_APPLY T
   SET
       T.VALIDFLAG = '0',
       T.DELETE_NAME = '#DELETE_NAME#',
       T.DELETE_TIME = SYSDATE
WHERE
       T.JUGDE_APPLY_CODE = '#JUGDE_APPLY_CODE#'
       AND T.JUGDE_APPLY_SQE = '#JUGDE_APPLY_SQE#'
        ]]>
    </query>
    <query id="QcmGpJugdeApplyDAL.Resume" desc="恢复">
        <![CDATA[
UPDATE QCM_GP_JUGDE_APPLY T
   SET
       T.VALIDFLAG = '1',
       T.DELETE_NAME = NULL,
       T.DELETE_TIME = NULL,
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
WHERE
       T.JUGDE_APPLY_CODE = '#JUGDE_APPLY_CODE#'
       AND T.JUGDE_APPLY_SQE = '#JUGDE_APPLY_SQE#'
        ]]>
    </query>
    <query id="QcmGpJugdeApplyDAL.setChemResultCode" desc="修改连铸成分判定结果">
		<![CDATA[
UPDATE QCM_GP_JUGDE_APPLY T
   SET T.CHEM_RESULT_CODE = {0}
 WHERE T.JUGDE_APPLY_CODE = {1}
		]]>
	</query>

	<query id="QcmGpJugdeApplyDAL.updatePhyResultCode" desc="修改理化判定结果">
		<![CDATA[
			UPDATE QCM_GP_JUDGE_APPLY T
			   SET T.PHY_RESULT_CODE = {0}
			 WHERE T.JUGDE_APPLY_CODE = {1}
			   AND T.JUGDE_APPLY_SQE = {2}
			   AND T.JUDGE_STOVE_NO = {3}
		]]>
	</query>

	<query id="QcmGpJugdeApplyDAL.updatePhyResultId" desc="修改理化结果id">
		<![CDATA[
			UPDATE QCM_LG_JUDGE T
			   SET T.PHY_RESULT_ID = {0}
			 WHERE T.JUGDE_APPLY_CODE = {1}
			   AND T.JUGDE_APPLY_SQE = {2}
			   AND T.JUDGE_STOVE_NO = {3}
		]]>
	</query>

	<query id="QcmGpJugdeApplyDAL.setJudgeResult" desc="修改综合判定结果">
		<![CDATA[
UPDATE QCM_GP_JUDGE_APPLY T
   SET T.JUDGE_RESULT_CODE  = {3},
       T.JUDGE_RESULT      =
       (SELECT BASENAME FROM COM_BASE_INFO A WHERE A.BASECODE = {3}),
       T.JUDGE_RESULT_TIME  = SYSDATE,
       T.JUDGE_MAKER        = {4},
       T.FACE_RESULT_CODE   = {5},
       T.PHY_RESULT_CODE    = {6},
       T.DETECT_RESULT_CODE = {7},
       T.CHEM_RESULT_CODE   = {8},
       T.VALIDFLAG = {9},
       T.JUDGE_MEMO = {10},
       T.JUDGE_ORDER = {11},
       T.JUDGE_GROUP = {12},
       T.SPEC_RESULT_CODE = {13}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUGDE_APPLY_SQE = {1}
   AND T.JUDGE_STOVE_NO = {2}
		]]>
	</query>
	<query id="QcmGpJugdeApplyDAL.setBalYearMonth" desc="修改结转年月">
		<![CDATA[
UPDATE QCM_GP_JUDGE_APPLY T
   SET T.BAL_YEAR_MONTH = {3}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUGDE_APPLY_SQE = {1}
   AND T.JUDGE_STOVE_NO = {2}
		]]>
	</query>
	<query id="QcmGpJugdeApplyDAL.setValidflag" desc="修改申请表状态">
		<![CDATA[
UPDATE QCM_GP_JUDGE_APPLY T
   SET T.VALIDFLAG = {3}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUGDE_APPLY_SQE = {1}
   AND T.JUDGE_STOVE_NO = {2}
		]]>
	</query>
	<query id="QcmGpJugdeApplyDAL.setAuditResult" desc="修改放行处置方式">
		<![CDATA[
UPDATE QCM_GP_JUDGE_APPLY T
   SET T.AUDIT_RESULT = {3},
   T.AUDIT_MEMO = {4}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUGDE_APPLY_SQE = {1}
   AND T.JUDGE_STOVE_NO = {2}
		]]>
	</query>
	<query id="QcmGpJugdeApplyDAL.setAuditResult2" desc="修改放行处置方式2">
		<![CDATA[
UPDATE QCM_GP_JUDGE_APPLY T
   SET T.AUDIT_RESULT2 = {3},
   T.AUDIT_MEMO2 = {4}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUGDE_APPLY_SQE = {1}
   AND T.JUDGE_STOVE_NO = {2}
		]]>
	</query>
	<query id="QcmGpJugdeApplyDAL.setInstancy" desc="修改紧急放行">
		<![CDATA[
UPDATE QCM_GP_JUDGE_APPLY T
   SET T.INSTANCY_FLAG  = {3}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUGDE_APPLY_SQE = {1}
   AND T.JUDGE_STOVE_NO = {2}
		]]>
	</query>
	<query id="QcmGpJugdeApplyDAL.queryCraftDesignKey" desc="查询工艺DesignKey">
		<![CDATA[
 SELECT C.DESGIN_KEY,
        A.INDEX_SEQ  MSC_PLINE,
        A.CIC_GP     CIC,
        A.PIC_GP     PIC,
        A.DIC        DIC
   FROM PLN_ORDER_ZG_S A, PLN_SALEORD B, CRAFT_ORD_DESIGN C
  WHERE A.PRO_PLAN_ID = {0}
    AND A.GX_PLAN_NO = {1}
    AND B.ORD_LN_DLY_PK = A.ORD_LN_DLY_PK
    AND B.ORD_LN_PK = C.ORD_LN_PK
    AND A.CRAFT_SEQ = C.CRAFT_SEQ
		]]>
	</query>
	<query id="QcmGpJugdeApplyDAL.queryFaceFile" desc="查询工艺DesignKey">
		<![CDATA[
SELECT T.FACE_RESULT_PATH,
 T.FACE_RESULT_PATH FACE_FILE, '合格' QUALIFIED
  FROM qcm_gp_judge_apply T
 WHERE T.JUDGE_STOVE_NO = {0}
   AND T.IS_FLAG = '0'
   GROUP BY T.FACE_RESULT_PATH
		]]>
	</query>
	<query id="QcmGpJugdeApplyDAL.getDetectFile" desc="获取探伤文件路径">
        <![CDATA[
SELECT T.DETECT_RESULT_PATH,
 SUBSTR(T.DETECT_RESULT_PATH, 33)  DETECT_FILE, '合格' QUALIFIED
  FROM qcm_gp_judge_apply T
 WHERE T.JUDGE_STOVE_NO = {0}
  AND T.IS_FLAG = '0'
  GROUP BY T.DETECT_RESULT_PATH
        ]]>
    </query>
	
	<query id="QcmGpJugdeApplyDAL.queryGpApplyByJudgeStoveNo" desc="查询管坯申请表">
		<![CDATA[
SELECT *
  FROM QCM_GP_JUDGE_APPLY T
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUGDE_APPLY_SQE = {1}
   AND T.JUDGE_STOVE_NO = {2}
		]]>
	</query>

	<query id="QcmGpJugdeApplyDAL.queryGpApplyByJudgeStoveNoToCrm" desc="查询管坯申请表">
		<![CDATA[
SELECT * FROM PLN_SALEORD T
WHERE T.ORDER_NO ={0}
AND T.ORDER_SEQ = {1}
AND T.DELIVERY_NO ={2}
		]]>
	</query>
	
	<query id="QcmGpJugdeApplyDAL.queryGpApplyByJudgeStoveNo2" desc="查询管坯申请表">
		<![CDATA[
SELECT *
  FROM QCM_GP_JUDGE_APPLY T
 WHERE T.JUDGE_STOVE_NO = {0}
 AND T.IS_FLAG = '0'
		]]>
	</query>
	
	<query id="QcmGpJugdeApplyDAL.getStlPlnIdByJudgeStoveNo" desc="获取切割信息计划ID">
		<![CDATA[
SELECT NVL(T.PRO_PLAN_ID,
           (SELECT A.PRO_PLAN_ID
              FROM STL_INCISION A
             WHERE A.STOVE_NO = T.STOVE_NO
               AND A.PRO_PLAN_ID IS NOT NULL
               AND ROWNUM <= 1)) PRO_PLAN_ID,
       NVL(T.GX_PLAN_NO,
           (SELECT A.GX_PLAN_NO
              FROM STL_INCISION A
             WHERE A.STOVE_NO = T.STOVE_NO
               AND A.PRO_PLAN_ID IS NOT NULL
               AND ROWNUM <= 1)) GX_PLAN_NO,
       MAX(T.PLINE_CODE) PLINE_CODE,
       MAX(T.STOVE_NO) STOVE_NO
  FROM STL_INCISION T
 WHERE T.JUDGE_STOVE_NO = {0}
 GROUP BY T.STOVE_NO, T.PRO_PLAN_ID, T.GX_PLAN_NO
		]]>
	</query>
	
		<query id="QcmGpJugdeApplyDAL.getStlPlnIdByStoveNo" desc="获取切割信息计划ID">
		<![CDATA[
SELECT NVL(T.PRO_PLAN_ID,
           (SELECT A.PRO_PLAN_ID
              FROM STL_INCISION A
             WHERE A.STOVE_NO = T.STOVE_NO
               AND A.PRO_PLAN_ID IS NOT NULL
               AND ROWNUM <= 1)) PRO_PLAN_ID,
       NVL(T.GX_PLAN_NO,
           (SELECT A.GX_PLAN_NO
              FROM STL_INCISION A
             WHERE A.STOVE_NO = T.STOVE_NO
               AND A.PRO_PLAN_ID IS NOT NULL
               AND ROWNUM <= 1)) GX_PLAN_NO,
       MAX(T.PLINE_CODE) PLINE_CODE,
       MAX(T.STOVE_NO) STOVE_NO
  FROM STL_INCISION T
 WHERE T.JUDGE_STOVE_NO != {0}
 AND T.STOVE_NO= {1}
 GROUP BY T.STOVE_NO, T.PRO_PLAN_ID, T.GX_PLAN_NO,t.sequenceno
 order by t.sequenceno
		]]>
	</query>
	
	<query id="QcmGpJugdeApplyDAL.getApplyPlnIdByJudgeStoveNo" desc="获取申请判定计划ID">
		<![CDATA[
SELECT T.PRO_PLAN_ID, T.GX_PLAN_NO, T.PRO_PLAN_ID_NEXT, T.GX_PLAN_NO_NEXT,
 MAX(T.PLINE_CODE) PLINE_CODE, MAX(T.STOVE_NO) STOVE_NO
  FROM QCM_GP_JUDGE_APPLY T
 WHERE T.JUDGE_STOVE_NO = {0}
 AND T.IS_FLAG = '0'
 GROUP BY T.PRO_PLAN_ID, T.GX_PLAN_NO, T.PRO_PLAN_ID_NEXT, T.GX_PLAN_NO_NEXT
		]]>
	</query>
	
	<query id="QcmGpJugdeApplyDAL.getApplyPlnIdByJudgeStoveNoApplyNo" desc="获取申请判定计划ID">
		<![CDATA[
SELECT T.PRO_PLAN_ID, T.GX_PLAN_NO, T.PRO_PLAN_ID_NEXT, T.GX_PLAN_NO_NEXT,
 MAX(T.PLINE_CODE) PLINE_CODE, MAX(T.STOVE_NO) STOVE_NO
  FROM QCM_GP_JUDGE_APPLY T
 WHERE T.JUGDE_APPLY_CODE = {0}
 AND T.JUGDE_APPLY_SQE = {1}
 AND T.JUDGE_STOVE_NO = {2}
 GROUP BY T.PRO_PLAN_ID, T.GX_PLAN_NO, T.PRO_PLAN_ID_NEXT, T.GX_PLAN_NO_NEXT
		]]>
	</query>
	
		<query id="QcmGpJugdeApplyDAL.getApplyPlnIdByStoveNoApplyNo" desc="获取申请判定计划ID">
		<![CDATA[
SELECT T.PRO_PLAN_ID, T.GX_PLAN_NO, T.PRO_PLAN_ID_NEXT, T.GX_PLAN_NO_NEXT,
 MAX(T.PLINE_CODE) PLINE_CODE, MAX(T.STOVE_NO) STOVE_NO
  FROM QCM_GP_JUDGE_APPLY T
 WHERE  T.JUDGE_STOVE_NO != {2}
 AND T.STOVE_NO={3}
 GROUP BY T.PRO_PLAN_ID, T.GX_PLAN_NO, T.PRO_PLAN_ID_NEXT, T.GX_PLAN_NO_NEXT
		]]>
	</query>
	
	<query id="QcmGpJugdeApplyDAL.existJudgeQualified" desc="是否已判合格">
		<![CDATA[
SELECT JUDGE_RESULT_CODE, JUDGE_RESULT
  FROM QCM_GP_JUDGE_APPLY T
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUGDE_APPLY_SQE = {1}
   AND T.JUDGE_STOVE_NO = {2}
		]]>
	</query>
	
	<query id="QcmGpJugdeApplyDAL.udpateGpJudgeApplyCxFlagChem" desc="查询计划轧管表">
		<![CDATA[
UPDATE QCM_GP_JUDGE_APPLY T
   SET T.CX_FLAG_CHEM = {1},
   	   T.CHEM_RESULT_CODE = {2}
 WHERE T.JUDGE_STOVE_NO = {0}
 AND T.IS_FLAG = '0'
		]]>
	</query>
	
	<query id="QcmGpJugdeApplyDAL.querDtlByJudgeStoveNoApplyNo" desc="查询计划轧管表">
		<![CDATA[
SELECT T.ACT_DIMATER,
        T.LEN_GP_SINGLE,
        T.MULTIPLE_NUM,
        T.ACT_COUNT,
        T.ACT_LEN,
        T.ACT_THEORY_WEIGHT,
        T.PRO_PLAN_ID,
        T.GX_PLAN_NO,
        T.PRO_PLAN_ID_NEXT,
        T.GX_PLAN_NO_NEXT,
        T.GRADENAME
   FROM QCM_GP_JUDGE_APPLY T
  WHERE T.JUGDE_APPLY_CODE = {0}
  AND T.JUGDE_APPLY_SQE = {1}
  AND T.JUDGE_STOVE_NO = {2}
  ORDER BY T.MULTIPLE_NUM
		]]>
	</query>
	
	
	<query id="QcmGpJugdeApplyDAL.udpateJudgeMemo" desc="修改判定备注">
		<![CDATA[
UPDATE QCM_GP_JUDGE_APPLY T
   SET T.JUDGE_MEMO = {3}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUGDE_APPLY_SQE = {1}
   AND T.JUDGE_STOVE_NO = {2}
		]]>
	</query>
	
	<query id="QcmGpJugdeApplyDAL.querySteelmakingColligateQuery" desc="炼钢综合查询">
		<![CDATA[
SELECT JUDGE_STOVE_NO,
       STOVE_NO,
       MIN(GRADENAME) GRADENAME,
       MIN(ACT_DIMATER) ACT_DIMATER,
       MIN(CHEM_RESULT) CHEM_RESULT,
       MIN(CHEM_RESULT_CODE) CHEM_RESULT_CODE,
       MIN(PHY_RESULT) PHY_RESULT,
       MIN(PHY_RESULT_CODE) PHY_RESULT_CODE,
       MIN(DETECT_RESULT) DETECT_RESULT,
       MIN(FACE_RESULT) FACE_RESULT,
       MIN(JUDGE_RESULT) JUDGE_RESULT,
       MIN(JUDGE_MAKER) JUDGE_MAKER,
       MIN(CREATE_NAME) CHEM_NAME,
       MIN(JUDGE_ORDER) JUDGE_ORDER,
       MIN(JUDGE_GROUP) JUDGE_GROUP,
       MIN(JUDGE_RESULT_TIME) JUDGE_RESULT_TIME,
       MIN(CHEM_RESULT_TIME) CHEM_RESULT_TIME,
       MIN(JUGDE_APPLY_CODE) JUGDE_APPLY_CODE,
       MIN(JUGDE_APPLY_SQE) JUGDE_APPLY_SQE,
       MIN(CUT_NUM) CUT_NUM,
       MIN(PLINE_NAME) PLINE_NAME,
       MIN(MEMO) MEMO,
       MIN(STARTTIME) STARTTIME,
       MIN(STEEL_STANDRAD) STEEL_STANDRAD,
       MIN(CHEM_MEMO) CHEM_MEMO,
       MIN(CIC) CIC,
       MIN(CHEM_TYPE) CHEM_TYPE,
       MIN(SUPP_CODE) SUPP_CODE,
       MIN(AUDIT_RESULT2) AUDIT_RESULT2,
       MIN(AUDIT_TYPE) AUDIT_TYPE,
       MIN(IS_FLAG) IS_FLAG,
       MAX(ACT_LEN) ACT_LEN,
       SUM(ACT_COUNT) ACT_COUNT,
       SUM(ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT,
       MAX(MULTIPLE_NUM) MULTIPLE_NUM,
       MAX(LEN_GP_SINGLE) LEN_GP_SINGLE,
       MIN(BAL_YEAR_MONTH) BAL_YEAR_MONTH,
       MIN(JUDGE_MEMO) JUDGE_MEMO
  FROM (SELECT MIN(T.JUDGE_STOVE_NO) JUDGE_STOVE_NO,
               MIN(T.STOVE_NO) STOVE_NO,
               MIN(T.GRADENAME) GRADENAME,
               MIN(T.ACT_DIMATER) ACT_DIMATER,
               MIN(A.BASENAME) CHEM_RESULT,
               MIN(T.CHEM_RESULT_CODE) CHEM_RESULT_CODE,
               MIN(B.BASENAME) PHY_RESULT,
               MIN(T.PHY_RESULT_CODE) PHY_RESULT_CODE,
               MIN(C.BASENAME) DETECT_RESULT,
               MIN(D.BASENAME) FACE_RESULT,
               MIN(T.JUDGE_RESULT) JUDGE_RESULT,
               MIN(T.JUDGE_MAKER) JUDGE_MAKER,
               MIN(T2.CREATE_NAME) CREATE_NAME,
               MIN(T.JUDGE_ORDER) JUDGE_ORDER,
               MIN(T.JUDGE_GROUP) JUDGE_GROUP,
               TO_CHAR(MIN(T.JUDGE_RESULT_TIME), 'YYYY-MM-DD HH24:MI:SS') JUDGE_RESULT_TIME,
               TO_CHAR(MIN(T2.CREATE_TIME), 'YYYY-MM-DD HH24:MI:SS') CHEM_RESULT_TIME,
               T.JUGDE_APPLY_CODE,
               T.JUGDE_APPLY_SQE,
               NVL(MIN(E.CUT_NUM), 1) CUT_NUM,
               MIN(T.PLINE_NAME) PLINE_NAME,
               MIN(F.MEMO) MEMO,
               TO_CHAR(NVL(MIN(G.STARTTIME), MIN(T.APPLY_TIME)),
                       'YYYY-MM-DD HH24:MI:SS') STARTTIME,
               MIN(T.STEEL_STANDRAD) STEEL_STANDRAD,
               MIN(H.MEMO) CHEM_MEMO,
               MIN(H.CIC) CIC,
               CASE
                 WHEN MIN(K2.CHEM_JUDGE_ID) IS NOT NULL THEN
                  '复样'
                 WHEN MIN(K.CHEM_JUDGE_ID) IS NOT NULL THEN
                  '初样'
                 ELSE
                  NULL
               END CHEM_TYPE,
               MIN(J2.SUPP_CODE) SUPP_CODE,
               MIN(A2.BASENAME) AUDIT_RESULT2,
               DECODE(MIN(H2.TYPE), '0', '质量放行', '1', '紧急放行') AUDIT_TYPE,
               MIN(T.IS_FLAG) IS_FLAG,
               MIN(T.ACT_LEN) ACT_LEN,
               MIN(T.ACT_COUNT) ACT_COUNT,
               MIN(T.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT,
               MIN(T.MULTIPLE_NUM) MULTIPLE_NUM,
               MIN(T.LEN_GP_SINGLE) LEN_GP_SINGLE,
               MIN(T.BAL_YEAR_MONTH) BAL_YEAR_MONTH,
               MIN(T.JUDGE_MEMO) JUDGE_MEMO
          FROM QCM_GP_JUDGE_APPLY T
          LEFT JOIN QCM_LG_CHEMJUDGE T2
            ON T2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND T2.VALIDFLAG = '1'
           AND T2.JUDGE_SEQ = 1
          LEFT JOIN COM_BASE_INFO A
            ON T2.CHEM_JUDGE_ID IS NOT NULL
           AND A.BASECODE = T2.MERGE_CHEM_RESULT
          LEFT JOIN COM_BASE_INFO A2
            ON A2.BASECODE = T.AUDIT_RESULT2
          LEFT JOIN COM_BASE_INFO B
            ON (T.PHY_RESULT_CODE IS NULL AND B.BASECODE = '0')
            OR (T.PHY_RESULT_CODE IS NOT NULL AND
               B.BASECODE = T.PHY_RESULT_CODE)
          LEFT JOIN COM_BASE_INFO C
            ON (T.DETECT_RESULT_CODE IS NULL AND C.BASECODE = '0')
            OR (T.DETECT_RESULT_CODE IS NOT NULL AND
               C.BASECODE = T.DETECT_RESULT_CODE)
          LEFT JOIN COM_BASE_INFO D
            ON (T.FACE_RESULT_CODE IS NULL AND D.BASECODE = '0')
            OR (T.FACE_RESULT_CODE IS NOT NULL AND
               D.BASECODE = T.FACE_RESULT_CODE)
          LEFT JOIN PLN_STEELFOR_ORD E
            ON E.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND E.CCM_PLN_TYPE = '00'
          LEFT JOIN QCM_LG_JUDGE F
            ON F.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND F.VALIDFLAG = '1'
           AND F.PROCESS_CDOE = 'B'
          LEFT JOIN PLN_STEELFORFURNACE G
            ON G.STOVE_NO = T.STOVE_NO
          LEFT JOIN QCM_LG_CHEMJUDGE H
            ON H.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND H.PROCESS_CDOE = 'B'
           AND H.VALIDFLAG = '1'
           AND H.JUDGE_SEQ = 1
          LEFT JOIN QCM_LG_CHEMJUDGE K
            ON K.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND K.VALIDFLAG = '1'
           AND K.PROCESS_CDOE = 'B'
           AND K.SAMPLE_TYPE = '1'
          LEFT JOIN QCM_LG_CHEMJUDGE K2
            ON K2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND K2.VALIDFLAG = '1'
           AND K2.PROCESS_CDOE = 'B'
           AND K2.SAMPLE_TYPE = '2'
          LEFT JOIN QCM_GP_PASS_APPLY H2
            ON H2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND H2.Validflag = '1'
           AND H2.PASS_APPLY_SEQ = '001'
          LEFT JOIN Ydm_Gp_Inlist J
            ON J.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
          LEFT JOIN BUY_GP_ORDER J2
            ON J2.ORD_NO_PK = J.ORD_PK
         WHERE ({0} IS NULL OR T.JUDGE_STOVE_NO LIKE '%' || {0} || '%')
           AND ({1} = '0' AND T.JUDGE_RESULT_CODE IS NULL OR
               {1} = '1' AND T.JUDGE_RESULT_CODE IS NOT NULL OR
               {1} NOT IN ('0', '1') AND T.JUDGE_RESULT_CODE = {1} OR
               {1} IS NULL)
           AND ({2} = '0' OR E.EF_PLINE_CODE IN {3})
           AND ({4} IS NULL OR T.JUDGE_RESULT_TIME BETWEEN
               TO_DATE({4}, 'YYYY-MM-DD HH24:MI:SS') AND
               TO_DATE({5}, 'YYYY-MM-DD HH24:MI:SS'))
           AND ({6} IS NULL OR {6} = '1' AND K.SAMPLE_NO LIKE '60_' OR
               {6} = '2' AND K.SAMPLE_NO LIKE '60_F%')
           AND ({7} IS NULL OR
               {7} = '1' AND T.PLINE_CODE NOT IN ('C063', 'C064') OR
               {7} = '2' AND T.PLINE_CODE IN ('C063', 'C064'))
           AND ({8} = '0' OR T.PLINE_CODE IN {9})
           AND ({10} IS NULL OR T.BAL_YEAR_MONTH = {10})
           AND ({11} IS NULL OR
               G.STARTTIME IS NOT NULL AND
               G.STARTTIME >= TO_DATE({11}, 'YYYY-MM-DD HH24:MI:SS') AND
               G.STARTTIME <= TO_DATE({12}, 'YYYY-MM-DD HH24:MI:SS') OR
               T.APPLY_TIME IS NOT NULL AND
               T.APPLY_TIME >= TO_DATE({11}, 'YYYY-MM-DD HH24:MI:SS') AND
               T.APPLY_TIME <= TO_DATE({12}, 'YYYY-MM-DD HH24:MI:SS'))
           AND T.IS_FLAG = '0'
           AND ({13} IS NULL OR EXISTS ( SELECT 1
			  FROM PLN_ORDER_ZG_S
			 WHERE
				PLAN_GROUP_ID  LIKE '%' || {13} || '%' AND GPREQ_ID = T.PRO_PLAN_ID ) )
         GROUP BY T.JUGDE_APPLY_CODE,
                  T.JUGDE_APPLY_SQE,
                  T.JUGDE_APPLY_SEQUENO
        UNION ALL
        SELECT MIN(T.JUDGE_STOVE_NO) JUDGE_STOVE_NO,
               MIN(T.STOVE_NO) STOVE_NO,
               MIN(T.GRADENAME) GRADENAME,
               MIN(T.DIAMETER) ACT_DIMATER,
               MIN(A.BASENAME) CHEM_RESULT,
               MIN(T.JUDGERESULT_CHEM) CHEM_RESULT_CODE,
               NULL PHY_RESULT,
               NULL PHY_RESULT_CODE,
               NULL DETECT_RESULT,
               NULL FACE_RESULT,
               NULL JUDGE_RESULT,
               NULL JUDGE_MAKER,
               MIN(H.CREATE_NAME) CHEM_NAME,
               NULL JUDGE_ORDER,
               NULL JUDGE_GROUP,
               NULL JUDGE_RESULT_TIME,
               TO_CHAR(MIN(H.CREATE_TIME), 'YYYY-MM-DD HH24:MI:SS') CHEM_RESULT_TIME,
               NULL JUGDE_APPLY_CODE,
               NULL JUGDE_APPLY_SQE,
               MIN(E.CUT_NUM) CUT_NUM,
               MIN(T.PLINE_NAME) PLINE_NAME,
               MIN(F.MEMO) MEMO,
               TO_CHAR(MIN(G.STARTTIME), 'YYYY-MM-DD HH24:MI:SS') STARTTIME,
               MIN(T.CIC) || '+' || MIN(T.PIC) || '+' || MIN(T.SIC) || '+' STEEL_STANDRAD,
               MIN(H.MEMO) CHEM_MEMO,
               MIN(H.CIC) CIC,
               CASE
                 WHEN MIN(K2.CHEM_JUDGE_ID) IS NOT NULL THEN
                  '复样'
                 WHEN MIN(K.CHEM_JUDGE_ID) IS NOT NULL THEN
                  '初样'
                 ELSE
                  NULL
               END CHEM_TYPE,
               NULL SUPP_CODE,
               NULL AUDIT_RESULT2,
               DECODE(MIN(H2.TYPE), '0', '质量放行', '1', '紧急放行') AUDIT_TYPE,
               NULL IS_FLAG,
               MIN(T.LENGTH_M) LENGTH_M,
               MIN(T.ACT_COUNT) ACT_COUNT,
               MIN(T.ACT_WEIGHT) ACT_WEIGHT,
               MIN(T.CUT_NUM_GP) CUT_NUM_GP,
               MIN(T.LEN_GP_SINGLE) LEN_GP_SINGLE,
               NULL,
               NULL JUDGE_MEMO
          FROM STL_INCISION T
          LEFT JOIN COM_BASE_INFO A
            ON A.BASECODE = T.JUDGERESULT_CHEM
          LEFT JOIN PLN_STEELFOR_ORD E
            ON E.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND E.CCM_PLN_TYPE = '00'
          LEFT JOIN QCM_LG_JUDGE F
            ON F.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND F.VALIDFLAG = '1'
           AND F.PROCESS_CDOE = 'B'
          LEFT JOIN PLN_STEELFORFURNACE G
            ON G.STOVE_NO = T.STOVE_NO
          LEFT JOIN QCM_LG_CHEMJUDGE H
            ON H.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND H.PROCESS_CDOE = 'B'
           AND H.VALIDFLAG = '1'
           AND H.JUDGE_SEQ = 1
          LEFT JOIN QCM_GP_PASS_APPLY H2
            ON H2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND H2.Validflag = '1'
           AND H2.PASS_APPLY_SEQ = '001'
          LEFT JOIN QCM_LG_CHEMJUDGE K
            ON K.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND K.VALIDFLAG = '1'
           AND K.PROCESS_CDOE = 'B'
           AND K.SAMPLE_TYPE = '1'
          LEFT JOIN QCM_LG_CHEMJUDGE K2
            ON K2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
           AND K2.VALIDFLAG = '1'
           AND K2.PROCESS_CDOE = 'B'
           AND K2.SAMPLE_TYPE = '2'
          LEFT JOIN QCM_GP_JUDGE_APPLY T2
            ON T2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
         WHERE ({0} IS NULL OR T.JUDGE_STOVE_NO LIKE '%' || {0} || '%')
           AND ({1} = '0' OR {1} IS NULL)
           AND ({2} = '0' OR E.EF_PLINE_CODE IN {3})
           AND ({6} IS NULL OR {6} = '1' AND K.SAMPLE_NO LIKE '60_' OR
               {6} = '2' AND K.SAMPLE_NO LIKE '60_F%')
           AND ({7} IS NULL OR {7} = '1')
           AND {10} IS NULL
           AND ({11} IS NULL OR
               G.STARTTIME >= TO_DATE({11}, 'YYYY-MM-DD HH24:MI:SS') AND
               G.STARTTIME <= TO_DATE({12}, 'YYYY-MM-DD HH24:MI:SS'))
           AND G.STARTTIME >=
               TO_DATE('2018-01-02 23:12:48', 'YYYY-MM-DD HH24:MI:SS')
           AND T2.JUGDE_APPLY_CODE IS NULL
           AND ({13} IS NULL OR EXISTS ( SELECT 1
			  FROM PLN_ORDER_ZG_S
			 WHERE
				PLAN_GROUP_ID LIKE '%' || {13} || '%' AND GPREQ_ID = T.PRO_PLAN_ID ) )
         GROUP BY T.INCISION_NO)
 GROUP BY STOVE_NO, JUDGE_STOVE_NO
 ORDER BY STOVE_NO, CUT_NUM
		]]>
	</query>
	
	<query id="QcmGpJugdeApplyDAL.queryApplyChemByJudgeStoveNo" desc="查询外购坯成分">
		<![CDATA[
SELECT D.*, E.CHEM_SEQ, '2' SPECL_FL
  FROM (SELECT B.CIC
          FROM QCM_GP_JUDGE_APPLY A, PLN_REQINF_GP B
         WHERE A.JUDGE_STOVE_NO = {0}
           AND A.IS_FLAG = '0'
           AND (A.PLINE_CODE IN ('C063', 'C064') OR A.LK_FLAG = '1' OR A.GPTYPE = '2')
           AND A.PRO_PLAN_ID = B.GPREQ_ID
         GROUP BY B.CIC) C,
       COM_MSC_STD_CHEM D,
       COM_BASE_CHEM E
 WHERE C.CIC = D.CIC
   AND D.VALIDFLAG = '1'
   AND E.CHEM_CODE = D.CHEM_CODE
		]]>
	</query>
	
		<query id="QcmGpJugdeApplyDAL.queryBaseChemByJudgeStoveNo" desc="查询外购坯成分">
		<![CDATA[
SELECT D.*, E.CHEM_SEQ, '2' SPECL_FL
  FROM (SELECT A.CIC
          FROM QCM_GP_JUDGE_APPLY A
         WHERE A.JUDGE_STOVE_NO = {0}
           AND A.IS_FLAG = '0'
         GROUP BY A.CIC) C,
       COM_MSC_STD_CHEM D,
       COM_BASE_CHEM E
 WHERE C.CIC = D.CIC
   AND D.VALIDFLAG = '1'
   AND E.CHEM_CODE = D.CHEM_CODE
		]]>
	</query>
	
			<query id="QcmGpJugdeApplyDAL.queryApplyChemByDesignAndCic" desc="查询工艺DesignKey">
		<![CDATA[
		select T.*,E.CHEM_SEQ,'2' SPECL_FL from Craft_Ord_Design_Std_Cic T ,
				COM_BASE_CHEM E
			where 	E.CHEM_CODE = T.CHEM_CODE
					AND T.DESGIN_KEY={0} 
					AND  T.CIC={1} 
					AND  T.PROCESS_CODE='A'

		]]>
	</query>
	
	
	  <query id="QcmGpJugdeApplyDAL.QueryOver" desc="判断是否结转">
        <![CDATA[
				SELECT IS_CARRY_VOER
				  FROM QCM_GP_JUDGE_APPLY 
				 WHERE JUGDE_APPLY_CODE = {0}
				   AND   JUGDE_APPLY_SQE ={1}
				   AND JUDGE_STOVE_NO = {2}      
        ]]>
    </query>
    
    <query id="QcmGpJugdeApplyDAL.getCntByStoveNo" desc="通过熔炼炉号查询数量">
        <![CDATA[
SELECT COUNT(1) COUNT
  FROM QCM_GP_JUDGE_APPLY T
 WHERE T.STOVE_NO = {0}
   AND T.IS_FLAG = '0'  
        ]]>
    </query>

	<query id="QcmGpJugdeApplyDAL.getCntByApplyCode" desc="通过熔炼炉号查询数量">
		<![CDATA[
			SELECT t.ACT_COUNT,T.ACT_LEN
			  FROM QCM_GP_JUDGE_APPLY T
			 WHERE T.JUGDE_APPLY_CODE = {0}
			 	and T.JUGDE_APPLY_SQE = {1}
			   AND T.IS_FLAG = '0'
        ]]>
	</query>
    
    <query id="QcmGpJugdeApplyDAL.getPassInfo" desc="获取放行信息">
        <![CDATA[
SELECT MIN(T.JUDGE_RESULT) JUDGE_RESULT,
       MIN(T.JUDGE_MAKER) JUDGE_MAKER,
       TO_CHAR(MIN(T.JUDGE_RESULT_TIME), 'YYYY-MM-DD HH24:MI:SS') JUDGE_RESULT_TIME,
       MIN(T.JUDGE_MEMO) JUDGE_MEMO,
       DECODE(MIN(T.AUDIT_RESULT), '0', '审核不通过', '1', '审核通过', MIN(T3.BASENAME)) AUDIT_RESULT,
       MIN(T2.AUDIT_NAME2) AUDIT_NAME,
       TO_CHAR(MIN(T2.AUDIT_TIME2), 'YYYY-MM-DD HH24:MI:SS') AUDIT_TIME,
       MIN(T2.AUDIT_MEMO2) AUDIT_MEMO,
       T.JUGDE_APPLY_CODE,
       DECODE(MIN(T.INSTANCY_FLAG), '1', '紧急放行', '质量放行') INSTANCY_FLAG,
       MIN(T.PLINE_NAME) PLINE_NAME,
       MIN(T.JUDGE_STOVE_NO) JUDGE_STOVE_NO
  FROM QCM_GP_JUDGE_APPLY T
  LEFT JOIN QCM_GP_PASS_APPLY T2
    ON T2.JUGDE_APPLY_CODE = T.JUGDE_APPLY_CODE
   AND T2.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
   AND T2.VALIDFLAG = '1'
  LEFT JOIN COM_BASE_INFO T3
    ON T3.BASECODE = T2.AUDIT_RESULT2
 WHERE T.JUDGE_STOVE_NO = {0}
   AND T.IS_FLAG = '0'
   AND T.IS_ALL_SCRAP = '0'
 GROUP BY T.JUGDE_APPLY_CODE
        ]]>
    </query>
    
    <query id="QcmGpJugdeApplyDAL.getPlineByStoveNo" desc="通过熔炼炉号查询产线">
        <![CDATA[
SELECT T.PLINE_CODE
  FROM QCM_GP_JUDGE_APPLY T
 WHERE T.STOVE_NO = {0}
   AND T.IS_FLAG = '0'
   AND ROWNUM <= 1
        ]]>
    </query>

	<query id="QcmGpJugdeApplyDAL.setAutoJudge" desc="自动判定标识">
		<![CDATA[
UPDATE QCM_GP_JUDGE_APPLY T
   SET T.AUTO_JUDGE = '1'
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
        ]]>
	</query>
	
	<!-- TZH 24.9.5 ADD  34.11.6 修改  加入gradename字段-->
	<query id="QcmGpJugdeApplyDAL.queryMatGpApplyByJudgeStoveNo" desc="查询管坯库存">
		<![CDATA[
		
select dimater,pro_order_no,gradecode,gradename,SUM(ACT_WEIGHT) ACT_WEIGHT from (
select JUDGE_RESULT_CODE,tt.dimater,tt.pro_order_no,tt.gradecode,tt.gradename,
(case when nvl(tt.ACT_WEIGHT,0)=0 then nvl(tt.ACT_THEORY_WEIGHT,0) else nvl(tt.ACT_WEIGHT,0) end)  ACT_WEIGHT
from Mat_Gp_M tt where tt.JUGDE_APPLY_CODE like   {0} || '%'
union all 
select JUDGE_RESULT_CODE,tt.dimater,tt.pro_order_no,tt.gradecode,tt.gradename,
tt.ACT_WEIGHT  ACT_WEIGHT
from MAT_GP_M_HISTORY tt where tt.JUGDE_APPLY_CODE like   {1} || '%'
)
GROUP BY dimater,pro_order_no,gradecode,gradename
		]]>
	</query>
	
	
		<!-- TZH 24.11.28  ADD  撤销判定穿负的总量过去-->
	<query id="QcmGpJugdeApplyDAL.queryMatGpApplyByJudgeStoveNo2" desc="查询管坯库存">
		<![CDATA[
		
select dimater,pro_order_no,gradecode,gradename,-SUM(ACT_WEIGHT) ACT_WEIGHT from (
select JUDGE_RESULT_CODE,tt.dimater,tt.pro_order_no,tt.gradecode,tt.gradename,
(case when nvl(tt.ACT_WEIGHT,0)=0 then nvl(tt.ACT_THEORY_WEIGHT,0) else nvl(tt.ACT_WEIGHT,0) end)  ACT_WEIGHT
from Mat_Gp_M tt where tt.JUGDE_APPLY_CODE like   {0} || '%'
union all 
select JUDGE_RESULT_CODE,tt.dimater,tt.pro_order_no,tt.gradecode,tt.gradename,
tt.ACT_WEIGHT  ACT_WEIGHT
from MAT_GP_M_HISTORY tt where tt.JUGDE_APPLY_CODE like   {1} || '%'
)
GROUP BY dimater,pro_order_no,gradecode,gradename
		]]>
	</query>
</queryMap>

