<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="">
    <query id="JdgMatBcM.queryLkFCnt" desc="查询轧管利库数">
        <![CDATA[
SELECT COUNT(1) COUNT
  FROM mat_BC_m T
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.LOCK_LIKU = '1'
        ]]>
    </query>
    
    <query id="JdgMatBcM.queryByBatchNoApplyCode" desc="通过炉批+送判单查询">
        <![CDATA[
SELECT *
  FROM mat_BC_m T
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcM.queryGroupByBatchGroupNoApplyCode" desc="通过炉批组+送判单查询">
        <![CDATA[
SELECT T.JUGDE_APPLY_CODE,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       MIN(T.PLINE_CODE) PLINE_CODE,
       MIN(T.GX_PLAN_NO_NEXT) GX_PLAN_NO_NEXT,
       MIN(T.JUGDE_APPLY_SEQUENO) JUGDE_APPLY_SEQUENO,
       T.LOT_NO,
       T.PROCESS_CDOE
  FROM mat_BC_m T
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
 GROUP BY T.JUGDE_APPLY_CODE,
          T.JUDGE_STOVE_NO,
          T.BATCH_NO,
          T.BATCH_GROUD_NO,
          T.LOT_NO,
         T.PROCESS_CDOE
 UNION ALL
 SELECT T.JUGDE_APPLY_CODE,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       MIN(T.PLINE_CODE) PLINE_CODE,
       MIN(T.GX_PLAN_NO_NEXT) GX_PLAN_NO_NEXT,
       MIN(T.JUGDE_APPLY_SEQUENO) JUGDE_APPLY_SEQUENO,
       T.LOT_NO,
       T.PROCESS_CDOE
  FROM mat_BC_BACKUP T
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
 GROUP BY T.JUGDE_APPLY_CODE,
          T.JUDGE_STOVE_NO,
          T.BATCH_NO,
          T.BATCH_GROUD_NO,
          T.LOT_NO,
          T.PROCESS_CDOE
        ]]>
    </query>
    
    <query id="JdgMatBcM.queryByBatchNoApplyCodeFirstRow" desc="通过炉批+送判单查询">
        <![CDATA[
SELECT *
  FROM mat_BC_m T
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
   AND ROWNUM <= 1
        ]]>
    </query>

    <query id="JdgMatBcM.queryByBatchNoApplyCodeRowS" desc="通过炉批+送判单查询">
        <![CDATA[
        SELECT SUM(ACT_COUNT) ACT_COUNT FROM (
SELECT *
  FROM mat_BC_m T
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
   UNION ALL
    SELECT *
  FROM MAT_BC_BACKUP T
 WHERE
 T.JUGDE_APPLY_CODE = {0}
   AND
	 T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
   )
        ]]>
    </query>
    
    <query id="JdgMatBcM.updateBelong" desc="更新炼钢、锻造生产物料主表的所属权">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.BELONG_CODE       = {3},
       T.BELONG_NAME       = {4}
 WHERE T.JUGDE_APPLY_CODE = {0}
       AND T.JUDGE_STOVE_NO = {1}
       AND T.BATCH_NO = {2}
       AND T.QCM_STAUS = '00'
       AND T.TARGET <> 'A'
        ]]>
    </query>
    
        <query id="JdgMatBcM.updateBelongByStorage" desc="更新炼钢、锻造生产物料主表的所属权">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.BELONG_CODE       = {3},
       T.BELONG_NAME       = {4}
 WHERE T.JUGDE_APPLY_CODE = {0}
       AND T.JUDGE_STOVE_NO = {1}
       AND T.BATCH_NO = {2}
       AND T.QCM_STAUS = '00'
       AND T.TARGET <> 'A'
       AND EXISTS (SELECT 1
       FROM YDM_BC_BUTTRESS T1,YDM_BS_STORAGE T2
       WHERE T1.STORAGE_NO=T2.STORAGE_NO
       AND T2.SEAM_AREA='0'
       AND T1.MAT_NO=T.MAT_NO)
        ]]>
    </query>
    
    <query id="JdgMatBcBackup.updateBelong" desc="更新炼钢、锻造生产物料历史表的所属权">
        <![CDATA[
UPDATE MAT_BC_BACKUP T
   SET T.BELONG_CODE       = {3},
       T.BELONG_NAME       = {4}
 WHERE T.JUGDE_APPLY_CODE = {0}
       AND T.JUDGE_STOVE_NO = {1}
       AND T.BATCH_NO = {2}
       AND T.QCM_STAUS = '00'
       AND T.TARGET <> 'A'
        ]]>
    </query>
    
    <query id="JdgMatBcBackup.updateBelongByStorage" desc="更新炼钢、锻造生产物料历史表的所属权">
        <![CDATA[
UPDATE MAT_BC_BACKUP T
   SET T.BELONG_CODE       = {3},
       T.BELONG_NAME       = {4}
 WHERE T.JUGDE_APPLY_CODE = {0}
       AND T.JUDGE_STOVE_NO = {1}
       AND T.BATCH_NO = {2}
       AND T.QCM_STAUS = '00'
       AND T.TARGET <> 'A'
       AND EXISTS (SELECT 1
       FROM YDM_BC_BUTTRESS T1,YDM_BS_STORAGE T2
       WHERE T1.STORAGE_NO=T2.STORAGE_NO
       AND T2.SEAM_AREA='0'
       AND T1.MAT_NO=T.MAT_NO)
        ]]>
    </query>

    <query id="JdgMatBcM.updateBelongZc" desc="更新炼钢、锻造生产物料主表的所属权">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.BELONG_CODE       = {3},
       T.BELONG_NAME       = {4}
 WHERE T.JUGDE_APPLY_CODE = {0}
       AND T.JUDGE_STOVE_NO = {1}
       AND T.BATCH_NO = {2}
       AND T.QCM_STAUS = '00'
       AND T.TARGET = 'A'
        ]]>
    </query>

    <query id="JdgMatBcBackup.updateBelongZc" desc="更新炼钢、锻造生产物料历史表的所属权">
        <![CDATA[
UPDATE MAT_BC_BACKUP T
   SET T.BELONG_CODE       = {3},
       T.BELONG_NAME       = {4}
 WHERE T.JUGDE_APPLY_CODE = {0}
       AND T.JUDGE_STOVE_NO = {1}
       AND T.BATCH_NO = {2}
       AND T.QCM_STAUS = '00'
       AND T.TARGET = 'A'
        ]]>
    </query>
    
    <query id="JdgMatBcM.updateJudgeResult" desc="更新炼钢、锻造生产物料表的判定结果">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.FACE_RESULT_CODE      = NVL({3}, T.FACE_RESULT_CODE),
       T.FACE_RESULT_TIME      = TO_DATE(SUBSTR({4}, 1, 19),
                                         'YYYY-MM-DD HH24:MI:SS'),
       T.FACE_MAKER            = {5},
       T.SPEC_RESULT_CODE      = {6},
       T.SPEC_RESULT_TIME      = TO_DATE(SUBSTR({7}, 1, 19),
                                         'YYYY-MM-DD HH24:MI:SS'),
       T.SPEC_MAKER            = {8},
       T.CHEM_RESULT_CODE      = {9},
       T.CHEM_RESULT_TIME      = TO_DATE(SUBSTR({10}, 1, 19),
                                         'YYYY-MM-DD HH24:MI:SS'),
       T.CHEM_MAKER            = {11},
       T.PHY_RESULT_CODE       = {12},
       T.PHY_RESULT_TIME       = TO_DATE(SUBSTR({13}, 1, 19),
                                         'YYYY-MM-DD HH24:MI:SS'),
       T.PHY_MAKER             = {14},
       T.WPRESSURE_RESULT_CODE = {15},
       T.JUDGE_RESULT_CODE     = {16},
       T.JUDGE_RESULT         =
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = {16}),
       T.JUDGE_RESULT_TIME    = TO_DATE(DECODE({16}, NULL, NULL, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS'),
       T.JUDGE_MAKER           = {17},
       T.JUGDE_CONVICTED       = {18},
       T.DETECT_RESULT_CODE    = NVL({19}, T.DETECT_RESULT_CODE),
       T.DETECT_RESULT_CODE1   = {20},
       T.TESTING_GRADE         = {21},
       T.TESTING_TYPE          = {22},
       T.TESTING_GRADE1        = {23},
       T.TESTING_TYPE1         = {24}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcBackup.updateJudgeResult" desc="更新炼钢、锻造生产物料历史表的判定结果">
        <![CDATA[
UPDATE MAT_BC_BACKUP T
   SET T.FACE_RESULT_CODE      = NVL({3}, T.FACE_RESULT_CODE),
       T.FACE_RESULT_TIME      = TO_DATE(SUBSTR({4}, 1, 19),
                                         'YYYY-MM-DD HH24:MI:SS'),
       T.FACE_MAKER            = {5},
       T.SPEC_RESULT_CODE      = {6},
       T.SPEC_RESULT_TIME      = TO_DATE(SUBSTR({7}, 1, 19),
                                         'YYYY-MM-DD HH24:MI:SS'),
       T.SPEC_MAKER            = {8},
       T.CHEM_RESULT_CODE      = {9},
       T.CHEM_RESULT_TIME      = TO_DATE(SUBSTR({10}, 1, 19),
                                         'YYYY-MM-DD HH24:MI:SS'),
       T.CHEM_MAKER            = {11},
       T.PHY_RESULT_CODE       = {12},
       T.PHY_RESULT_TIME       = TO_DATE(SUBSTR({13}, 1, 19),
                                         'YYYY-MM-DD HH24:MI:SS'),
       T.PHY_MAKER             = {14},
       T.WPRESSURE_RESULT_CODE = {15},
       T.JUDGE_RESULT_CODE     = {16},
       T.JUDGE_RESULT         =
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = {16}),
       T.JUDGE_RESULT_TIME    = TO_DATE(DECODE({16}, NULL, NULL, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS'),
       T.JUDGE_MAKER           = {17},
       T.JUGDE_CONVICTED       = {18},
       T.DETECT_RESULT_CODE    = NVL({19}, T.DETECT_RESULT_CODE),
       T.DETECT_RESULT_CODE1   = {20},
       T.TESTING_GRADE         = {21},
       T.TESTING_TYPE          = {22},
       T.TESTING_GRADE1        = {23},
       T.TESTING_TYPE1         = {24}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcM.updateInstockMatStatus" desc="更新入库标志、材料状态">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.MAT_STATUS            = NVL({3}, T.MAT_STATUS),
       T.INSTOCK_FLAG        = {4}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcBackup.updateInstockMatStatus" desc="更新入库标志、材料状态">
        <![CDATA[
UPDATE MAT_BC_BACKUP T
   SET T.MAT_STATUS            = NVL({3}, T.MAT_STATUS),
       T.INSTOCK_FLAG        = {4}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcM.updateJudgeResultOlny" desc="只修改结果">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.JUDGE_RESULT_CODE     = {3},
       T.JUDGE_RESULT         =
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = {3}),
       T.JUDGE_RESULT_TIME    = TO_DATE(DECODE({3}, NULL, NULL, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS'),
       T.JUDGE_MAKER           = {4},
       T.JUGDE_CONVICTED       = {5}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcBackup.updateJudgeResultOlny" desc="只修改结果">
        <![CDATA[
UPDATE MAT_BC_BACKUP T
   SET T.JUDGE_RESULT_CODE     = {3},
       T.JUDGE_RESULT         =
       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = {3}),
       T.JUDGE_RESULT_TIME    = TO_DATE(DECODE({3}, NULL, NULL, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS'),
       T.JUDGE_MAKER           = {4},
       T.JUGDE_CONVICTED       = {4}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcM.updateInstancy" desc="更新炼钢、锻造生产物料主表的紧急放行标志">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.INSTANCY_FLAG = {3}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcBackup.updateInstancy" desc="更新炼钢、锻造生产物料历史表的紧急放行标志">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.INSTANCY_FLAG = {3}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcM.updateTolJudgeResult" desc="更成品判定结果">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.JUDGE_TOLRESULT_CODE = {3},
       T.JUDGE_TOLRESULT     =
       (SELECT BASENAME FROM COM_BASE_INFO A WHERE A.BASECODE = {3}),
       T.JUDGE_TOLMAKER       = {4},
       T.JUGDE_TOLCONVICTED   = {5}
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
     <query id="JdgMatBcM.updateTolJudgeTime" desc="更成品判定时间">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.JUDGE_TOLRESULT_TIME = TO_DATE(DECODE({3}, NULL, NULL, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS')
 WHERE T.JUGDE_APPLY_CODE = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.BATCH_NO = {2}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcBackup.updateTolJudgeResult" desc="更新成品判定结果">
        <![CDATA[
 UPDATE MAT_BC_BACKUP T
    SET T.JUDGE_TOLRESULT_CODE = {3},
        T.JUDGE_TOLRESULT      = (SELECT BASENAME FROM COM_BASE_INFO A WHERE A.BASECODE = {3}),
        T.JUDGE_TOLMAKER       = {4},
        T.JUGDE_TOLCONVICTED = {5}
  WHERE T.JUGDE_APPLY_CODE = {0}
    AND T.JUDGE_STOVE_NO = {1}
    AND T.BATCH_NO = {2}
    AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcBackup.updateTolJudgeTime" desc="更新成品判定时间">
        <![CDATA[
 UPDATE MAT_BC_BACKUP T
    SET T.JUDGE_TOLRESULT_TIME = TO_DATE(DECODE({3}, NULL, NULL, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS')
  WHERE T.JUGDE_APPLY_CODE = {0}
    AND T.JUDGE_STOVE_NO = {1}
    AND T.BATCH_NO = {2}
    AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcM.getCraftInfoByJudgeStoveNoProPlanId" desc="获取工艺相关信息">
        <![CDATA[
SELECT *
  FROM (SELECT T.ORD_LN_DLY_PK,
               T.PRO_ORDER_ID,
               T.GX_PLAN_NO,
               T.STOVE_NO,
               T.CRAFT_SEQ,
               T.CIC
          FROM MAT_BC_M T
         WHERE T.JUDGE_STOVE_NO = {0}
           AND T.PRO_ORDER_ID = {1}
           AND T.GX_PLAN_NO = {2}
           AND T.PROCESS_CDOE = {3}
           AND T.QCM_STAUS = '00'
           AND (T.JUDGE_RESULT_CODE IS NULL OR T.JUDGE_RESULT_CODE <> '40740705') 
        UNION ALL
        SELECT T.ORD_LN_DLY_PK,
               T.PRO_ORDER_ID,
               T.GX_PLAN_NO,
               T.STOVE_NO,
               T.CRAFT_SEQ,
               T.CIC
          FROM MAT_BC_BACKUP T
         WHERE T.JUDGE_STOVE_NO = {0}
           AND T.PRO_ORDER_ID = {1}
           AND T.GX_PLAN_NO = {2}
           AND T.PROCESS_CDOE = {3}
           AND T.QCM_STAUS = '00'
           AND (T.JUDGE_RESULT_CODE IS NULL OR T.JUDGE_RESULT_CODE <> '40740705'))
 WHERE ROWNUM <= 1
        ]]>
    </query>
    
    <query id="JdgMatBcM.setZbsFlagByJudgeStoveNo" desc="修改质保书标志">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.ZBS_FLAG = {2}
 WHERE T.JUDGE_STOVE_NO = {0}
   AND T.PROCESS_CDOE = {1}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcBackup.setZbsFlagByJudgeStoveNo" desc="修改质保书标志">
        <![CDATA[
UPDATE MAT_BC_BACKUP T
   SET T.ZBS_FLAG = {2}
 WHERE T.JUDGE_STOVE_NO = {0}
   AND T.PROCESS_CDOE = {1}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcBackup.setZbsFlag" desc="修改质保书标志">
        <![CDATA[
UPDATE MAT_BC_BACKUP T
   SET T.ZBS_FLAG = {3}
 WHERE T.JUGDE_APPLY_CODE = {0}
    AND T.JUDGE_STOVE_NO = {1}
    AND T.BATCH_NO = {2}
    AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcM.setZbsFlag" desc="修改质保书标志">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.ZBS_FLAG = {3}
 WHERE T.JUGDE_APPLY_CODE = {0}
    AND T.JUDGE_STOVE_NO = {1}
    AND T.BATCH_NO = {2}
    AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcM.setZbsId" desc="修改质保书ID">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.ZBS_ID = {3}
 WHERE T.JUGDE_APPLY_CODE = {0}
    AND T.JUDGE_STOVE_NO = {1}
    AND T.BATCH_NO = {2}
    AND T.QCM_STAUS = '00'
        ]]>
    </query>
    
    <query id="JdgMatBcM.setZbsIdByRownum" desc="修改质保书ID">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.ZBS_ID = {5}, T.JG_ZBS_ID = {6}
 WHERE T.MAT_NO IN (SELECT MAT_NO
                      FROM (SELECT A.MAT_NO, ROWNUM RN
                              FROM (SELECT A.MAT_NO
                                      FROM MAT_BC_M A
                                     WHERE A.JUGDE_APPLY_CODE = {0}
                                       AND A.JUDGE_STOVE_NO = {1}
                                       AND A.BATCH_NO = {2}
                                       AND A.QCM_STAUS = '00') A
                             WHERE ROWNUM <= {4})
                     WHERE RN >= {3})
        ]]>
    </query>
    
    <query id="JdgMatBcM.getWgByOrdLnDlyPk" desc="通过合同行获取">
        <![CDATA[
SELECT T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.ORD_LN_DLY_PK,
       T.PRO_ORDER_ID,
       T.GX_PLAN_NO
  FROM MAT_BC_M T
 WHERE T.ORD_LN_DLY_PK = {0}
   AND T.PROCESS_CDOE = {1}
   AND (T.JUDGE_RESULT_CODE IS NULL OR T.JUDGE_RESULT_CODE NOT IN ('40740701', '40740709'))
   AND T.QCM_STAUS = '00'
 GROUP BY T.JUDGE_STOVE_NO,
          T.BATCH_NO,
          T.ORD_LN_DLY_PK,
          T.PRO_ORDER_ID,
          T.GX_PLAN_NO
UNION ALL
SELECT T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.ORD_LN_DLY_PK,
       T.PRO_ORDER_ID,
       T.GX_PLAN_NO
  FROM MAT_BC_BACKUP T
 WHERE T.ORD_LN_DLY_PK = {0}
   AND T.PROCESS_CDOE = {1}
   AND (T.JUDGE_RESULT_CODE IS NULL OR T.JUDGE_RESULT_CODE NOT IN ('40740701', '40740709'))
   AND T.QCM_STAUS = '00'
 GROUP BY T.JUDGE_STOVE_NO,
          T.BATCH_NO,
          T.ORD_LN_DLY_PK,
          T.PRO_ORDER_ID,
          T.GX_PLAN_NO
        ]]>
    </query>
    
    <query id="JdgMatBcM.setCraftSeq" desc="修改工艺版本">
        <![CDATA[
UPDATE MAT_BC_M T
   SET T.CRAF_NO        = {4},
       T.CRAFT_SEQ      = {5},
       T.CIC            = {6}
 WHERE T.JUDGE_STOVE_NO = {0}
   AND T.BATCH_NO = {1}
   AND T.PROCESS_CDOE = {2}
   AND T.ORD_LN_DLY_PK = {3}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
    <query id="JdgMatBcBackup.setCraftSeq" desc="修改工艺版本">
        <![CDATA[
UPDATE MAT_BC_BACKUP T
   SET T.CRAF_NO        = {4},
       T.CRAFT_SEQ      = {5},
       T.CIC            = {6}
 WHERE T.JUDGE_STOVE_NO = {0}
   AND T.BATCH_NO = {1}
   AND T.PROCESS_CDOE = {2}
   AND T.ORD_LN_DLY_PK = {3}
   AND T.QCM_STAUS = '00'
        ]]>
    </query>
</queryMap>