<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="内控标准">
	<query id="InnerStdDao.getCicInfo" desc=" 查询成分索引号信息">  
            <![CDATA[ 
SELECT T.CIC,
       T.PSC,
       T.MSC,
       T.STDSTYLE,
       T.STD_CODE_NK,
       T.STD_NAME_NK,
       T.PROCESS_CODE,
       T.PROCESS_DESC,
       T.GRADECODE,
       T.GRADENAME,
       T.STD_CODE,
       T.STD_NAME,
       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.MODEL_CODE,
       T.MODEL_DESC,
       T.PRODUC_HEAD,
       T.CODE_JG,
       T.STEELCODE_NK,
       T.STEELNAME_NK,
       T.MODEL_CODE_NK,
       T.MODEL_DESC_NK,
       T.PRODUCCODE_NK,
       T.PRODUCNAME_NK,
       A.PURCHASE_STD,
       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_CIC T
  LEFT JOIN COM_BASE_STD A
    ON A.STD_CODE = T.STD_CODE_NK
 WHERE T.STDSTYLE = 'N'
   AND T.CIC = ?
   AND T.VALIDFLAG != '0'
   AND (INSTR(T.MODEL_CODE_NK, ?) > 0 OR T.MODEL_CODE_NK IS NULL)
   AND INSTR(?, T.GRADECODE) > 0
                ]]>
	</query>

	<query id="InnerStdDao.getPicInfo" desc="查询理化主表内控">  
            <![CDATA[ 
            SELECT T.PIC,
       T.PSC,
       T.STDSTYLE,
       T.STD_CODE_NK,
       T.STD_NAME_NK,
       T.PROCESS_CDOE,
       T.PROCESS_DESC,
       T.CREATE_NAME,
       T.CREATE_TIME,
       T.UPDATE_NAME,
       T.UPDATE_TIME,
       T.DELETE_NAME,
       T.DELETE_TIME,
       T.VALIDFLAG,
       T.MEMO,
       T.MSC,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.PRODUC_HEAD,
       T.CODE_JG,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.BATCH_LOCA,
       T.STEELCODE_NK,
       T.STEELNAME_NK,
       T.MODEL_CODE_NK,
       T.MODEL_DESC_NK,
       T.PRODUCCODE_NK,
       T.PRODUCNAME_NK,
       A.PURCHASE_STD
  FROM COM_MSC_STD_PIC T
  LEFT JOIN COM_BASE_STD A
    ON A.STD_CODE = T.STD_CODE_NK
 WHERE T.STDSTYLE = 'N'
   AND T.PIC = ?
   AND T.VALIDFLAG != '0'
   AND (INSTR(T.MODEL_CODE_NK, ?) > 0 OR T.MODEL_CODE_NK IS NULL)
   AND (INSTR(T.GRADECODE, ?) > 0 OR T.GRADECODE IS NULL)
                ]]>
	</query>

	<query id="InnerStdDao.getSicInfo" desc="查询公差主表内控">  
            <![CDATA[ 
SELECT T.SIC,
       T.PSC,
       T.MSC,
       T.STDSTYLE,
       T.STD_CODE,
       T.STD_NAME,
       T.PROCESS_CODE,
       T.PROCESS_DESC,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.STDMEMO,
       T.CREATE_NAME,
       T.CREATE_TIME,
       T.UPDATE_NAME,
       T.UPDATE_TIME,
       T.DELETE_NAME,
       T.DELETE_TIME,
       T.VALIDFLAG,
       T.PRODUC_HEAD,
       T.CODE_JG,
       T.SPECIAL_PATH,
       T.STEELCODE_NK,
       T.STEELNAME_NK,
       T.MODEL_CODE_NK,
       T.MODEL_DESC_NK,
       T.PRODUCCODE_NK,
       T.PRODUCNAME_NK,
       A.PURCHASE_STD
  FROM COM_MSC_STD_SPEC T
  LEFT JOIN COM_BASE_STD A
    ON A.STD_CODE = T.STD_CODE
 WHERE T.SIC = ?
   AND T.STDSTYLE = 'N'
   AND T.VALIDFLAG != '0'
   AND (INSTR(T.MODEL_CODE_NK, ?) > 0 OR T.MODEL_CODE_NK IS NULL)
                ]]>
	</query>

	<query id="InnerStdDao.getDicInfo" desc="查询探伤主表内控">  
            <![CDATA[ 
SELECT T.DIC,
       T.PSC,
       T.MSC,
       T.STDSTYLE,
       T.PROCESS_CODE,
       T.PROCESS_DESC,
       T.STD_CODE_NK,
       T.STD_NAME_NK,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.CREATE_NAME,
       T.CREATE_TIME,
       T.UPDATE_NAME,
       T.UPDATE_TIME,
       T.DELETE_NAME,
       T.DELETE_TIME,
       T.VALIDFLAG,
       T.MEMO,
       T.PRODUC_HEAD,
       T.CODE_JG,
       T.STEELCODE_NK,
       T.STEELNAME_NK,
       T.MODEL_CODE_NK,
       T.MODEL_DESC_NK,
       T.PRODUCCODE_NK,
       T.PRODUCNAME_NK,
       A.PURCHASE_STD,
       T.STD_CODE_S_NK,
       T.STD_NAME_S_NK,
       T.STD_STYLE_S_NK,
       T.STD_STYLE_DESC_S_NK
  FROM COM_MSC_STD_DETECTION T
  LEFT JOIN COM_BASE_STD A
    ON A.STD_CODE = T.STD_CODE_NK
 WHERE T.DIC = ?
   AND T.STDSTYLE = 'N'
   AND T.VALIDFLAG != '0'
   AND (INSTR(T.MODEL_CODE_NK, ?) > 0 OR T.MODEL_CODE_NK IS NULL)
                ]]>
	</query>

	<query id="InnerStdDao.getWicInfo" desc="查询水压主表内控">  
            <![CDATA[ 
            SELECT T.WIC,
       T.PSC,
       T.STDSTYLE,
       T.PROCESS_CDOE,
       T.PROCESS_DESC,
       T.STD_CODE_NK,
       T.STD_NAME_NK,
       T.MIN_D,
       T.MAX_D,
       T.MIN_H,
       T.MAX_H,
       T.SPEC_JG,
       T.SPEC_JG_DESC,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.CREATE_NAME,
       T.CREATE_TIME,
       T.UPDATE_NAME,
       T.UPDATE_TIME,
       T.DELETE_NAME,
       T.DELETE_TIME,
       T.VALIDFLAG,
       T.MEMO,
       T.MSC,
       T.PRODUC_HEAD,
       T.CODE_JG,
       T.MIN_D_SIGN,
       T.MAX_D_SIGN,
       T.MIN_H_SIGN,
       T.MAX_H_SIGN,
       T.STEELCODE_NK,
       T.STEELNAME_NK,
       T.MODEL_CODE_NK,
       T.MODEL_DESC_NK,
       T.PRODUCCODE_NK,
       T.PRODUCNAME_NK,
       A.PURCHASE_STD
  FROM COM_MSC_STD_WATER T
  LEFT JOIN COM_BASE_STD A
    ON A.STD_CODE = T.STD_CODE_NK
 WHERE T.WIC = ?
   AND T.STDSTYLE = 'N'
   AND T.VALIDFLAG != '0'
   AND (INSTR(T.MODEL_CODE_NK, ?) > 0 OR T.MODEL_CODE_NK IS NULL)
                ]]>
	</query>

	<query id="InnerStdDao.getGicInfo" desc="查询加工主表内控">  
            <![CDATA[ 
            SELECT T.GIC,
       T.PSC,
       T.MSC,
       T.STDSTYLE,
       T.PROCESS_CDOE,
       T.PROCESS_DESC,
       T.STD_CODE_NK,
       T.STD_NAME_NK,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.CREATE_NAME,
       T.CREATE_TIME,
       T.UPDATE_NAME,
       T.UPDATE_TIME,
       T.DELETE_NAME,
       T.DELETE_TIME,
       T.VALIDFLAG,
       T.MEMO,
       T.PRODUC_HEAD,
       T.CODE_JG,
       T.STEELCODE_NK,
       T.STEELNAME_NK,
       T.MODEL_CODE_NK,
       T.MODEL_DESC_NK,
       T.PRODUCCODE_NK,
       T.PRODUCNAME_NK,
       A.PURCHASE_STD
  FROM COM_MSC_STD_PROCESS T
  LEFT JOIN COM_BASE_STD A
    ON A.STD_CODE = T.STD_CODE_NK
 WHERE T.GIC = ?
   AND T.STDSTYLE = 'N'
   AND T.VALIDFLAG != '0'
   AND (INSTR(T.MODEL_CODE_NK, ?) > 0 OR T.MODEL_CODE_NK IS NULL)
                ]]>
	</query>

	<query id="InnerStdDao.checkInnerPicSmp" desc="验证内控取样要求是否重复">  
            <![CDATA[ 
SELECT COUNT(1) COUNT
  FROM CRAFT_ORD_DESIGN_STD_PIC_SMP T
 WHERE T.DESGIN_KEY = '#DESGIN_KEY#'
   AND T.PIC = '#PIC#'
   AND T.SIC = '#SIC#'
   AND T.PHY_CODE_MIN = '#PHY_CODE_MIN#'
   AND DECODE('#ITEM_CODE_F#', NULL, '1', T.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_F#', NULL, T.ITEM_CODE_F, NULL) IS NULL
   AND DECODE('#ITEM_CODE_C#', NULL, '1', T.ITEM_CODE_C) =
       DECODE('#ITEM_CODE_C#', NULL, '1', '#ITEM_CODE_C#')
   AND DECODE('#ITEM_CODE_C#', NULL, T.ITEM_CODE_C, NULL) IS NULL
   AND DECODE('#ITEM_CODE_W#', NULL, '1', T.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_W#', NULL, T.ITEM_CODE_W, NULL) IS NULL
   AND T.PROCESS_CODE = '#PROCESS_CODE#'
   AND T.MSC_PLINE = '#MSC_PLINE#'
                ]]>
	</query>

	<query id="InnerStdDao.updateInnerSeq" desc="修改内控标准索引号">  
            <![CDATA[ 
               UPDATE CRAFT_ORD_DESIGN_MSC_PL_PRC T SET T.CIC=?,T.PIC=?,T.SIC=?,T.DIC=?,T.WIC=?,
               T.GIC=? WHERE T.DESGIN_KEY=? AND T.MSC_PLINE=? AND T.PROCESS_CODE=?
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftMsc0Chem" desc="获取工艺评审中MSC0的成分">  
            <![CDATA[ 
SELECT *
  FROM CRAFT_ORD_DESIGN_STD_CIC T
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '0'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftMscNChem" desc="获取工艺评审中MSCN的成分">  
            <![CDATA[ 
SELECT *
  FROM CRAFT_ORD_DESIGN_STD_CIC T
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '1'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftJfChem" desc="获取工艺评审中交付标准的成分">  
            <![CDATA[ 
SELECT *
          FROM CRAFT_ORD_DESIGN_STD_CIC T
         WHERE T.DESGIN_KEY = {0}
           AND T.SPECL_FL = '0'
           AND NOT EXISTS (SELECT 1
                  FROM CRAFT_ORD_DESIGN_STD_CIC A
                 WHERE A.DESGIN_KEY = T.DESGIN_KEY
                   AND A.SPECL_FL = '1'
                   AND T.CHEM_CODE = A.CHEM_CODE)
        UNION ALL
        SELECT *
          FROM CRAFT_ORD_DESIGN_STD_CIC T
         WHERE T.DESGIN_KEY = {0}
           AND T.SPECL_FL = '1'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftNkChem" desc="获取工艺评审中内控的成分">  
            <![CDATA[ 
SELECT T.*
  FROM CRAFT_ORD_DESIGN_STD_CIC    T,
       CRAFT_ORD_DESIGN_MSC_PL     A,
       CRAFT_ORD_DESIGN_MSC_PL_PRC B
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '2'
   AND A.DESGIN_KEY = T.DESGIN_KEY
   AND A.MSC_PLINE = {1}
   AND B.DESGIN_KEY = T.DESGIN_KEY
   AND B.MSC_PLINE = A.MSC_PLINE
   AND B.PROCESS_CODE = {2}
   AND INSTR(B.CIC, T.CIC) > 0
   AND T.CIC = {3}
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftMsc0Phy" desc="获取工艺评审中MSC0的理化">  
            <![CDATA[ 
SELECT *
  FROM CRAFT_ORD_DESIGN_STD_PIC T
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '0'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftMscNPhy" desc="获取工艺评审中MSCN的理化">  
            <![CDATA[ 
SELECT *
  FROM CRAFT_ORD_DESIGN_STD_PIC T
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '1'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftNkPhy" desc="获取工艺评审中内控的理化">  
            <![CDATA[ 
SELECT T.*
  FROM CRAFT_ORD_DESIGN_STD_PIC    T,
       CRAFT_ORD_DESIGN_MSC_PL     A,
       CRAFT_ORD_DESIGN_MSC_PL_PRC B
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '2'
   AND A.DESGIN_KEY = T.DESGIN_KEY
   AND A.MSC_PLINE = {1}
   AND B.DESGIN_KEY = T.DESGIN_KEY
   AND B.MSC_PLINE = A.MSC_PLINE
   AND B.PROCESS_CODE = {2}
   AND INSTR(B.PIC, T.PIC) > 0
   AND T.PIC = {3}
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftMsc0Spec" desc="获取工艺评审中MSC0的公差">  
            <![CDATA[ 
SELECT *
  FROM CRAFT_ORD_DESIGN_STD_SIC T
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '0'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftMscNSpec" desc="获取工艺评审中MSCN的公差">  
            <![CDATA[ 
SELECT *
  FROM CRAFT_ORD_DESIGN_STD_SIC T
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '1'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftNkSpec" desc="获取工艺评审中内控的公差">  
            <![CDATA[ 
SELECT T.*
  FROM CRAFT_ORD_DESIGN_STD_SIC    T,
       CRAFT_ORD_DESIGN_MSC_PL     A,
       CRAFT_ORD_DESIGN_MSC_PL_PRC B
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '2'
   AND A.DESGIN_KEY = T.DESGIN_KEY
   AND A.MSC_PLINE = {1}
   AND B.DESGIN_KEY = T.DESGIN_KEY
   AND B.MSC_PLINE = A.MSC_PLINE
   AND B.PROCESS_CODE = {2}
   AND INSTR(B.SIC, T.SIC) > 0
   AND T.SIC = {3}
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftMsc0Dete" desc="获取工艺评审中MSC0的探伤">  
            <![CDATA[ 
SELECT *
  FROM CRAFT_ORD_DESIGN_STD_DIC T
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '0'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftMscNDete" desc="获取工艺评审中MSCN的探伤">  
            <![CDATA[ 
SELECT *
  FROM CRAFT_ORD_DESIGN_STD_DIC T
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '1'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftNkDete" desc="获取工艺评审中内控的探伤">  
            <![CDATA[ 
SELECT T.*
  FROM CRAFT_ORD_DESIGN_STD_DIC    T,
       CRAFT_ORD_DESIGN_MSC_PL     A,
       CRAFT_ORD_DESIGN_MSC_PL_PRC B
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '2'
   AND A.DESGIN_KEY = T.DESGIN_KEY
   AND A.MSC_PLINE = {1}
   AND B.DESGIN_KEY = T.DESGIN_KEY
   AND B.MSC_PLINE = A.MSC_PLINE
   AND B.PROCESS_CODE = {2}
   AND INSTR(B.DIC, T.DIC) > 0
   AND T.DIC = {3}
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftMsc0Water" desc="获取工艺评审中MSC0的水压">  
            <![CDATA[ 
SELECT *
  FROM CRAFT_ORD_DESIGN_STD_WIC T
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '0'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftMscNWater" desc="获取工艺评审中MSCN的水压">  
            <![CDATA[ 
SELECT *
  FROM CRAFT_ORD_DESIGN_STD_WIC T
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '1'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftNkWater" desc="获取工艺评审中内控的水压">  
            <![CDATA[ 
SELECT T.*
  FROM CRAFT_ORD_DESIGN_STD_WIC    T,
       CRAFT_ORD_DESIGN_MSC_PL     A,
       CRAFT_ORD_DESIGN_MSC_PL_PRC B
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '2'
   AND A.DESGIN_KEY = T.DESGIN_KEY
   AND A.MSC_PLINE = {1}
   AND B.DESGIN_KEY = T.DESGIN_KEY
   AND B.MSC_PLINE = A.MSC_PLINE
   AND B.PROCESS_CODE = {2}
   AND INSTR(B.WIC, T.WIC) > 0
   AND T.WIC = {3}
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftMsc0Process" desc="获取工艺评审中MSC0的加工">  
            <![CDATA[ 
SELECT *
  FROM CRAFT_ORD_DESIGN_STD_GIC T
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '0'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftMscNProcess" desc="获取工艺评审中MSCN的加工">  
            <![CDATA[ 
SELECT *
  FROM CRAFT_ORD_DESIGN_STD_GIC T
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '1'
                ]]>
	</query>
	
	<query id="InnerStdDao.getCraftNkProcess" desc="获取工艺评审中内控的加工">  
            <![CDATA[ 
SELECT T.*
  FROM CRAFT_ORD_DESIGN_STD_GIC    T,
       CRAFT_ORD_DESIGN_MSC_PL     A,
       CRAFT_ORD_DESIGN_MSC_PL_PRC B
 WHERE T.DESGIN_KEY = {0}
   AND T.SPECL_FL = '2'
   AND A.DESGIN_KEY = T.DESGIN_KEY
   AND A.MSC_PLINE = {1}
   AND B.DESGIN_KEY = T.DESGIN_KEY
   AND B.MSC_PLINE = A.MSC_PLINE
   AND B.PROCESS_CODE = {2}
   AND INSTR(B.GIC, T.GIC) > 0
   AND T.GIC = {3}
                ]]>
	</query>
</queryMap>