<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="下拉框动态数据获取管理">
	<query id="ComBaseQuery.COMBASEPLINE" desc="生产产线管理">
		<![CDATA[
			SELECT 
			PLINE_CODE,
			PLINE_NAME
			FROM COM_BASE_PLINE
			WHERE VALIDFLAG='1'
			ORDER BY PLINE_CODE
		]]>
	</query>
	<query id="ComBaseQuery.COMBASEINFO" desc="孔型管理">
		<![CDATA[
			SELECT 
			BASECODE,
			BASENAME
			FROM COM_BASE_INFO
			WHERE VALIDFLAG='1'
			AND SORTCODE='4047' 
			ORDER BY BASECODE
		]]>
	</query>
		<query id="ComBaseQuery.COMBASEMODEL" desc="扣型管理">
		<![CDATA[
			SELECT 
			'False' CHC,
			MODEL_DESC, 
			MODEL_CODE
			FROM COM_BASE_MODEL
			WHERE VALIDFLAG='1'
			AND DECODE(?,'','1',MODEL_STYLE)= DECODE(?,'','1',?)
			ORDER BY MODEL_CODE
		]]>
	</query>

		<query id="ComBaseQuery.COMBASEMODEL1" desc="扣型管理">
		<![CDATA[
			SELECT 
			'FALSE' CHC,
			MODEL_DESC, 
			MODEL_CODE
			FROM COM_BASE_MODEL
			WHERE VALIDFLAG='1'
			ORDER BY MODEL_CODE
		]]>
	</query>
		<query id="ComBaseQuery.COMMSCJG" desc="接箍码基础管理">
		<![CDATA[
			SELECT 
			
			SPEC_CODE AS SPEC_JG, 
			SPEC_NAME AS SPEC_JG_DESC
			FROM COM_BASE_SPEC
			WHERE VALIDFLAG='1'
			AND MSC_STYLE='C'
		]]>
	</query>

		<query id="ComBaseQuery.COMBASEWELL" desc="产能井设置管理">
		<![CDATA[
			SELECT 
			WELL_CODE,
			WELL_NAME
			FROM COM_BASE_WELL
			WHERE VALIDFLAG='1'
			ORDER BY WELL_CODE
		]]>
	</query>
	
	<query id="ComBaseQuery.getComBaseWellByProcessCode" desc="通过工序代码获取产能井设置管理">
		<![CDATA[
			SELECT 
			WELL_CODE,
			WELL_NAME
			FROM COM_BASE_WELL
			WHERE VALIDFLAG='1'
		    AND 
		    DECODE('#PROCESS_CDOE#', NULL, '1', PROCESS_CDOE) = DECODE('#PROCESS_CDOE#', NULL, '1', '#PROCESS_CDOE#')
			ORDER BY WELL_CODE
		]]>
	</query>
	
      <query id="ComBaseQuery.CombaseChem" desc="化学元素基础">
		<![CDATA[
			SELECT 
            CHEM_CODE, 
            CHEM_NAME,
            DECODE(CHEM_TYPE,'A','单一元素','复合元素') CHEM_TYPE,
            CHEM_FORMULA,
            CHEM_TYPE CHEM_TYPE_CODE
            FROM COM_BASE_CHEM
			WHERE VALIDFLAG='1'
			ORDER BY CHEM_CODE
		]]>
	</query>
	 <query id="ComBaseQuery.CombaseChemA" desc="化学元素基础">
		<![CDATA[
			SELECT 
            CHEM_CODE, 
            CHEM_NAME,
            DECODE(CHEM_TYPE,'A','单一元素','复合元素') CHEM_TYPE, 
            CHEM_FORMULA 
            FROM COM_BASE_CHEM
			WHERE VALIDFLAG='1'
			--AND CHEM_TYPE='A'
			ORDER BY CHEM_CODE
		]]>
	</query>
	
      <query id="ComBaseQuery.ComBaseGrade" desc="钢种管理">
		<![CDATA[
			
           SELECT 
           GRADECODE,
           GRADENAME
           FROM COM_BASE_GRADE
		   WHERE VALIDFLAG='1'
		   ORDER BY GRADECODE
		]]>
	</query>
	
    <query id="ComBaseQuery.ComBaseStdGX" desc="国标标准和协议">
		<![CDATA[
          SELECT 
          STD_CODE,
          STD_NAME,
          DECODE(STDSTYLE,'K','Alpha','N','内控','S','试验标准','成分偏差标准') STDSTYLE
          FROM COM_BASE_STD
      WHERE VALIDFLAG='1' AND (STDSTYLE ='G' OR STDSTYLE ='X')
      ORDER BY STD_NAME
		]]>
	</query>
      
	<query id="ComBaseQuery.ComBaseStdG" desc="国标标准">
		<![CDATA[
          SELECT 
          STD_CODE,
          STD_NAME,
          DECODE(STDSTYLE,'K','Alpha','N','内控','S','试验标准','成分偏差标准') STDSTYLE
          FROM COM_BASE_STD
      WHERE VALIDFLAG='1' AND STDSTYLE ='G'
      ORDER BY STD_CODE
		]]>
	</query>
	 <query id="ComBaseQuery.ComBaseStdN" desc="内控标准">
		<![CDATA[	
          SELECT 
          STD_CODE,
          STD_NAME,
          DECODE(STDSTYLE,'K','Alpha','N','内控','S','试验标准','成分偏差标准') STDSTYLE
          FROM COM_BASE_STD
      WHERE VALIDFLAG='1' AND STDSTYLE ='N'
      ORDER BY STD_CODE
		]]>
	</query>
	<query id="ComBaseQuery.ComBaseStdNPurchase" desc="采购内控标准">
		<![CDATA[	
          SELECT 
          STD_CODE,
          STD_NAME,
          DECODE(STDSTYLE,'K','Alpha','N','内控','S','试验标准','成分偏差标准') STDSTYLE
          FROM COM_BASE_STD
      WHERE VALIDFLAG='1' 
      AND STDSTYLE ='N'
      AND PURCHASE_STD = '1'
      ORDER BY STD_CODE
		]]>
	</query>
	 <query id="ComBaseQuery.ComBaseStdK" desc="标准Alpha">
		<![CDATA[	
          SELECT 
          ALPHA_CODE AS STD_CODE,
          (SELECT STD_NAME FROM COM_BASE_STD C WHERE C.STD_CODE=T.STD_CODE) STD_NAME,
          'Alpha' STDSTYLE
          FROM COM_BASE_STD_ALPHA T
          WHERE VALIDFLAG='1'  
          ORDER BY ALPHA_CODE
		]]>
	</query>
	<query id="ComBaseQuery.ComBaseStdSS" desc="试验标准">
		<![CDATA[	
          SELECT 
          STD_CODE,
          STD_NAME,
          DECODE(STDSTYLE,'K','Alpha','N','内控','S','试验标准','成分偏差标准') STDSTYLE
          FROM COM_BASE_STD
      WHERE VALIDFLAG='1' AND STDSTYLE IN ('S')
      ORDER BY STD_CODE
		]]>
	</query>
	 <query id="ComBaseQuery.ComBaseStdS" desc="其它标准">
		<![CDATA[	
          SELECT 
          STD_CODE,
          STD_NAME,
          DECODE(STDSTYLE,'K','Alpha','N','内控','S','试验标准','成分偏差标准') STDSTYLE
          FROM COM_BASE_STD
      WHERE VALIDFLAG='1' AND STDSTYLE IN ('P','S')
      ORDER BY STD_CODE
		]]>
	</query>
	 <query id="ComBaseQuery.ComBaseProcess" desc="工序基础">
		<![CDATA[
			
         SELECT 
         PROCESS_CODE,
         PROCESS_DESC
         FROM COM_BASE_PROCESS
         WHERE   STYLE='B' AND
		 VALIDFLAG='1' 
		   ORDER BY PROCESS_CODE
		]]>
	</query>
	<query id="ComBaseQuery.ComBaseProcessAll" desc="工序基础">
		<![CDATA[
		SELECT T.PROCESS_CODE, T.PROCESS_DESC FROM com_base_process T WHERE T.VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="ComBaseQuery.ComBaseProcessAll2" desc="工序基础">
		<![CDATA[
			
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE  
		 VALIDFLAG='1' AND SORTCODE='4032'
		   ORDER BY BASECODE
		]]>
	</query>
	 <query id="ComBaseQuery.ComBaseInfo4003" desc="基础信息限制規格">
		<![CDATA[
			
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE   SORTCODE='4003' AND
		 VALIDFLAG='1' 
		   ORDER BY BASECODE
		]]>
	</query>
	 <query id="ComBaseQuery.ComBaseInfo4010" desc="基础信息">
		<![CDATA[
			
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE   SORTCODE='4010' AND
		 VALIDFLAG='1' 
		   ORDER BY BASECODE
		]]>
	</query>
	 <query id="ComBaseQuery.ComBaseInfo4011" desc="基础信息">
		<![CDATA[
			
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE   SORTCODE='4011' AND
		 VALIDFLAG='1' 
		   ORDER BY BASECODE
		]]>
	</query>
	 <query id="ComBaseQuery.ComBaseInfo4012" desc="基础信息">
		<![CDATA[
			
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE   SORTCODE='4012' AND
		 VALIDFLAG='1' 
		   ORDER BY BASECODE
		]]>
	</query>
	<query id="ComBaseQuery.ComBaseInfo4020" desc="基础信息">
		<![CDATA[
			
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE   SORTCODE='4020' AND
		 VALIDFLAG='1' 
		   ORDER BY BASECODE
		]]>
	</query>
	<query id="ComBaseQuery.ComBaseInfo4021" desc="基础信息">
		<![CDATA[
			
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE   SORTCODE='4021' AND
		 VALIDFLAG='1' 
		   ORDER BY BASECODE
		]]>
	</query>
	<query id="ComBaseQuery.ComBaseInfo4022" desc="基础信息">
		<![CDATA[
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE   SORTCODE='4022' AND
		 VALIDFLAG='1' 
		   ORDER BY BASECODE
		]]>
	</query>
	<query id="ComBaseQuery.ComBaseInfo4040" desc="基础信息">
		<![CDATA[
			
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE   SORTCODE='4040' AND
		 VALIDFLAG='1' 
		   ORDER BY BASECODE
		]]>
	</query>
	<query id="ComBaseQuery.ComBaseInfo4041" desc="基础信息">
		<![CDATA[
			
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE   SORTCODE='4041' AND
		 VALIDFLAG='1' 
		   ORDER BY BASECODE
		]]>
	</query>
	
	<query id="ComBaseQuery.ComBaseInfo4060" desc="基础信息 交货状态">
		<![CDATA[
			
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE   SORTCODE='4060' AND
		 VALIDFLAG='1' 
		   ORDER BY BASECODE
		]]>
	</query>
	
    <query id="ComBaseQuery.ComBasePhyRStd" desc="材质大类与试验标准基础表">
		<![CDATA[
		SELECT PHY_CODE,
               PHY_TYPE
        FROM   COM_BASE_PHY_B
        WHERE  VALIDFLAG='1' 
		ORDER BY PHY_CODE
		]]>
	</query>
	
    <query id="ComBaseQuery.ComBasePhyC" desc="材质大类基础表">
		<![CDATA[
		SELECT 
		       PHY_CODE,
               PHY_TYPE
        FROM  COM_BASE_PHY_C
        WHERE PHY_TYPE_M=?  AND VALIDFLAG='1' 
        ORDER BY PHY_CODE
		]]>
	</query>
	
	<query id="ComBaseQuery.ComBasePhy" desc="材质项目基础表">
		<![CDATA[
		SELECT 
		       PHY_CODE,
               PHY_NAME
        FROM COM_BASE_PHY
        WHERE PHY_TYPE_C=?  AND VALIDFLAG='1' 
        ORDER BY PHY_CODE
		]]>
	</query>
	
	<query id="ComBaseQuery.ComBasePhyP001" desc="材质项目基础表">
		<![CDATA[
		SELECT 
		       PHY_CODE,
               PHY_NAME
        FROM COM_BASE_PHY
        WHERE VALIDFLAG='1' 
        ORDER BY PHY_CODE
		]]>
	</query>
	
	<query id="ComBaseQuery.ComBasePhyRItem" desc="试样组关系表">
		<![CDATA[
		SELECT '' ITEM_NAME_F,
       '' ITEM_CODE_F,
       '' ITEM_NAME_C,
       '' ITEM_CODE_C
  FROM DUAL
UNION ALL
SELECT (SELECT T2.ITEM_NAME
          FROM COM_BASE_PHY_ITEM T2
         WHERE T1.ITEM_CODE_F = T2.ITEM_CODE) ITEM_NAME_F,
       T1.ITEM_CODE_F,
       (SELECT T2.ITEM_NAME
          FROM COM_BASE_PHY_ITEM T2
         WHERE T1.ITEM_CODE_C = T2.ITEM_CODE) ITEM_NAME_C,
       T1.ITEM_CODE_C
  FROM COM_BASE_PHY_R_ITEM T1
 WHERE T1.PHY_TYPE_C = ?
   AND T1.VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="ComBaseQuery.ComBasePhyRPos" desc="检验项关系表">
		<![CDATA[
SELECT '' ITEM_NAME_W, '' ITEM_CODE_W
  FROM DUAL
UNION ALL
SELECT (SELECT T2.ITEM_NAME
          FROM COM_BASE_PHY_ITEM T2
         WHERE T1.ITEM_CODE_W = T2.ITEM_CODE) ITEM_NAME_W,
       T1.ITEM_CODE_W
  FROM COM_BASE_PHY_R_POS T1
 WHERE T1.PHY_CODE = ?
   AND T1.VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="ComBaseQuery.CHEMBIAS" desc="成分偏差">
		<![CDATA[
SELECT STD_CODE, STD_NAME
  FROM COM_BASE_STD
 WHERE VALIDFLAG = '1'
   AND STDSTYLE = 'P'
		]]>
	</query>
	
	 <query id="ComBaseQuery.GETPSC" desc="产品规范码">
        <![CDATA[
            SELECT PSC_DESC,
                   P.PSC,
                   P.PRODUCNAME,
                   DECODE(S.STDSTYLE,'G','国标','协议') STDSTYLE,
                   P.STD_NAME,
                   P.STEELNAME,
                   P.STD_STYLE_DESC,
                   P.STD_CODE
              FROM COM_PSC P LEFT JOIN COM_BASE_STD S ON  P.STD_CODE=S.STD_CODE
              ORDER BY PSC_DESC
	     ]]>
	  </query>
	  
	   <query id="ComBaseQuery.GetCount" desc="验证是否存在有效值">
        <![CDATA[          
             SELECT SUM(CNT) FROM 
             (SELECT   COUNT(1) CNT
             FROM COM_MSC_STD_CIC
             WHERE STD_NAME_NK=?  AND VALIDFLAG='1'
             
             UNION ALL
             SELECT   COUNT(1) CNT
             FROM COM_MSC_STD_PIC  
             WHERE  STD_NAME_NK=?  AND VALIDFLAG='1'
             UNION ALL
             SELECT   COUNT(1)
             FROM COM_MSC_STD_SPEC
             WHERE  STD_NAME=?  AND VALIDFLAG='1'
             UNION ALL
             SELECT   COUNT(1)
             FROM COM_MSC_STD_DETECTION
             WHERE  STD_NAME_NK=?  AND VALIDFLAG='1'
             UNION ALL
             SELECT   COUNT(1)
             FROM COM_MSC_STD_WATER
             WHERE  STD_NAME_NK=?  AND VALIDFLAG='1') T
	     ]]>
	  </query>
	  
	<query id="ComBaseQuery.GETMSC" desc="冶金规范码">
		<![CDATA[
		  SELECT M.MSC,
		       M.MSC_DESC,
		       C.PSC,
		       C.PSC_DESC,
		       P.PRODUCNAME,
		       P.STD_NAME,
		       P.STEELNAME,
		       P.STD_STYLE_DESC,
		       DECODE(S.STDSTYLE, 'G', '订货标准', '协议标准') STDSTYLE,
		       P.STEELCODE,
		       P.STD_CODE
		  FROM COM_MSC M
		  JOIN COM_PSC_R_MSC C ON M.MSC = C.MSC
		  JOIN COM_PSC P ON P.PSC = C.PSC
		  LEFT JOIN COM_BASE_STD S ON P.STD_CODE = S.STD_CODE
		  WHERE DECODE('#MSC#', NULL, '1', M.MSC) = DECODE('#MSC#', NULL, '1', '#MSC#')
		UNION ALL
		SELECT M.MSC,
		       M.MSC_DESC,
		       C.PSC,
		       C.PSC_DESC,
		       P.PRODUCNAME,
		       P.STD_NAME,
		       P.STEELNAME,
		       P.STD_STYLE_DESC,
		       DECODE(P.STD_STYLE, 'G', '订货标准', '协议标准') STDSTYLE,
		       P.STEELCODE,
		       P.STD_CODE
		  FROM COM_MSC M
		  JOIN COM_PSC_R_MSC C ON M.MSC = C.MSC
		  JOIN COM_MSC_BL P ON P.PSC_BL = C.PSC
		 ORDER BY MSC
		]]>
	</query>
	
	<query id="ComBaseQuery.ComBasePhyD" desc="材质项目探伤">
		<![CDATA[
		SELECT PHY_CODE, PHY_NAME
              FROM COM_BASE_PHY
             WHERE VALIDFLAG = '1'
             AND PHY_TYPE = 'R0006'
             ORDER BY PHY_CODE
		]]>
	</query>
	
	<query id="ComBaseQuery.ComBaseInfo4023" desc="刻槽位置(4023)">
		<![CDATA[
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE   SORTCODE='4023' AND
		 VALIDFLAG='1' 
		   ORDER BY BASECODE
		]]>
	</query>
	
	<query id="ComBaseQuery.ComBaseInfo4024" desc="刻槽方向(4024)">
		<![CDATA[
         SELECT 
         BASECODE,
         BASENAME
         FROM COM_BASE_INFO
         WHERE   SORTCODE='4024' AND
		 VALIDFLAG='1' 
		   ORDER BY BASECODE
		]]>
	</query>
	
	<query id="ComBaseQuery.GetStdStyle" desc="获取标准类别描述">
		<![CDATA[
			SELECT T.Std_Style, T.STD_STYLE_DESC FROM COM_BASE_STD_STYLE T WHERE T.VALIDFLAG = '1'
			ORDER BY T.STD_STYLE_DESC ASC
		]]>
	</query>
	
	<query id="ComBaseQuery.BANDSTDXH" desc="绑定标准协会代码">
		<![CDATA[
			select BASECODE,BASENAME from COM_BASE_INFO where SORTCODE=4001 AND VALIDFLAG = '1'
			ORDER BY BASENAME ASC
		]]>
	</query>
	
	<query id="ComBaseQuery.GETCUST" desc="绑定选择客户">
		<![CDATA[
			SELECT CUSTOMER_NO,CUSTOMER_NM FROM SLM_BASE_CUSTOMER ORDER BY CUSTOMER_NO
		]]>
	</query>
	
	<query id="ComBaseQuery.GETPRODUCT" desc="获取品名描述">
		<![CDATA[
			SELECT T.PRODUCNAME, T.PRODUCCODE,
			T.PRODUC_DESC, T.PRODUC_JX ,T.PRODUC_HEAD,
			PRODUC_TYPE,PRODUC_STYLE
			FROM COM_BASE_PRODUCT T 
			WHERE T.VALIDFLAG = '1'
			ORDER BY T.PRODUCNAME ASC
		]]>
	</query>
	
	<query id="ComBaseQuery.GETPRODUCT2" desc="获取品名描述">
		<![CDATA[
			SELECT  T.PRODUCCODE, T.PRODUC_JX
			FROM COM_BASE_PRODUCT T 
			WHERE T.VALIDFLAG = '1'
			ORDER BY T.PRODUC_JX  ASC
		]]>
	</query>
	
	<query id="ComBaseQuery.GETSTEEL" desc="获取钢级牌号">
		<![CDATA[
			SELECT T.STEELCODE, T.STEELNAME FROM COM_BASE_STEEL T WHERE T.VALIDFLAG = '1'
			ORDER BY T.STEELNAME ASC
		]]>
	</query>
	
	<query id="ComBaseQuery.GETBASESTDADD" desc="获取标准附加项">
		<![CDATA[
			SELECT I.BASECODE, I.BASENAME FROM COM_BASE_INFO I WHERE SORTCODE = 1210
		]]>
	</query>
	
	<query id="ComBaseQuery.checkElement" desc="检验化学元素">
		<![CDATA[
			SELECT COUNT(1)
              FROM COM_BASE_CHEM C
             WHERE C.CHEM_NAME IN (?)
               AND C.CHEM_TYPE = 'A'
		]]>
	</query>
	
	<query id="ComBaseQuery.getAskItem" desc="查询附加要求项目">
		<![CDATA[
			SELECT A.ASK_ITEM_NO, A.ASK_ITEM_DESC
              FROM SLM_BASE_ADD_ASK A
             WHERE LENGTH(A.ASK_ITEM_NO) = 6
               AND A.VALIDFLAG = '1'
          ORDER BY A.ASK_ITEM_NO
		]]>
	</query>
	
	<query id="ComBaseQuery.getSecProcess" desc="查询附加要求项目">
		<![CDATA[
			 SELECT PROCESS_CDOE_C,
			 PROCESS_DESC_C,
			 'FALSE' CHK
			 FROM COM_BASE_PROCESS_C T
			 WHERE T.VALIDFLAG ='1'
			 AND DECODE(?,'','1',T.PROCESS_STYLE) = DECODE(?,'','1',?)
		]]>
	</query>
	
	<query id="ComBaseQuery.getSpecByType" desc="通过规格类型查找规格">
		<![CDATA[
SELECT T.SPEC_CODE, T.SPEC_NAME
  FROM COM_BASE_SPEC T
 WHERE T.MSC_STYLE = '#MSC_STYLE#'
   AND T.VALIDFLAG = '1'
   ORDER BY T.SPEC_NAME
		]]>
	</query>
	
	
	<query id="ComBaseQuery.getMscPlineByMsc" desc="通过MSC查询制程">
		<![CDATA[
SELECT T.MSC_PLINE
  FROM COM_MSC_BACKLOG T
 WHERE T.MSC = '#MSC#'
   AND T.VALIDFLAG IN ('1', '2', '3')
		]]>
	</query>
	
	<query id="ComBaseQuery.getPsc2" desc="查询PSC">
		<![CDATA[
SELECT PSC, PSC_DESC FROM COM_PSC ORDER BY PSC_DESC
		]]>
	</query>
	
	<query id="ComBaseQuery.getPlineByProcess" desc="查询工序对应的产线">
		<![CDATA[
SELECT T.PLINE_CODE, T.PLINE_NAME FROM COM_BASE_PLINE T WHERE T.PROCESS_CODE = {0} AND T.VALIDFLAG = '1'
		]]>
	</query>
</queryMap>