<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="">
	<query id="JdgQcmJudgeLock.QueryJudgeStoveNo" desc="查询">
        <![CDATA[
SELECT DISTINCT JUDGE_STOVE_NO
  FROM (SELECT A.JUDGE_STOVE_NO
          FROM PLN_STEELFOR_ORD A
         WHERE A.JUDGE_STOVE_NO LIKE '%' || {0} || '%'
        UNION ALL
        SELECT B.FEED_HEAT_NO
          FROM PLN_ZY_ZG_M B
         WHERE B.JUDGE_STOVE_NO LIKE '%' || {0} || '%'
        UNION ALL
        SELECT B.JUDGE_STOVE_NO
          FROM PLN_ZY_DBK_M B
         WHERE B.JUDGE_STOVE_NO LIKE '%' || {0} || '%'
        UNION ALL
        SELECT B.JUDGE_STOVE_NO
          FROM PLN_ZY_RCL_M B
         WHERE B.JUDGE_STOVE_NO LIKE '%' || {0} || '%'
        UNION ALL
        SELECT B.JUDGE_STOVE_NO
          FROM PLN_ZY_JGX_M B
         WHERE B.JUDGE_STOVE_NO LIKE '%' || {0} || '%'
        UNION ALL
        SELECT B.JUDGE_STOVE_NO
          FROM PLN_ZY_JG_M B
         WHERE B.JUDGE_STOVE_NO LIKE '%' || {0} || '%')
        ]]>
    </query>
    
    <query id="JdgQcmJudgeLock.QueryJudgeStoveNoByOrderNo" desc="查询">
        <![CDATA[
SELECT DISTINCT JUDGE_STOVE_NO
  FROM (SELECT A.JUDGE_STOVE_NO
          FROM PLN_STEELFOR_ORD A, PLN_ORDER_ZG_S C
         WHERE C.PRO_PLAN_ID = A.PRO_PLAN_ID
           AND C.GX_PLAN_NO = A.GX_PLAN_NO
           AND C.ORDER_NO LIKE '%' || {0} || '%'
           AND ({1} IS NULL OR C.ORDER_SEQ = {1})
        UNION ALL
        SELECT B.FEED_HEAT_NO
          FROM PLN_ZY_ZG_M B, PLN_SALEORD C
         WHERE B.ORD_LN_DLY_PK = C.ORD_LN_DLY_PK
           AND C.ORDER_NO LIKE '%' || {0} || '%'
        UNION ALL
        SELECT B.JUDGE_STOVE_NO
          FROM PLN_ZY_DBK_M B, PLN_SALEORD C
         WHERE B.ORD_LN_DLY_PK = C.ORD_LN_DLY_PK
           AND C.ORDER_NO LIKE '%' || {0} || '%'
        UNION ALL
        SELECT B.JUDGE_STOVE_NO
          FROM PLN_ZY_RCL_M B, PLN_SALEORD C
         WHERE B.ORD_LN_DLY_PK = C.ORD_LN_DLY_PK
           AND C.ORDER_NO LIKE '%' || {0} || '%'
        UNION ALL
        SELECT B.JUDGE_STOVE_NO
          FROM PLN_ZY_JGX_M B, PLN_SALEORD C
         WHERE B.ORD_LN_DLY_PK = C.ORD_LN_DLY_PK
           AND C.ORDER_NO LIKE '%' || {0} || '%'
        UNION ALL
        SELECT B.JUDGE_STOVE_NO
          FROM PLN_ZY_JG_M B, PLN_SALEORD C
         WHERE B.ORD_LN_DLY_PK = C.ORD_LN_DLY_PK
           AND C.ORDER_NO LIKE '%' || {0} || '%')
        ]]>
    </query>

	<query id="JdgQcmJudgeLock.QueryLg" desc="查询">
        <![CDATA[
SELECT 'A' PROCESS_CODE,
       MIN(H5.PROCESS_DESC) PROCESS_DESC,
       F.JUDGE_STOVE_NO,
       SUM(1) ACT_COUNT,
       SUM(F.WEIGHT) ACT_WEIGHT,
       MIN(H.LOCK_REASON) LOCK_REASON,
       MIN(H.LOCK_TIME) LOCK_TIME,
       MIN(H2.USERNAME) LOCK_USER,
       MIN(H.UNLOCK_TIME) UNLOCK_TIME,
       MIN(H3.USERNAME) UNLOCK_USER,
       MIN(H.LOCK_FLAG) LOCK_FLAG,
       MIN(H.LOCK_PROCESS_CODE) LOCK_PROCESS_CODE,
       MIN(H.LOCK_ID) LOCK_ID
  FROM (SELECT MIN(D.JUDGE_STOVE_NO) JUDGE_STOVE_NO,
               MIN(D.WEIGHT) WEIGHT,
               LISTAGG(D.ORDER_NO || '/' || D.ORDER_SEQ, ',') WITHIN GROUP(ORDER BY D.ORDER_NO),
               LISTAGG(D.ORDER_NO || '/' || D.ORDER_SEQ, ',') WITHIN GROUP(ORDER BY D.ORDER_NO),
               MIN(D.STEELNAME) STEELNAME,
               MIN(D.GRADENAME) GRADENAME,
               MIN(D.DIAMETER) DIAMETER
          FROM (SELECT C.MAT_NO,
                       C.JUDGE_STOVE_NO,
                       MIN(C.WEIGHT) WEIGHT,
                       A.ORDER_NO,
                       A.ORDER_SEQ,
                       MIN(A.STEELNAME) STEELNAME,
                       MIN(B.GRADENAME) GRADENAME,
                       MIN(C.DIAMETER) DIAMETER
                  FROM PLN_ORDER_ZG_S   A,
                       PLN_STEELFOR_ORD B,
                       STL_LG_PROGRRSS  C
                  LEFT JOIN MAT_GP_M C2
                    ON C2.MAT_NO = C.MAT_NO
                   AND C.MAT_NO IS NOT NULL
                  LEFT JOIN MAT_GP_M_HISTORY C3
                    ON C3.MAT_NO = C.MAT_NO
                   AND C.MAT_NO IS NOT NULL
                  LEFT JOIN PORT_MIL_BATCH_SAMPLE_RESULT C4
                    ON C4.IS_VALID = '1'
                   AND C4.STATUS = '0'
                   AND C4.JUDGE_STOVE_NO LIKE C.JUDGE_STOVE_NO || '%'
                   AND C.JUDGE_STOVE_NO IS NOT NULL, SLM_ORDER_HEAD D,
                 SLM_ORDER_LINE E, SLM_ORDER_LINE_DELIVERY F
                 WHERE B.JUDGE_STOVE_NO = C.JUDGE_STOVE_NO
                   AND C.JUDGE_STOVE_NO IS NOT NULL
                   AND B.JUDGE_STOVE_NO IS NOT NULL
                   AND C.IS_VALID = '0'
                   AND C.STATUS = '0'
                   AND A.GPREQ_ID = B.PRO_PLAN_ID
                   AND B.PRO_PLAN_ID IS NOT NULL
                   AND A.GPREQ_ID IS NOT NULL
                   AND ({0} IS NULL OR B.JUDGE_STOVE_NO = {0})
                   AND A.PLN_DIVIDE_ID = '01'
                   AND F.ORD_LN_DLY_PK = A.ORD_LN_DLY_PK
                   AND E.ORD_LN_PK = F.ORD_LN_PK
                   AND D.ORD_PK = E.ORD_PK
                   AND D.ORD_PK IS NOT NULL
                   AND E.ORD_LN_PK IS NOT NULL
                   AND F.ORD_LN_DLY_PK IS NOT NULL
                   AND ({1} IS NULL OR
                       D.ORDER_NO LIKE '%' || UPPER({1}) || '%')
                   AND ({2} IS NULL OR E.ORDER_SEQ = {2})
                   AND ((C2.MAT_NO IS NULL OR
                       C2.JUDGE_RESULT_CODE <> '40740701') AND
                       (C3.MAT_NO IS NULL OR
                       C3.JUDGE_RESULT_CODE <> '40740701') OR
                       C4.MAT_NO IS NULL)
                 GROUP BY C.MAT_NO, C.JUDGE_STOVE_NO, A.ORDER_NO, A.ORDER_SEQ) D
         GROUP BY D.MAT_NO) F
  LEFT JOIN QCM_JUDGE_LOCK H
    ON H.JUDGE_STOVE_NO = F.JUDGE_STOVE_NO
   AND H.PROCESS_CODE = 'A'
   AND F.JUDGE_STOVE_NO IS NOT NULL
  LEFT JOIN CORE_APP_USER H2
    ON H2.USERID = H.LOCK_USER_ID
   AND H.LOCK_USER_ID IS NOT NULL
  LEFT JOIN CORE_APP_USER H3
    ON H3.USERID = H.UNLOCK_USER_ID
   AND H.UNLOCK_USER_ID IS NOT NULL
  LEFT JOIN COM_BASE_PROCESS H4
    ON H4.PROCESS_CODE = H.LOCK_PROCESS_CODE
   AND H.LOCK_PROCESS_CODE IS NOT NULL
  LEFT JOIN COM_BASE_PROCESS H5
    ON H5.PROCESS_CODE = 'A'
 GROUP BY F.JUDGE_STOVE_NO
        ]]>
    </query>
    
    <query id="JdgQcmJudgeLock.QueryZg" desc="查询轧管">
        <![CDATA[
SELECT MIN(C.ORDER_NO) || '/' || MIN(C.ORDER_SEQ) ORDER_NO,
       MIN(A.FEED_HEAT_NO) JUDGE_STOVE_NO,
       E.BATCH_NO,
       MIN(C.STEELNAME) STEELNAME,
       MIN(B.GRADENAME) GRADENAME,
       MIN(C.SPEC_NAME) SPEC_NAME,
       SUM(E.ACT_COUNT) ACT_COUNT,
       SUM(E.ACT_THEORY_WEIGHT) ACT_WEIGHT,
       'D' PROCESS_CODE,
       MIN(F4.PROCESS_DESC) PROCESS_DESC,
       MIN(F.LOCK_REASON) LOCK_REASON,
       MIN(F.LOCK_PROCESS_CODE) LOCK_PROCESS_CODE,
       MIN(F.LOCK_FLAG) LOCK_FLAG,
       MIN(F2.USERNAME) LOCK_NAME,
       TO_CHAR(MIN(F.LOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') LOCK_TIME,
       MIN(F3.USERNAME) UNLOCK_NAME,
       TO_CHAR(MIN(F.UNLOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') UNLOCK_TIME,
       MIN(F.LOCK_ID) LOCK_ID
  FROM PLN_ORDER_ZG_S B, PLN_ZY_ZG_M A
  LEFT JOIN PLN_ZY_DBK_M A2
    ON A2.UPPER_HEATPLAN_ID = A.HEAT_PLAN_NO
   AND A2.PLANSTATUS IN ('20', '30', '40')
   AND A.HEAT_PLAN_NO IS NOT NULL
  LEFT JOIN PLN_ZY_RCL_M A3
    ON A3.UPPER_HEATPLAN_ID = A.HEAT_PLAN_NO
   AND A3.PLANSTATUS IN ('20', '30', '40')
   AND A.HEAT_PLAN_NO IS NOT NULL
  LEFT JOIN PLN_ZY_JGX_M A4
    ON A4.UPPER_HEATPLAN_ID = A.HEAT_PLAN_NO
   AND A4.PLANSTATUS IN ('20', '30', '40')
   AND A.HEAT_PLAN_NO IS NOT NULL
  LEFT JOIN PLN_ZY_JG_M A5
    ON A5.UPPER_HEATPLAN_ID = A.HEAT_PLAN_NO
   AND A5.PLANSTATUS IN ('20', '30', '40')
   AND A.HEAT_PLAN_NO IS NOT NULL
  LEFT JOIN QCM_JUDGE_LOCK F
    ON F.PROCESS_CODE = 'D'
   AND A.FEED_HEAT_NO IS NOT NULL
   AND F.JUDGE_STOVE_NO = A.FEED_HEAT_NO
  LEFT JOIN CORE_APP_USER F2
    ON F.LOCK_USER_ID IS NOT NULL
   AND F2.USERID = F.LOCK_USER_ID
  LEFT JOIN CORE_APP_USER F3
    ON F.UNLOCK_USER_ID IS NOT NULL
   AND F3.USERID = F.UNLOCK_USER_ID
  LEFT JOIN COM_BASE_PROCESS F4
    ON F4.PROCESS_CODE = 'D', PORT_MIL_BATCH_SAMPLE_RESULT E
  LEFT JOIN MAT_BC_M E2
    ON E2.MAT_NO = E.MAT_NO
   AND E2.PROCESS_CDOE = 'D'
   AND E.MAT_NO IS NOT NULL
  LEFT JOIN MAT_BC_BACKUP E3
    ON E3.MAT_NO = E.MAT_NO
   AND E3.PROCESS_CDOE = 'D'
   AND E.MAT_NO IS NOT NULL, PLN_SALEORD C
 WHERE (A.PRO_PLAN_ID IS NOT NULL AND B.PRO_PLAN_ID IS NOT NULL AND
       A.PRO_PLAN_ID = B.PRO_PLAN_ID)
   AND (A.GX_PLAN_NO IS NOT NULL AND B.GX_PLAN_NO IS NOT NULL AND
       A.GX_PLAN_NO = B.GX_PLAN_NO)
   AND (C.ORD_LN_DLY_PK IS NOT NULL AND C.ORD_LN_DLY_PK = B.ORD_LN_DLY_PK)
   AND E.JUDGE_STOVE_NO LIKE A.FEED_HEAT_NO || '%'
   AND E.JUDGE_STOVE_NO IS NOT NULL
   AND A.FEED_HEAT_NO IS NOT NULL
   AND E.IS_VALID = '1'
   AND (E.STATUS = '0' or E.STATUS = '3')
   AND ({0} IS NULL OR A.FEED_HEAT_NO = {0})
   AND ({1} IS NULL OR
       C.ORDER_NO IS NOT NULL AND C.ORDER_NO LIKE '%' || UPPER({1}) || '%')
   AND ({2} IS NULL OR C.ORDER_SEQ IS NOT NULL AND C.ORDER_SEQ = {2})
   AND ((E2.MAT_NO IS NULL OR
       E2.JUDGE_RESULT_CODE NOT IN ('40740701', '40740705')) AND
       (E3.MAT_NO IS NULL OR
       E3.JUDGE_RESULT_CODE NOT IN ('40740701', '40740705')) OR
       A2.HEAT_PLAN_NO IS NOT NULL AND A3.HEAT_PLAN_NO IS NOT NULL AND
       A4.HEAT_PLAN_NO IS NOT NULL AND A5.HEAT_PLAN_NO IS NOT NULL)
 GROUP BY E.JUDGE_STOVE_NO, E.BATCH_NO
        ]]>
    </query>
    
    <query id="JdgQcmJudgeLock.QueryDbk" desc="查询热处理">
        <![CDATA[
SELECT MIN(C.ORDER_NO) || '/' || MIN(C.ORDER_SEQ) ORDER_NO,
       MIN(A.JUDGE_STOVE_NO) JUDGE_STOVE_NO,
       E.PHY_BATCH_NO BATCH_NO,
       MIN(C.STEELNAME) STEELNAME,
       MIN(B.GRADENAME) GRADENAME,
       MIN(C.SPEC_NAME) SPEC_NAME,
       SUM(E.ACT_COUNT) ACT_COUNT,
       SUM(E.ACT_THEORY_WEIGHT) ACT_WEIGHT,
       'E' PROCESS_CODE,
       MIN(F4.PROCESS_DESC) PROCESS_DESC,
       MIN(F.LOCK_REASON) LOCK_REASON,
       MIN(F.LOCK_PROCESS_CODE) LOCK_PROCESS_CODE,
       MIN(F.LOCK_FLAG) LOCK_FLAG,
       MIN(F2.USERNAME) LOCK_NAME,
       TO_CHAR(MIN(F.LOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') LOCK_TIME,
       MIN(F3.USERNAME) UNLOCK_NAME,
       TO_CHAR(MIN(F.UNLOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') UNLOCK_TIME,
       MIN(F.LOCK_ID) LOCK_ID
  FROM PLN_ORDER_DBK_S B, PLN_ZY_DBK_M A
  LEFT JOIN PLN_ZY_RCL_M A3
    ON A3.UPPER_HEATPLAN_ID = A.HEAT_PLAN_NO
   AND A3.PLANSTATUS IN ('20', '30', '40')
   AND A.HEAT_PLAN_NO IS NOT NULL
  LEFT JOIN PLN_ZY_JGX_M A4
    ON A4.UPPER_HEATPLAN_ID = A.HEAT_PLAN_NO
   AND A4.PLANSTATUS IN ('20', '30', '40')
   AND A.HEAT_PLAN_NO IS NOT NULL
  LEFT JOIN PLN_ZY_JG_M A5
    ON A5.UPPER_HEATPLAN_ID = A.HEAT_PLAN_NO
   AND A5.PLANSTATUS IN ('20', '30', '40')
   AND A.HEAT_PLAN_NO IS NOT NULL, PORT_VRP_BATCH_SAMPLE_RESULT E
  LEFT JOIN MAT_BC_M E2
    ON E2.MAT_NO = E.MAT_NO
   AND E2.PROCESS_CDOE = 'E'
   AND E.MAT_NO IS NOT NULL
  LEFT JOIN MAT_BC_BACKUP E3
    ON E3.MAT_NO = E.MAT_NO
   AND E3.PROCESS_CDOE = 'E'
   AND E.MAT_NO IS NOT NULL
  LEFT JOIN QCM_JUDGE_LOCK F
    ON F.PROCESS_CODE = 'E'
   AND E.JUDGE_STOVE_NO IS NOT NULL
   AND F.JUDGE_STOVE_NO = E.JUDGE_STOVE_NO
   AND F.BATCH_NO = E.PHY_BATCH_NO
  LEFT JOIN CORE_APP_USER F2
    ON F.LOCK_USER_ID IS NOT NULL
   AND F2.USERID = F.LOCK_USER_ID
  LEFT JOIN CORE_APP_USER F3
    ON F.UNLOCK_USER_ID IS NOT NULL
   AND F3.USERID = F.UNLOCK_USER_ID
  LEFT JOIN COM_BASE_PROCESS F4
    ON F4.PROCESS_CODE = 'E', PLN_SALEORD C
 WHERE (A.PRO_PLAN_ID IS NOT NULL AND B.PRO_PLAN_ID IS NOT NULL AND
       A.PRO_PLAN_ID = B.PRO_PLAN_ID)
   AND (A.GX_PLAN_NO IS NOT NULL AND B.GX_PLAN_NO IS NOT NULL AND
       A.GX_PLAN_NO = B.GX_PLAN_NO)
   AND (C.ORD_LN_DLY_PK IS NOT NULL AND C.ORD_LN_DLY_PK = B.ORD_LN_DLY_PK)
   AND E.JUDGE_STOVE_NO = A.JUDGE_STOVE_NO
   AND E.JUDGE_STOVE_NO IS NOT NULL
   AND A.JUDGE_STOVE_NO IS NOT NULL
   AND E.MAT_STATUS IN ('00', '20')
   AND ({0} IS NULL OR A.JUDGE_STOVE_NO = {0})
   AND ({1} IS NULL OR
       C.ORDER_NO IS NOT NULL AND C.ORDER_NO LIKE '%' || UPPER({1}) || '%')
   AND ({2} IS NULL OR C.ORDER_SEQ IS NOT NULL AND C.ORDER_SEQ = {2})
   AND ((E2.MAT_NO IS NULL OR
       E2.JUDGE_RESULT_CODE NOT IN ('40740701', '40740705')) AND
       (E3.MAT_NO IS NULL OR
       E3.JUDGE_RESULT_CODE NOT IN ('40740701', '40740705')) OR
       A3.HEAT_PLAN_NO IS NOT NULL AND A4.HEAT_PLAN_NO IS NOT NULL AND
       A5.HEAT_PLAN_NO IS NOT NULL)
 GROUP BY E.JUDGE_STOVE_NO, E.PHY_BATCH_NO
        ]]>
    </query>
    
    <query id="JdgQcmJudgeLock.QueryRcl" desc="查询热处理">
        <![CDATA[
SELECT MIN(C.ORDER_NO) || '/' || MIN(C.ORDER_SEQ) ORDER_NO,
       MIN(A.JUDGE_STOVE_NO) JUDGE_STOVE_NO,
       E.PHY_BATCH_NO BATCH_NO,
       MIN(C.STEELNAME) STEELNAME,
       MIN(B.GRADENAME) GRADENAME,
       MIN(C.SPEC_NAME) SPEC_NAME,
       SUM(E.ACT_COUNT) ACT_COUNT,
       SUM(E.ACT_THEORY_WEIGHT) ACT_WEIGHT,
       'F' PROCESS_CODE,
       MIN(F4.PROCESS_DESC) PROCESS_DESC,
       MIN(F.LOCK_REASON) LOCK_REASON,
       MIN(F.LOCK_PROCESS_CODE) LOCK_PROCESS_CODE,
       MIN(F.LOCK_FLAG) LOCK_FLAG,
       MIN(F2.USERNAME) LOCK_NAME,
       TO_CHAR(MIN(F.LOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') LOCK_TIME,
       MIN(F3.USERNAME) UNLOCK_NAME,
       TO_CHAR(MIN(F.UNLOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') UNLOCK_TIME,
       MIN(F.LOCK_ID) LOCK_ID
  FROM PLN_ORDER_RCL_S B, PLN_ZY_RCL_M A
  LEFT JOIN PLN_ZY_JGX_M A4
    ON A4.UPPER_HEATPLAN_ID = A.HEAT_PLAN_NO
   AND A4.PLANSTATUS IN ('20', '30', '40')
   AND A.HEAT_PLAN_NO IS NOT NULL
  LEFT JOIN PLN_ZY_JG_M A5
    ON A5.UPPER_HEATPLAN_ID = A.HEAT_PLAN_NO
   AND A5.PLANSTATUS IN ('20', '30', '40')
   AND A.HEAT_PLAN_NO IS NOT NULL, PORT_HTT_BATCH_SAMPLE_RESULT E
  LEFT JOIN MAT_BC_M E2
    ON E2.MAT_NO = E.MAT_NO
   AND E2.PROCESS_CDOE = 'F'
   AND E.MAT_NO IS NOT NULL
  LEFT JOIN MAT_BC_BACKUP E3
    ON E3.MAT_NO = E.MAT_NO
   AND E3.PROCESS_CDOE = 'F'
   AND E.MAT_NO IS NOT NULL
  LEFT JOIN QCM_JUDGE_LOCK F
    ON F.PROCESS_CODE = 'F'
   AND (E.JUDGE_STOVE_NO IS NOT NULL AND
       F.JUDGE_STOVE_NO = E.JUDGE_STOVE_NO)
   AND F.BATCH_NO = E.PHY_BATCH_NO
  LEFT JOIN CORE_APP_USER F2
    ON (F.LOCK_USER_ID IS NOT NULL AND F2.USERID = F.LOCK_USER_ID)
  LEFT JOIN CORE_APP_USER F3
    ON (F.UNLOCK_USER_ID IS NOT NULL AND F3.USERID = F.UNLOCK_USER_ID)
  LEFT JOIN COM_BASE_PROCESS F4
    ON F4.PROCESS_CODE = 'F', PLN_SALEORD C
 WHERE (A.PRO_PLAN_ID IS NOT NULL AND B.PRO_PLAN_ID IS NOT NULL AND
       A.PRO_PLAN_ID = B.PRO_PLAN_ID)
   AND (A.GX_PLAN_NO IS NOT NULL AND B.GX_PLAN_NO IS NOT NULL AND
       A.GX_PLAN_NO = B.GX_PLAN_NO)
   AND (C.ORD_LN_DLY_PK IS NOT NULL AND C.ORD_LN_DLY_PK = B.ORD_LN_DLY_PK)
   AND E.JUDGE_STOVE_NO = A.JUDGE_STOVE_NO
   AND E.JUDGE_STOVE_NO IS NOT NULL
   AND A.JUDGE_STOVE_NO IS NOT NULL
   AND E.MAT_STATUS IN ('00', '20')
   AND ({0} IS NULL OR A.JUDGE_STOVE_NO = {0})
   AND ({1} IS NULL OR
       C.ORDER_NO IS NOT NULL AND C.ORDER_NO LIKE '%' || UPPER({1}) || '%')
   AND ({2} IS NULL OR C.ORDER_SEQ IS NOT NULL AND C.ORDER_SEQ = {2})
   AND ((E2.MAT_NO IS NULL OR
       E2.JUDGE_RESULT_CODE NOT IN ('40740701', '40740705')) AND
       (E3.MAT_NO IS NULL OR
       E3.JUDGE_RESULT_CODE NOT IN ('40740701', '40740705')) OR
       A4.HEAT_PLAN_NO IS NOT NULL AND
       A5.HEAT_PLAN_NO IS NOT NULL)
 GROUP BY E.JUDGE_STOVE_NO, E.PHY_BATCH_NO
        ]]>
    </query>
    
    <query id="JdgQcmJudgeLock.QueryJgx" desc="查询加工线">
        <![CDATA[
SELECT MIN(C.ORDER_NO) || '/' || MIN(C.ORDER_SEQ) ORDER_NO,
       MIN(A.JUDGE_STOVE_NO) JUDGE_STOVE_NO,
       E.PHY_BATCH_NO BATCH_NO,
       MIN(C.STEELNAME) STEELNAME,
       MIN(A.GRADENAME) GRADENAME,
       MIN(C.SPEC_NAME) SPEC_NAME,
       SUM(E.ACT_COUNT) ACT_COUNT,
       SUM(E.ACT_THEORY_WEIGHT) ACT_WEIGHT,
       'G' PROCESS_CODE,
       MIN(F4.PROCESS_DESC) PROCESS_DESC,
       MIN(F.LOCK_REASON) LOCK_REASON,
       MIN(F.LOCK_PROCESS_CODE) LOCK_PROCESS_CODE,
       MIN(F.LOCK_FLAG) LOCK_FLAG,
       MIN(F2.USERNAME) LOCK_NAME,
       TO_CHAR(MIN(F.LOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') LOCK_TIME,
       MIN(F3.USERNAME) UNLOCK_NAME,
       TO_CHAR(MIN(F.UNLOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') UNLOCK_TIME,
       MIN(F.LOCK_ID) LOCK_ID
  FROM PLN_ORDER_JGX_S B, PLN_ZY_JGX_M A
  LEFT JOIN PLN_ZY_JG_M A5
    ON A5.UPPER_HEATPLAN_ID = A.HEAT_PLAN_NO
   AND A5.PLANSTATUS IN ('20', '30', '40')
   AND A.HEAT_PLAN_NO IS NOT NULL, PORT_MCH_BATCH_SAMPLE_RESULT E
  LEFT JOIN MAT_BC_M E2
    ON E2.MAT_NO = E.MAT_NO
   AND E2.PROCESS_CDOE = 'G'
   AND E.MAT_NO IS NOT NULL
  LEFT JOIN MAT_BC_BACKUP E3
    ON E3.MAT_NO = E.MAT_NO
   AND E3.PROCESS_CDOE = 'G'
   AND E.MAT_NO IS NOT NULL
  LEFT JOIN QCM_JUDGE_LOCK F
    ON F.PROCESS_CODE = 'G'
   AND (E.JUDGE_STOVE_NO IS NOT NULL AND
       F.JUDGE_STOVE_NO = E.JUDGE_STOVE_NO)
   AND F.BATCH_NO = E.PHY_BATCH_NO
  LEFT JOIN CORE_APP_USER F2
    ON (F.LOCK_USER_ID IS NOT NULL AND F2.USERID = F.LOCK_USER_ID)
  LEFT JOIN CORE_APP_USER F3
    ON (F.UNLOCK_USER_ID IS NOT NULL AND F3.USERID = F.UNLOCK_USER_ID)
  LEFT JOIN COM_BASE_PROCESS F4
    ON F4.PROCESS_CODE = 'G', PLN_SALEORD C
 WHERE (A.PRO_PLAN_ID IS NOT NULL AND B.PRO_PLAN_ID IS NOT NULL AND
       A.PRO_PLAN_ID = B.PRO_PLAN_ID)
   AND (A.GX_PLAN_NO IS NOT NULL AND B.GX_PLAN_NO IS NOT NULL AND
       A.GX_PLAN_NO = B.GX_PLAN_NO)
   AND (C.ORD_LN_DLY_PK IS NOT NULL AND C.ORD_LN_DLY_PK = B.ORD_LN_DLY_PK)
   AND E.JUDGE_STOVE_NO = A.JUDGE_STOVE_NO
   AND E.JUDGE_STOVE_NO IS NOT NULL
   AND A.JUDGE_STOVE_NO IS NOT NULL
   AND E.MAT_STATUS IN ('00', '20')
   AND E.VALIDFLAG = '1'
   AND ({0} IS NULL OR A.JUDGE_STOVE_NO = {0})
   AND ({1} IS NULL OR
       C.ORDER_NO IS NOT NULL AND C.ORDER_NO LIKE '%' || UPPER({1}) || '%')
   AND ({2} IS NULL OR C.ORDER_SEQ IS NOT NULL AND C.ORDER_SEQ = {2})
   AND ((E2.MAT_NO IS NULL OR
       E2.JUDGE_RESULT_CODE NOT IN ('40740701', '40740705')) AND
       (E3.MAT_NO IS NULL OR
       E3.JUDGE_RESULT_CODE NOT IN ('40740701', '40740705')) OR
       A5.HEAT_PLAN_NO IS NOT NULL)
 GROUP BY E.JUDGE_STOVE_NO, E.PHY_BATCH_NO
        ]]>
    </query>
    
    <query id="JdgQcmJudgeLock.QueryJg" desc="查询接箍线">
        <![CDATA[
SELECT MIN(C.ORDER_NO) || '/' || MIN(C.ORDER_SEQ) ORDER_NO,
       MIN(A.JUDGE_STOVE_NO) JUDGE_STOVE_NO,
       E.BATCH_NO,
       MIN(C.STEELNAME) STEELNAME,
       MIN(A.GRADENAME) GRADENAME,
       MIN(C.SPEC_NAME) SPEC_NAME,
       SUM(E.ACT_COUNT) ACT_COUNT,
       SUM(E.ACT_THEORY_WEIGHT) ACT_WEIGHT,
       'H' PROCESS_CODE,
       MIN(F4.PROCESS_DESC) PROCESS_DESC,
       MIN(F.LOCK_REASON) LOCK_REASON,
       MIN(F.LOCK_PROCESS_CODE) LOCK_PROCESS_CODE,
       MIN(F.LOCK_FLAG) LOCK_FLAG,
       MIN(F2.USERNAME) LOCK_NAME,
       TO_CHAR(MIN(F.LOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') LOCK_TIME,
       MIN(F3.USERNAME) UNLOCK_NAME,
       TO_CHAR(MIN(F.UNLOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') UNLOCK_TIME,
       MIN(F.LOCK_ID) LOCK_ID
  FROM PLN_GX_JG_PROP_S B, PLN_ZY_JG_M A
  LEFT JOIN QCM_JUDGE_LOCK F
    ON F.PROCESS_CODE = 'H'
   AND (A.JUDGE_STOVE_NO IS NOT NULL AND
       F.JUDGE_STOVE_NO = A.JUDGE_STOVE_NO)
  LEFT JOIN CORE_APP_USER F2
    ON (F.LOCK_USER_ID IS NOT NULL AND F2.USERID = F.LOCK_USER_ID)
  LEFT JOIN CORE_APP_USER F3
    ON (F.UNLOCK_USER_ID IS NOT NULL AND F3.USERID = F.UNLOCK_USER_ID)
  LEFT JOIN COM_BASE_PROCESS F4
    ON F4.PROCESS_CODE = 'H', PORT_MCH_BATCH_SAMPLE_RESULT E
  LEFT JOIN MAT_BC_M E2
    ON E2.MAT_NO = E.MAT_NO
   AND E2.PROCESS_CDOE = 'G'
   AND E.MAT_NO IS NOT NULL
  LEFT JOIN MAT_BC_BACKUP E3
    ON E3.MAT_NO = E.MAT_NO
   AND E3.PROCESS_CDOE = 'G'
   AND E.MAT_NO IS NOT NULL, PLN_SALEORD C
 WHERE (A.PRO_PLAN_ID IS NOT NULL AND B.PRO_PLAN_ID IS NOT NULL AND
       A.PRO_PLAN_ID = B.PRO_PLAN_ID)
   AND (A.GX_PLAN_NO IS NOT NULL AND B.GX_PLAN_NO IS NOT NULL AND
       A.GX_PLAN_NO = B.GX_PLAN_NO)
   AND (C.ORD_LN_DLY_PK IS NOT NULL AND C.ORD_LN_DLY_PK = B.ORD_LN_DLY_PK)
   AND E.JUDGE_STOVE_NO = A.JUDGE_STOVE_NO
   AND E.JUDGE_STOVE_NO IS NOT NULL
   AND A.JUDGE_STOVE_NO IS NOT NULL
   AND E.MAT_STATUS IN ('00', '20')
   AND ({0} IS NULL OR A.JUDGE_STOVE_NO = {0})
   AND ({1} IS NULL OR
       C.ORDER_NO IS NOT NULL AND C.ORDER_NO LIKE '%' || UPPER({1}) || '%')
   AND ({2} IS NULL OR C.ORDER_SEQ IS NOT NULL AND C.ORDER_SEQ = {2})
   AND ((E2.MAT_NO IS NULL OR
       E2.JUDGE_RESULT_CODE NOT IN ('40740701', '40740705')) AND
       (E3.MAT_NO IS NULL OR
       E3.JUDGE_RESULT_CODE NOT IN ('40740701', '40740705')))
 GROUP BY E.JUDGE_STOVE_NO, E.BATCH_NO
        ]]>
    </query>
    
    <query id="JdgQcmJudgeLock.QueryZc" desc="查询成品">
        <![CDATA[
SELECT MIN(A5.ORDER_NO) || '/' || MIN(A4.ORDER_SEQ) ORDER_NO,
       MIN(A.JUDGE_STOVE_NO) JUDGE_STOVE_NO,
       A.BATCH_NO,
       MIN(A.STEELNAME) STEELNAME,
       MIN(A.GRADENAME) GRADENAME,
       MIN(A.SPEC_NAME) SPEC_NAME,
       SUM(A.ACT_COUNT) ACT_COUNT,
       SUM(A.ACT_WEIGHT) ACT_WEIGHT,
       'ZC' PROCESS_CODE,
       '成品' PROCESS_DESC,
       MIN(F.LOCK_REASON) LOCK_REASON,
       MIN(F.LOCK_PROCESS_CODE) LOCK_PROCESS_CODE,
       MIN(F.LOCK_FLAG) LOCK_FLAG,
       MIN(F2.USERNAME) LOCK_NAME,
       TO_CHAR(MIN(F.LOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') LOCK_TIME,
       MIN(F3.USERNAME) UNLOCK_NAME,
       TO_CHAR(MIN(F.UNLOCK_TIME), 'YYYY-MM-DD HH24:MI:SS') UNLOCK_TIME,
       MIN(F.LOCK_ID) LOCK_ID
  FROM QCM_ZG_JUGDE_APPLY A
  LEFT JOIN SLM_ORDER_LINE_DELIVERY A3
    ON A3.ORD_LN_DLY_PK = A.ORD_LN_DLY_PK
   AND A.ORD_LN_DLY_PK IS NOT NULL
  LEFT JOIN SLM_ORDER_LINE A4
    ON A4.ORD_LN_PK = A3.ORD_LN_PK
   AND A3.ORD_LN_PK IS NOT NULL
  LEFT JOIN SLM_ORDER_HEAD A5
    ON A5.ORD_PK = A4.ORD_PK
   AND A4.ORD_PK IS NOT NULL
  LEFT JOIN QCM_JUDGE_LOCK F
    ON F.PROCESS_CODE = 'ZC'
   AND F.JUDGE_STOVE_NO = A.JUDGE_STOVE_NO
   AND F.BATCH_NO = A.BATCH_NO
   AND A.JUDGE_STOVE_NO IS NOT NULL
   AND A.BATCH_NO IS NOT NULL
  LEFT JOIN CORE_APP_USER F2
    ON F2.USERID = F.LOCK_USER_ID
   AND F.LOCK_USER_ID IS NOT NULL
  LEFT JOIN CORE_APP_USER F3
    ON F3.USERID = F.UNLOCK_USER_ID
   AND F.UNLOCK_USER_ID IS NOT NULL
  LEFT JOIN COM_BASE_PROCESS F4
    ON F4.PROCESS_CODE = A.PROCESS_CODE
   AND A.PROCESS_CODE IS NOT NULL
 WHERE A.TARGET = 'A'
   AND (A.JUDGE_RESULT_CODE = '40740701' AND A.JUDGE_TOLRESULT_CODE IS NULL OR
       A.JUDGE_TOLRESULT_CODE <> '40740701')
   AND ({0} IS NULL OR A.JUDGE_STOVE_NO = {0})
   AND ({1} IS NULL OR A3.ORD_LN_DLY_PK IS NOT NULL AND
       A5.ORDER_NO LIKE '%' || UPPER({1}) || '%')
   AND ({2} IS NULL OR A3.ORD_LN_DLY_PK IS NOT NULL AND A4.ORDER_SEQ = {2})
 GROUP BY A.JUDGE_STOVE_NO, A.BATCH_NO
        ]]>
    </query>
    
     <query id="JdgQcmJudgeLock.insert" desc="新增">
        <![CDATA[
INSERT INTO QCM_JUDGE_LOCK
  (LOCK_ID,
   PROCESS_CODE,
   JUDGE_STOVE_NO,
   LOCK_REASON,
   LOCK_TIME,
   LOCK_USER_ID,
   LOCK_PROCESS_CODE,
   BATCH_NO,
   LOCK_FLAG,
   ORDER_NO,
   STEELNAME,
   GRADENAME,
   SPEC_NAME,
   ACT_COUNT,
   ACT_WEIGHT)
VALUES
  ((SELECT NVL(MAX(A.LOCK_ID), 0) + 1 FROM QCM_JUDGE_LOCK A),
   '#PROCESS_CODE#',
   '#JUDGE_STOVE_NO#',
   '#LOCK_REASON#',
   SYSDATE,
   '#LOCK_USER_ID#',
   '#LOCK_PROCESS_CODE#',
   '#BATCH_NO#',
   '1',
   '#ORDER_NO#',
   '#STEELNAME#',
   '#GRADENAME#',
   '#SPEC_NAME#',
   '#ACT_COUNT#',
   '#ACT_WEIGHT#')
        ]]>
    </query>
    
    <query id="JdgQcmJudgeLock.Lock" desc="锁定">
        <![CDATA[
UPDATE QCM_JUDGE_LOCK T
   SET T.LOCK_REASON       = '#LOCK_REASON#',
       T.LOCK_TIME         = SYSDATE,
       T.LOCK_USER_ID      = '#LOCK_USER_ID#',
       T.LOCK_PROCESS_CODE = '#LOCK_PROCESS_CODE#',
       T.LOCK_FLAG         = '1',
       T.ORDER_NO = '#ORDER_NO#',
       T.STEELNAME = '#STEELNAME#',
       T.GRADENAME = '#GRADENAME#',
       T.SPEC_NAME = '#SPEC_NAME#',
       T.ACT_COUNT = '#ACT_COUNT#',
       T.ACT_WEIGHT = '#ACT_WEIGHT#'
 WHERE T.LOCK_ID = '#LOCK_ID#'
        ]]>
    </query>
    
    <query id="JdgQcmJudgeLock.unlock" desc="解锁">
        <![CDATA[
UPDATE QCM_JUDGE_LOCK T
   SET T.UNLOCK_TIME    = SYSDATE,
       T.UNLOCK_USER_ID = '#UNLOCK_USER_ID#',
       T.LOCK_FLAG      = '0'
 WHERE T.LOCK_ID = '#LOCK_ID#'
        ]]>
    </query>
    
    <query id="JdgQcmJudgeLock.getLockInfo" desc="查询">
        <![CDATA[
SELECT T.*, A.USERNAME LOCK_NAME
   FROM QCM_JUDGE_LOCK T
   LEFT JOIN CORE_APP_USER A
     ON A.USERID = T.LOCK_USER_ID
  WHERE T.JUDGE_STOVE_NO = {0}
    AND (T.BATCH_NO IS NULL OR T.BATCH_NO = {1})
    AND T.PROCESS_CODE = {2}
    AND T.LOCK_PROCESS_CODE = {3}
    AND T.LOCK_FLAG = '1'
        ]]>
    </query>

    <query id="JdgQcmJudgeLock.getLockInfo1" desc="查询">
        <![CDATA[
SELECT T.*, A.USERNAME LOCK_NAME
   FROM QCM_JUDGE_LOCK T
   LEFT JOIN CORE_APP_USER A
     ON A.USERID = T.LOCK_USER_ID
  WHERE T.JUDGE_STOVE_NO = {0}
    --AND (T.BATCH_NO IS NULL OR T.BATCH_NO = {1})
    AND T.LOCK_PROCESS_CODE = {1}
    AND T.LOCK_FLAG = '1'
        ]]>
    </query>
    
    <query id="JdgQcmJudgeLock.getLockRecord" desc="查询">
        <![CDATA[
SELECT DECODE(T.PROCESS_CODE, 'ZC', '成品', T2.PROCESS_DESC) PROCESS_DESC,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.LOCK_FLAG,
       T.LOCK_REASON,
       TO_CHAR(T.LOCK_TIME, 'YYYY-MM-DD HH24:MI:SS') LOCK_TIME,
       T4.USERNAME      LOCK_USER,
       TO_CHAR(T.UNLOCK_TIME, 'YYYY-MM-DD HH24:MI:SS') UNLOCK_TIME,
       T5.USERNAME      UNLOCK_USER,
       DECODE(T.LOCK_PROCESS_CODE, 'ZC', '成品', T3.PROCESS_DESC) LOCK_PROCESS_DESC,
       T.ORDER_NO,
       T.STEELNAME,
       T.GRADENAME,
       T.SPEC_NAME,
       T.ACT_COUNT,
       T.ACT_WEIGHT,
       T.LOCK_ID
  FROM QCM_JUDGE_LOCK T
  LEFT JOIN COM_BASE_PROCESS T2
    ON T2.PROCESS_CODE = T.PROCESS_CODE
  LEFT JOIN COM_BASE_PROCESS T3
    ON T3.PROCESS_CODE = T.LOCK_PROCESS_CODE
  LEFT JOIN CORE.CORE_APP_USER T4
    ON T4.USERID = T.LOCK_USER_ID
  LEFT JOIN CORE.CORE_APP_USER T5
    ON T5.USERID = T.UNLOCK_USER_ID
 WHERE ({0} IS NULL OR T.JUDGE_STOVE_NO LIKE '%' || {0} || '%')
   AND ({1} IS NULL OR T.LOCK_TIME >= TO_DATE({1}, 'YYYY-MM-DD HH24:MI:SS'))
   AND ({1} IS NULL OR T.LOCK_TIME <= TO_DATE({2}, 'YYYY-MM-DD HH24:MI:SS'))
   AND ({3} IS NULL OR T4.USERNAME = {3})
   AND ({4} IS NULL OR T.ORDER_NO LIKE '%' || {4} || '%')
   AND ({5} IS NULL OR T.LOCK_FLAG = {5})
   ORDER BY T.LOCK_TIME DESC, T.ORDER_NO, T.PROCESS_CODE, T.JUDGE_STOVE_NO, T.BATCH_NO
        ]]>
    </query>
</queryMap>