<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="合同量转换计算参数">
	<query id="CoreGetOrdAmount.getPlineNameByCode" desc="查询产线名称">
		<![CDATA[
			SELECT PLINE_NAME
			  FROM COM_BASE_PLINE T
			 WHERE T.PLINE_CODE = ?
		]]>
	</query>

	<query id="CoreGetOrdAmount.getPlnSaleOrdInf" desc="查询排产表交货行信息">
		<![CDATA[
			SELECT T.ORDER_QTY,
			       T.ORDER_UNIT,
			       T.TOTLENGTH,
			       T.TOTLENGTH_M,
			       NVL(T.TOTLENGTH_UNIT, T.LEN_UNIT) TOTLENGTH_UNIT,
			       T.LENGTHMAX,
			       T.LENGTHMIN,
			       T.OUTDIAMETER,
			       T.WALLTHICK,
			       NVL(T.WEIGH_TYPE,
			           (SELECT B.ASK_SUB_ITME_VAL_DESC
			              FROM SLM_ORDER_ADD_ASK B
			             WHERE B.ADD_ASK_NO = T.ADD_ASK_NO
			               AND B.ASK_ITME = '121005'
			               AND B.VALIDFLAG = '1')) WEIGH_TYPE,
			       (SELECT B.INSPECTION_VALUE
			          FROM SLM_ORDER_LINE B
			         WHERE B.VALIDFLAG = '1'
			           AND B.ORD_LN_PK = T.ORD_LN_PK) INSPECTION_VALUE,
			       T.DELVRY_RANGE_MIN,
			       T.DELVRY_RANGE_MAX,
			       T.DELVRY_RANGE_TPE,
			       T.MODEL_DESC,
			       T.SIGL_LEN,
			       T.SHORTEST,
			       T.SHRT_STOVE,
			       T.SHRT_LEN_RATO,
			       T.LEN_UNIT,
			       NVL(T.AVG_LEN_MIN, 0) AVG_LEN_MIN,
			       T.ORD_LN_DLY_PK,
			       NVL(T.ENDLEN_SPECSTD,0) ENDLEN_SPECSTD
			  FROM PLN_SALEORD T
			 WHERE T.ORD_LN_DLY_PK = ?
		]]>
	</query>

	<query id="CoreGetOrdAmount.getPlnSaleOrdDivideInf" desc="查询排产表交货行分解表信息">
		<![CDATA[
			SELECT T1.ORDER_QTY_D,
			       T.ORDER_UNIT,
			       (T.TOTLENGTH * (T1.ORDER_QTY_D / T.ORDER_QTY)) TOTLENGTH,
			       NVL(T.TOTLENGTH_UNIT, T.LEN_UNIT) TOTLENGTH_UNIT,
			       T.LENGTHMAX,
			       T.LENGTHMIN,
			       T.OUTDIAMETER,
			       T.WALLTHICK,
			       NVL(T.WEIGH_TYPE,
			           (SELECT B.ASK_SUB_ITME_VAL_DESC
			              FROM SLM_ORDER_ADD_ASK B
			             WHERE B.ADD_ASK_NO = T.ADD_ASK_NO
			               AND B.ASK_ITME = '121005'
			               AND B.VALIDFLAG = '1')) WEIGH_TYPE,
			       (SELECT B.INSPECTION_VALUE
			          FROM SLM_ORDER_LINE B
			         WHERE B.VALIDFLAG = '1'
			           AND B.ORD_LN_PK = T.ORD_LN_PK) INSPECTION_VALUE,
			       T.DELVRY_RANGE_MIN,
			       T.DELVRY_RANGE_MAX,
			       T.DELVRY_RANGE_TPE,
			       T.MODEL_DESC,
			       T.SIGL_LEN,
			       T.SHORTEST,
			       T.SHRT_STOVE,
			       T.SHRT_LEN_RATO,
			       T.LEN_UNIT,
			       NVL(T.ENDLEN_SPECSTD,0) ENDLEN_SPECSTD
			  FROM PLN_SALEORD T, PLN_SALEORD_PROC T1
			 WHERE T.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK
			   AND T1.ORD_LN_DLY_PK = ?
			   AND T1.PLN_DIVIDE_ID = ?
		]]>
	</query>

	<query id="CoreGetOrdAmount.queryMscPlPrc" desc="查询工序内控标准索引号">
		<![CDATA[
			SELECT SIC
			  FROM CRAFT_ORD_DESIGN_MSC_PL_PRC T
			 WHERE T.DESGIN_KEY = ?
			   AND T.MSC_PLINE = ?
			   AND T.PROCESS_CODE = ?
		]]>
	</query>

	<query id="CoreGetOrdAmount.getBomZgSpecInf" desc="查询BOM轧管规格">
		<![CDATA[
			SELECT T.D_IN_MATERIAL_NO,
			       T.D_OUT_MATERIAL_NO,
			       T.E_IN_MATERIAL_NO,
			       T.E_OUT_MATERIAL_NO,
			       (SELECT B.DIMATER
			          FROM COM_BASE_SPEC B
			         WHERE B.SPEC_CODE = T.SPEC_CODE_R) DIMATER,
			       (SELECT B.HEIGHT
			          FROM COM_BASE_SPEC B
			         WHERE B.SPEC_CODE = T.SPEC_CODE_R) HEIGHT,
			       (SELECT B.DIMATER
			          FROM COM_BASE_SPEC B
			         WHERE B.SPEC_CODE = NVL(T.SPEC_CODE_D, T.SPEC_CODE_Z)) SPEC_BILT,
			       T.WHOLE_BACKLOG,
                   T.WHOLE_BACKLOG_DESC
			  FROM SLM_ORD_DESIGN_BOM T
			 WHERE T.BOM = ?
		]]>
	</query>

	<query id="CoreGetOrdAmount.getZgBasePline" desc="查询BOM轧管规格">
		<![CDATA[
			SELECT T.PLINE_CODE,
			       T.PLINE_NAME,
			       T.PROCESS_CODE,
			       T.LENGTH_COLDBED,
			       T.LENGTH_MAX_RING,
			       T.LENGTH_MIN_RING,
			       T.BURNOUT_RATE,
			       NVL(T.LENGTH_MIN_TUBE, 0) LENGTH_MIN_TUBE,
                   NVL(T.LENGTH_MAX_TUBE, 0) LENGTH_MAX_TUBE,
                   NVL(T.TOLERANCE_ZONE, 0) TOLERANCE_ZONE,
			       T.LENGTH_MIN,
			       T.LENGTH_MAX
			  FROM COM_BASE_PLINE T
			 WHERE T.PROCESS_CODE = 'D'
			   AND T.PLINE_CODE = ?
			   AND T.VALIDFLAG = '1'
		]]>
	</query>

	<query id="CoreGetOrdAmount.getComMscJg" desc="查询接箍信息">
		<![CDATA[
			SELECT T.WEIGHT_JG, T.CHECK_J_VAL
			  FROM COM_MSC_JG T
			 WHERE T.CODE_JG = ?
			   AND T.VALIDFLAG = '1'
		]]>
	</query>

	<query id="CoreGetOrdAmount.getMaterialDPl" desc="查询轧管小时能力产线切头尾">
		<![CDATA[
			SELECT CROP_END, CROP_HEAD,TUBE_END_RATIO,
			       NVL(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 = ?
			   AND (T.DISABLE_FL != '1' OR T.DISABLE_FL IS NULL)
		]]>
	</query>

	<query id="CoreGetOrdAmount.getMaterialEPl" desc="查询镦拔扩小时能力加长">
		<![CDATA[
			SELECT T.CROP_HEAD,
			       T.CROP_END,
			       T.UPSETTING_LENGTH,
			       T.PLINE_CODE,
			       B.BURNOUT_RATE
			  FROM SLM_BASE_MATERIAL_E_PL T
			  LEFT JOIN COM_BASE_PLINE B
			    ON B.PLINE_CODE = T.PLINE_CODE
			   AND B.VALIDFLAG = '1'
			 WHERE (T.DISABLE_FL != '1' OR T.DISABLE_FL IS NULL)
			   AND T.AUDIT_FLAG != '0'
			   AND T.IN_MATERIAL_NO = ?
			   AND T.OUT_MATERIAL_NO = ?
			   AND T.PLINE_CODE IN (SELECT B.PLINE_CODE
                                 FROM CRAFT_ORD_DESIGN_MSC_PL_GX_PRL B
                                WHERE B.PROCESS_CODE = 'E'
                                  AND B.DESGIN_KEY = ?
                                  AND B.MSC_PLINE = ?
                                  AND B.VALIDFLAG = '1')
			 ORDER BY T.PRD_RATE DESC
		]]>
	</query>

	<query id="CoreGetOrdAmount.getMscBlInfo" desc="查询备料码信息">
		<![CDATA[
			SELECT T.MODEL_CODE, T.MODEL_DESC FROM COM_MSC_BL T WHERE T.PSC_BL = ?
		]]>
	</query>
	<query id="CoreGetOrdAmount.getChekJAve" desc="查询测量J值和平均长度大于">
		<![CDATA[
SELECT NVL(T.AVG_LEN_MIN, 0) AVG_LEN_MIN,
       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 PLN_SALEORD T
 WHERE T.ORD_LN_DLY_PK =?

		]]>
	</query>

</queryMap>