<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="利库">
	<query id="FrmPlanMaterialRcl.updatePlnZgM" desc="修改热处理虚拟炉计划">
		<![CDATA[
DECLARE
BEGIN
  FOR MYROW IN (SELECT SUM(T.PLAN_INDOUBLE_NUM) V_NUM,
                       SUM(T.PLAN_INDOUBLE_WT) V_WT,
                       NVL(C.BURNOUT_RATE, 0) / 100 V_BURNOUT_RATE
                  FROM PLN_ZY_RCL_C T, COM_BASE_PLINE C
                 WHERE T.PLINE_CODE = C.PLINE_CODE
                   AND T.HEAT_PLAN_NO = ?
                 GROUP BY C.BURNOUT_RATE) LOOP
    UPDATE PLN_ZY_RCL_M T
       SET T.PLN_INSINGLE_NUM  = MYROW.V_NUM,
           T.PLN_INSINGLE_WT   = MYROW.V_WT,
           T.PLN_OUTSINGLE_NUM = MYROW.V_NUM,
           T.PLN_OUTSINGLE_W   = MYROW.V_WT - MYROW.V_WT * MYROW.V_BURNOUT_RATE
     WHERE T.HEAT_PLAN_NO = ?;
  END LOOP;
END;
		]]>
	</query>
		<query id="FrmPlanMaterialRcl.QueryProcessSeq" desc="查询热处理循环次数">
		<![CDATA[
	SELECT DECODE(NVL(T.PROCESS_SEQ,1),'0','1',T.PROCESS_SEQ) PROCESS_SEQ
  FROM CRAFT_ORD_DESIGN_MSC_PL_PRC T,
       PLN_ORDER_RCL_S             T1,
       CRAFT_ORD_DESIGN            T2,
       PLN_SALEORD                 T3
 WHERE T3.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK
   AND T2.ORD_LN_PK = T3.ORD_LN_PK
   AND T1.CRAFT_SEQ = T2.CRAFT_SEQ
   AND T.PROCESS_CODE = 'F'
   AND T1.PRO_PLAN_ID = ?
   AND T1.GX_PLAN_NO = ?
		]]>
	</query>
	<query id="FrmPlanMaterialRcl.QueryProcessSeq1" desc="查询热处理循环次数">
		<![CDATA[
SELECT T.PROCESS_SEQ, T.REAL_PROCESS_SEQ
  FROM PLN_ZY_RCL_M T
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
   AND T.HEAT_PLAN_NO = ?
   AND T.IF_MATCH_ODD IN ('0', '1')
		]]>
	</query>
	<query id="FrmPlanMaterialRcl.queryCic" desc="获取炼钢CIC">
		<![CDATA[
SELECT DISTINCT C.CIC, D.GRADECODE
  FROM PLN_ORDER_RCL_S           T,
       PLN_SALEORD              T1,
       CRAFT_ORD_DESIGN         M,
       CRAFT_ORD_DESIGN_STD_CIC C,
       COM_MSC_STD_CIC          D
 WHERE T1.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
   AND M.ORD_LN_PK = T1.ORD_LN_PK
   AND M.CRAFT_SEQ = T.CRAFT_SEQ
   AND C.DESGIN_KEY = M.DESGIN_KEY
   AND C.MSC_PLINE = T.INDEX_SEQ
   AND C.PROCESS_CODE IN ('A')
   AND C.CIC = D.CIC
   AND D.GRADENAME = ?
   AND T.PRO_PLAN_ID =?
   AND T.GX_PLAN_NO = ?
		]]>
	</query>
</queryMap>