<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="长度基础数据">

	<query id="LengthCalculateDao.getSpec" desc="查询公差数据壁厚外径">
         <![CDATA[
       SELECT DESGIN_KEY,
       SIC,
       USE_CODE,
       USE_DESC,
       SPECL_FL,
       INDEX_SEQ,
       BIAS_CODE,
       BIAS_NAME,
       LV,
       BIAS_CODE_Z,
       BIAS_NAME_Z,
       ZMIN_SIGN,
       ZMIN,
       ZMAX_SIGN,
       ZMAX,
       BIAS_CODE_C,
       BIAS_NAME_C,
       CMIN_SIGN,
       CMIN,
       CMAX_SIGN,
       CMAX,
       BIAS_CODE_S,
       BIAS_NAME_S,
       SMIN_SIGN,
       SMIN,
       SMAX_SIGN,
       SMAX,
       ISCHECK,
       STD_MIN_VAL,
       STD_MAX_VAL,
       STD_MIN_IN,
       STD_MAX_IN,
       STD_MIN_PERCENT,
       STD_MAX_PERCENT,
       STD_MIN_FORMULA,
       STD_MAX_FORMULA,
       STD_MIN_FORMULA_V,
       STD_MAX_FORMULA_V,
       STDMEMO
  FROM SLM_ORD_DESIGN_STD_SIC T
 WHERE T.DESGIN_KEY = ?
   AND T.BIAS_CODE=?
 ORDER BY T.SPECL_FL DESC

         ]]>
	</query>


	<query id="LengthCalculateDao.getPline" desc="查询基础产线">
         <![CDATA[
          SELECT PLINE_CODE,
       PLINE_NAME,
       DEPARTMENT_CODE,
       DEPARTMENT_DESC,
       CREATE_NAME,
       CREATE_TIME,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME,
       VALIDFLAG,
       MEMO,
       PROCESS_CODE,
       PROCESS_DESC,
       PLINE_CODE_OLD,
       LENGTH_MIN,
       LENGTH_MAX,
       LENGTH_COLDBED,
       LENGTH_MAX_RING,
       LENGTH_MIN_RING,
       LENGTH_MIN_TUBE,
       LENGTH_MAX_TUBE,
       BURNOUT_RATE
  FROM COM_BASE_PLINE T WHERE T.PLINE_CODE = ? AND T.VALIDFLAG = '1'
         ]]>
	</query>

	<query id="LengthCalculateDao.saveLength" desc="保存长度">
         <![CDATA[
        INSERT INTO SLM_ORD_DESIGN_LENGTH(
        ROLL_SPEC_DESC,
        DESIGN_KEY,
        MSC,
        MSC_PLINE,
        ROLL_PLINE_CODE,
        ROLL_PLINE_DESC,
        FIT_BILT_SPECS,
        DIMATER,
        HEIGHT,
        HEIGHT_MAX,
        HEIGHT_MIN,
        SHRT_STOVE,
        SIGL_LEN,
        SHORT_TEST,
        LEN_MAX,
        LEN_MIN,
        CUT_HEAD_TAIL,
        BURN_OUT_RATE,
        LENGTH_COLD_BED,
        LENGTH_MAX_RING,
        IS_OUTPUT,
        BEST_BILT_SPEC,
        LOSS_PRCENT,
        AIM_LENGHT,
        CUT_NUM,
        ROLL_LENGHT,
        LENGHT_LIMIT,
        REASON,
        COMMIT_FLAG,
        ROLL_SPEC_CODE,
        GRADE_CODE,
        GRADE_NAME)
 VALUES( 
        '#ROLL_SPEC_DESC#',
        '#DESIGN_KEY#',
        '#MSC#',
        '#MSC_PLINE#',
        '#ROLL_PLINE_CODE#',
        '#ROLL_PLINE_DESC#',
        '#FIT_BILT_SPECS#',
        '#DIMATER#',
        '#HEIGHT#',
        '#HEIGHT_MAX#',
        '#HEIGHT_MIN#',
        '#SHRT_STOVE#',
        '#SIGL_LEN#',
        '#SHORT_TEST#',
        '#LEN_MAX#',
        '#LEN_MIN#',
        '#CUT_HEAD_TAIL#',
        '#BURN_OUT_RATE#',
        '#LENGTH_COLD_BED#',
        '#LENGTH_MAX_RING#',
        '#IS_OUTPUT#',
        '#BEST_BILT_SPEC#',
        '#LOSS_PRCENT#',
        '#AIM_LENGHT#',
        '#CUT_NUM#',
        '#ROLL_LENGHT#',
        '#LENGHT_LIMIT#',
        '#REASON#',
        '#COMMIT_FLAG#',
        '#ROLL_SPEC_CODE#',
         '#GRADE_CODE#',
        '#GRADE_NAME#')
         ]]>
	</query>

	<query id="LengthCalculateDao.getLength" desc="查询长度">
         <![CDATA[
         SELECT ORD_LN_PK,
       MSC,
       MSC_PLINE,
       ROLL_PLINE_CODE,
       ROLL_PLINE_DESC,
       FIT_BILT_SPECS,
       DIMATER,
       HEIGHT,
       HEIGHT_MAX,
       HEIGHT_MIN,
       SHRT_STOVE,
       SIGL_LEN,
       SHORT_TEST,
       LEN_MAX,
       LEN_MIN,
       CUT_HEAD_TAIL,
       BURN_OUT_RATE,
       LENGTH_COLD_BED,
       LENGTH_MAX_RING,
       IS_OUTPUT,
       BEST_BILT_SPEC,
       LOSS_PRCENT,
       AIM_LENGHT,
       CUT_NUM,
       ROLL_LENGHT,
       LENGHT_LIMIT,
       REASON,
       COMMIT_FLAG
  FROM SLM_ORD_DESIGN_LENGTH T
 WHERE T.ORD_LN_PK = ?
         ]]>
	</query>

	<query id="LengthCalculateDao.getRollSpecPline" desc="查询轧制产线">
         <![CDATA[
         SELECT DESGIN_KEY,
                MSC_PLINE,
                SPEC_CODE,
                PLINE_CODE,
                PLINE_NAME,
                PRD_LEN,
                LOSS_RATE,
                IS_OUTPUT
           FROM SLM_ORD_DESIGN_MSC_GZ_GG_PL T
          WHERE T.DESGIN_KEY = ?
            AND T.MSC_PLINE = ?
         ]]>
	</query>

	<query id="LengthCalculateDao.deleteLength" desc="刪除长度">
         <![CDATA[
        DELETE SLM_ORD_DESIGN_LENGTH T WHERE T.ORD_LN_PK = ?
         ]]>
	</query>

	<query id="LengthCalculateDao.updateRollSpecLine" desc="修改轧制产线">
         <![CDATA[
       UPDATE SLM_ORD_DESIGN_MSC_GZ_GG_PL
          SET IS_OUTPUT = '#IS_OUTPUT#',       
              PRD_LEN   = '#PRD_LEN#',
              LOSS_RATE = '#LOSS_RATE#'
        WHERE DESGIN_KEY = '#DESGIN_KEY#'
          AND MSC_PLINE = '#MSC_PLINE#'
          AND SPEC_CODE = '#SPEC_CODE#'
          AND PLINE_CODE = '#PLINE_CODE#'
         ]]>
	</query>

	<query id="LengthCalculateDao.getJgKeyValue" desc="查询接箍测量Ｊ值">
         <![CDATA[
         SELECT NVL((SELECT T1.CHECK_J_VAL
               FROM COM_MSC_JG T1
              WHERE T1.CODE_JG = T.CODE_JG
                AND T1.VALIDFLAG = '1'),
             0) CHECK_J_VAL
    FROM SLM_ORD_DESIGN_MSC_JG T
   WHERE T.DESGIN_KEY = ?
         ]]>
	</query>

	<query id="LengthCalculateDao.getSpecDH" desc="通过规格代码查询外径壁厚">
         <![CDATA[
SELECT T.DIMATER,T.HEIGHT FROM COM_BASE_SPEC T WHERE T.SPEC_CODE=?
         ]]>
	</query>

	<query id="LengthCalculateDao.getPlineE" desc="查询镦拔扩产线">
         <![CDATA[
            SELECT 
       T.DESGIN_KEY,
       T.MSC_PLINE,
       T.BACKLOG_SEQ,
       T.PROCESS_CODE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.WELL_CODE,
       T.WELL_NAME,
       T.WARN_FL,
       T.WARN_DESC,
       T.VALIDFLAG,
       T.IDENT_FLAG
 FROM SLM_ORD_DESIGN_MSC_PL_GX_PRL T
 where t.desgin_key=?
 and t.msc_pline=?
 and t.process_code=?
 ORDER BY T.PLINE_CODE
         ]]>
	</query>

	<query id="LengthCalculateDao.getCutHeadtailE" desc="查询镦拔扩切头切尾">
         <![CDATA[
SELECT T.CROP_HEAD, T.CROP_END, T.UPSETTING_LENGTH
  FROM SLM_BASE_MATERIAL_E_PL T
 WHERE T.IN_MATERIAL_NO = ?
   AND T.OUT_MATERIAL_NO = ?
   AND T.PLINE_CODE = ?
         ]]>
	</query>

	<query id="LengthCalculateDao.getCutHeadtailD" desc="查询轧管切头切尾">
         <![CDATA[
 SELECT 
       T.IN_MATERIAL_NO,
       T.OUT_MATERIAL_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.HR_CAPCTY,
       T.PRD_RATE,
       T.DBL_LEN_MAX,
       T.ROL_LEN_MIN,
       T.ROL_LEN_MAX,
       T.CROP_END,
       T.MANDREL_SIZE,
       T.DISABLE_FL,
       T.CROP_HEAD,
       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,
       T.PLINE_LEVEL,
       T.PROCESSING_COST,
       T.TOTAL_COST,
       T.TUBE_END_RATIO,
       NVL(T.DBL_LEN_MAX, 0) DBL_LEN_MAX
 FROM SLM_BASE_MATERIAL_D_PL T
 WHERE
T.IN_MATERIAL_NO = ?
AND T.OUT_MATERIAL_NO = ?
AND T.PLINE_CODE = ?

         ]]>
	</query>

	<query id="LengthCalculateDao.getGradeBySpecCode" desc="查询钢种">
         <![CDATA[
          SELECT 
       T.GRADECODE,
       T.GRADENAME
 FROM SLM_ORD_DESIGN_MSC_GZ_GG T
 WHERE
T.DESGIN_KEY = ?
AND T.MSC_PLINE = ?
AND T.SPEC_CODE = ?
         ]]>
	</query>

	<query id="LengthCalculateDao.getSlmOrdDesignBom" desc="查询成品物料BOM">
         <![CDATA[
          SELECT 
       T.MATERIAL_NO,
       T.MATERIAL_DESC,
       T.BOM,
       T.BOM_TYP,
       T.MSC_PLINE,
       T.WHOLE_BACKLOG,
       T.WHOLE_BACKLOG_DESC,
       T.MSC,
       T.MSC_DESC,
       T.GRADECODE,
       T.GRADENAME,
       T.SPEC_CODE_C,
       T.SPEC_NAME_C,
       T.SPEC_CODE_R,
       T.SPEC_NAME_R,
       T.SPEC_CODE_D,
       T.SPEC_NAME_D,
       T.SPEC_CODE_Z,
       T.SPEC_NAME_Z,
       T.A_IN_MATERIAL_NO,
       T.A_IN_MATERIAL_DESC,
       T.A_OUT_MATERIAL_NO,
       T.A_OUT_MATERIAL_DESC,
       T.B_IN_MATERIAL_NO,
       T.B_IN_MATERIAL_DESC,
       T.B_OUT_MATERIAL_NO,
       T.B_OUT_MATERIAL_DESC,
       T.C_IN_MATERIAL_NO,
       T.C_IN_MATERIAL_DESC,
       T.C_OUT_MATERIAL_NO,
       T.C_OUT_MATERIAL_DESC,
       T.D_IN_MATERIAL_NO,
       T.D_IN_MATERIAL_DESC,
       T.D_OUT_MATERIAL_NO,
       T.D_OUT_MATERIAL_DESC,
       T.E_IN_MATERIAL_NO,
       T.E_IN_MATERIAL_DESC,
       T.E_OUT_MATERIAL_NO,
       T.E_OUT_MATERIAL_DESC,
       T.F_IN_MATERIAL_NO,
       T.F_IN_MATERIAL_DESC,
       T.F_OUT_MATERIAL_NO,
       T.F_OUT_MATERIAL_DESC,
       T.J_IN_MATERIAL_NO,
       T.J_IN_MATERIAL_DESC,
       T.J_OUT_MATERIAL_NO,
       T.J_OUT_MATERIAL_DESC,
       T.I_IN_MATERIAL_NO,
       T.I_IN_MATERIAL_DESC,
       T.I_OUT_MATERIAL_NO,
       T.I_OUT_MATERIAL_DESC,
       T.PROCESS_CODE_CS,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.CREATE_NAME
 FROM SLM_ORD_DESIGN_BOM T,SLM_ORD_LINE_BOM T1
 WHERE
T.BOM=T1.BOM
AND T1.DESGIN_KEY=?
AND T.MSC_PLINE=?
AND T.GRADECODE=?
AND T.SPEC_CODE_R=?

         ]]>
	</query>

	<query id="LengthCalculateDao.getGradeByMscPline" desc="查询钢种">
         <![CDATA[
         select t.GRADECODE,t.gradename from slm_ord_design_msc_pl_gz t where t.desgin_key=? and t.msc_pline=?
         ]]>
	</query>
</queryMap>