<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="热处理产线能力">

	<query id="FrmBaseMaterialFPl.queryRclPl" desc="查询热处理产线能力">
             <![CDATA[
             SELECT T1.IN_MATERIAL_NO,
       T1.OUT_MATERIAL_NO,
       T2.IN_MATERIAL_DESC,
       T2.OUT_MATERIAL_DESC,
       T1.PLINE_CODE,
       T1. PLINE_NAME,
       T1.HR_CAPCTY,
       T1.PRD_RATE,
       T1.PLINE_LEVEL,
       DECODE(T1.DISABLE_FL,'1','TRUE','FALSE') DISABLE_FL,
       T1.WASTE_RATE,
       T1.CREATE_NAME,
       TO_CHAR(T1.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T1.UPDATE_NAME,
       TO_CHAR(T1.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T1.DELETE_NAME,
       T1.DELETE_TIME
  FROM SLM_BASE_MATERIAL_F_PL T1, SLM_BASE_MATERIAL_F T2,COM_BASE_PLINE T3
 WHERE T1.IN_MATERIAL_NO = T2.IN_MATERIAL_NO
   AND T1.OUT_MATERIAL_NO = T2.OUT_MATERIAL_NO
   AND T1.PLINE_CODE=T3.PLINE_CODE
   AND T1.IN_MATERIAL_NO = ?
   AND T1.OUT_MATERIAL_NO = ?
   AND DECODE(?, NULL, 1, T3.GROUP_PLAN) = DECODE(?, NULL, 1, ?)
                 ]]>
	</query>

	<query id="FrmBaseMaterialFPl.checkIsExist" desc="验证是否存在">
             <![CDATA[
SELECT IN_MATERIAL_NO,
       OUT_MATERIAL_NO,
       PLINE_CODE,
       PLINE_NAME,
       HR_CAPCTY,
       PRD_RATE,
       DISABLE_FL,
       WASTE_RATE,
       CREATE_NAME,
       CREATE_TIME,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME
  FROM SLM_BASE_MATERIAL_F_PL T
 WHERE T.PLINE_CODE = ?
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
                 ]]>
	</query>

	<query id="FrmBaseMaterialFPl.getBasePlineF" desc="查询基础热处理产线">
             <![CDATA[
SELECT T.PLINE_CODE, T.PLINE_NAME
  FROM COM_BASE_PLINE T
 WHERE T.PROCESS_CODE = 'F'
   AND T.VALIDFLAG = '1'
   AND DECODE(?, NULL, 1, T.GROUP_PLAN) = DECODE(?, NULL, 1, ?)
 ORDER BY T.PLINE_CODE
                 ]]>
	</query>

	<query id="FrmBaseMaterialFPl.getBaseMaterialDescF" desc="查询热处理基础物料描述">
             <![CDATA[
SELECT T.IN_MATERIAL_DESC ,T.OUT_MATERIAL_DESC
  FROM SLM_BASE_MATERIAL_F T
 WHERE T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
                 ]]>
	</query>

	<query id="FrmBaseMaterialFPl.addRclPl" desc="新增热处理产线能力">
             <![CDATA[
INSERT INTO SLM_BASE_MATERIAL_F_PL
  (IN_MATERIAL_NO,
   OUT_MATERIAL_NO,
   PLINE_CODE,
   PLINE_NAME,
   HR_CAPCTY,
   PRD_RATE,
   DISABLE_FL,
   WASTE_RATE,
    PLINE_LEVEL,
   CREATE_NAME,
   CREATE_TIME,
   UPDATE_NAME,
   UPDATE_TIME,
   DELETE_NAME,
   DELETE_TIME)
VALUES
  ('#IN_MATERIAL_NO#',
   '#OUT_MATERIAL_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#HR_CAPCTY#',
   '#PRD_RATE#',
   '#DISABLE_FL#',
   '#WASTE_RATE#',
   '#PLINE_LEVEL#',
   '#CREATE_NAME#',
   SYSDATE,
   NULL,
   NULL,
   NULL,
   SYSDATE)
                 ]]>
	</query>


	<query id="FrmBaseMaterialFPl.updateRclPl" desc="修改热处理产线能力">
             <![CDATA[
UPDATE SLM_BASE_MATERIAL_F_PL T
   SET T.IN_MATERIAL_NO  = '#IN_MATERIAL_NO#',
       T.OUT_MATERIAL_NO = '#OUT_MATERIAL_NO#',
       T.PLINE_CODE      = '#PLINE_CODE#',
       T.PLINE_NAME      = '#PLINE_NAME#',
       T.HR_CAPCTY       = '#HR_CAPCTY#',
       T.PRD_RATE        = '#PRD_RATE#',
       T.DISABLE_FL      = '#DISABLE_FL#',
       T.WASTE_RATE      = '#WASTE_RATE#',
        T.PLINE_LEVEL     ='#PLINE_LEVEL#',
       T.UPDATE_NAME     = '#UPDATE_NAME#',
       T.UPDATE_TIME     = SYSDATE
 WHERE T.IN_MATERIAL_NO = '#IN_MATERIAL_NO#'
   AND T.OUT_MATERIAL_NO = '#OUT_MATERIAL_NO#'
   AND T.PLINE_CODE = '#PLINE_CODE#'
                 ]]>
	</query>

	<query id="FrmBaseMaterialFPl.deleteRclPl" desc="删除热处理产线能力">
             <![CDATA[
DELETE FROM SLM_BASE_MATERIAL_F_PL T
 WHERE T.IN_MATERIAL_NO = '#IN_MATERIAL_NO#'
   AND T.OUT_MATERIAL_NO = '#OUT_MATERIAL_NO#'
   AND T.PLINE_CODE = '#PLINE_CODE#'
                 ]]>
	</query>

</queryMap>