<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="BOM界面">

	<query id="FrmBomConfirm.getBomByOrdLnDlyPk" desc="查询交货行BOM">
            <![CDATA[
          SELECT T.*, T1.DESGIN_KEY AS DESIGN_KEY, T4.PRIORITY
  FROM SLM_ORD_DESIGN_BOM         T,
       CRAFT_ORD_LINE_BOM         T1,
       CRAFT_ORD_DESIGN           T2,
       PLN_SALEORD                T3,
       CRAFT_ORD_DESIGN_MSC_PL_GZ T4
 WHERE T.BOM = T1.BOM
   AND T1.DESGIN_KEY = T2.DESGIN_KEY
   AND T2.ORD_LN_PK = T3.ORD_LN_PK
   AND T2.VALIDFLAG = '1'
   AND T4.DESGIN_KEY = T1.DESGIN_KEY
   AND T4.MSC_PLINE = T.MSC_PLINE
   AND T4.WHOLE_BACKLOG = T.WHOLE_BACKLOG
   AND T4.GRADECODE = T.GRADECODE
   AND T3.ORD_LN_DLY_PK = ?
              ]]>
	</query>

	<query id="FrmBomConfirm.getSpecBySpecName" desc="查询管坯直径的代码">
            <![CDATA[
             SELECT T1.SPEC_CODE, T1.SPEC_NAME
  FROM COM_BASE_SPEC T1
 WHERE T1.MSC_STYLE = 'B'
   AND T1.VALIDFLAG = '1'
   AND TO_NUMBER(T1.SPEC_NAME) = TO_NUMBER(?)
              ]]>
	</query>
