<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="钢种索引码集合">
	<query id="FrmCicIntersection.getQueryPlnZg" desc="查询合同行PK,工艺文件序号">
             <![CDATA[
 SELECT T1.ORD_LN_PK, T.CRAFT_SEQ,T.INDEX_SEQ
   FROM PLN_ORDER_ZG_S T, PLN_SALEORD T1
  WHERE T.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK
    AND T.GPREQ_ID = (SELECT MAX(G.PRO_PLAN_ID)
                        FROM PLN_STEELFOR_ORD G
                       WHERE G.FURNACENO = ?)
                 ]]>
	</query>
	<query id="FrmCicIntersection.getQueryFurnCIC" desc="查询虚拟炉号对应的CIC">
             <![CDATA[
SELECT DISTINCT G.CIC
                  FROM PLN_STEELFOR_ORD G
                 WHERE G.FURNACENO = ?
                 ]]>
	</query>
	<query id="FrmCicIntersection.getQueryCIC" desc="通过工艺文件序号,合同行PK 查询钢种成分索引码">
             <![CDATA[
SELECT COUNT(*) ICOUNT
  FROM CRAFT_ORD_DESIGN_STD_CIC V
 WHERE V.CIC IN (SELECT DISTINCT G.CIC
                  FROM PLN_STEELFOR_ORD G
                 WHERE G.FURNACENO = ?)
   AND V.PROCESS_CODE = 'A'
   AND V.DESGIN_KEY = (SELECT T.DESGIN_KEY
                         FROM CRAFT_ORD_DESIGN T
                        WHERE T.ORD_LN_PK = ?
                          AND T.CRAFT_SEQ = ?)
   AND V.MSC_PLINE=?
   AND V.SPECL_FL='2' AND V.VALIDFLAG='1'
                 ]]>
	</query>
	<query id="FrmCicIntersection.getQueryCicChemCode" desc="查询两个虚拟炉号对应的元素成分">
             <![CDATA[
SELECT *
  FROM (SELECT V.CHEM_CODE,
               V.CHEM_NAME,
               V.CHEM_TYPE,
               V.CHEM_FORMULA,
               V.STDMIN_SIGN,
               V.STDMIN,
               V.STDMAX_SIGN,
               V.STDMAX,
               V.STDTARGET, C.CHEM_SEQ,
               V.ISCHECK,
       V.ISJUDGE,
       V.ISQUOTE,
       V.REP_CODE,
       V.REP_NAME,
       V.REP_MIN_SIGN,
       V.REP_MIN,
       V.REP_MAX_SIGN,
       V.REP_MAX,
       V.REP_VAL
          FROM CRAFT_ORD_DESIGN_STD_CIC V,COM_BASE_CHEM C
         WHERE  V.CHEM_CODE = C.CHEM_CODE AND V.CIC = (SELECT DISTINCT G.CIC
                          FROM PLN_STEELFOR_ORD G
                         WHERE G.FURNACENO = ?)
           AND V.PROCESS_CODE = 'A'
           AND V.DESGIN_KEY = (SELECT T.DESGIN_KEY
                                 FROM CRAFT_ORD_DESIGN T
                                WHERE T.ORD_LN_PK = ?
                                  AND T.CRAFT_SEQ = ?)
           AND V.MSC_PLINE=?
           AND V.SPECL_FL='2' AND V.VALIDFLAG='1'
        UNION ALL (SELECT V.CHEM_CODE,
                         V.CHEM_NAME,
                         V.CHEM_TYPE,
                         V.CHEM_FORMULA,
                         V.STDMIN_SIGN,
                         V.STDMIN,
                         V.STDMAX_SIGN,
                         V.STDMAX,
                         V.STDTARGET, C.CHEM_SEQ,
                         V.ISCHECK,
       V.ISJUDGE,
       V.ISQUOTE,
       V.REP_CODE,
       V.REP_NAME,
       V.REP_MIN_SIGN,
       V.REP_MIN,
       V.REP_MAX_SIGN,
       V.REP_MAX,
       V.REP_VAL
                    FROM CRAFT_ORD_DESIGN_STD_CIC V,COM_BASE_CHEM C
                   WHERE  V.CHEM_CODE = C.CHEM_CODE AND  V.CIC = (SELECT DISTINCT G.CIC
                                    FROM PLN_STEELFOR_ORD G
                                   WHERE G.FURNACENO = ?)
                     AND V.PROCESS_CODE = 'A'
                     AND V.DESGIN_KEY =
                         (SELECT T.DESGIN_KEY
                            FROM CRAFT_ORD_DESIGN T
                           WHERE T.ORD_LN_PK = ?
                             AND T.CRAFT_SEQ = ?)
                     AND V.MSC_PLINE=?
           AND V.SPECL_FL='2' AND V.VALIDFLAG='1'))
 ORDER BY CHEM_CODE

                 ]]>
	</query>
	<query id="FrmCicIntersection.getAddSteeCic" desc="新增交集索引码">
             <![CDATA[
 INSERT INTO PLN_STEELFORFURNACE_CIC
  (FURNACENO_ALL, XH, CHEM_CODE, CHEM_NAME, CHEM_TYPE, CHEM_FORMULA, STDMIN_SIGN, STDMIN, STDMAX_SIGN, STDMAX,STDTARGET, CREATE_TIME,CIC,
  ISCHECK,ISJUDGE,ISQUOTE)
VALUES
  (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,SYSDATE,?,?,?,?)
               ]]>
	</query>
	<query id="FrmCicIntersection.getSelectSteeCic" desc="查询交集索引码">
             <![CDATA[
             SELECT COUNT(*) COUNT
  FROM PLN_STEELFORFURNACE_CIC T
 WHERE T.FURNACENO_ALL = ?
    OR T.FURNACENO_ALL = ?
              ]]>
	</query>
	<query id="FrmCicIntersection.getFurnCicALL" desc="获取cic集合">
             <![CDATA[
             SELECT LISTAGG(CIC, ',') WITHIN GROUP(ORDER BY CIC ASC) CIC
  FROM (SELECT DISTINCT T.CIC
          FROM PLN_STEELFOR_ORD T
         WHERE T.FURNACENO IN (?, ?))
              ]]>
	</query>
	<query id="FrmCicIntersection.getQueryPlnZgZz" desc="查询合同行PK,工艺文件序号">
             <![CDATA[
 SELECT C.DESGIN_KEY, T.INDEX_SEQ,T.CIC_GP||'/'||C.DESGIN_KEY||'/'||T.INDEX_SEQ CIC_GPDESG
   FROM PLN_ORDER_ZG_S T, PLN_SALEORD T1, CRAFT_ORD_DESIGN C
  WHERE T.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK
    AND C.ORD_LN_PK = T1.ORD_LN_PK
    AND C.CRAFT_SEQ = T.CRAFT_SEQ
   
                 ]]>
	</query>
	<query id="FrmCicIntersection.getQueryCicChemCodezZ" desc="查询cic对应元素">
             <![CDATA[
SELECT T.*
  FROM (SELECT V.CIC, 
               V.CHEM_NAME,
               V.STDMIN_SIGN || V.STDMIN STDMIN_SIGN,
               V.STDMAX_SIGN || V.STDMAX STDMAX_SIGN,
               T1.STD_NAME STD_NAME_NK,
               '工艺评审' STYTECHEM,V.CHEM_CODE,C.CHEM_SEQ
          FROM CRAFT_ORD_DESIGN_STD_CIC V,
               COM_MSC_STD_CIC          T,
               COM_BASE_STD             T1,
               COM_BASE_CHEM    C
         WHERE V.PROCESS_CODE = 'A'
           AND V.SPECL_FL = '2'
           AND V.VALIDFLAG = '1'
           AND T.CIC = V.CIC
           AND T.STDSTYLE = 'N'
           AND T.STD_CODE_NK = T1.STD_CODE(+)
           AND T1.VALIDFLAG = '1'
          AND V.CHEM_CODE = C.CHEM_CODE
                 ]]>
	</query>
	<query id="FrmCicIntersection.getQueryPlnZgPro" desc="查询合同行PK,工艺文件序号">
             <![CDATA[
 SELECT T1.ORD_LN_PK, T.CRAFT_SEQ,T.INDEX_SEQ
   FROM PLN_ORDER_ZG_S T, PLN_SALEORD T1
  WHERE T.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK
    AND T.GPREQ_ID = ?
                 ]]>
	</query>
	<query id="FrmCicIntersection.getQueryCICPro" desc="通过工艺文件序号,合同行PK 查询钢种成分索引码">
             <![CDATA[
SELECT COUNT(*) ICOUNT
  FROM CRAFT_ORD_DESIGN_STD_CIC V
 WHERE V.CIC = ?
   AND V.PROCESS_CODE = 'A'
   AND V.DESGIN_KEY = (SELECT T.DESGIN_KEY
                         FROM CRAFT_ORD_DESIGN T
                        WHERE T.ORD_LN_PK = ?
                          AND T.CRAFT_SEQ = ?)
   AND V.MSC_PLINE=?
   AND V.SPECL_FL='2' AND V.VALIDFLAG='1'
                 ]]>
	</query>
		<query id="FrmCicIntersection.getQueryGraderAllCIC" desc="查询交集cic对应元素">
             <![CDATA[
SELECT V.FURNACENO_ALL,
       V.CIC,
       V.CHEM_NAME,
       V.STDMIN_SIGN || V.STDMIN STDMIN_SIGN,
       V.STDMAX_SIGN || V.STDMAX STDMAX_SIGN
  FROM PLN_STEELFORFURNACE_CIC V,COM_BASE_CHEM C
 WHERE V.CHEM_CODE = C.CHEM_CODE AND V.CIC LIKE '%' || ? || '%'
   AND V.FURNACENO_ALL LIKE '%' || ? || '%'
   ORDER BY V.CIC ASC,C.CHEM_SEQ ASC
                 ]]>
	</query>
	<query id="FrmCicIntersection.DeleteAllCIC" desc="删除交集cic对应元素">
             <![CDATA[ DELETE PLN_STEELFORFURNACE_CIC WHERE FURNACENO_ALL = ?   AND CIC = ?]]>
	</query>
	</queryMap>