<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="手工输入MPS编号">

	<query id="CoreStableMps.queryOrdInfo" desc="是否存在指定炉批组号的材料库存">
		<![CDATA[
   	  		SELECT T.MSC, T.FINAL_USER, T.FINAL_USER_DESC,
   	  		T.DIMATER,T.HEIGHT,T.MODEL_CODE
         FROM SLM_ORDER_LINE T
         WHERE T.ORD_LN_PK = ?

		]]>
	</query>

	<query id="CoreStableMps.updateStableMps" desc="是否存在指定炉批组号的材料库存">
		<![CDATA[
          
          UPDATE SLM_ORDER_STABLE_MPS T
          SET T.MPS_FILENAME = ?,
              T.MPS_ADDR    = ?
          WHERE T.MPS_ID = ?
   	 		
		]]>
	</query>

	<query id="CoreStableMps.queryData" desc="是否存在指定炉批组号的材料库存">
		<![CDATA[
    
        SELECT 
       T.MPS_ID,
       T.MSC,
       T.FINA_USER,
       T.FINA_USER_DESC,
       T.MPS_NO,
       T.DIMATER_MIN,
       T.DIMATER_MAX,
       T.HEIGHT_MIN,
       T.HEIGHT_MAX,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.MPS_FILENAME,
       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,
       DECODE(T.VALIDFLAG,'1','有效','无效') VALIDFLAG
      FROM SLM_ORDER_STABLE_MPS T
        WHERE T.MPS_NO||'&' LIKE '%'||?||'%'
        AND T.MPS_FILENAME||'&' LIKE '%'||?||'%'
   	 		
		]]>
	</query>

	<query id="CoreStableMps.queryMpsNoByNo" desc="是否存在指定炉批组号的材料库存">
		<![CDATA[
          
          SELECT  1 FROM  SLM_ORDER_STABLE_MPS T
          WHERE T.MPS_NO = ?
   	 		
		]]>
	</query>

	<query id="CoreStableMps.queryMpsNoById" desc="是否存在指定炉批组号的材料库存">
		<![CDATA[
          
          SELECT MPS_NO FROM SLM_ORDER_STABLE_MPS T
          WHERE T.MPS_ID = ?
   	 		
		]]>
	</query>

	<query id="CoreStableMps.AddMps" desc="是否存在指定炉批组号的材料库存">
		<![CDATA[
          
          INSERT INTO SLM_ORDER_STABLE_MPS
  (MPS_ID,
   MSC,
   FINA_USER,
   FINA_USER_DESC,
   MPS_NO,
   DIMATER_MIN,
   DIMATER_MAX,
   HEIGHT_MIN,
   HEIGHT_MAX,
   MODEL_CODE,
   MODEL_DESC,
   MPS_FILENAME,
   CREATE_NAME,
   CREATE_TIME)
VALUES
  ((SELECT TO_CHAR(SYSDATE, 'YYYYMMDD') ||
          LPAD(TO_NUMBER(NVL(SUBSTR(MAX(A.MPS_ID), 9, 3), 0)) + 1, 3, '0')
     FROM SLM_ORDER_STABLE_MPS A
    WHERE SUBSTR(A.MPS_ID, 1, 8) = TO_CHAR(SYSDATE, 'YYYYMMDD')),
   '#MSC#',
   '#FINA_USER#',
   '#FINA_USER_DESC#',
   '#MPS_NO#',
   '#DIMATER_MIN#',
   '#DIMATER_MAX#',
   '#HEIGHT_MIN#',
   '#HEIGHT_MAX#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#MPS_FILENAME#',
   '#CREATE_NAME#',
   SYSDATE)
          
   	 		
		]]>
	</query>

	<query id="CoreStableMps.UpdateMps" desc="是否存在指定炉批组号的材料库存">
		<![CDATA[
          
          UPDATE SLM_ORDER_STABLE_MPS T
   SET T.MSC            = '#MSC#',
       T.FINA_USER      = '#FINA_USER#',
       T.FINA_USER_DESC = '#FINA_USER_DESC#',
       T.MPS_NO         = '#MPS_NO#',
       T.DIMATER_MIN    = '#DIMATER_MIN#',
       T.DIMATER_MAX    = '#DIMATER_MAX#',
       T.HEIGHT_MIN     = '#HEIGHT_MIN#',
       T.HEIGHT_MAX     = '#HEIGHT_MAX#',
       T.MODEL_CODE     = '#MODEL_CODE#',
       T.MODEL_DESC     = '#MODEL_DESC#',
       T.MPS_FILENAME   = '#MPS_FILENAME#',
       T.UPDATE_NAME    = '#UPDATE_NAME#',
       T.UPDATE_TIME    = SYSDATE

 WHERE T.MPS_ID = '#MPS_ID#'
          
   	 		
		]]>
	</query>

	<query id="CoreStableMps.queryDataByFilter" desc="是否存在指定炉批组号的材料库存">
		<![CDATA[
          
          SELECT T.MPS_ID,
       T.MSC,
       T.FINA_USER,
       T.FINA_USER_DESC,
       T.MPS_NO,
       T.DIMATER_MIN,
       T.DIMATER_MAX,
       T.HEIGHT_MIN,
       T.HEIGHT_MAX,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.MPS_FILENAME,
       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,
       DECODE(T.VALIDFLAG, '1', '有效', '无效') VALIDFLAG
  FROM SLM_ORDER_STABLE_MPS T
 WHERE T.MPS_NO || '&' LIKE '%' || ? || '%'
   AND T.MPS_FILENAME || '&' LIKE '%' || ? || '%'
   AND NVL(T.DIMATER_MIN, 0) <= NVL(?, 0)
   AND NVL(T.DIMATER_MAX, 9999) >= NVL(?, 0)
   AND NVL(T.HEIGHT_MIN, 0) <= NVL(?, 0)
   AND NVL(T.HEIGHT_MAX, 9999) >= NVL(?, 0)
   AND (INSTR(T.MODEL_CODE, ?) > 0 OR T.MODEL_CODE IS NULL)
   AND T.MSC  =  ?
   AND T.FINA_USER = ?
          
         
   	 		
		]]>
	</query>

	<query id="CoreStableMps.SelectStableMps" desc="是否存在指定炉批组号的材料库存">
		<![CDATA[
          
          UPDATE SLM_ORDER_LINE T
          SET T.MPS_ID = ?,
              T.MPS_NO_INPUT = ?,
              T.MPS_NO_FILE = ?
          WHERE T.ORD_LN_PK = ?
          
   	 		
		]]>
	</query>

	<query id="CoreStableMps.selectMpsAddr" desc="是否存在指定炉批组号的材料库存">
		<![CDATA[
          
          SELECT  T.MPS_ADDR FROM  
             SLM_ORDER_STABLE_MPS T
          WHERE T.MPS_ID = ?
          
   	 		
		]]>
	</query>




</queryMap>
