<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="炼钢工艺卡">

	<query id="FrmSteelProcessCard.queryLgM" desc="查询工艺卡主信息">
             <![CDATA[
SELECT T.CRAFT_NO,
       T.GRADECODE,
       T.GRADENAME,
       T.CIC,
       DECODE(T.CRAFT_TYPE, 'A', '标准卡', 'B', '联络卡') CRAFT_TYPE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.GRADE_NO,
       T.CRAFT_ROUTE,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.STD_CODE_NK,
       T.STD_NAME_NK,
       T.STD_VERSION,
       T.ORTHER_ASK,
       T.CIC_GID,
       T.TAR_CIC_GID,
       T.TEP_GID,
       T.CCM_GID,
       DECODE(T.VALIDFLAG, '00', '无效', '10', '有效') VALIDFLAG,
       T.MARK_MAN,
       TO_CHAR(T.MARK_DATE, 'YYYY-MM-DD HH24:MI:SS') MARK_DATE,
       T.APP_MAN,
       TO_CHAR(T.APP_DATE, 'YYYY-MM-DD HH24:MI:SS') APP_DATE,
       TO_CHAR(T.EXC_DATE, 'YYYY-MM-DD') EXC_DATE,
       T.ALLOY_GID,T.VERSION_NO,
        DECODE(T.DEFAULTCRAFT, '1', '默认', '') DEFAULTCRAFT
  FROM CRAFT_LG2_M T
 WHERE 1=1
                 ]]>
	</query>
	<query id="FrmSteelProcessCard.queryLgCic" desc="查询工艺卡CIC信息">
             <![CDATA[
   SELECT *
 FROM CRAFT_LG2_CIC T
 WHERE T.CIC_GID = ?
 ORDER BY T.XH ASC
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryLgTarCic" desc="查询工艺卡目标CIC信息">
             <![CDATA[
 SELECT 
       T.*
 FROM CRAFT_LG2_TAR_CIC T
 WHERE T.TAR_CIC_GID = ?
  ORDER BY T.XH ASC
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryLgCcm" desc="查询工艺卡CCM信息">
             <![CDATA[
  SELECT 
       T.CCM_GID,
       T.XH,
       T.CCM_CODE,
       T.COOLING_VAL,
       T.DIAMETER,
       T.WATER_NO
 FROM CRAFT_LG2_CCM T
 WHERE T.CCM_GID = ?
 ORDER BY T.XH ASC
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryLgtTem" desc="查询工艺卡温度信息">
             <![CDATA[
 SELECT 
       T.TEP_GID,
       T.XH,
       T.STATION_CODE,
       T.TEP_VAL1_MIN,
       T.TEP_VAL1_MAX,
       T.TEP_VAL2_MIN,
       T.TEP_VAL2_MAX,
       T.TEP_VAL
 FROM CRAFT_LG2_TEMPERATURE T
 WHERE T.TEP_GID=?
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryCraftNo" desc="查询工艺号">
             <![CDATA[
             SELECT DISTINCT T.CRAFT_NO FROM CRAFT_LG2_M T WHERE T.VALIDFLAG = '10'
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryOrdDesigStdCic" desc="查询工艺评审CIC">
             <![CDATA[
             SELECT ROW_NUMBER() OVER(ORDER BY V.CHEM_CODE) XH,V.CHEM_CODE,V.CIC,
       V.CHEM_NAME,
       V.CHEM_TYPE,
       V.CHEM_FORMULA,
       V.STDMIN_SIGN,
       V.STDMIN,
       V.STDMAX_SIGN,
       V.STDMAX,
       V.STDTARGET,
       V.ELE_CODE,
       V.ELE_NAME,
       V.ELE_MIN_SIGN,
       V.ELE_MIN,
       V.ELE_MAX_SIGN,
       V.ELE_MAX,
       V.CIC_MEMO,
       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.PROCESS_CODE = 'A'
   AND V.VALIDFLAG = '1'
   AND V.SPECL_FL = '2'
   AND V.CHEM_CODE = C.CHEM_CODE
   AND V.CIC = ?
   AND V.DESGIN_KEY =
       (SELECT MAX(C.DESGIN_KEY)
          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
           AND T.GPREQ_ID = (SELECT MAX(G.PRO_PLAN_ID)
                               FROM PLN_STEELFOR_ORD G
                              WHERE G.SURPLUSFLAG = '0'
                                AND G.FURNACENO = ? AND G.CCM_PLN_TYPE ='00'))
   AND V.MSC_PLINE =
       (SELECT MAX(T.INDEX_SEQ)
          FROM PLN_ORDER_ZG_S T
         WHERE T.GPREQ_ID = (SELECT MAX(G.PRO_PLAN_ID)
                               FROM PLN_STEELFOR_ORD G
                              WHERE G.SURPLUSFLAG = '0'
                                AND G.FURNACENO = ? AND G.CCM_PLN_TYPE ='00'))
                                
   ORDER BY C.CHEM_SEQ ASC ,V.CHEM_CODE ASC
               ]]>
	</query>

	<query id="FrmSteelProcessCard.queryOrdDesigStdCicByProPlnID" desc="查询工艺评审CIC">
		<![CDATA[
             SELECT ROW_NUMBER() OVER(ORDER BY V.CHEM_CODE) XH,V.CHEM_CODE,V.CIC,
       V.CHEM_NAME,
       V.CHEM_TYPE,
       V.CHEM_FORMULA,
       V.STDMIN_SIGN,
       V.STDMIN,
       V.STDMAX_SIGN,
       V.STDMAX,
       V.STDTARGET,
       V.ELE_CODE,
       V.ELE_NAME,
       V.ELE_MIN_SIGN,
       V.ELE_MIN,
       V.ELE_MAX_SIGN,
       V.ELE_MAX,
       V.CIC_MEMO,
       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.PROCESS_CODE = 'A'
   AND V.VALIDFLAG = '1'
   AND V.SPECL_FL = '2'
   AND V.CHEM_CODE = C.CHEM_CODE
   AND V.CIC = ?
   AND V.DESGIN_KEY =
       (SELECT MAX(C.DESGIN_KEY)
          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
           AND T.GPREQ_ID = ?)
   AND V.MSC_PLINE =
       (SELECT MAX(T.INDEX_SEQ)
          FROM PLN_ORDER_ZG_S T
         WHERE T.GPREQ_ID =?)

   ORDER BY C.CHEM_SEQ ASC ,V.CHEM_CODE ASC
               ]]>
	</query>

	<query id="FrmSteelProcessCard.queryOrdDesigStdCicByZGProPlnID" desc="查询工艺评审CIC">
		<![CDATA[
             SELECT ROW_NUMBER() OVER(ORDER BY V.CHEM_CODE) XH,V.CHEM_CODE,V.CIC,
       V.CHEM_NAME,
       V.CHEM_TYPE,
       V.CHEM_FORMULA,
       V.STDMIN_SIGN,
       V.STDMIN,
       V.STDMAX_SIGN,
       V.STDMAX,
       V.STDTARGET,
       V.ELE_CODE,
       V.ELE_NAME,
       V.ELE_MIN_SIGN,
       V.ELE_MIN,
       V.ELE_MAX_SIGN,
       V.ELE_MAX,
       V.CIC_MEMO,
       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,
       (SELECT T1.ORD_LN_PK, D.DESGIN_KEY, T2.INDEX_SEQ
          FROM PLN_SALEORD T1, PLN_ORDER_ZG_S T2, CRAFT_ORD_DESIGN D
         WHERE T1.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK
           AND T1.ORD_LN_PK = D.ORD_LN_PK
           AND T2.CRAFT_SEQ = D.CRAFT_SEQ
           AND T2.PRO_PLAN_ID = ?
           AND T2.GX_PLAN_NO = ?) B
 WHERE V.PROCESS_CODE = 'A'
   AND V.CHEM_CODE = C.CHEM_CODE
   AND V.DESGIN_KEY = B.DESGIN_KEY
   AND V.MSC_PLINE = B.INDEX_SEQ
   AND V.CIC = ?
   AND V.VALIDFLAG = '1'
   AND V.SPECL_FL='2'
 ORDER BY C.CHEM_SEQ ASC ,V.CHEM_CODE ASC
               ]]>
	</query>

	<query id="FrmSteelProcessCard.queryChenName" desc="查询元素">
             <![CDATA[
SELECT ROW_NUMBER() OVER(ORDER BY T.CHEM_CODE) XH,
       T.CHEM_CODE,
       T.CHEM_NAME,
       T.CHEM_TYPE,
       T.CHEM_FORMULA
  FROM COM_BASE_CHEM T
 WHERE T.VALIDFLAG = '1'
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryMaxCraftNo" desc="查询最大工艺卡号">
             <![CDATA[
SELECT ? || TO_CHAR(SYSDATE, 'YY') ||
       LPAD(TO_NUMBER(NVL(SUBSTR(MAX(T.CRAFT_NO), 9), '000')) + 1, 3, '0') AS CRAFT_NO
  FROM CRAFT_LG2_M T
 WHERE T.GRADECODE = ?
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryMaxCicNo" desc="查询最大成分ID">
             <![CDATA[
SELECT 'CIC' || ? ||
       LPAD(TO_NUMBER(SUBSTR(NVL(MAX(T.CIC_GID), '000000'), 6)) + 1,
            6,
            '0') AS CIC_GID
  FROM CRAFT_LG2_CIC T
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryMaxTarCicNo" desc="查询最大目标成分ID">
             <![CDATA[
SELECT 'TCIC' || ? ||
       LPAD(TO_NUMBER(SUBSTR(NVL(MAX(T.TAR_CIC_GID), '000000'), 7)) + 1,
            6,
            '0') AS TAR_CIC_GID
  FROM CRAFT_LG2_TAR_CIC T
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryMaxTarCicXH" desc="查询最大目标成分ID序号">
             <![CDATA[
SELECT MAX(T.XH) AS XH FROM CRAFT_LG2_TAR_CIC T
 WHERE T.TAR_CIC_GID = ?
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryMaxCcmXH" desc="查询最大CCM序号">
             <![CDATA[
SELECT MAX(T.XH) AS XH FROM CRAFT_LG2_CCM T WHERE T.CCM_GID = ?
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryMaxTepXH" desc="查询最大温度序号">
             <![CDATA[
SELECT MAX(T.XH) AS XH FROM CRAFT_LG2_TEMPERATURE T WHERE T.TEP_GID = ?
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryMaxHjXH" desc="查询最大合金配置序号">
             <![CDATA[
SELECT MAX(T.XH) AS XH FROM CRAFT_LG2_ALLOY T WHERE T.ALLOY_GID = ?
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryMaxCcmNo" desc="查询最大ccmID">
             <![CDATA[
SELECT 'CCM' || ? ||
       LPAD(TO_NUMBER(SUBSTR(NVL(MAX(T.CCM_GID), '000000'), 6)) + 1,
            6,
            '0') AS CCM_GID
  FROM CRAFT_LG2_CCM T

               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryMaxTepNo" desc="查询最大温度Id">
             <![CDATA[
SELECT 'TEP' || ? ||
       LPAD(TO_NUMBER(SUBSTR(NVL(MAX(T.TEP_GID), '000000'), 6)) + 1,
            6,
            '0') AS TEP_GID
  FROM CRAFT_LG2_TEMPERATURE T
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryStdCic" desc="查询内控标准">
             <![CDATA[
SELECT T.STD_CODE, T.STD_NAME, T.STD_VERSION, C.CIC
  FROM COM_BASE_STD T,
       COM_MSC_STD_CIC C
 WHERE T.STD_CODE = C.STD_CODE_NK
   AND T.STDSTYLE = 'N'
   AND T.VALIDFLAG = '1'
   AND C.VALIDFLAG != '0'
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryProduName" desc="获取品名">
             <![CDATA[
             SELECT T.PRODUC_JX,T.PRODUCCODE
  FROM COM_BASE_PRODUCT T
 WHERE T.VALIDFLAG = '1'
 ORDER BY T.PRODUC_JX ASC
              ]]>
	</query>
	<query id="FrmSteelProcessCard.queryComBaseCcm" desc="获取水表">
             <![CDATA[
SELECT T.CCM_CODE,
       T.PLINE_NAME 铸造产线,
       T.GRADENAME 钢种,
       T.WATER_NO 水表号,
       T.DIAMETER 直径,
       DECODE(T.COOLING_VAL, '0', '强', '1', '中', '2', '弱') 冷却强度,
       T.TEP_VAL 液相线温度,
       T.CIC 索引码
  FROM COM_BASE_CCM T
 WHERE T.VALIDFLAG = '1'
   AND T.PLINE_CODE =?
   AND T.GRADECODE = ?
   AND INSTR(?, T.CIC) > 0
           ]]>
	</query>
	<query id="FrmSteelProcessCard.queryComBaseTep" desc="获取温度上下偏差">
             <![CDATA[
SELECT T.PLINE_CODE,
       T.PLINE_NAME,
       T.PLAN_ROUTE,
       T.PRO_POINT,
       NVL(T.DEVIATION_NO1,0) DEVIATION_NO1,
       NVL(T.DEVIATION_UN1,0) DEVIATION_UN1,
       NVL(T.DEVIATION_NO2,0) DEVIATION_NO2,
       NVL(T.DEVIATION_NU2,0) DEVIATION_NU2
  FROM COM_BASE_DEVIATION T
 WHERE T.PLINE_CODE = ?
   AND T.PLAN_ROUTE = ?
   AND T.PRO_POINT  = ?
           ]]>
	</query>
	<query id="FrmSteelProcessCard.addLgCic" desc="新增成分">
             <![CDATA[
 INSERT INTO CRAFT_LG2_CIC(
        CIC_GID,
        XH,
        CHEM_CODE,
        CHEM_NAME,
        CHEM_TYPE,
        CHEM_FORMULA,
        STDMIN_SIGN,
        STDMIN,
        STDMAX_SIGN,
        STDMAX,
        STDTARGET,
        ELE_CODE,
        ELE_NAME,
        ELE_MIN_SIGN,
        ELE_MIN,
        ELE_MAX_SIGN,
        ELE_MAX,
        MEMO,
ISCHECK,
       ISJUDGE,
       ISQUOTE,
       REP_CODE,
       REP_NAME,
       REP_MIN_SIGN,
       REP_MIN,
       REP_MAX_SIGN,
       REP_MAX,
       REP_VAL,
       NEWFLAG
        )
 VALUES( 
        '#CIC_GID#',
        '#XH#',
        '#CHEM_CODE#',
        '#CHEM_NAME#',
        '#CHEM_TYPE#',
        '#CHEM_FORMULA#',
        '#STDMIN_SIGN#',
        '#STDMIN#',
        '#STDMAX_SIGN#',
        '#STDMAX#',
        '#STDTARGET#',
        '#ELE_CODE#',
        '#ELE_NAME#',
        '#ELE_MIN_SIGN#',
        '#ELE_MIN#',
        '#ELE_MAX_SIGN#',
        '#ELE_MAX#',
        '#MEMO#',
        '#ISCHECK#',
       '#ISJUDGE#',
       '#ISQUOTE#',
       '#REP_CODE#',
       '#REP_NAME#',
       '#REP_MIN_SIGN#',
       '#REP_MIN#',
       '#REP_MAX_SIGN#',
       '#REP_MAX#',
       '#REP_VAL#',
       '#NEWFLAG#')
              ]]>
	</query>
	<query id="FrmSteelProcessCard.addLgTarCic" desc="新增目标成分">
             <![CDATA[
 INSERT INTO CRAFT_LG2_TAR_CIC(
        TAR_CIC_GID,
        XH,
        STATION_CODE,
        CHEM_CODE,
        CHEM_NAME,
        STDMIN_SIGN,
        STDMIN,
        STDMAX_SIGN,
        STDMAX)
 VALUES( 
        '#TAR_CIC_GID#',
        '#XH#',
        '#STATION_CODE#',
        '#CHEM_CODE#',
        '#CHEM_NAME#',
        '#STDMIN_SIGN#',
        '#STDMIN#',
        '#STDMAX_SIGN#',
        '#STDMAX#')
              ]]>
	</query>
	<query id="FrmSteelProcessCard.addLgCcm" desc="新增CCM">
             <![CDATA[
 INSERT INTO CRAFT_LG2_CCM(
        CCM_GID,
        XH,
        CCM_CODE,
        COOLING_VAL,
        DIAMETER,
        WATER_NO)
 VALUES( 
        '#CCM_GID#',
        '#XH#',
        '#CCM_CODE#',
        '#COOLING_VAL#',
        '#DIAMETER#',
        '#WATER_NO#')
              ]]>
	</query>
	<query id="FrmSteelProcessCard.addLgTep" desc="新增温度">
             <![CDATA[
 INSERT INTO CRAFT_LG2_TEMPERATURE(
        TEP_GID,
        XH,
        STATION_CODE,
        TEP_VAL1_MIN,
        TEP_VAL1_MAX,
        TEP_VAL2_MIN,
        TEP_VAL2_MAX,
        TEP_VAL)
 VALUES( 
        '#TEP_GID#',
        '#XH#',
        '#STATION_CODE#',
        '#TEP_VAL1_MIN#',
        '#TEP_VAL1_MAX#',
        '#TEP_VAL2_MIN#',
        '#TEP_VAL2_MAX#',
        '#TEP_VAL#')
              ]]>
	</query>
	<query id="FrmSteelProcessCard.addLgCraftNoM" desc="新增工艺卡主信息">
             <![CDATA[
  INSERT INTO CRAFT_LG2_M(
        CRAFT_NO,
        GRADECODE,
        GRADENAME,
        CIC,
        CRAFT_TYPE,
        PLINE_CODE,
        PLINE_NAME,
        GRADE_NO,
        CRAFT_ROUTE,
        PRODUCCODE,
        PRODUCNAME,
        STD_CODE_NK,
        STD_NAME_NK,
        STD_VERSION,
        ORTHER_ASK,
        CIC_GID,
        TAR_CIC_GID,
        TEP_GID,
        CCM_GID,
        VALIDFLAG,
        MARK_MAN,
        MARK_DATE,
        APP_MAN,
        APP_DATE,
        EXC_DATE,ALLOY_GID,VERSION_NO)
 VALUES( 
        '#CRAFT_NO#',
        '#GRADECODE#',
        '#GRADENAME#',
        '#CIC#',
        '#CRAFT_TYPE#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#GRADE_NO#',
        '#CRAFT_ROUTE#',
        '#PRODUCCODE#',
        '#PRODUCNAME#',
        '#STD_CODE_NK#',
        '#STD_NAME_NK#',
        '#STD_VERSION#',
        '#ORTHER_ASK#',
        '#CIC_GID#',
        '#TAR_CIC_GID#',
        '#TEP_GID#',
        '#CCM_GID#',
        '10',
        '#MARK_MAN#',
        SYSDATE,
        '#APP_MAN#',
        SYSDATE,
        SYSDATE,'#ALLOY_GID#','#VERSION_NO#')
              ]]>
	</query>
	<query id="FrmSteelProcessCard.updateLgCraftNoM" desc="修改工艺卡主信息">
             <![CDATA[
 UPDATE CRAFT_LG2_M T SET 
        T.CRAFT_TYPE = '#CRAFT_TYPE#',
        T.GRADE_NO = '#GRADE_NO#',
        T.PRODUCCODE = '#PRODUCCODE#',
        T.PRODUCNAME = '#PRODUCNAME#',
        T.ORTHER_ASK = '#ORTHER_ASK#'
 WHERE T.CRAFT_NO = '#CRAFT_NO#'
              ]]>
	</query>
	<query id="FrmSteelProcessCard.updateLgCic" desc="修改成分">
             <![CDATA[
 UPDATE CRAFT_LG2_CIC T
   SET T.STDMIN    = '#STDMIN#',
       T.STDMAX    = '#STDMAX#',
       T.STDTARGET = '#STDTARGET#',
       T.MEMO      = '#MEMO#'
 WHERE T.CIC_GID = '#CIC_GID#'
   AND T.XH = '#XH#'
             
              ]]>
	</query>
	<query id="FrmSteelProcessCard.updateLgTarCic" desc="修改目标成分">
             <![CDATA[
             UPDATE CRAFT_LG2_TAR_CIC T
   SET T.STATION_CODE = '#STATION_CODE#',
       T.CHEM_CODE    = '#CHEM_CODE#',
       T.CHEM_NAME    = '#CHEM_NAME#',
       T.STDMIN_SIGN  = '#STDMIN_SIGN#',
       T.STDMIN       = '#STDMIN#',
       T.STDMAX_SIGN  = '#STDMAX_SIGN#',
       T.STDMAX       = '#STDMAX#'
 WHERE T.TAR_CIC_GID = '#TAR_CIC_GID#'
   AND T.XH = '#XH#'           
              ]]>
	</query>
	<query id="FrmSteelProcessCard.updateLgCcm" desc="修改CCm">
             <![CDATA[
  UPDATE CRAFT_LG2_CCM T
   SET T.CCM_CODE = '#CCM_CODE#',
       T.COOLING_VAL = '#COOLING_VAL#',
       T.DIAMETER    = '#DIAMETER#',
       T.WATER_NO    = '#WATER_NO#'
 WHERE T.CCM_GID = '#CCM_GID#'
   AND T.XH = '#XH#'
              ]]>
	</query>
	<query id="FrmSteelProcessCard.updateLgTem" desc="修改温度">
             <![CDATA[
 UPDATE CRAFT_LG2_TEMPERATURE T
   SET T.STATION_CODE = '#STATION_CODE#',
       T.TEP_VAL1_MIN = '#TEP_VAL1_MIN#',
       T.TEP_VAL1_MAX = '#TEP_VAL1_MAX#',
       T.TEP_VAL2_MIN = '#TEP_VAL2_MIN#',
       T.TEP_VAL2_MAX = '#TEP_VAL2_MAX#',
       T.TEP_VAL      = '#TEP_VAL#'
 WHERE T.TEP_GID = '#TEP_GID#'
   AND T.XH='#XH#'
              ]]>
	</query>
	<query id="FrmSteelProcessCard.DeleteLgCraftNoM" desc="删除主表信息">
             <![CDATA[
               DELETE CRAFT_LG2_M WHERE CRAFT_NO = '#CRAFT_NO#'
               ]]>
	</query>
	<query id="FrmSteelProcessCard.DeleteLgCic" desc="删除CIC信息">
             <![CDATA[
          DELETE CRAFT_LG2_CIC WHERE CIC_GID = '#CIC_GID#'
               ]]>
	</query>
	<query id="FrmSteelProcessCard.DeleteLgTar" desc="删除目标成分信息">
             <![CDATA[
             DELETE CRAFT_LG2_TAR_CIC WHERE TAR_CIC_GID = '#TAR_CIC_GID#'
               ]]>
	</query>
	<query id="FrmSteelProcessCard.DeleteLgCcm" desc="删除CCM信息">
             <![CDATA[
             DELETE CRAFT_LG2_CCM WHERE CCM_GID = '#CCM_GID#'
               ]]>
	</query>
	<query id="FrmSteelProcessCard.DeleteLgTep" desc="删除温度信息">
             <![CDATA[
             DELETE CRAFT_LG2_TEMPERATURE WHERE TEP_GID = '#TEP_GID#'
               ]]>
	</query>
	<query id="FrmSteelProcessCard.UpdateFurnNo" desc="修改炉次炼钢工艺卡">
             <![CDATA[
             UPDATE PLN_STEELFORFURNACE SET CRAFT_NO=? WHERE CRAFT_NO=?
               ]]>
	</query>
	<query id="FrmSteelProcessCard.UpdateFurnNoZz" desc="修改铸造炼钢工艺卡">
             <![CDATA[
             UPDATE PLN_ORDER_CAST_S SET CRAFT_NO=? WHERE PRO_PLAN_ID=? AND GX_PLAN_NO=?
               ]]>
	</query>
	<query id="FrmSteelProcessCard.UpdatePlnOrderCastCraftNo" desc="修改铸造炼钢工艺卡">
             <![CDATA[
             UPDATE PLN_ORDER_CAST_S SET CRAFT_NO='' WHERE PRO_PLAN_ID=? AND GX_PLAN_NO=? AND CRAFT_NO=?
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryProdu" desc="查询炉次订单对应品名">
             <![CDATA[
         SELECT T1.PRODUCNAME, T1.PRODUCCODE
  FROM PLN_STEELFOR_ORD T,
       (SELECT MAX(Y.ABRVITION) FINAL_USER_DESC,
               MAX(S.ORDER_NO || '/' || S.ORDER_SEQ) ORDER_SEQ_NO,
               Z.GPREQ_ID,
               MAX(S.PRODUCNAME) PRODUCNAME,
               MAX(S.PRODUCCODE) PRODUCCODE
          FROM PLN_ORDER_ZG_S    Z,
               PLN_SALEORD       S,
               PLN_STEELFOR_ORD  C,
               SLM_BASE_CUSTOMER Y
         WHERE Z.ORD_LN_DLY_PK = S.ORD_LN_DLY_PK
           AND Z.GPREQ_ID = C.PRO_PLAN_ID
           AND S.FINAL_USER = Y.CUSTOMER_NO
           AND C.CCM_PLN_TYPE ='00'
         GROUP BY Z.GPREQ_ID) T1
 WHERE 1 = 1
   AND T.PRO_PLAN_ID = T1.GPREQ_ID(+)
   AND T.FURNACENO = ?
   AND T.CCM_PLN_TYPE ='00'
               ]]>
	</query>

	<query id="FrmSteelProcessCard.queryProduByProPlanID" desc="查询炉次订单对应品名">
		<![CDATA[
       SELECT MAX(S.PRODUCNAME) PRODUCNAME,
               MAX(S.PRODUCCODE) PRODUCCODE
          FROM PLN_ORDER_ZG_S    Z,
               PLN_SALEORD       S,
               SLM_BASE_CUSTOMER Y
         WHERE Z.ORD_LN_DLY_PK = S.ORD_LN_DLY_PK
           AND S.FINAL_USER = Y.CUSTOMER_NO
           AND  Z.GPREQ_ID = ?
               ]]>
	</query>

	<query id="FrmSteelProcessCard.queryOrdDesigJJCic" desc="查询交集CIC">
             <![CDATA[
           SELECT ROW_NUMBER() OVER(ORDER BY V.CHEM_CODE) XH,
       V.CHEM_CODE,
       V.CHEM_NAME,
       V.CHEM_TYPE,
       V.CHEM_FORMULA,
       V.STDMIN_SIGN,
       V.STDMIN,
       V.STDMAX_SIGN,
       V.STDMAX,
       V.STDTARGET,
       V.CIC
  FROM PLN_STEELFORFURNACE_CIC V,COM_BASE_CHEM C
 WHERE V.CHEM_CODE = C.CHEM_CODE
   AND V.CIC = ?
   AND V.FURNACENO_ALL LIKE '%' || ? || '%'
 ORDER BY C.CHEM_SEQ ASC ,V.CHEM_CODE ASC
               ]]>
	</query>
	<query id="FrmSteelProcessCard.queryLgtHj" desc="查询合金配置信息">
             <![CDATA[
  SELECT 
       T.ALLOY_GID,
       T.XH,
       T.ITEM_CODE,
       T.ITEM_NAME,
       T.INPUT_AMOUNT
 FROM CRAFT_LG2_ALLOY T
 WHERE T.ALLOY_GID = ?
              ]]>
	</query>
	<query id="FrmSteelProcessCard.queryLgtHjGrae" desc="根据钢种查询合金配置信息">
             <![CDATA[
 SELECT T.ITEM_CODE, T.ITEM_NAME, T.INPUT_AMOUNT
  FROM COST_BASE_METAL_R_GRADE T
 WHERE T.GRADECODE = ?
              ]]>
	</query>
	<query id="FrmSteelProcessCard.queryItemCode" desc="查询合金物料信息">
             <![CDATA[
SELECT T.ITEM_CODE,T.ITEM_NAME FROM COST_BASE_METAL_TYPE T WHERE T.ARC_CODE='111002'
              ]]>
	</query>
	<query id="FrmSteelProcessCard.addLgHj" desc="新增合金配置">
             <![CDATA[
 INSERT INTO CRAFT_LG2_ALLOY(
        ALLOY_GID,
        ITEM_CODE,
        ITEM_NAME,
        INPUT_AMOUNT,XH)
 VALUES( 
        '#ALLOY_GID#',
        '#ITEM_CODE#',
        '#ITEM_NAME#',
        '#INPUT_AMOUNT#','#XH#')
              ]]>
	</query>
	<query id="FrmSteelProcessCard.UpdateLgHj" desc="修改合金配置">
             <![CDATA[
 UPDATE CRAFT_LG2_ALLOY T
   SET  T.ITEM_CODE = '#ITEM_CODE#',
        T.ITEM_NAME = '#ITEM_NAME#',
        T.INPUT_AMOUNT = '#INPUT_AMOUNT#'
 WHERE T.ALLOY_GID = '#ALLOY_GID#'
 AND T.XH='#XH#'
              ]]>
	</query>
	<query id="FrmSteelProcessCard.DeleteLgHj" desc="删除合金配置">
             <![CDATA[
DELETE CRAFT_LG2_ALLOY WHERE ALLOY_GID ='#ALLOY_GID#'
              ]]>
	</query>
	<query id="FrmSteelProcessCard.queryLgMversionNo" desc="查询工艺版本号">
             <![CDATA[
SELECT MAX(T.VERSION_NO) VERSION_NO
  FROM CRAFT_LG2_M T
 WHERE T.CIC = ?
   AND T.GRADECODE = ?
   AND T.PLINE_CODE = ?
              ]]>
	</query>
	<query id="FrmSteelProcessCard.queryComMscChemCode" desc="查询基础数据CIC">
             <![CDATA[
             SELECT T.CHEM_NAME,
       T.STDMIN_SIGN,
       T.STDMIN,
       T.STDMAX_SIGN,
       T.STDMAX,
       T.STDTARGET
  FROM COM_MSC_STD_CHEM T
  WHERE 1=1
                ]]>
	</query>

	<query id="FrmSteelProcessCard.queryOrdDesigCicByProPlanID" desc="查询CIC(工艺评审，交集)">
	<![CDATA[
             SELECT *
  FROM (SELECT
               V.CHEM_CODE CHEMCODE,
               V.CHEM_NAME CHEMNAME,
               V.CHEM_TYPE CHEMTYPE,
               V.CHEM_FORMULA CHEMFORMULA,
               V.STDMIN_SIGN STDMINSIGN,
               V.STDMIN,
               V.STDMAX_SIGN  STDMAXSIGN,
               V.STDMAX,
               V.STDTARGET,
               V.CIC,
               V.ELE_CODE ELECODE,
               V.ELE_NAME ELENAME,
               V.ELE_MIN_SIGN ELEMINSIGN,
               V.ELE_MIN ELEMIN,
               V.ELE_MAX_SIGN ELEMAXSIGN,
               V.ELE_MAX ELEMAX,
               V.CIC_MEMO CICMEMO,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.PROCESS_CODE = 'A'
           AND V.VALIDFLAG = '1'
           AND V.SPECL_FL = '2'
           AND V.CHEM_CODE = C.CHEM_CODE
           AND V.CIC = ?
           AND V.DESGIN_KEY =
               (SELECT MAX(C.DESGIN_KEY)
                  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
                   AND T.GPREQ_ID =? )
           AND V.MSC_PLINE =
               (SELECT MAX(T.INDEX_SEQ)
                  FROM PLN_ORDER_ZG_S T
                 WHERE T.GPREQ_ID = ?)

           )
 ORDER BY CIC,CHEM_SEQ ASC
                ]]>
</query>

	<query id="FrmSteelProcessCard.queryOrdDesigCicByZGProPlanID" desc="查询CIC(工艺评审，交集)">
		<![CDATA[
             SELECT
               V.CHEM_CODE CHEMCODE,
               V.CHEM_NAME CHEMNAME,
               V.CHEM_TYPE CHEMTYPE,
               V.CHEM_FORMULA CHEMFORMULA,
               V.STDMIN_SIGN STDMINSIGN,
               V.STDMIN,
               V.STDMAX_SIGN  STDMAXSIGN,
               V.STDMAX,
               V.STDTARGET,
               V.CIC,
               V.ELE_CODE ELECODE,
               V.ELE_NAME ELENAME,
               V.ELE_MIN_SIGN ELEMINSIGN,
               V.ELE_MIN ELEMIN,
               V.ELE_MAX_SIGN ELEMAXSIGN,
               V.ELE_MAX ELEMAX,
               V.CIC_MEMO CICMEMO,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,
       (SELECT T1.ORD_LN_PK, D.DESGIN_KEY, T2.INDEX_SEQ
          FROM PLN_SALEORD T1, PLN_ORDER_ZG_S T2, CRAFT_ORD_DESIGN D
         WHERE T1.ORD_LN_DLY_PK = T2.ORD_LN_DLY_PK
           AND T1.ORD_LN_PK = D.ORD_LN_PK
           AND T2.CRAFT_SEQ = D.CRAFT_SEQ
           AND T2.PRO_PLAN_ID = ?
           AND T2.GX_PLAN_NO = ?) B
 WHERE V.PROCESS_CODE = 'A'
   AND V.CHEM_CODE = C.CHEM_CODE
   AND V.DESGIN_KEY = B.DESGIN_KEY
   AND V.MSC_PLINE = B.INDEX_SEQ
   AND V.CIC = ?
   AND V.VALIDFLAG = '1'
   AND V.SPECL_FL='2'
 ORDER BY C.CHEM_SEQ ASC ,V.CHEM_CODE ASC
                ]]>
	</query>

	<query id="FrmSteelProcessCard.queryOrdDesigCic" desc="查询CIC(工艺评审，交集)">
             <![CDATA[
             SELECT *
  FROM (SELECT 
               V.CHEM_CODE CHEMCODE,
               V.CHEM_NAME CHEMNAME,
               V.CHEM_TYPE CHEMTYPE,
               V.CHEM_FORMULA CHEMFORMULA,
               V.STDMIN_SIGN STDMINSIGN,
               V.STDMIN,
               V.STDMAX_SIGN  STDMAXSIGN,
               V.STDMAX,
               V.STDTARGET,
               V.CIC,
               V.ELE_CODE ELECODE,
               V.ELE_NAME ELENAME,
               V.ELE_MIN_SIGN ELEMINSIGN,
               V.ELE_MIN ELEMIN,
               V.ELE_MAX_SIGN ELEMAXSIGN,
               V.ELE_MAX ELEMAX,
               V.CIC_MEMO CICMEMO,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.PROCESS_CODE = 'A'
           AND V.VALIDFLAG = '1'
           AND V.SPECL_FL = '2'
           AND V.CHEM_CODE = C.CHEM_CODE
           AND V.CIC = ?
           AND V.DESGIN_KEY =
               (SELECT MAX(C.DESGIN_KEY)
                  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
                   AND T.GPREQ_ID =(SELECT MAX(G.PRO_PLAN_ID)
                               FROM PLN_STEELFOR_ORD G
                              WHERE G.SURPLUSFLAG = '0'
                                AND G.FURNACENO = ? AND G.CCM_PLN_TYPE ='00'))
           AND V.MSC_PLINE =
               (SELECT MAX(T.INDEX_SEQ)
                  FROM PLN_ORDER_ZG_S T
                 WHERE T.GPREQ_ID =(SELECT MAX(G.PRO_PLAN_ID)
                               FROM PLN_STEELFOR_ORD G
                              WHERE G.SURPLUSFLAG = '0'
                                AND G.FURNACENO = ? AND G.CCM_PLN_TYPE ='00'))
        UNION ALL
        SELECT 
                V.CHEM_CODE CHEMCODE,
               V.CHEM_NAME CHEMNAME,
               V.CHEM_TYPE CHEMTYPE,
               V.CHEM_FORMULA CHEMFORMULA,
               V.STDMIN_SIGN STDMINSIGN,
               V.STDMIN,
               V.STDMAX_SIGN  STDMAXSIGN,
               V.STDMAX,
               V.STDTARGET,
               V.CIC,
               V.ELE_CODE ELECODE,
               V.ELE_NAME ELENAME,
               V.ELE_MIN_SIGN ELEMINSIGN,
               V.ELE_MIN ELEMIN,
               V.ELE_MAX_SIGN ELEMAXSIGN,
               V.ELE_MAX ELEMAX,
               '' CICMEMO,
               C.CHEM_SEQ,
               V.ISCHECK ISCHECK,
              V.ISJUDGE ISJUDGE,
               V.ISQUOTE ISQUOTE,
               V.REP_CODE REP_CODE,
               V.REP_NAME REP_NAME,
               V.REP_MIN_SIGN REP_MIN_SIGN,
               V.REP_MIN REP_MIN,
               V.REP_MAX_SIGN REP_MAX_SIGN,
               V.REP_MAX REP_MAX,
               V.REP_VAL REP_VAL

          FROM PLN_STEELFORFURNACE_CIC V,COM_BASE_CHEM C
         WHERE V.CHEM_CODE = C.CHEM_CODE
         AND INSTR(V.CIC, ?) > 0  
          -- AND V.FURNACENO_ALL LIKE '%' || ? || '%'
           )
 ORDER BY CIC,CHEM_SEQ ASC           
                ]]>
	</query>


	<query id="FrmSteelProcessCard.queryAllGrade" desc="查询所有基础钢种">
		<![CDATA[
                SELECT * FROM COM_BASE_GRADE
                ]]>
	</query>

	<query id="FrmSteelProcessCard.queryMscStd" desc="">
		<![CDATA[
               SELECT *
  FROM COM_MSC_STD_CIC
 WHERE STD_CODE_NK IN ('STD0000860', 'STD0001096')
      AND VALIDFLAG <> '0'
                ]]>
	</query>

	<query id="FrmSteelProcessCard.queryMscStdChem" desc="">
		<![CDATA[
              SELECT * FROM COM_MSC_STD_CHEM
              WHERE VALIDFLAG='1'
                ]]>
	</query>

	<query id="FrmSteelProcessCard.queryAllMscStdChem" desc="">
		<![CDATA[
      SELECT A.GRADENAME,
                B.CIC,
                B.CHEM_CODE,
                B.CHEM_NAME,
                B.STDMIN_SIGN || B.STDMIN STDMIN,
                B.STDMAX_SIGN || B.STDMAX STDMAX
           FROM COM_MSC_STD_CIC A, COM_MSC_STD_CHEM B，COM_BASE_CHEM C
          WHERE A.STD_CODE_NK IN ('STD0000860', 'STD0001096')
                AND A.VALIDFLAG <> '0'
                AND B.VALIDFLAG = '1'
                AND A.CIC = B.CIC
               AND  B.CHEM_CODE = C.CHEM_CODE
                AND (B.STDMIN IS NOT NULL OR B.STDMAX IS NOT NULL)
          ORDER BY A.GRADECODE, A.CIC, C.CHEM_SEQ

                ]]>
	</query>

	<query id="FrmSteelProcessCard.queryBaseChem" desc="">
		<![CDATA[
SELECT *  FROM COM_BASE_CHEM ORDER BY CHEM_SEQ

                ]]>
	</query>

</queryMap>