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

	<query id="BLIQualityPreDao.getMscBlEntity" 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,
       T.OUTS_BILLET_FL,
       T.OUTS_STL_PIPE_FL
 FROM COM_MSC_BL T
 WHERE
       T.PSC_BL = ?
 AND   T.VALIDFLAG='1'
         ]]>
	</query>

	<query id="BLIQualityPreDao.getDesignKeyByblCode" desc="根据备料码查询质量主键">
         <![CDATA[
         SELECT T.DESGIN_KEY
           FROM SLM_ORD_DESIGN_BL T
          WHERE T.PSC_BL = ?
            AND T.VALIDFLAG = '1'
         ]]>
	</query>

	<query id="BLIQualityPreDao.addSlmOrdDesignBl" desc="新增备料码技术评审主记录">
         <![CDATA[
          INSERT INTO SLM_ORD_DESIGN_BL(
        PSC_BL,
        PRODUCCODE,
        PRODUCNAME,
        STD_CODE,
        STD_NAME,
        STEELCODE,
        STEELNAME,
        STD_STYLE,
        STD_STYLE_DESC,
        MODEL_CODE,
        MODEL_DESC,
        MIN_D,
        MIN_H,
        USE_CODE,
        USE_DESC,
        CREATE_NAME,
        CREATE_TIME,
        UPDATE_NAME,
        UPDATE_TIME,
        DELETE_NAME,
        DELETE_TIME,
        VALIDFLAG,
        MEMO,
        MIN_L,
        MAX_L,
        FILE_JPG,
        DESGIN_KEY,
        REVIEW_STATUS,
        OUTS_BILLET_FL,
        OUTS_STL_PIPE_FL)
 VALUES( 
        '#PSC_BL#',
        '#PRODUCCODE#',
        '#PRODUCNAME#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#STEELCODE#',
        '#STEELNAME#',
        '#STD_STYLE#',
        '#STD_STYLE_DESC#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#MIN_D#',
        '#MIN_H#',
        '#USE_CODE#',
        '#USE_DESC#',
        '#CREATE_NAME#',
        SYSDATE,
        NULL,
        NULL,
        NULL,
        NULL,
        '1',
        '#MEMO#',
        '#MIN_L#',
        '#MAX_L#',
        '#FILE_JPG#',
        SYS_GUID(),
        '#REVIEW_STATUS#',
        '#OUTS_BILLET_FL#',
        '#OUTS_STL_PIPE_FL#')
         ]]>
	</query>

	<query id="BLIQualityPreDao.updateSlmOrdDesignBl" desc="备料码技术评审主记录">
         <![CDATA[
        DELETE FROM SLM_ORD_DESIGN_BL T  WHERE T.DESGIN_KEY = ?
         ]]>
	</query>

	<query id="BLIQualityPreDao.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="BLIQualityPreDao.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="BLIQualityPreDao.getMscByPscAndUseCode" desc="通过产品码与用途码查询冶金规范码">
         <![CDATA[
         SELECT T1.MSC
  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>

</queryMap>