<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="修改钢种及钢种索引码">
	<query id="CorePlnZgMStoGp.getQueryGradeChoose" desc="查询钢种">
		<![CDATA[	
		SELECT T.GRADECODE,
       T.GRADENAME,
       T.ASSORTMENT_CODE,
       T.ASSORTMENT_NAME,
       T.COEFFICIENT,
       DECODE(T.ALLOW_BUY, '0', '否', '1', '是') ALLOW_BUY
  FROM COM_BASE_GRADE T
 WHERE T.VALIDFLAG = '1'
 ORDER BY T.GRADENAME ASC
		]]>
	</query>
	<query id="CorePlnZgMStoGp.getQueryGrade" desc="查询钢种及钢种索引码">
		<![CDATA[
SELECT T.AGREEMENT_CODE,
       T.AGREEMENT_DESC,
       T.STD_CODE_NK,
       T.STD_NAME_NK,
       T1.GRADECODE,
       T1.GRADENAME,
       T2.STD_IDX,
       T2.STD_IDX_TYPE,
       T1.VALIDFLAG
  FROM COM_BASE_PURCHASE_AGREEMENT T,
       COM_MSC_STD_CIC             T1,
       COM_BASE_PURCHASE_STD_IDX   T2
 WHERE T.AGREEMENT_CODE = T2.AGREEMENT_CODE
   AND T1.CIC = T2.STD_IDX
   AND T.VALIDFLAG = '1'
   AND T1.VALIDFLAG != '0'
			  
		]]>
	</query>
	<query id="FrmChangeGrade.getBomByOrdLnDlyPk" desc="查询Bom">
		<![CDATA[	
	SELECT B.*,
       NVL(B.SPEC_NAME_D, B.SPEC_NAME_Z) SPEC_GP,
       S.DIMATER,
       C.DESGIN_KEY
  FROM PLN_ORDER_ZG_S     T,
       PLN_SALEORD        P,
       CRAFT_ORD_DESIGN   D,
       CRAFT_ORD_LINE_BOM C,
       SLM_ORD_DESIGN_BOM B
  LEFT JOIN COM_BASE_SPEC S
    ON S.SPEC_CODE = NVL(B.SPEC_CODE_D, B.SPEC_CODE_Z)
   AND S.VALIDFLAG = '1'
 WHERE T.ORD_LN_DLY_PK = P.ORD_LN_DLY_PK
   AND P.ORD_LN_PK = D.ORD_LN_PK
   AND T.CRAFT_SEQ = D.CRAFT_SEQ
   AND D.DESGIN_KEY = C.DESGIN_KEY
   AND C.BOM = B.BOM
   AND T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
   AND B.MSC_PLINE=?
		]]>
	</query>
	<query id="FrmChangeGrade.getQueryGrade" desc="查询钢种及钢种索引码">
		<![CDATA[
SELECT T.GRADECODE,
       T.GRADENAME,
       T.CIC,
       T1.STD_CODE STD_CODE_NK,
       T1.STD_NAME STD_NAME_NK,
       DECODE(T1.PURCHASE_STD, '0', '自炼', '外购') ALLOW_BUY
  FROM COM_MSC_STD_CIC T, COM_BASE_STD T1
 WHERE T.STDSTYLE = 'N'
   AND T.STD_CODE_NK = T1.STD_CODE(+)
   AND T1.VALIDFLAG = '1'	  
		]]>
	</query>
	<query id="FrmChangeGrade.getZgPlanInfo" desc="查询轧制订单信息">
            <![CDATA[
              SELECT *
  FROM PLN_ORDER_ZG_S T
 WHERE 1=1
              ]]>
	</query>
	<query id="FrmChangeGrade.getBomByBom" desc="查询BOM信息">
            <![CDATA[
             SELECT * FROM SLM_ORD_DESIGN_BOM T WHERE T.BOM=?
              ]]>
	</query>
	<query id="FrmChangeGrade.updateZgMaterial" desc="修改轧管订单物料">
            <![CDATA[
         UPDATE PLN_ORDER_ZG_S T
   SET T.GRADECODE        = ?,
       T.GRADENAME        = ?,
       T.INWL_ID          = ?,
       T.INWL_DESC        = ?,
       T.OUTWL_ID         = ?,
       T.OUTWL_DESC       = ?,
       T.CIC_GP           =?
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
              ]]>
	</query>
</queryMap>