<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="BOM清单生成">

	<query id="IBomDao.getOrdLnPk" desc="查询质量设计 合同行号 ">
		<![CDATA[
			SELECT T.ORD_PK, T.ORD_LN_PK, T1.AVG_LEN_MIN
  FROM SLM_ORD_DESIGN_MSC T, SLM_ORDER_LINE T1
 WHERE T1.ORD_PK = T.ORD_PK
   AND T1.ORD_LN_PK = T.ORD_LN_PK
   AND T.DESGIN_KEY = ?
   AND T.VALIDFLAG = '1'
   AND T1.VALIDFLAG = '1'

		]]>
	</query>


	<query id="IBomDao.getProcess" desc="查询质量设计 制程 ">
		<![CDATA[
			SELECT DESGIN_KEY, MSC_PLINE, WHOLE_BACKLOG, WHOLE_BACKLOG_DESC, SET_FL
              FROM SLM_ORD_DESIGN_MSC_PL T
             WHERE T.DESGIN_KEY = ?
		]]>
	</query>

	<query id="IBomDao.getGrade" desc="查询质量设计 钢种 ">
		<![CDATA[
			SELECT DESGIN_KEY,
                   MSC_PLINE,
                   WHOLE_BACKLOG,
                   WHOLE_BACKLOG_DESC,
                   GRADECODE,
                   GRADENAME,
                   ASSORTMENT_CODE,
                   ASSORTMENT_NAME
              FROM SLM_ORD_DESIGN_MSC_PL_GZ T
             WHERE T.DESGIN_KEY = ?
               AND T.MSC_PLINE = ?
		]]>
	</query>

	<query id="IBomDao.getSpec" desc="查询质量设计 轧管规格 ">
		<![CDATA[
			SELECT DESGIN_KEY,
                   MSC_PLINE,
                   GRADECODE,
                   GRADENAME,
                   SPEC_CODE,
                   SPEC_NAME,
                   DIMATER,
                   HEIGHT
              FROM SLM_ORD_DESIGN_MSC_GZ_GG T
             WHERE T.DESGIN_KEY = ?
               AND T.MSC_PLINE = ?
		]]>
	</query>

	<query id="IBomDao.getBlank" desc="查询质量设计 断面规格 ">
		<![CDATA[
			SELECT DESGIN_KEY, MSC_PLINE, SPEC_CODE, B_SPEC_CODE, B_SPEC_NAME
              FROM SLM_ORD_DESIGN_MSC_BILT T
             WHERE T.DESGIN_KEY = ?
               AND T.MSC_PLINE = ?
		]]>
	</query>

	<query id="IBomDao.getBilt" desc="查询质量设计 坯料规格 ">
		<![CDATA[
		SELECT DESGIN_KEY,
               MSC_PLINE,
               SPEC_CODE,
               B_SPEC_CODE,
               C_SPEC_CODE,
               C_SPEC_NAME
          FROM SLM_ORD_DESIGN_MSC_BILT_C T
         WHERE T.DESGIN_KEY = ?
           AND T.MSC_PLINE = ?
		]]>
	</query>

	<query id="IBomDao.getProline" desc="查询质量设计 适用产线 ">
		<![CDATA[
		SELECT DESGIN_KEY,
               MSC_PLINE,
               BACKLOG_SEQ,
               PROCESS_CODE,
               PLINE_CODE,
               PLINE_NAME,
               WELL_CODE,
               WELL_NAME,
               WARN_FL,
               WARN_DESC
          FROM SLM_ORD_DESIGN_MSC_PL_GX_PRL T
         WHERE T.DESGIN_KEY = ?
           AND T.MSC_PLINE = ?
		]]>
	</query>


	<query id="IBomDao.getProductCode" desc="查询产品大类 ">
		<![CDATA[
				SELECT T.PRODUCCODE,
                       T.PRODUCNAME,
                       T.PRODUC_STYLE,
                       T.PRODUC_DESC,
                       T.HAVEJG,
                       T.MEMO,
                       T.PRODUC_JX,
                       T.PRODUC_ENG,
                       T.PRODUCCODE_OLD,
                       T.PRODUC_TYPE,
                       T.PRODUC_HEAD,
                       I.BASENAME
                  FROM COM_BASE_PRODUCT T
                  JOIN COM_BASE_INFO I
                    ON T.PRODUC_HEAD = I.BASECODE
                 WHERE T.PRODUCCODE = ?
		]]>
	</query>


	<query id="IBomDao.getStdStyle" desc="查询标准类别">
		<![CDATA[
				SELECT STD_STYLE, STD_STYLE_DESC
                  FROM COM_MSC T
                 WHERE T.MSC = ?
                   AND T.VALIDFLAG != 0		
		]]>
	</query>

	<query id="IBomDao.getFirstPrdc" desc="查询基础物料编码是否新物料">
		<![CDATA[
				SELECT FIRST_PRDC FROM SLM_BASE_MATERIAL T WHERE T.MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomDao.getBomI" desc="查询加工物料信息">
		<![CDATA[
				SELECT BOM,
                      IN_MATERIAL_NO,
                      IN_MATERIAL_DESC,
                      OUT_MATERIAL_NO,
                      OUT_MATERIAL_DESC
                 FROM SLM_ORD_DESIGN_BOM_I T
                WHERE T.BOM = ?
		]]>
	</query>

	<query id="IBomDao.getOperation" desc="查询工序信息">
		<![CDATA[
			SELECT DESGIN_KEY,
       MSC_PLINE,
       WHOLE_BACKLOG,
       WHOLE_BACKLOG_DESC,
       BACKLOG_SEQ,
       PROCESS_CODE,
       PROCESS_DESC,
       PROCESS_SEQ,
       PROCESS_CODE_C,
       PROCESS_DESC_C,
       MINUTE_PRODUCT,
       MINUTE_PRODUCT_OUT,
       MINUTE_WAITE,
       MINUTE_WAITE_OUT,
       BATCH_WAITE,
       BATCH_WAITE_OUT,
       CIC,
       PIC,
       SIC,
       DIC,
       WIC,
       GIC
  FROM SLM_ORD_DESIGN_MSC_PL_PRC T
 WHERE T.DESGIN_KEY = ?
   AND T.MSC_PLINE = ?
   AND T.PROCESS_CODE = ?	
		]]>
	</query>

	<query id="IBomDao.getBLEntity" desc="查询备料码信息">
		<![CDATA[
			 SELECT 
       T.PSC_BL,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.STD_CODE,
       T.STD_NAME,
       T.STEELCODE,
       T.STEELNAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.MIN_D,
       T.MIN_H,
       T.USE_CODE,
       T.USE_DESC,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       T.VALIDFLAG,
       T.MEMO,
       T.MIN_L,
       T.MAX_L,
       T.FILE_JPG,
       T.DESGIN_KEY,
       T.REVIEW_STATUS
 FROM SLM_ORD_DESIGN_BL T
 WHERE
T.DESGIN_KEY=?
AND T.VALIDFLAG='1'
		]]>
	</query>

	<query id="IBomDao.getBLEntityByBl" desc="查询备料码信息">
		<![CDATA[
			 SELECT 
       T.PSC_BL,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.STD_CODE,
       T.STD_NAME,
       T.STEELCODE,
       T.STEELNAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.MIN_D,
       T.MIN_H,
       T.USE_CODE,
       T.USE_DESC,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       T.VALIDFLAG,
       T.MEMO,
       T.MIN_L,
       T.MAX_L,
       T.FILE_JPG,
       T.DESGIN_KEY,
       T.REVIEW_STATUS
 FROM SLM_ORD_DESIGN_BL T
 WHERE
T.PSC_BL=?
AND T.VALIDFLAG='1'
		]]>
	</query>

	<query id="IBomDao.getPsc" desc="通过备料码的四项标准查询产品码">
         <![CDATA[
         SELECT PSC,
       PSC_DESC,
       PRODUCCODE,
       PRODUCNAME,
       STD_CODE,
       STD_NAME,
       STEELCODE,
       STEELNAME,
       STD_STYLE,
       STD_STYLE_DESC,
       NEW_PROC_CODE,
       NEW_PROC_DESC,
       DEPARTMENT_CODE,
       DEPARTMENT_DESC,
       UNIT_CODE,
       AUTOJUDGE,
       UNIT_DESC,
       CREATE_NAME,
       CREATE_TIME,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME,
       VALIDFLAG,
       MEMO,
       PSC_OLD,
       PRODUC_HEAD,
       PRODUC_TYPE,
       PRODUC_STYLE,
       PRODUC_DESC
  FROM COM_PSC T
 WHERE T.PRODUCCODE = ?
   AND T.STD_CODE = ?
   AND T.STEELCODE = ?
   AND NVL(T.STD_STYLE,'/') = NVL(?,'/')
   AND T.VALIDFLAG = '1'
         ]]>
	</query>

	<query id="IBomDao.getMscByPscAndUseCode" desc="通过产品码与用途码查询冶金规范码">
         <![CDATA[
         SELECT T1.MSC,T1.MSC_DESC,T1.MSC_STYLE
  FROM COM_MSC T1, COM_PSC_R_MSC T2
 WHERE T1.MSC = T2.MSC
   AND T2.PSC = ?
   AND T1.USE_CODE = ?
   AND T2.VALIDFLAG = '1'
   AND T1.VALIDFLAG != 'D'
         ]]>
	</query>

	<query id="IBomDao.getBaseSpec" desc="验证备料码的规格在基础规格表里是否存在">
         <![CDATA[
         SELECT T.SPEC_CODE, T.SPEC_NAME
  FROM COM_BASE_SPEC T
 WHERE T.DIMATER = TO_NUMBER(?)
   AND T.HEIGHT = TO_NUMBER(?)
   AND T.MSC_STYLE = 'A'
   AND T.VALIDFLAG = '1'
         ]]>
	</query>


	<query id="IBomDao.getQualityZgPlineBySpec" desc="通过规格查轧管产线(质量设计) ">
		<![CDATA[
			 SELECT 
       T.DESGIN_KEY,
       T.MSC_PLINE,
       T.SPEC_CODE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.PRD_LEN,
       T.LOSS_RATE,
       T.IS_OUTPUT
 FROM SLM_ORD_DESIGN_MSC_GZ_GG_PL T
 WHERE
       T.DESGIN_KEY=?
   AND T.MSC_PLINE=?
   AND T.SPEC_CODE=?
     AND (T.IS_OUTPUT='1' OR  T.IS_OUTPUT IS NULL)
		]]>
	</query>

	<query id="IBomDao.getCraftZgPlineBySpec" desc="通过规格查轧管产线(工艺设计) ">
		<![CDATA[
			 SELECT 
       T.DESGIN_KEY,
       T.MSC_PLINE,
       T.SPEC_CODE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.PRD_LEN,
       T.LOSS_RATE,
       T.IS_OUTPUT
 FROM CRAFT_ORD_DESIGN_MSC_GZ_GG_PL T
 WHERE
       T.DESGIN_KEY=?
   AND T.MSC_PLINE=?
   AND T.SPEC_CODE=?
   AND (T.IS_OUTPUT='1' OR  T.IS_OUTPUT IS NULL)
		]]>
	</query>


	<query id="IBomDao.getQualityDzPlineBySpec" desc="通过规格查锻造产线(质量设计) ">
		<![CDATA[
	 SELECT 
       T.DESGIN_KEY,
       T.MSC_PLINE,
       T.B_SPEC_CODE,
       T.PLINE_CODE,
       T.PLINE_NAME
 FROM SLM_ORD_DESIGN_MSC_BILT_PL T
 WHERE  T.DESGIN_KEY=?
 AND   T.MSC_PLINE=?
 AND T.B_SPEC_CODE=?
		]]>
	</query>

	<query id="IBomDao.getCraftDzPlineBySpec" desc="通过规格查锻造产线(工艺设计) ">
		<![CDATA[
	 SELECT 
       T.DESGIN_KEY,
       T.MSC_PLINE,
       T.B_SPEC_CODE,
       T.PLINE_CODE,
       T.PLINE_NAME
 FROM CRAFT_ORD_DESIGN_MSC_BILT_PL T
 WHERE  T.DESGIN_KEY=?
  AND   T.MSC_PLINE=?
 AND T.B_SPEC_CODE=?
		]]>
	</query>

	<query id="IBomDao.getQualityZzPlineBySpec" desc="通过规格查铸造产线(质量设计) ">
		<![CDATA[
 SELECT 
       T.DESGIN_KEY,
       T.MSC_PLINE,
       T.C_SPEC_CODE,
       T.PLINE_CODE,
       T.PLINE_NAME
 FROM SLM_ORD_DESIGN_MSC_BILT_C_PL T
 WHERE  T.DESGIN_KEY=?
 AND T.MSC_PLINE=?
 AND T.C_SPEC_CODE=?
		]]>
	</query>

	<query id="IBomDao.getCraftZzPlineBySpec" desc="通过规格查铸造产线(工艺设计) ">
		<![CDATA[
	 SELECT 
       T.DESGIN_KEY,
       T.MSC_PLINE,
       T.C_SPEC_CODE,
       T.PLINE_CODE,
       T.PLINE_NAME
 FROM CRAFT_ORD_DESIGN_MSC_BILT_C_PL T
 WHERE  T.DESGIN_KEY=?
 AND T.MSC_PLINE=?
 AND T.C_SPEC_CODE=?
		]]>
	</query>


</queryMap>