<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="成分判定记录表">
	<query id="QcmZgChemJudgeDAL.query" desc="查询成分判定记录表">
		<![CDATA[
SELECT T.CHEM_JUDGE_ID,
       T.LOT_NO,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.OBJECTNO,
       B.PLINE_NAME PLINE_CODE,
       T.PROCESS_CDOE,
       T.PROCESS_DESC,
       T.JUDGE_PROORDER,
       A.BASENAME JUDGERESULT_CHEM,
       T.ASSAYNO,
       DECODE(T.ORDERISUNCHAIN, '1', '是', '0', '否') ORDERISUNCHAIN,
       DECODE(T.VALIDFLAG, '1', '有效', '0', '无效') VALIDFLAG,
       T.MEMO,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.JUGDE_APPLY_CODE
  FROM QCM_ZG_CHEMJUDGE T
  LEFT JOIN COM_BASE_INFO A
    ON A.BASECODE = T.JUDGERESULT_CHEM
  LEFT JOIN COM_BASE_PLINE B
    ON B.PLINE_CODE = T.PLINE_CODE
 WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
 ORDER BY T.CHEM_JUDGE_ID DESC
		]]>
	</query>
	
	<query id="QcmZgChemJudgeDAL.insert" desc="新增成分判定记录表">
		<![CDATA[
 INSERT INTO QCM_ZG_CHEMJUDGE(
        CHEM_JUDGE_ID,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        BATCH_NO,
        OBJECTNO,
        PLINE_CODE,
        PROCESS_CDOE,
        PROCESS_DESC,
        JUDGE_PROORDER,
        JUDGERESULT_CHEM,
        ASSAYNO,
        ORDERISUNCHAIN,
        MEMO,
        CREATE_NAME,
        CREATE_TIME,
        JUGDE_APPLY_CODE)
 VALUES( 
        '#CHEM_JUDGE_ID#',
        '#LOT_NO#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#BATCH_NO#',
        '#OBJECTNO#',
        '#PLINE_CODE#',
        '#PROCESS_CDOE#',
        '#PROCESS_DESC#',
        '#JUDGE_PROORDER#',
        '#JUDGERESULT_CHEM#',
        '#ASSAYNO#',
        '#ORDERISUNCHAIN#',
        '#MEMO#',
        '#CREATE_NAME#',
        SYSDATE,
        '#JUGDE_APPLY_CODE#')
		]]>
	</query>
	
	<query id="QcmZgChemJudgeDAL.getMaxChemJudgeId" desc="查询最大的成分判定记录号">
		<![CDATA[
SELECT NVL(MAX(T.CHEM_JUDGE_ID), TO_CHAR(SYSDATE, 'YYYYMMDD') || '00000') + 1 MAX_VALUE
  FROM QCM_ZG_CHEMJUDGE T
 WHERE T.CHEM_JUDGE_ID LIKE TO_CHAR(SYSDATE, 'YYYYMMDD') || '%'
		]]>
	</query>
</queryMap>