<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="冶金规范工艺标准管理">
   <query id="MSCCraft.InitStation" desc="获取工艺参数工序点等代码、名称">
		<![CDATA[ 
SELECT T.STATION_CODE,
       T.STATION_DESC,
       T.CRAFTITEM_CODE,
       T.CRAFTITEM_DESC,
       T.ALLOW_COUNT,
       D.PROCESS_CODE,
       D.PROCESS_DESC,
       D.PROCESS_CODE_C,
       D.PROCESS_DESC_C,
       D.BACKLOG_SEQ
  FROM COM_BASE_STATION_R_CRAFT T, COM_MSC_STATION C, COM_MSC_PROCESS D
 WHERE T.VALIDFLAG = '1'
   AND C.STATION_CODE = T.STATION_CODE
   AND C.MSC = '#MSC#'
   AND C.MSC_PLINE = '#MSC_PLINE#'
   AND C.VALIDFLAG = '1'
   AND D.PROCESS_CODE = C.PROCESS_CODE
   AND D.MSC = '#MSC#'
   AND D.MSC_PLINE = '#MSC_PLINE#'
   AND D.VALIDFLAG = '1'
   AND DECODE('#PROCESS_CODE#', NULL, '1', D.PROCESS_CODE) = DECODE('#PROCESS_CODE#', NULL, '1', '#PROCESS_CODE#')
		]]>
	</query>
	 <query id="MSCCraft.JGSpec" desc="获取接箍规格代码、名称">
		<![CDATA[ 
		SELECT T.SPEC_NAME,T.SPEC_CODE 
		FROM COM_BASE_SPEC T
		WHERE T.MSC_STYLE='C' AND T.VALIDFLAG='1'
		]]>
	</query>
	 <query id="MSCCraft.Param" desc="获取从项参数代码、名称">
		<![CDATA[ 
		SELECT  
        CRAFTITEM_DESC,
        CRAFT_CODE
        FROM COM_BASE_CRAFT
        WHERE VALIDFLAG='1'
		]]>
	</query>
	<query id="MSCCraft.QUERY" desc="冶金规范工艺标准查询">
		<![CDATA[
       SELECT 
       'TRUE' CHK,
       MSC,
       MSC_PLINE,
       BACKLOG_SEQ,
       PROCESS_CDOE,
       PROCESS_DESC,
       PROCESS_CDOE_C,
       PROCESS_DESC_C,
       STATION_CODE,
       STATION_DESC,
       MIN_D,
       MAX_D,
       MIN_H,
       MAX_H,
       MODEL_CODE,
       MODEL_DESC,
       SPEC_JG,
       SPEC_JG_DESC,
       CRAFTITEM_CDOE,
       CRAFTITEM_DESC,
       ALLOW_COUNT,
       MIN_VALUE,
       MAX_VALUE,
       CRAFTITEM_CDOE1,
       CRAFTITEM_DESC1,
       MIN_VALUE1,
       MAX_VALUE1,
       CRAFTITEM_CDOE2,
       CRAFTITEM_DESC2,
       MIN_VALUE2,
       MAX_VALUE2,
       CRAFTITEM_CDOE3,
       CRAFTITEM_DESC3,
       MIN_VALUE3,
       MAX_VALUE3,
       CRAFTITEM_CDOE4,
       CRAFTITEM_DESC4,
       MIN_VALUE4,
       MAX_VALUE4,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME,'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME,'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       DECODE(VALIDFLAG,'1','有效','0','无效') VALIDFLAG,
       MEMO,
       GRADE_SEQ
       FROM COM_MSC_STD_CRAFT
       WHERE VALIDFLAG='1' AND MSC=? AND MSC_PLINE=? 
       AND BACKLOG_SEQ=? AND  STATION_CODE=? AND CRAFTITEM_CDOE=?
		]]>
	</query> 
	
	<query id="MSCCraft.DELETE" desc="删除存在的冶金规范工艺标准">
		<![CDATA[ 
		DELETE FROM COM_MSC_STD_CRAFT   
		WHERE  MSC=? AND MSC_PLINE=?  AND BACKLOG_SEQ=? 
		AND  STATION_CODE=? AND CRAFTITEM_CDOE=?
		]]>
	</query>
	
	<query id="MSCCraft.ADD" desc="添加冶金规范工艺标准">
		<![CDATA[ 
	INSERT INTO COM_MSC_STD_CRAFT
    (MSC,
     MSC_PLINE,
     BACKLOG_SEQ,
     PROCESS_CDOE,
     PROCESS_DESC,
     PROCESS_CDOE_C,
     PROCESS_DESC_C,
     STATION_CODE,
     STATION_DESC,
     MIN_D,
     MAX_D,
     MIN_H,
     MAX_H,
     MODEL_CODE,
     MODEL_DESC,
     SPEC_JG,
     SPEC_JG_DESC,
     CRAFTITEM_CDOE,
     CRAFTITEM_DESC,
     ALLOW_COUNT,
     MIN_VALUE,
     MAX_VALUE,
     CRAFTITEM_CDOE1,
     CRAFTITEM_DESC1,
     MIN_VALUE1,
     MAX_VALUE1,
     CRAFTITEM_CDOE2,
     CRAFTITEM_DESC2,
     MIN_VALUE2,
     MAX_VALUE2,
     CRAFTITEM_CDOE3,
     CRAFTITEM_DESC3,
     MIN_VALUE3,
     MAX_VALUE3,
     CRAFTITEM_CDOE4,
     CRAFTITEM_DESC4,
     MIN_VALUE4,
     MAX_VALUE4,
     CREATE_NAME,
     CREATE_TIME,
     MEMO,
     GRADE_SEQ)
     VALUES(?,?,?,?,?,?,?,?,?,?,
           ?,?,?,?,?,?,?,?,?,?,
           ?,?,?,?,?,?,?,?,?,?,
           ?,?,?,?,?,?,?,?,?,SYSDATE,?,?) 
		]]>
	</query>
</queryMap>