<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="BOM清单验证数据SQL">

	<query id="IBomCheckDao.checkBaseMaterialA" desc="验证基础物料-电炉是否存在相同记录">
		<![CDATA[
				SELECT COUNT(*) COUNT
                  FROM SLM_BASE_MATERIAL_A T
                 WHERE T.IN_MATERIAL_NO = ?
                   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialB" desc="验证基础物料-铸造是否存在相同记录">
		<![CDATA[
				SELECT COUNT(*) COUNT
                  FROM SLM_BASE_MATERIAL_B T
                 WHERE T.IN_MATERIAL_NO = ?
                   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialC" desc="验证基础物料-锻造是否存在相同记录">
		<![CDATA[
				SELECT COUNT(*) COUNT
                  FROM SLM_BASE_MATERIAL_C T
                 WHERE T.IN_MATERIAL_NO = ?
                   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialD" desc="验证基础物料-轧管是否存在相同记录">
		<![CDATA[
				SELECT COUNT(*) COUNT
                  FROM SLM_BASE_MATERIAL_D T
                 WHERE T.IN_MATERIAL_NO = ?
                   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialE" desc="验证基础物料-墩拔扩是否存在相同记录">
		<![CDATA[
				SELECT COUNT(*) COUNT
                  FROM SLM_BASE_MATERIAL_E T
                 WHERE T.IN_MATERIAL_NO = ?
                   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialF" desc="验证基础物料-热处理是否存在相同记录">
		<![CDATA[
				SELECT COUNT(*) COUNT
                  FROM SLM_BASE_MATERIAL_F T
                 WHERE T.IN_MATERIAL_NO = ?
                   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>


	<query id="IBomCheckDao.checkBaseMaterialJ" desc="验证基础物料-接箍是否存在相同记录">
		<![CDATA[
				SELECT COUNT(*) COUNT
                  FROM SLM_BASE_MATERIAL_J T
                 WHERE T.IN_MATERIAL_NO = ?
                   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialI" desc="验证基础物料-加工产出是否存在相同记录">
		<![CDATA[
				SELECT COUNT(*) COUNT
                  FROM SLM_BASE_MATERIAL_I T
                 WHERE T.IN_MATERIAL_SET = ?
                   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialIn" desc="验证基础物料-加工投入是否存在相同记录">
		<![CDATA[
				SELECT COUNT(*) COUNT
                  FROM SLM_BASE_MATERIAL_I_IN T
                 WHERE T.IN_MATERIAL_SET = ?
                   AND T.IN_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBomCommon" desc="判断BOM是否存在">
		<![CDATA[
	    SELECT P.BOM
  FROM (SELECT MATERIAL_NO,
               MATERIAL_DESC,
               BOM,
               BOM_TYP,
               MSC_PLINE,
               PROCESS_CODE_CS,
               WHOLE_BACKLOG,
               WHOLE_BACKLOG_DESC,
               MSC,
               MSC_DESC,
               GRADECODE,
               GRADENAME,
               NVL(SPEC_CODE_C, '/') SPEC_CODE_C,
               SPEC_NAME_C,
               NVL(SPEC_CODE_R, '/') SPEC_CODE_R,
               SPEC_NAME_R,
               NVL(SPEC_CODE_D, '/') SPEC_CODE_D,
               SPEC_NAME_D,
               NVL(SPEC_CODE_Z, '/') SPEC_CODE_Z,
               SPEC_NAME_Z
          FROM SLM_ORD_DESIGN_BOM T
         WHERE T.MATERIAL_NO = ?
           AND T.MSC_PLINE = ?
           AND T.WHOLE_BACKLOG = ?
           AND T.MSC = ?
           AND T.GRADECODE = ?) P
 WHERE P.SPEC_CODE_C = ?
   AND P.SPEC_CODE_R = ?
   AND P.SPEC_CODE_D = ?
   AND P.SPEC_CODE_Z = ?
   AND P.PROCESS_CODE_CS=?
   AND P.WHOLE_BACKLOG=?
		         ]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterial" desc="验证基础物料编码是否存在相同记录">
		<![CDATA[
			SELECT COUNT(*) COUNT FROM SLM_BASE_MATERIAL T WHERE T.MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialAPl" desc="验证基础数据-电炉投入产出-产线能力">
		<![CDATA[
			SELECT COUNT(1) COUNT
              FROM SLM_BASE_MATERIAL_A_PL T
             WHERE T.IN_MATERIAL_NO = ?
               AND T.OUT_MATERIAL_NO = ?
               AND T.PLINE_CODE = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialBPl" desc="验证基础数据-铸造投入产出-产线能力">
		<![CDATA[
			SELECT COUNT(1) COUNT
              FROM SLM_BASE_MATERIAL_B_PL T
             WHERE T.IN_MATERIAL_NO = ?
               AND T.OUT_MATERIAL_NO = ?
               AND T.PLINE_CODE = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialCPl" desc="验证基础数据-锻造投入产出-产线能力">
		<![CDATA[
			SELECT COUNT(1) COUNT
              FROM SLM_BASE_MATERIAL_C_PL T
             WHERE T.IN_MATERIAL_NO = ?
               AND T.OUT_MATERIAL_NO = ?
               AND T.PLINE_CODE = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialDPl" desc="验证基础数据-轧管投入产出-产线能力">
		<![CDATA[
			SELECT COUNT(1) COUNT
              FROM SLM_BASE_MATERIAL_D_PL T
             WHERE T.IN_MATERIAL_NO = ?
               AND T.OUT_MATERIAL_NO = ?
               AND T.PLINE_CODE = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialEPl" desc="验证基础数据-墩拔扩投入产出-产线能力">
		<![CDATA[
			SELECT COUNT(1) COUNT
              FROM SLM_BASE_MATERIAL_E_PL T
             WHERE T.IN_MATERIAL_NO = ?
               AND T.OUT_MATERIAL_NO = ?
               AND T.PLINE_CODE = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialFPl" desc="验证基础数据-热处理投入产出-产线能力">
		<![CDATA[
			SELECT COUNT(1) COUNT
              FROM SLM_BASE_MATERIAL_F_PL T
             WHERE T.IN_MATERIAL_NO = ?
               AND T.OUT_MATERIAL_NO = ?
               AND T.PLINE_CODE = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialJPl" desc="验证基础数据-接箍投入产出-产线能力">
		<![CDATA[
			SELECT COUNT(1) COUNT
              FROM SLM_BASE_MATERIAL_J_PL T
             WHERE T.IN_MATERIAL_NO = ?
               AND T.OUT_MATERIAL_NO = ?
               AND T.PLINE_CODE = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialIPl" desc="验证基础数据-加工投入产出-产线能力">
		<![CDATA[
			SELECT COUNT(1) COUNT
              FROM SLM_BASE_MATERIAL_I_PL T
             WHERE T.OUT_MATERIAL_NO = ?
               AND T.PLINE_CODE = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkSlmOrdLineBom" desc="验证质量设计-合同行生产BOM">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM SLM_ORD_LINE_BOM T
 WHERE T.DESGIN_KEY = ?
   AND T.BOM = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkSlmOrdLineBomJG" desc="验证质量设计-合同行生产-接箍BOM">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM SLM_ORD_LINE_BOM_JG T
 WHERE T.Desgin_Key = ?
   AND T.BOM = ?
   AND T.BOM_JG = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBomA" desc="">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM SLM_ORD_DESIGN_BOM_A T
 WHERE T.BOM = ?
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBomB" desc="">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM SLM_ORD_DESIGN_BOM_B T
 WHERE T.BOM = ?
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>


	<query id="IBomCheckDao.checkBomC" desc="">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM SLM_ORD_DESIGN_BOM_C T
 WHERE T.BOM = ?
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBomD" desc="">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM SLM_ORD_DESIGN_BOM_D T
 WHERE T.BOM = ?
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBomE" desc="">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM SLM_ORD_DESIGN_BOM_E T
 WHERE T.BOM = ?
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBomF" desc="">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM SLM_ORD_DESIGN_BOM_F T
 WHERE T.BOM = ?
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBomG" desc="">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM SLM_ORD_DESIGN_BOM_G T
 WHERE T.BOM = ?
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBomI" desc="">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM SLM_ORD_DESIGN_BOM_I T
 WHERE T.BOM = ?
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialK" desc="验证基础物料-加工是否存在相同记录">
		<![CDATA[
				SELECT COUNT(*) COUNT
                  FROM SLM_BASE_MATERIAL_K T
                 WHERE T.IN_MATERIAL_NO = ?
                   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBomK" desc="">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM SLM_ORD_DESIGN_BOM_K T
 WHERE T.BOM = ?
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
   AND T.GROUP_NUM=?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialKPl" desc="验证基础数据-加工投入产出-产线能力">
		<![CDATA[
			SELECT COUNT(1) COUNT
              FROM SLM_BASE_MATERIAL_K_PL T
             WHERE T.IN_MATERIAL_NO = ?
               AND T.OUT_MATERIAL_NO = ?
               AND T.PLINE_CODE = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialH" desc="验证基础物料-接箍加工是否存在相同记录">
		<![CDATA[
				SELECT COUNT(*) COUNT
                  FROM SLM_BASE_MATERIAL_H T
                 WHERE T.IN_MATERIAL_NO = ?
                   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBomH" desc="验证接箍加工BOM">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM SLM_ORD_DESIGN_BOM_H T
 WHERE T.BOM = ?
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkBaseMaterialHPl" desc="验证基础数据-接箍加工-产线能力">
		<![CDATA[
			SELECT COUNT(1) COUNT
              FROM SLM_BASE_MATERIAL_H_PL T
             WHERE T.IN_MATERIAL_NO = ?
               AND T.OUT_MATERIAL_NO = ?
               AND T.PLINE_CODE = ?
		]]>
	</query>

	<query id="IBomCheckDao.checkPlineSpec" desc="验证产线">
		<![CDATA[
		SELECT COUNT(1) COUNT
  FROM COM_MSC_PLINE_R_SPEC T
 WHERE T.PLINE_CODE = ?
   AND T.SPEC_CODE = ?
   AND TO_NUMBER(T.MIN_D) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_D) >= TO_NUMBER(?)
   AND TO_NUMBER(T.MIN_H) <= TO_NUMBER(?)
   AND TO_NUMBER(T.MAX_H) >= TO_NUMBER(?)
   AND T.VALIDFLAG = '1'
		]]>
	</query>

	<query id="IBomCheckDao.getSpecDH" desc="通过规格代码查询外径壁厚">
         <![CDATA[
SELECT T.DIMATER,T.HEIGHT FROM COM_BASE_SPEC T WHERE T.SPEC_CODE=?
         ]]>
	</query>
</queryMap>