<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="合同量重算">

	<query id="CoreOrdProcRefresCal.queryPlnOrdProc" desc="查询排产合同信息">
		<![CDATA[
			SELECT T.WEIGHT_PER_M,
			       T.AIM_LEN_END,
			       T.PLANSTATUS,
			       T.PROCESS_SEQ,
			       T.INDEX_SEQ,
			       T.BOM,
			       T.GROUP_ROLL,
			       T.ORDER_QTY_D,
			       T.ORDER_UNIT,
			       T.ROLL_MONTH,
			       T1.CODE_JG,
			       T1.OUTS_STL_PIPE_FL,
			       M.DESGIN_KEY
			  FROM PLN_SALEORD_PROC T
			  LEFT JOIN PLN_SALEORD T1
			    ON T.ORD_LN_DLY_PK = T1.ORD_LN_DLY_PK
			  LEFT JOIN CRAFT_ORD_DESIGN M
			    ON M.ORD_LN_PK = T1.ORD_LN_PK
			   AND M.CRAFT_SEQ = T.CRAFT_SEQ
			 WHERE T.ORD_LN_DLY_PK = ?
			   AND T.PLN_DIVIDE_ID = ?
		]]>
	</query>

	<query id="CoreOrdProcRefresCal.updatePlnOrdProcOutPi" desc="更新外购管交货行子记录拆分量">
		<![CDATA[
			UPDATE PLN_SALEORD_PROC T
			   SET T.PLAN_WT_D      = '#PLAN_WT_D#',
			       T.PLAN_NUM_D     = '#PLAN_NUM_D#',
			       T.AIM_LEN_END    = '#AIM_LEN_END#',
			       T.PLAN_P_MAIN    = '#PLAN_P_MAIN#',
			       T.PLAN_TOT_LEN_D = '#PLAN_TOT_LEN_D#'
			 WHERE T.ORD_LN_DLY_PK = '#ORD_LN_DLY_PK#'
			   AND T.PLN_DIVIDE_ID = '#PLN_DIVIDE_ID#'
		]]>
	</query>
	
	<query id="CoreOrdProcRefresCal.updatePlnOrdProc" desc="更新交货行子记录拆分量">
		<![CDATA[
			UPDATE PLN_SALEORD_PROC T
			   SET T.PLAN_WT_D      = '#PLAN_WT_D#',
			       T.PLAN_NUM_D     = '#PLAN_NUM_D#',
			       T.WEIGHT_PER_M   = '#WEIGHT_PER_M#',
			       T.AIM_LEN_END    = '#AIM_LEN_END#',
			       T.AIM_LEN_ROLL   = '#AIM_LEN_ROLL#',
			       T.PLAN_P_MAIN    = '#PLAN_P_MAIN#',
			       T.PLAN_TOT_LEN_D = '#PLAN_TOT_LEN_D#',
			       T.TOT_LEN_ONE_P  = '#TOT_LEN_ONE_P#',
			       T.CUT_NUM_P      = '#CUT_NUM_P#',
			       T.AIM_WALLTHICK  = '#AIM_WALLTHICK#',
			       T.ROLL_LENGTH    = '#ROLL_LENGTH#',
			       T.LEN_ROLL_MAX  	= '#LEN_ROLL_MAX#',
			       T.LEN_ROLL_MIN   = '#LEN_ROLL_MIN#'
			 WHERE T.ORD_LN_DLY_PK = '#ORD_LN_DLY_PK#'
			   AND T.PLN_DIVIDE_ID = '#PLN_DIVIDE_ID#'
		]]>
	</query>
</queryMap>