<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="加工标准">

           <query id="IMscProcessDao.getExamineGic" desc="查询审批加工索引号">
         <![CDATA[
   SELECT P.GIC, P.MODEL_CODE
  FROM (SELECT T.GIC, NVL(T.MODEL_CODE, 'C001') MODEL_CODE, MSC
          FROM COM_MSC_STD_PROCESS T
         WHERE T.MSC = ?
           AND T.CODE_JG IS NULL
           AND T.VALIDFLAG = 3) P
 WHERE INSTR(P.MODEL_CODE, ?) > 0
    OR (P.MODEL_CODE = 'C001' AND NOT EXISTS
        (SELECT 1
           FROM (SELECT T.GIC, NVL(T.MODEL_CODE, 'C001') MODEL_CODE
                   FROM COM_MSC_STD_PROCESS T
                  WHERE T.MSC = ?
                    AND T.CODE_JG IS NULL
                    AND T.VALIDFLAG = 3) Q
          WHERE INSTR(Q.MODEL_CODE, ?) > 0))
 ORDER BY P.MODEL_CODE DESC
             ]]>
	</query>
	
	   <query id="IMscProcessDao.getValidGic" desc="查询有效加工索引号">
         <![CDATA[
   SELECT P.GIC, P.MODEL_CODE
  FROM (SELECT T.GIC, NVL(T.MODEL_CODE, 'C001') MODEL_CODE, MSC
          FROM COM_MSC_STD_PROCESS T
         WHERE T.MSC = ?
           AND T.CODE_JG IS NULL
           AND T.VALIDFLAG != 0) P
 WHERE INSTR(P.MODEL_CODE, ?) > 0
    OR (P.MODEL_CODE = 'C001' AND NOT EXISTS
        (SELECT 1
           FROM (SELECT T.GIC, NVL(T.MODEL_CODE, 'C001') MODEL_CODE
                   FROM COM_MSC_STD_PROCESS T
                  WHERE T.MSC = ?
                    AND T.CODE_JG IS NULL
                    AND T.VALIDFLAG != 0) Q
          WHERE INSTR(Q.MODEL_CODE, ?) > 0))
 ORDER BY P.MODEL_CODE DESC
             ]]>
	</query>
	
		<query id="IMscProcessDao.getProcessByGic" desc="查詢交付加工标准">
         <![CDATA[
        SELECT 
       T.GIC,
       T.XH,
       T.STATION_CODE,
       T.STATION_DESC,
       T.PROCESS_CDOE,
       T.PROCESS_DESC,
       T.PROCESS_CDOE_C,
       T.PROCESS_DESC_C,
       T.VALUE_TEXT,
       T.VALUE_NUM,
       T.VALUE_MEMO,
       T.GROUP_SEQ,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       T.VALIDFLAG,
       T.MEMO,
       T.MIN_D,
       T.MAX_D,
       T.MIN_H,
       T.MAX_H,
       T.MIN_D_SIGN,
       T.MAX_D_SIGN,
       T.MIN_H_SIGN,
       T.MAX_H_SIGN
 FROM COM_MSC_STD_PROCESS_C T
 WHERE
T.GIC = ?
AND T.VALIDFLAG='1'
             ]]>
	</query>
	
	<query id="IMscProcessDao.saveGic" desc="保存质量设计加工标准">
         <![CDATA[
         INSERT INTO SLM_ORD_DESIGN_STD_GIC(
        DESGIN_KEY,
        GIC,
        USE_CODE,
        USE_DESC,
        SPECL_FL,
        XH,
        PROCESS_CDOE,
        PROCESS_DESC,
        PROCESS_CDOE_C,
        PROCESS_DESC_C,
        STATION_CODE,
        STATION_DESC,
        VALUE_TEXT,
        VALUE_NUM,
        VALUE_MEMO,
        GROUP_SEQ,
        MEMO)
 VALUES( 
        '#DESGIN_KEY#',
        '#GIC#',
        '#USE_CODE#',
        '#USE_DESC#',
        '#SPECL_FL#',
        '#XH#',
        '#PROCESS_CDOE#',
        '#PROCESS_DESC#',
        '#PROCESS_CDOE_C#',
        '#PROCESS_DESC_C#',
        '#STATION_CODE#',
        '#STATION_DESC#',
        '#VALUE_TEXT#',
        '#VALUE_NUM#',
        '#VALUE_MEMO#',
        '#GROUP_SEQ#',
        '#MEMO#')
             ]]>
	</query>
	
	 <query id="IMscProcessDao.updateDesignStd" desc="修改交付标准索引号">
         <![CDATA[
      UPDATE SLM_ORD_DESIGN_STD SET GIC = ? WHERE DESGIN_KEY = ?
             ]]>
	</query>
	
	<query id="IMscProcessDao.getModelStyle" desc="查询探伤检验项 ">
         <![CDATA[
SELECT T.MODEL_STYLE, T.MODEL_STYLE_DESC
  FROM COM_BASE_MODEL T
 WHERE T.MODEL_CODE = ?
   AND T.VALIDFLAG = '1'
         ]]>
	</query>
	
	<query id="IMscProcessDao.getStationDesc" desc="查询工序点描述 ">
         <![CDATA[
SELECT T.STATION_DESC VALUE FROM COM_BASE_STATION T WHERE T.STATION_CODE = {0}
         ]]>
	</query>
</queryMap>    