<query id="FrmBomConfirm.changeZgInOutMate" desc="查询投入产出是否禁用">
            <![CDATA[
   SELECT T.* FROM SLM_BASE_MATERIAL_D_PL T WHERE T.PLINE_CODE=? AND T.IN_MATERIAL_NO=? AND T.OUT_MATERIAL_NO=? AND T.DISABLE_FL='1'
              ]]>
	</query>
	<query id="FrmBomConfirm.getBomByBom" desc="查询BOM信息">
            <![CDATA[
             SELECT * FROM SLM_ORD_DESIGN_BOM T WHERE T.BOM=?
              ]]>
	</query>

	<query id="FrmBomConfirm.getPlanOrderInfo" desc=" 通过轧制订单编号与PK查询轧制的工序合同">
            <![CDATA[
           SELECT *
  FROM PLN_ORDER_ZG T
 WHERE T.ORD_LN_DLY_PK = ?
   AND T.PRO_PLAN_ID = ?
              ]]>
	</query>

	<query id="FrmBomConfirm.getZgPlanInfo" desc="查询轧制订单信息">
            <![CDATA[
              SELECT *
  FROM PLN_ORDER_ZG_S T
 WHERE 1=1
              ]]>
	</query>

	<query id="FrmBomConfirm.getPlineEByProPlanId" desc="通过轧制订单编号查询镦拔扩信息">
            <![CDATA[
            SELECT T.*
  FROM PLN_ORDER_DBK_S T
 WHERE T.PRO_PLAN_ID IN
       (SELECT T3.PRO_PLAN_ID
          FROM PLN_ORDER_ZG_S T1, PLN_ORDER_ZG T2, PLN_ORDER_DBK T3
         WHERE T1.PRO_PLAN_ID = T2.PRO_PLAN_ID
           AND T2.PLAN_GROUP_ID = T3.PLAN_GROUP_ID
           AND T1.PRO_PLAN_ID = ?)
              ]]>
	</query>


	<query id="FrmBomConfirm.getPlineFByProPlanId" desc="通过轧制订单编号查询热处理信息">
            <![CDATA[
           SELECT T.*
  FROM PLN_ORDER_RCL_S T
 WHERE T.PRO_PLAN_ID IN
       (SELECT T3.PRO_PLAN_ID
          FROM PLN_ORDER_ZG_S T1, PLN_ORDER_ZG T2, PLN_ORDER_RCL T3
         WHERE T1.PRO_PLAN_ID = T2.PRO_PLAN_ID
           AND T2.PLAN_GROUP_ID = T3.PLAN_GROUP_ID
           AND T1.PRO_PLAN_ID = ?)
              ]]>
	</query>


	<query id="FrmBomConfirm.getPlineGByProPlanId" desc="通过轧制订单编号查询加工信息">
            <![CDATA[
           SELECT T.*
  FROM PLN_ORDER_JGX_S T
 WHERE T.PRO_PLAN_ID IN
       (SELECT T3.PRO_PLAN_ID
          FROM PLN_ORDER_ZG_S T1, PLN_ORDER_ZG T2, PLN_ORDER_JGX T3
         WHERE T1.PRO_PLAN_ID = T2.PRO_PLAN_ID
           AND T2.PLAN_GROUP_ID = T3.PLAN_GROUP_ID
           AND T1.PRO_PLAN_ID = ?)
              ]]>
	</query>


	<query id="FrmBomConfirm.getPlineD" desc="查询轧管产线">
            <![CDATA[
            SELECT *
  FROM SLM_BASE_MATERIAL_D_PL T
 WHERE T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
   AND T.PLINE_CODE IN (SELECT T1.PLINE_CODE
                          FROM CRAFT_ORD_DESIGN_MSC_PL_GX_PRL T1
                         WHERE T1.DESGIN_KEY = ?
                           AND T1.MSC_PLINE = ?)
             ORDER BY T.PLINE_NAME
              ]]>
	</query>

	<query id="FrmBomConfirm.getPlineE" desc="查询镦拔扩产线">
            <![CDATA[
            SELECT *
  FROM SLM_BASE_MATERIAL_E_PL T
 WHERE T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
   AND T.PLINE_CODE IN (SELECT T1.PLINE_CODE
                          FROM CRAFT_ORD_DESIGN_MSC_PL_GX_PRL T1
                         WHERE T1.DESGIN_KEY = ?
                           AND T1.MSC_PLINE = ?)
                           ORDER BY T.PLINE_NAME
              ]]>
	</query>

	<query id="FrmBomConfirm.getPlineF" desc="查询热处理产线">
            <![CDATA[
            SELECT *
  FROM SLM_BASE_MATERIAL_F_PL T
 WHERE T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
   AND T.PLINE_CODE IN (SELECT T1.PLINE_CODE
                          FROM CRAFT_ORD_DESIGN_MSC_PL_GX_PRL T1
                         WHERE T1.DESGIN_KEY = ?
                           AND T1.MSC_PLINE = ?)
                           ORDER BY T.PLINE_NAME
              ]]>
	</query>

	<query id="FrmBomConfirm.getPlineG" desc="查询加工产线">
            <![CDATA[
            SELECT *
  FROM SLM_BASE_MATERIAL_K_PL T
 WHERE T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
   AND T.PLINE_CODE IN (SELECT T1.PLINE_CODE
                          FROM CRAFT_ORD_DESIGN_MSC_PL_GX_PRL T1
                         WHERE T1.DESGIN_KEY = ?
                           AND T1.MSC_PLINE = ?)
                           ORDER BY T.PLINE_NAME
              ]]>
	</query>

	<query id="FrmBomConfirm.updateZgMaterial" desc="修改轧管订单物料">
            <![CDATA[
         UPDATE PLN_ORDER_ZG_S T
   SET T.GRADECODE        = ?,
       T.GRADENAME        = ?,
       T.DIAMETER_GP      = ?,
       T.INWL_ID          = ?,
       T.INWL_DESC        = ?,
       T.OUTWL_ID         = ?,
       T.OUTWL_DESC       = ?,
       T.PLINE_CODE       = ?,
       T.PLINE_NAME       = ?,
       T.GX_PRO_SEQ       = ?,
       T.PASS_CODE        = ?,
       T.PASS_NAME        = ?,
       T.DIAMETER_MANDREL = ?,
       T.CIC_GP           =?,
       T.PLINE_CODE_ZZ     =?,
       T.PLINE_NAME_ZZ     =?,
       T.IS_PLAN_OK = '0'
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
              ]]>
	</query>
