<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="接箍码和备料码">
	<query id="IMscBLDao.getCodeBLByDAndH" desc="查询备料码 外径、壁厚">  
             <![CDATA[     
SELECT A.CODE_JG, A.GROUP_NUM
          FROM COM_MSC_R_JG A
         WHERE A.MSC = {0}
           AND A.STOCK_STYLE = 'B'
           AND A.VALIDFLAG = '1'
           AND EXISTS
         (SELECT 1
                  FROM COM_MSC_R_BL_SPEC B
                 WHERE B.MSC = A.MSC
                   AND A.GROUP_NUM = B.GROUP_NUM
                   AND B.VALIDFLAG = '1'
                   AND (INSTR(B.MODEL_CODE, {3}) > 0 OR B.MODEL_CODE IS NULL)
                   AND TO_NUMBER(NVL(B.MIN_D, '0')) <= TO_NUMBER({1})
                   AND TO_NUMBER(NVL(B.MAX_D, '10000')) >= TO_NUMBER({1})
                   AND TO_NUMBER(NVL(B.MIN_H, '0')) <= TO_NUMBER({2})
                   AND TO_NUMBER(NVL(B.MAX_H, '10000')) >= TO_NUMBER({2}))
                     ]]>
	</query>

	<query id="IMscBLDao.getCodeBLBySpecCode" desc="查询备料码 产品规格">  
             <![CDATA[
SELECT A.CODE_JG, A.GROUP_NUM
  FROM COM_MSC_R_JG A
 WHERE A.MSC = ?
   AND A.STOCK_STYLE = 'B'
   AND A.VALIDFLAG = '1'
   AND EXISTS (SELECT 1
          FROM COM_MSC_R_BL_SPEC B
         WHERE A.MSC = B.MSC
           AND A.GROUP_NUM = B.GROUP_NUM
           AND B.SPEC_CODE = ?
           AND (INSTR(B.MODEL_CODE, ?) > 0 OR B.MODEL_CODE IS NULL)
           AND B.VALIDFLAG = '1') 
                     ]]>
	</query>

	<query id="IMscBLDao.saveBL" desc="保存备料码">  
             <![CDATA[ 
             INSERT INTO SLM_ORD_DESIGN_MSC_BL
  (DESGIN_KEY, GROUP_NUM, PSC_BL, DESGIN_KEY_BL)
VALUES
  (?, ?, ?, ?)
                     ]]>
	</query>

</queryMap>