<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="QCM_ZG_CHEMJUDGE_EXCEPTION">
    <query id="QcmZgChemjudgeExceptionDAL.Query" desc="查询">
        <![CDATA[
 SELECT 
       T.CHEM_JUDGE_ID,
       T.LOT_NO,
       T.JUDGE_STOVE_NO,
       T.PLAN_PROORDER,
       T.ORD_PK,
       T.ORD_LN_PK,
       T.ORD_LN_DLY_PK,
       T.PROCESS_CDOE,
       T.PROCESS_DESC,
       T.JUDGERESULT_CHEM,
       T.ASSAYNO,
       T.ORDERISUNCHAIN,
       T.VALIDFLAG,
       T.MEMO,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME
 FROM QCM_ZG_CHEMJUDGE_EXCEPTION T
 WHERE
       T.CHEM_JUDGE_ID = '#CHEM_JUDGE_ID#'
       AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
       AND T.PLAN_PROORDER = '#PLAN_PROORDER#'
       AND T.ORD_LN_DLY_PK = '#ORD_LN_DLY_PK#'
ORDER BY T.CHEM_JUDGE_ID DESC
        ]]>
    </query>
    <query id="QcmZgChemjudgeExceptionDAL.QueryByJudgeStoveNo" desc="通过炉号查询">
        <![CDATA[
SELECT T.CHEM_JUDGE_ID,
       T.LOT_NO,
       T.JUDGE_STOVE_NO,
       T.PLAN_PROORDER,
       T.ORD_LN_PK,
       T.PROCESS_CDOE,
       T.PROCESS_DESC,
       T.JUDGERESULT_CHEM,
       A.BASENAME JUDGERESULT_CHEM_DESC,
       T.ASSAYNO,
       T.ORDERISUNCHAIN,
       DECODE(T.ORDERISUNCHAIN, '1', '是', '0', '否') ORDERISUNCHAIN_DESC,
       T.VALIDFLAG,
       DECODE(T.VALIDFLAG, '1', '有效', '0', '无效') VALIDFLAG_DESC,
       T.MEMO,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME
  FROM QCM_ZG_CHEMJUDGE_EXCEPTION T
  LEFT JOIN COM_BASE_INFO A
  ON A.BASECODE = T.JUDGERESULT_CHEM
 WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
   AND T.VALIDFLAG = '1'
        ]]>
    </query>
    <query id="QcmZgChemjudgeExceptionDAL.QueryByPk" desc="通过主键查询">
        <![CDATA[
 SELECT 
       T.CHEM_JUDGE_ID,
       T.LOT_NO,
       T.JUDGE_STOVE_NO,
       T.PLAN_PROORDER,
       T.ORD_PK,
       T.ORD_LN_PK,
       T.ORD_LN_DLY_PK,
       T.PROCESS_CDOE,
       T.PROCESS_DESC,
       T.JUDGERESULT_CHEM,
       T.ASSAYNO,
       T.ORDERISUNCHAIN,
       T.VALIDFLAG,
       T.MEMO,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME
 FROM QCM_ZG_CHEMJUDGE_EXCEPTION T
 WHERE
       T.CHEM_JUDGE_ID = '#CHEM_JUDGE_ID#'
       AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
       AND T.PLAN_PROORDER = '#PLAN_PROORDER#'
       AND T.ORD_LN_DLY_PK = '#ORD_LN_DLY_PK#'
        ]]>
    </query>
    <query id="QcmZgChemjudgeExceptionDAL.Insert" desc="新增">
        <![CDATA[
 INSERT INTO QCM_ZG_CHEMJUDGE_EXCEPTION(
        CHEM_JUDGE_ID,
        LOT_NO,
        JUDGE_STOVE_NO,
        PLAN_PROORDER,
        ORD_LN_PK,
        PROCESS_CDOE,
        PROCESS_DESC,
        JUDGERESULT_CHEM,
        ASSAYNO,
        ORDERISUNCHAIN,
        MEMO,
        CREATE_NAME,
        CREATE_TIME)
 VALUES( 
        '#CHEM_JUDGE_ID#',
        '#LOT_NO#',
        '#JUDGE_STOVE_NO#',
        '#PLAN_PROORDER#',
        '#ORD_LN_PK#',
        '#PROCESS_CDOE#',
        '#PROCESS_DESC#',
        '#JUDGERESULT_CHEM#',
        '#ASSAYNO#',
        '#ORDERISUNCHAIN#',
        '#MEMO#',
        '#CREATE_NAME#',
        SYSDATE)
        ]]>
    </query>
    <query id="QcmZgChemjudgeExceptionDAL.Update" desc="修改">
        <![CDATA[
 UPDATE QCM_ZG_CHEMJUDGE_EXCEPTION T
   SET 
        T.CHEM_JUDGE_ID = '#CHEM_JUDGE_ID#',
        T.LOT_NO = '#LOT_NO#',
        T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#',
        T.PLAN_PROORDER = '#PLAN_PROORDER#',
        T.ORD_PK = '#ORD_PK#',
        T.ORD_LN_PK = '#ORD_LN_PK#',
        T.ORD_LN_DLY_PK = '#ORD_LN_DLY_PK#',
        T.PROCESS_CDOE = '#PROCESS_CDOE#',
        T.PROCESS_DESC = '#PROCESS_DESC#',
        T.JUDGERESULT_CHEM = '#JUDGERESULT_CHEM#',
        T.ASSAYNO = '#ASSAYNO#',
        T.ORDERISUNCHAIN = '#ORDERISUNCHAIN#',
        T.VALIDFLAG = '#VALIDFLAG#',
        T.MEMO = '#MEMO#',
        T.CREATE_NAME = '#CREATE_NAME#',
        T.CREATE_TIME = SYSDATE
 WHERE
       T.CHEM_JUDGE_ID = '#CHEM_JUDGE_ID#'
       AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
       AND T.PLAN_PROORDER = '#PLAN_PROORDER#'
       AND T.ORD_LN_DLY_PK = '#ORD_LN_DLY_PK#'
        ]]>
    </query>
    <query id="QcmZgChemjudgeExceptionDAL.GetMaxPk" desc="获取最大主键">
        <![CDATA[
SELECT NVL(MAX(CHEM_JUDGE_ID), 0) + 1 MAX_VALUE FROM QCM_ZG_CHEMJUDGE_EXCEPTION T
        ]]>
    </query>
    <query id="QcmZgChemjudgeExceptionDAL.Delete" desc="作废">
        <![CDATA[
UPDATE QCM_ZG_CHEMJUDGE_EXCEPTION T
   SET
       T.VALIDFLAG = '0',
       T.DELETE_NAME = '#DELETE_NAME#',
       T.DELETE_TIME = SYSDATE
WHERE
       T.CHEM_JUDGE_ID = '#CHEM_JUDGE_ID#'
       AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
       AND T.PLAN_PROORDER = '#PLAN_PROORDER#'
       AND T.ORD_LN_DLY_PK = '#ORD_LN_DLY_PK#'
        ]]>
    </query>
    <query id="QcmZgChemjudgeExceptionDAL.Resume" desc="恢复">
        <![CDATA[
UPDATE QCM_ZG_CHEMJUDGE_EXCEPTION T
   SET
       T.VALIDFLAG = '1',
       T.DELETE_NAME = NULL,
       T.DELETE_TIME = NULL,
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
WHERE
       T.CHEM_JUDGE_ID = '#CHEM_JUDGE_ID#'
       AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
       AND T.PLAN_PROORDER = '#PLAN_PROORDER#'
       AND T.ORD_LN_DLY_PK = '#ORD_LN_DLY_PK#'
        ]]>
    </query>
</queryMap>