<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc=" 加工产线能力维护">

	<query id="FrmBaseMaterialIPl.getBaseJgxPline" desc="初始化加工基础产线">
             <![CDATA[
             SELECT T.PLINE_CODE, T.PLINE_NAME
  FROM COM_BASE_PLINE T
 WHERE T.PROCESS_CODE = 'G'
   AND T.VALIDFLAG = '1'
   AND DECODE(?, NULL, 1, T.GROUP_PLAN) = DECODE(?, NULL, 1, ?)
   ORDER BY T.PLINE_CODE
                 ]]>
	</query>


	<query id="FrmBaseMaterialIPl.getMaterialDesc" desc="初始化物料描述">
             <![CDATA[
             SELECT T.IN_MATERIAL_NO,
       T.IN_MATERIAL_DESC,
       T.OUT_MATERIAL_NO,
       T.OUT_MATERIAL_DESC
  FROM  SLM_BASE_MATERIAL_K T
   WHERE T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
                 ]]>
	</query>

	<query id="FrmBaseMaterialIPl.getGjxPl" desc="查询加工产线能力">
             <![CDATA[
SELECT T.IN_MATERIAL_NO,
       T.IN_MATERIAL_DESC,
       T.OUT_MATERIAL_NO,
       T.OUT_MATERIAL_DESC,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.HR_CAPCTY,
       T.PRD_RATE,
       T.PLINE_LEVEL,
       T.WASTE_RATE,
       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,
       DECODE(T.DISABLE_FL,'1','True','False') DISABLE_FL,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME
  FROM SLM_BASE_MATERIAL_K_PL T, COM_BASE_PLINE T1
 WHERE T.PLINE_CODE = T1.PLINE_CODE
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
   AND DECODE(?, NULL, 1, T1.GROUP_PLAN) = DECODE(?, NULL, 1, ?)
 ORDER BY T.PLINE_CODE
                 ]]>
	</query>

	<query id="FrmBaseMaterialIPl.checkIsExist" desc="验证是否存在">
             <![CDATA[
             SELECT  T.OUT_MATERIAL_NO,
                T.OUT_MATERIAL_DESC,
                T.IN_MATERIAL_DESC,
                T.IN_MATERIAL_NO
  FROM SLM_BASE_MATERIAL_K_PL T
 WHERE T.PLINE_CODE = ?
   AND T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
                 ]]>
	</query>

	<query id="FrmBaseMaterialIPl.addJgxPl" desc="新增加工产线能力">
             <![CDATA[
             INSERT INTO SLM_BASE_MATERIAL_K_PL
  (OUT_MATERIAL_NO,
  OUT_MATERIAL_DESC,
  IN_MATERIAL_DESC,
  IN_MATERIAL_NO,
   PLINE_CODE,
   PLINE_NAME,
   HR_CAPCTY,
   PRD_RATE,
   WASTE_RATE,
   PLINE_LEVEL,
   CREATE_NAME,
   CREATE_TIME,
   UPDATE_NAME,
   UPDATE_TIME,
   DELETE_NAME,
   DELETE_TIME,
   DISABLE_FL)
VALUES
  ('#OUT_MATERIAL_NO#',
  '#OUT_MATERIAL_DESC#',
  '#IN_MATERIAL_DESC#',
  '#IN_MATERIAL_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#HR_CAPCTY#',
   '#PRD_RATE#',
   '#WASTE_RATE#',
   '#PLINE_LEVEL#',
   '#CREATE_NAME#',
   SYSDATE,
   NULL,
   NULL,
   NULL,
   NULL,
   '0')
                 ]]>
	</query>

	<query id="FrmBaseMaterialIPl.updateJgxPl" desc="修改加工产线能力">
             <![CDATA[
         UPDATE SLM_BASE_MATERIAL_K_PL T
   SET T.IN_MATERIAL_NO    = '#IN_MATERIAL_NO#',
       T.IN_MATERIAL_DESC  = '#IN_MATERIAL_DESC#',
       T.OUT_MATERIAL_NO   = '#OUT_MATERIAL_NO#',
       T.OUT_MATERIAL_DESC = '#OUT_MATERIAL_DESC#',
       T.PLINE_CODE        = '#PLINE_CODE#',
       T.PLINE_NAME        = '#PLINE_NAME#',
       T.HR_CAPCTY         = '#HR_CAPCTY#',
       T.PRD_RATE          = '#PRD_RATE#',
       T.PLINE_LEVEL       = '#PLINE_LEVEL#',
       T.WASTE_RATE        = '#WASTE_RATE#',
       T.UPDATE_NAME       = '#UPDATE_NAME#',
       T.UPDATE_TIME       = SYSDATE,
       T.DISABLE_FL           ='#DISABLE_FL#'
 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="FrmBaseMaterialIPl.deleteJgxPl" desc="删除加工产线能力">
             <![CDATA[
             DELETE FROM SLM_BASE_MATERIAL_K_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>