<query id="FrmBomConfirm.updateZgMaterial1" desc="修改轧管订单物料">
            <![CDATA[
UPDATE PLN_ORDER_ZG_S T
   SET T.GRADECODE         = ?,
       T.GRADENAME         = ?,
       T.DIAMETER_GP       = ?,
       T.INWL_ID           = ?,
       T.INWL_DESC         = ?,
       T.OUTWL_ID          = ?,
       T.OUTWL_DESC        = ?,
       T.PLINE_CODE        = ?,
       T.PLINE_NAME        = ?,
       T.GX_PRO_SEQ        = ?,
       T.PASS_CODE         = ?,
       T.PASS_NAME         = ?,
       T.DIAMETER_MANDREL  = ?,
       T.CIC_GP            = ?,
       T.IS_PLAN_OK        = ?,
       T.ISSUED_MAN        = ?,
       T.ISSUED_TIME       = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.LAST_UNDOWN_MAN   = ?,
       T.LAST_UNDOWN_TIME  = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.IF_STOVE_ISSUED   = ?,
       T.STOVE_ISSUED_TIME = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.STOVE_ISSUED_MAN  = ?,
       T.ZY_BATCH_ID       =?,
       T.PLINE_CODE_ZZ     =?,
       T.PLINE_NAME_ZZ     =?
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?

              ]]>
	</query>

	<query id="FrmBomConfirm.updateDbkMaterial" desc="修改镦拔扩订单物料">
            <![CDATA[
              UPDATE PLN_ORDER_DBK_S T
   SET T.INWL_ID = ?, T.INWL_DESC = ?, T.OUTWL_ID = ?, T.OUTWL_DESC = ?,
   T.MSC=?,T.INDEX_SEQ=?,T.BOM=?,T.WHOLE_BACKLOG_DESC=?
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
              ]]>
	</query>

	<query id="FrmBomConfirm.updateRclMaterial" desc="修改热处理订单物料">
            <![CDATA[
              UPDATE PLN_ORDER_RCL_S T
   SET T.INWL_ID = ?, T.INWL_DESC = ?, T.OUTWL_ID = ?, T.OUTWL_DESC = ?,
   T.MSC=?,T.INDEX_SEQ=?,T.BOM=?,T.WHOLE_BACKLOG_DESC=?
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
              ]]>
	</query>

	<query id="FrmBomConfirm.updateJgxMaterial" desc="修改加工订单物料">
            <![CDATA[
               UPDATE PLN_ORDER_JGX_S T
   SET T.INWL_ID = ?, T.INWL_DESC = ?, T.OUTWL_ID = ?, T.OUTWL_DESC = ?,
   T.MSC=?,T.INDEX_SEQ=?,T.BOM=?,T.WHOLE_BACKLOG_DESC=?
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
              ]]>
	</query>

	<query id="FrmBomConfirm.getPassCodeByPlineAndSpec" desc="通过产线与管坯规格查询孔型">
            <![CDATA[
          SELECT T.PASS_CODE, T.PASS_NAME
  FROM COM_MSC_PLINE_R_SPEC T
 WHERE T.PLINE_CODE = ?
   AND T.SPEC_CODE =?
   AND T.VALIDFLAG='1'
       GROUP BY T.PASS_CODE, T.PASS_NAME
              ]]>
	</query>

	<query id="FrmBomConfirm.getPassCodeByPlineAndMonth" desc="通过产线与轧管年月查询孔型计划">
            <![CDATA[
         SELECT T.PASS_CODE, T.PASS_NAME
  FROM PLN_PASSMODEL T
 WHERE T.PLINE_CODE = ?
   AND T.PRO_MONTH = ?
   ORDER BY T.PASS_CODE
              ]]>
	</query>

	<query id="FrmBomConfirm.getDiameterMandrel" desc="查询芯棒">
            <![CDATA[
           SELECT T.DIAMETER_MANDREL
  FROM COM_BASE_MANDREL_SPEC T
 WHERE T.PLINE_CODE = ?
   AND T.PASS_CODE = ?
   AND T.MIN_D <= TO_NUMBER(?)
   AND T.MAX_D >= TO_NUMBER(?)
   AND T.MIN_H <= TO_NUMBER(?)
   AND T.MAX_H >= TO_NUMBER(?)
              ]]>
	</query>

	<query id="FrmBomConfirm.updateZgBom" desc="修改轧管工序合同BOM">
            <![CDATA[
               UPDATE PLN_ORDER_ZG T SET T.BOM=? WHERE T.PRO_PLAN_ID=?
              ]]>
	</query>
	<query id="FrmBomConfirm.updateZgSBom" desc="修改轧管排产耗时表BOM">
            <![CDATA[
UPDATE PLN_ORDER_ZG_S T
   SET T.BOM                = ?,
       T.MSC                = ?,
       T.INDEX_SEQ          = ?,
       T.WHOLE_BACKLOG_DESC = ?
 WHERE T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
              ]]>
	</query>

	<query id="FrmBomConfirm.updateDbkBom" desc="修改镦拔扩工序合同BOM">
            <![CDATA[
              UPDATE PLN_ORDER_DBK T SET T.BOM=? WHERE T.PRO_PLAN_ID=?
              ]]>
	</query>


	<query id="FrmBomConfirm.updateRclBom" desc="修改热处理工序合同BOM">
            <![CDATA[
               UPDATE PLN_ORDER_RCL T SET T.BOM=? WHERE T.PRO_PLAN_ID=?
              ]]>
	</query>


	<query id="FrmBomConfirm.updateJgxBom" desc="修改加工工序合同BOM">
            <![CDATA[
               UPDATE PLN_ORDER_JGX T SET T.BOM=? WHERE T.PRO_PLAN_ID=?
              ]]>
	</query>
<query id="FrmBomConfirm.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="FrmBomConfirm.updateOutsFl" desc="修改轧管排产坯子来源">
            <![CDATA[
                UPDATE PLN_ORDER_ZG_S T
      SET T.OUTS_BILLET_FL = ?
    WHERE T.PRO_PLAN_ID = ?
      AND T.GX_PLAN_NO=?

              ]]>
	</query>
</queryMap>