<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="轧管推荐长度申请审批">
	<query id="FrmApplyRoval.queryApplyNo" desc="查询">
		<![CDATA[
	SELECT T.APPLY_NO,
       T.ORD_LN_PK,
       T.ORDER_SOURCE,
       T.ORD_LN_DLY_PK,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.OUTDIAMETER,
       T.WALLTHICK,
       T.LENGTH_MIN,
       T.LENGTH_MAX,
       T.LENGTHDISC,
       T1.LEN_MIN LENGTH_MIN_N,
       T1.LEN_MAX LENGTH_MAX_N,
       T.LENGTHDISC_N,
       DECODE(T.EXE_STATUS,
              '00',
              '作废',
              '10',
              '申请',
              '20',
              '审批通过',
              '30',
              '审批不通过') EXE_STATUS,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.APPLY_MAN,
       TO_CHAR(T.APPLY_TIME, 'YYYY-MM-DD HH24:MI:SS') APPLY_TIME,
       T.ISSUED_MEMO,
       TO_CHAR(T.ISSUED_TIME, 'YYYY-MM-DD HH24:MI:SS') ISSUED_TIME,
       T.ISSUED_MAN,
       T.FOUNDER_NAME,
       (SELECT S.SHRT_STOVE FROM SLM_ORDER_LEN S WHERE T.LEN_NO = S.LEN_NO) SHRT_STOVE,
       T1.SHRT_STOVE SHRT_STOVE_N,
       T.LEN_NO,
       T.LEN_NO_N
  FROM PLN_SIZE_UPAPPLY T, SLM_ORDER_LEN T1
 WHERE T.LEN_NO_N = T1.LEN_NO
		]]>
	</query>
	<query id="FrmApplyRoval.updateApplyNoStrat" desc="修改审批状态">
		<![CDATA[
UPDATE PLN_SIZE_UPAPPLY
   SET EXE_STATUS  = ?,
       ISSUED_MEMO = ?,
       ISSUED_TIME = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       ISSUED_MAN  = ?,
       LENGTHDISC_N=?
 WHERE APPLY_NO = ?
		]]>
	</query>
	<query id="FrmApplyRoval.updatePlnOrderZgS" desc="修改轧管排产耗时表">
		<![CDATA[
UPDATE PLN_ORDER_ZG_S
   SET APPLY_STATUS = ?, ISSUED_MEMO = ?
 WHERE ORDER_NO = ?
   AND ORDER_SEQ = ?
		]]>
	</query>
	<query id="FrmApplyRoval.updatePlnSarORDER" desc="修改合同提报表">
		<![CDATA[
UPDATE PLN_SALEORD
   SET LENGTHDISC_N = ?, LEN_NO_N = ?
 WHERE ORD_LN_PK = ?
		]]>
	</query>
	<query id="FrmApplyRoval.updatePlnSarORDERLen" desc="修改合同提报表长度">
		<![CDATA[
UPDATE PLN_SALEORD
   SET LEN_NO         = '#LEN_NO#',
       LENGTHDISC     = '#LEN_DESC#',
       LENGTHMIN      = '#LEN_MIN#',
       LENGTHMAX      = '#LEN_MAX#',
       SHRT_STOVE     = '#SHRT_STOVE#',
       SHRT_LEN_RATO  = '#SHRT_LEN_RATO#',
       SHORTEST       = '#SHORTEST#',
       LONG_LEN_RATO  = '#LONG_LEN_RATO#',
       LONGEST        = '#LONGEST#',
       AVG_LEN_MIN    = '#AVG_LEN_MIN#',
       DIFRNC_LEN_MAX = '#DIFRNC_LEN_MAX#',
       SIGL_LEN       = '#SIGL_LEN#',
       ENDLEN_SPECSTD = '#ENDLEN_SPECSTD#'
 WHERE ORD_LN_PK = ?

		]]>
	</query>
	<query id="FrmApplyRoval.updateSlmOrderLen" desc="修改合同行长度">
		<![CDATA[
UPDATE SLM_ORDER_LINE
   SET LEN_NO         = '#LEN_NO#',
       LEN_DESC       = '#LEN_DESC#',
       LEN_MIN        = '#LEN_MIN#',
       LEN_MAX        = '#LEN_MAX#',
       SHRT_LEN_RATO  = '#SHRT_LEN_RATO#',
       SHORTEST       = '#SHORTEST#',
       LONG_LEN_RATO  = '#LONG_LEN_RATO#',
       LONGEST        = '#LONGEST#',
       SHRT_STOVE     = '#SHRT_STOVE#',
       AVG_LEN_MIN    = '#AVG_LEN_MIN#',
       DIFRNC_LEN_MAX = '#DIFRNC_LEN_MAX#',
       ENDLEN_SPECSTD = '#ENDLEN_SPECSTD#',
       SIGL_LEN       = '#SIGL_LEN#'
 WHERE ORD_LN_PK = ?
		]]>
	</query>
	<query id="FrmApplyRoval.updatePln" desc="修改计划表">
		<![CDATA[
DECLARE
BEGIN
  UPDATE PLN_ORDER_JGX_S T
     SET T.LENGTHMAX      = '#LEN_MAX#',
         T.LENGTHMIN      = '#LEN_MIN#',
         T.LENGTHDISC     = '#LEN_DESC#',
         T.SHRT_LEN_RATO  = '#SHRT_LEN_RATO#',
         T.SHORTEST       = '#SHORTEST#',
         T.LONG_LEN_RATO  = '#LONG_LEN_RATO#',
         T.LONGEST        = '#LONGEST#',
         T.SHRT_STOVE     = '#SHRT_STOVE#',
         T.AVG_LEN_MIN    = '#AVG_LEN_MIN#',
         T.DIFRNC_LEN_MAX = '#DIFRNC_LEN_MAX#',
         T.SIGL_LEN       = '#SIGL_LEN#',
         T.ENDLEN_SPECSTD = '#ENDLEN_SPECSTD#'
   WHERE T.ORDER_NO = '#ORDER_NO#'
     AND T.ORDER_SEQ = '#ORDER_SEQ#';
  UPDATE PLN_GX_JGX_M T
     SET T.LENGTHMAX      = '#LEN_MAX#',
         T.LENGTHMIN      = '#LEN_MIN#',
         T.LENGTHDISC     = '#LEN_DESC#',
         T.SHRT_LEN_RATO  = '#SHRT_LEN_RATO#',
         T.SHORTEST       = '#SHORTEST#',
         T.LONG_LEN_RATO  = '#LONG_LEN_RATO#',
         T.LONGEST        = '#LONGEST#',
         T.SHRT_STOVE     = '#SHRT_STOVE#',
         T.AVG_LEN_MIN    = '#AVG_LEN_MIN#',
         T.DIFRNC_LEN_MAX = '#DIFRNC_LEN_MAX#',
         T.SIGL_LEN       = '#SIGL_LEN#',
         T.ENDLEN_SPECSTD = '#ENDLEN_SPECSTD#'
   WHERE T.ORDER_NO = '#ORDER_NO#'
     AND T.ORDER_SEQ = '#ORDER_SEQ#';
  UPDATE PLN_ORDER_JGX T
     SET T.LENGTHMAX  = '#LEN_MAX#',
         T.LENGTHMIN  = '#LEN_MIN#',
         T.LENGTHDISC = '#LEN_DESC#'
   WHERE T.ORDER_NO = '#ORDER_NO#'
     AND T.ORDER_SEQ = '#ORDER_SEQ#';
  UPDATE PLN_ORDER_DBK_S T
     SET T.LENGTHDISC = '#LEN_DESC#'
   WHERE T.ORDER_NO = '#ORDER_NO#'
     AND T.ORDER_SEQ = '#ORDER_SEQ#';
  UPDATE PLN_ORDER_DBK T
     SET T.LENGTHMAX = '#LEN_MAX#', T.LENGTHMIN = '#LEN_MIN#'
   WHERE T.ORDER_NO = '#ORDER_NO#'
     AND T.ORDER_SEQ = '#ORDER_SEQ#';
  UPDATE PLN_GX_DBK_M T
     SET T.LENGTHMAX = '#LEN_MAX#', T.LENGTHMIN = '#LEN_MIN#'
   WHERE T.ORDER_NO = '#ORDER_NO#'
     AND T.ORDER_SEQ = '#ORDER_SEQ#';
  UPDATE PLN_ORDER_RCL_S T
     SET T.LENGTHDISC = '#LEN_DESC#'
   WHERE T.ORDER_NO = '#ORDER_NO#'
     AND T.ORDER_SEQ = '#ORDER_SEQ#';
  UPDATE PLN_ORDER_RCL T
     SET T.LENGTHMAX = '#LEN_MAX#', T.LENGTHMIN = '#LEN_MIN#'
   WHERE T.ORDER_NO = '#ORDER_NO#'
     AND T.ORDER_SEQ = '#ORDER_SEQ#';
  UPDATE PLN_GX_RCL_M T
     SET T.LENGTHMAX = '#LEN_MAX#', T.LENGTHMIN = '#LEN_MIN#'
   WHERE T.ORDER_NO = '#ORDER_NO#'
     AND T.ORDER_SEQ = '#ORDER_SEQ#';
  UPDATE PLN_ORDER_ZG_S T
     SET T.LENGTHDISC = '#LEN_DESC#'
   WHERE T.ORDER_NO = '#ORDER_NO#'
     AND T.ORDER_SEQ = '#ORDER_SEQ#';
END;		
			]]>
	</query>
</queryMap>