<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="镦拔扩产线能力">

	<query id="FrmBaseMaterialHPl.getBaseMaterialH" desc="查询基础接箍物料">
             <![CDATA[
               SELECT T.IN_MATERIAL_NO,T.IN_MATERIAL_DESC,T.OUT_MATERIAL_NO,T.OUT_MATERIAL_DESC FROM SLM_BASE_MATERIAL_H T 
               WHERE T.IN_MATERIAL_NO=? AND T.OUT_MATERIAL_NO=?
                 ]]>
	</query>

	<query id="FrmBaseMaterialHPl.getBaseMaterialHPl" 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,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
        DECODE(T.DISABLE_FL, '1', 'TRUE', 'FALSE') DISABLE_FL,
       T.PROCESSING_COST,
       T.TOTAL_COST
  FROM SLM_BASE_MATERIAL_H_PL T
 WHERE T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
                 ]]>
	</query>

	<query id="FrmBaseMaterialHPl.updateBaseMaterialHPl" desc="修改接箍物料产线能力">
             <![CDATA[
             UPDATE SLM_BASE_MATERIAL_H_PL T
   SET 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#',
       T.PROCESSING_COST = '#PROCESSING_COST#',
       T.TOTAL_COST      = '#TOTAL_COST#'
 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="FrmBaseMaterialHPl.updateBasePlineJgM" desc="修改接箍订单产线">
             <![CDATA[
    UPDATE PLN_GX_JG_M T
   SET T.PLINE_CODE  = ?,
       T.PLINE_NAME  = ?,
       T.UPDATE_NAME = ?,
       T.UPDATE_TIME = SYSDATE
 WHERE T.PRO_PLAN_ID = ?     
              ]]>
	</query>
	<query id="FrmBaseMaterialHPl.QueryPlineJgM" desc="查询接箍订单是否全部配料完成">
             <![CDATA[
SELECT T.PRO_PLAN_ID,
       DECODE(T.IFBUYPLAN,
              '1',
              '完成配料',
              DECODE(SIGN(NVL(T.PLAN_NUM, 0) - NVL(T.MATCHNUM, 0) -
                          NVL(T.JGWT_BLREQ, 0)),
                     1,
                     '未完成配料',
                     '完成配料')) IS_FINISH,
   NVL(T.JGWT_BLREQ, 0) JGWT_BLREQ
  FROM PLN_GX_JG_M T
 WHERE T.PRO_PLAN_ID = ? 
              ]]>
	</query>
</queryMap>