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

	<query id="CoreOrderCopy.getManagNo" desc="获取管理卡号">
		<![CDATA[
			SELECT nvl(MAX(MANAG_NO),?||'000') + 1 FROM SLM_ORDER_HEAD WHERE MANAG_NO LIKE ? || '%'
         ]]>
	</query>

	<query id="CoreOrderCopy.getOrderByOrderNo" desc="通过合同查询">
		<![CDATA[
			SELECT ORDER_NO FROM SLM_ORDER_HEAD WHERE ORDER_NO = {0}  AND VALIDFLAG = '1'
         ]]>
	</query>

	<query id="CoreOrderCopy.getOrderByCustm" desc="通过客户合同查询">
		<![CDATA[
			SELECT ORDER_NO FROM SLM_ORDER_HEAD WHERE CUSTM_ORDER_NO = {0} AND VALIDFLAG = '1'
         ]]>
	</query>

	<query id="CoreOrderCopy.getDeliveryPk" desc="查询交货行pk值">
		<![CDATA[
		   SELECT
				DECODE(
					MAX( ORD_LN_DLY_PK ),
					'',
					{0} || '001',
					MAX( ORD_LN_PK ) || LPAD( SUBSTR( MAX( ORD_LN_DLY_PK ), 36 ) + 1, 3, '0' )
				)
				FROM
					SLM_ORDER_LINE_DELIVERY
			WHERE
				ORD_LN_PK = {0}
         ]]>
	</query>

	<query id="CoreOrderCopy.queryCustomer" desc="查询客户">
		<![CDATA[
			SELECT
				T.CUSTOMER_NO,CUSTOMER_NM
			FROM
				SLM_BASE_CUSTOMER T
				RIGHT JOIN COM_BASE_INFO c on T.CUSTOMER_NM = c.BASENAME and c.VALIDFLAG = '1'
			WHERE
				C.BASECODE = {0}
         ]]>
	</query>

	<query id="CoreOrderCopy.queryHead" desc="查询合同头">
	<![CDATA[
		 SELECT
			   T.ORD_PK,
			   T.MANAG_NO,
			   T.ORDER_NO,
			   T.CUSTM_ORDER_NO,
			   T.REVW_RPT_NO,
			   T.ORDER_TYP,
			   T.ORDER_TYP_DESC,
			   T.PROTCL_NO,
			   T.CUSTOMER_NO,
			   T.CUSTOMER_NM,
			   T.MARKET_SYS,
			   T.MARKET_SYS_DESC,
			   T.ABRVITION,
			   T.SUPPLY_UNIT,
			   T.PRICE_FL,
			   T.CURRENCY,
			   T.MNY_ASK_TYP,
			   T.STLMT_UNIT_NO,
			   T.STLMT_UNIT_NM,
			   T.FST_DRAWEE_UNIT,
			   T.LEGAL_PSN,
			   T.AGENT,
			   T.ADDRESS,
			   T.ZIP_CODE,
			   T.BANK,
			   T.ACCOUNT,
			   T.TAX_ID,
			   T.PHONE,
			   T.FAX,
			   T.ORDER_WGT,
			   T.ORDER_MNY_TAX,
			   T.ORDER_MNY_NTAX,
			   T.MNY_ASK_DESC,
			   T.SIGN_PERSON,
			   TO_CHAR(T.SIGN_DATE, 'YYYY-MM-DD HH24:MI:SS') SIGN_DATE,
			   T.SIGN_ADDRESS,
			   T.ORDER_YEAR,
			   TO_CHAR(T.ORDER_BDATE, 'YYYY-MM-DD HH24:MI:SS') ORDER_BDATE,
			   TO_CHAR(T.ORDER_EDATE, 'YYYY-MM-DD HH24:MI:SS') ORDER_EDATE,
			   T.ORDER_SCAN_NO,
			   T.CUSTOMER_MODEL_FL,
			   T.ORDER_MODEL_NO,
			   T.ORDER_MODEL_DESC,
			   T.SALE_ORG,
			   T.SALE_ORG_DESC,
			   T.SALE_AREA_NO,
			   T.SALE_AREA_DESC,
			   T.MEMO,
			   T.BE_ORDER_STS,
			   T.BE_OBJ_STS_OP,
			   T.ORDER_STS,
			   T.ORDER_STS_DESC,
			   T.OBJ_STS_OP,
			   T.APPROVAL_MAN,
			   TO_CHAR(T.APPROVAL_TIME, 'YYYY-MM-DD HH24:MI:SS') APPROVAL_TIME,
			   T.EFFECT_MAN,
			   TO_CHAR(T.EFFECT_TIME, 'YYYY-MM-DD HH24:MI:SS') EFFECT_TIME,
			   T.CLOSE_MAN,
			   TO_CHAR(T.CLOSE_TIME, 'YYYY-MM-DD HH24:MI:SS') CLOSE_TIME,
			   T.VALIDFLAG,
			   T.CREATE_NAME,
			   T.CREATE_DEPT,
			   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.ORD_PK_OLD,
			   T.BE_ORDER_STS_DESC,
			   T.PRICE_NO,
			   T.ORDER_CHGE_NO,
			   T.ISLOCK,
			   T.PRINT_PRICE,
			   T.PRICE_PLAN,
			   T.CONTAIN_TAX,
			   T.ORDER_ARCHIVE,
			   TO_CHAR(T.PASS_TIME, 'YYYY-MM-DD HH24:MI:SS') PASS_TIME,
			   TO_CHAR(T.CONFIRM_TIME, 'YYYY-MM-DD HH24:MI:SS') CONFIRM_TIME,
			   T.TRADE_TYPE,
			   T.ORDER_CLASSIFY,
			   T.BUSINESS_TYPE,
			   TO_CHAR(T.PRINT_TIME, 'YYYY-MM-DD HH24:MI:SS') PRINT_TIME,
			   T.PRINT_COUNT,
			   T.LOCAL_LAW,
			   T.ORDER_FILE,
			   T.IPMAC,
			   T.AREA_FLAG,
			   T.USERORDER_FILE,
			   T.DOCUMENTARY_NAME,
			   T.DOCUMENTARY_DEPT
		 FROM SLM_ORDER_HEAD T
		 WHERE
		T.ORD_PK = {0}
	]]>
	</query>

	<query id="CoreOrderCopy.addHead" desc="添加合同头">
		<![CDATA[
		  INSERT INTO SLM_ORDER_HEAD(
				ORD_PK,
				MANAG_NO,
				ORDER_NO,
				CUSTM_ORDER_NO,
				REVW_RPT_NO,
				ORDER_TYP,
				ORDER_TYP_DESC,
				PROTCL_NO,
				CUSTOMER_NO,
				CUSTOMER_NM,
				MARKET_SYS,
				MARKET_SYS_DESC,
				ABRVITION,
				SUPPLY_UNIT,
				PRICE_FL,
				CURRENCY,
				MNY_ASK_TYP,
				STLMT_UNIT_NO,
				STLMT_UNIT_NM,
				FST_DRAWEE_UNIT,
				LEGAL_PSN,
				AGENT,
				ADDRESS,
				ZIP_CODE,
				BANK,
				ACCOUNT,
				TAX_ID,
				PHONE,
				FAX,
				ORDER_WGT,
				ORDER_MNY_TAX,
				ORDER_MNY_NTAX,
				MNY_ASK_DESC,
				SIGN_PERSON,
				SIGN_DATE,
				SIGN_ADDRESS,
				ORDER_YEAR,
				ORDER_BDATE,
				ORDER_EDATE,
				ORDER_SCAN_NO,
				CUSTOMER_MODEL_FL,
				ORDER_MODEL_NO,
				ORDER_MODEL_DESC,
				SALE_ORG,
				SALE_ORG_DESC,
				SALE_AREA_NO,
				SALE_AREA_DESC,
				MEMO,
				BE_ORDER_STS,
				BE_OBJ_STS_OP,
				ORDER_STS,
				ORDER_STS_DESC,
				OBJ_STS_OP,
				APPROVAL_MAN,
				APPROVAL_TIME,
				EFFECT_MAN,
				EFFECT_TIME,
				CLOSE_MAN,
				CLOSE_TIME,
				VALIDFLAG,
				CREATE_NAME,
				CREATE_DEPT,
				CREATE_TIME,
				ORD_PK_OLD,
				BE_ORDER_STS_DESC,
				PRICE_NO,
				ORDER_CHGE_NO,
				ISLOCK,
				PRINT_PRICE,
				PRICE_PLAN,
				CONTAIN_TAX,
				ORDER_ARCHIVE,
				PASS_TIME,
				CONFIRM_TIME,
				TRADE_TYPE,
				ORDER_CLASSIFY,
				BUSINESS_TYPE,
				PRINT_TIME,
				PRINT_COUNT,
				LOCAL_LAW,
				ORDER_FILE,
				IPMAC,
				AREA_FLAG,
				USERORDER_FILE,
				DOCUMENTARY_NAME,
				DOCUMENTARY_DEPT)
		 VALUES(
				'#ORD_PK#',
				'#MANAG_NO#',
				'#ORDER_NO#',
				'#CUSTM_ORDER_NO#',
				'#REVW_RPT_NO#',
				'#ORDER_TYP#',
				'#ORDER_TYP_DESC#',
				'#PROTCL_NO#',
				'#CUSTOMER_NO#',
				'#CUSTOMER_NM#',
				'#MARKET_SYS#',
				'#MARKET_SYS_DESC#',
				'#ABRVITION#',
				'#SUPPLY_UNIT#',
				'#PRICE_FL#',
				'#CURRENCY#',
				'#MNY_ASK_TYP#',
				'#STLMT_UNIT_NO#',
				'#STLMT_UNIT_NM#',
				'#FST_DRAWEE_UNIT#',
				'#LEGAL_PSN#',
				'#AGENT#',
				'#ADDRESS#',
				'#ZIP_CODE#',
				'#BANK#',
				'#ACCOUNT#',
				'#TAX_ID#',
				'#PHONE#',
				'#FAX#',
				'#ORDER_WGT#',
				'#ORDER_MNY_TAX#',
				'#ORDER_MNY_NTAX#',
				'#MNY_ASK_DESC#',
				'#SIGN_PERSON#',
				TO_DATE('#SIGN_DATE#','YYYY-MM-DD HH24:MI:SS'),
				'#SIGN_ADDRESS#',
				'#ORDER_YEAR#',
				'#ORDER_BDATE#',
				'#ORDER_EDATE#',
				'#ORDER_SCAN_NO#',
				'#CUSTOMER_MODEL_FL#',
				'#ORDER_MODEL_NO#',
				'#ORDER_MODEL_DESC#',
				'#SALE_ORG#',
				'#SALE_ORG_DESC#',
				'#SALE_AREA_NO#',
				'#SALE_AREA_DESC#',
				'#MEMO#',
				'#BE_ORDER_STS#',
				'#BE_OBJ_STS_OP#',
				'#ORDER_STS#',
				'#ORDER_STS_DESC#',
				'#OBJ_STS_OP#',
				'#APPROVAL_MAN#',
				TO_DATE('#APPROVAL_TIME#','YYYY-MM-DD HH24:MI:SS'),
				'#EFFECT_MAN#',
				TO_DATE('#EFFECT_TIME#','YYYY-MM-DD HH24:MI:SS'),
				'#CLOSE_MAN#',
				TO_DATE('#CLOSE_TIME#','YYYY-MM-DD HH24:MI:SS'),
				'#VALIDFLAG#',
				'#CREATE_NAME#',
				'#CREATE_DEPT#',
				SYSDATE,
				'#ORD_PK_OLD#',
				'#BE_ORDER_STS_DESC#',
				'#PRICE_NO#',
				'#ORDER_CHGE_NO#',
				'#ISLOCK#',
				'#PRINT_PRICE#',
				'#PRICE_PLAN#',
				'#CONTAIN_TAX#',
				'#ORDER_ARCHIVE#',
				TO_DATE('#PASS_TIME#','YYYY-MM-DD HH24:MI:SS'),
				TO_DATE('#CONFIRM_TIME#','YYYY-MM-DD HH24:MI:SS'),
				'#TRADE_TYPE#',
				'#ORDER_CLASSIFY#',
				'#BUSINESS_TYPE#',
				TO_DATE('#PRINT_TIME#','YYYY-MM-DD HH24:MI:SS'),
				'#PRINT_COUNT#',
				'#LOCAL_LAW#',
				'#ORDER_FILE#',
				'#IPMAC#',
				'#AREA_FLAG#',
				'#USERORDER_FILE#',
				'#DOCUMENTARY_NAME#',
				'#DOCUMENTARY_DEPT#')
	]]>
	</query>

	<query id="CoreOrderCopy.queryLine" desc="查询合同行">
		<![CDATA[
		 SELECT
			   T.ORD_PK,
			   T.ORD_LN_PK,
			   T.ORDER_SEQ,
			   T.CUST_ALPHA_NO,
			   T.PSC,
			   T.PSC_DESC,
			   T.MSC,
			   T.MSC_DESC,
			   T.MSC_STYLE,
			   T.USE_CODE,
			   T.USE_DESC,
			   T.PRD_CLS,
			   T.PRODUCCODE,
			   T.PRODUCNAME,
			   T.STD_CODE,
			   T.STD_NAME,
			   T.STEELCODE,
			   T.STEELNAME,
			   T.STD_STYLE,
			   T.STD_STYLE_DESC,
			   T.ORDER_SPEC_CODE,
			   T.ORDER_SPEC_DESC,
			   T.SPEC_CODE,
			   T.SPEC_NAME,
			   T.DIMATER,
			   T.HEIGHT,
			   T.MODEL_CODE,
			   T.MODEL_DESC,
			   T.LEN_NO,
			   T.LEN_DESC,
			   T.LEN_UNIT,
			   T.LEN_MIN,
			   T.LEN_MAX,
			   T.SHRT_LEN_RATO,
			   T.SHORTEST,
			   T.LONG_LEN_RATO,
			   T.LONGEST,
			   T.SHRT_STOVE,
			   T.AVG_LEN_MIN,
			   T.DIFRNC_LEN_MAX,
			   T.ENDLEN_SPECSTD,
			   T.SIGL_LEN,
			   T.ORDER_UNIT,
			   T.ORDER_QTY,
			   T.ORD_ENSU_TOTL_LEN,
			   T.PRDCT_WGT,
			   T.DELVRY_RANGE_TPE,
			   T.DELVRY_RANGE_MIN,
			   T.DELVRY_RANGE_MAX,
			   T.FINAL_USER,
			   T.FINAL_USER_DESC,
			   T.OUTS_BILLET_FL,
			   T.OUTS_STL_PIPE_FL,
			   T.ASSEL_FL,
			   T.PRODUCER_FL,
			   T.PRDCR_NO,
			   T.PRDCR_DESC,
			   T.MPS_FL,
			   T.MPS_NO,
			   T.MPS_DESC,
			   TO_CHAR(T.DELVRY_BDATE, 'YYYY-MM-DD HH24:MI:SS') DELVRY_BDATE,
			   TO_CHAR(T.DELVRY_EDATE, 'YYYY-MM-DD HH24:MI:SS') DELVRY_EDATE,
			   T.DELVRY_DESC,
			   T.TRANS_DESC,
			   T.ADD_ASK_NO,
			   T.ORDER_ADD_DESC,
			   T.ORDER_SPECIAL_FL,
			   T.ORDER_SPECIAL_HEAD,
			   T.ORDER_SPECIAL_PATH,
			   T.ORDER_SPECIAL_DESC,
			   T.ZBS,
			   T.ORDER_PRICE,
			   T.TRANS_PRICE,
			   T.TEST_ID,
			   T.TEST_PRICE,
			   T.OUT_PRICE,
			   T.BALNCE_PRICE,
			   T.BE_ORDER_LN_STATUS,
			   T.BE_OBJ_STS_OP,
			   T.ORDER_LN_STATUS,
			   T.OBJ_STS_OP,
			   T.MEMO,
			   T.VALIDFLAG,
			   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.ORD_LN_PK_OLD,
			   T.ISLOCK,
			   T.CUST_ALPHA_NO2,
			   T.ORDER_CHGE_NO,
			   T.CHGE_ORD_LN_PK,
			   T.BALNCE_PRICE_STS,
			   T.BALNCE_PRICE_ORG,
			   T.BALNCE_PRICE_ORG_STS,
			   T.PAK_PRICE,
			   T.AW,
			   T.MPS_NO_INPUT,
			   T.MAN_INSPECTION,
			   T.INSPECTION_VALUE,
			   T.MPS_NO_FILE,
			   T.QUALITY_USER,
			   T.QUALITY_USER_DESC,
			   T.OUTPUT_STD_NO,
			   T.PROJECT_NO,
			   T.CRAFT_NO,
			   T.CRAFT_NO_V,
			   T.ORDER_COUNT,
			   T.MPS_ID,
			   T.LOGOUT_REVIEW_NO,
			   T.PIC_FD_CHECK,
			   T.BALNCE_PRICE_UNIT,
			   T.TON_PRICE
		 FROM SLM_ORDER_LINE T
		 WHERE
		T.ORD_PK = {0} and t.VALIDFLAG = '1'
		order by ORDER_SEQ
	]]>
	</query>

	<query id="CoreOrderCopy.addLine" desc="添加合同行">
		<![CDATA[
			 INSERT INTO SLM_ORDER_LINE(
				ORD_PK,
				ORD_LN_PK,
				ORDER_SEQ,
				CUST_ALPHA_NO,
				PSC,
				PSC_DESC,
				MSC,
				MSC_DESC,
				MSC_STYLE,
				USE_CODE,
				USE_DESC,
				PRD_CLS,
				PRODUCCODE,
				PRODUCNAME,
				STD_CODE,
				STD_NAME,
				STEELCODE,
				STEELNAME,
				STD_STYLE,
				STD_STYLE_DESC,
				ORDER_SPEC_CODE,
				ORDER_SPEC_DESC,
				SPEC_CODE,
				SPEC_NAME,
				DIMATER,
				HEIGHT,
				MODEL_CODE,
				MODEL_DESC,
				LEN_NO,
				LEN_DESC,
				LEN_UNIT,
				LEN_MIN,
				LEN_MAX,
				SHRT_LEN_RATO,
				SHORTEST,
				LONG_LEN_RATO,
				LONGEST,
				SHRT_STOVE,
				AVG_LEN_MIN,
				DIFRNC_LEN_MAX,
				ENDLEN_SPECSTD,
				SIGL_LEN,
				ORDER_UNIT,
				ORDER_QTY,
				ORD_ENSU_TOTL_LEN,
				PRDCT_WGT,
				DELVRY_RANGE_TPE,
				DELVRY_RANGE_MIN,
				DELVRY_RANGE_MAX,
				FINAL_USER,
				FINAL_USER_DESC,
				OUTS_BILLET_FL,
				OUTS_STL_PIPE_FL,
				ASSEL_FL,
				PRODUCER_FL,
				PRDCR_NO,
				PRDCR_DESC,
				MPS_FL,
				MPS_NO,
				MPS_DESC,
				DELVRY_BDATE,
				DELVRY_EDATE,
				DELVRY_DESC,
				TRANS_DESC,
				ADD_ASK_NO,
				ORDER_ADD_DESC,
				ORDER_SPECIAL_FL,
				ORDER_SPECIAL_HEAD,
				ORDER_SPECIAL_PATH,
				ORDER_SPECIAL_DESC,
				ZBS,
				ORDER_PRICE,
				TRANS_PRICE,
				TEST_ID,
				TEST_PRICE,
				OUT_PRICE,
				BALNCE_PRICE,
				BE_ORDER_LN_STATUS,
				BE_OBJ_STS_OP,
				ORDER_LN_STATUS,
				OBJ_STS_OP,
				MEMO,
				VALIDFLAG,
				CREATE_NAME,
				CREATE_TIME,
				ORD_LN_PK_OLD,
				ISLOCK,
				CUST_ALPHA_NO2,
				ORDER_CHGE_NO,
				CHGE_ORD_LN_PK,
				BALNCE_PRICE_STS,
				BALNCE_PRICE_ORG,
				BALNCE_PRICE_ORG_STS,
				PAK_PRICE,
				AW,
				MPS_NO_INPUT,
				MAN_INSPECTION,
				INSPECTION_VALUE,
				MPS_NO_FILE,
				QUALITY_USER,
				QUALITY_USER_DESC,
				OUTPUT_STD_NO,
				PROJECT_NO,
				CRAFT_NO,
				CRAFT_NO_V,
				ORDER_COUNT,
				MPS_ID,
				LOGOUT_REVIEW_NO,
				PIC_FD_CHECK,
				BALNCE_PRICE_UNIT,
				TON_PRICE)
		 VALUES(
				'#ORD_PK#',
				'#ORD_LN_PK#',
				'#ORDER_SEQ#',
				'#CUST_ALPHA_NO#',
				'#PSC#',
				'#PSC_DESC#',
				'#MSC#',
				'#MSC_DESC#',
				'#MSC_STYLE#',
				'#USE_CODE#',
				'#USE_DESC#',
				'#PRD_CLS#',
				'#PRODUCCODE#',
				'#PRODUCNAME#',
				'#STD_CODE#',
				'#STD_NAME#',
				'#STEELCODE#',
				'#STEELNAME#',
				'#STD_STYLE#',
				'#STD_STYLE_DESC#',
				'#ORDER_SPEC_CODE#',
				'#ORDER_SPEC_DESC#',
				'#SPEC_CODE#',
				'#SPEC_NAME#',
				'#DIMATER#',
				'#HEIGHT#',
				'#MODEL_CODE#',
				'#MODEL_DESC#',
				'#LEN_NO#',
				'#LEN_DESC#',
				'#LEN_UNIT#',
				'#LEN_MIN#',
				'#LEN_MAX#',
				'#SHRT_LEN_RATO#',
				'#SHORTEST#',
				'#LONG_LEN_RATO#',
				'#LONGEST#',
				'#SHRT_STOVE#',
				'#AVG_LEN_MIN#',
				'#DIFRNC_LEN_MAX#',
				'#ENDLEN_SPECSTD#',
				'#SIGL_LEN#',
				'#ORDER_UNIT#',
				'#ORDER_QTY#',
				'#ORD_ENSU_TOTL_LEN#',
				'#PRDCT_WGT#',
				'#DELVRY_RANGE_TPE#',
				'#DELVRY_RANGE_MIN#',
				'#DELVRY_RANGE_MAX#',
				'#FINAL_USER#',
				'#FINAL_USER_DESC#',
				'#OUTS_BILLET_FL#',
				'#OUTS_STL_PIPE_FL#',
				'#ASSEL_FL#',
				'#PRODUCER_FL#',
				'#PRDCR_NO#',
				'#PRDCR_DESC#',
				'#MPS_FL#',
				'#MPS_NO#',
				'#MPS_DESC#',
				TO_DATE('#DELVRY_BDATE#','YYYY-MM-DD HH24:MI:SS'),
				TO_DATE('#DELVRY_EDATE#','YYYY-MM-DD HH24:MI:SS'),
				'#DELVRY_DESC#',
				'#TRANS_DESC#',
				'#ADD_ASK_NO#',
				'#ORDER_ADD_DESC#',
				'#ORDER_SPECIAL_FL#',
				'#ORDER_SPECIAL_HEAD#',
				'#ORDER_SPECIAL_PATH#',
				'#ORDER_SPECIAL_DESC#',
				'#ZBS#',
				'#ORDER_PRICE#',
				'#TRANS_PRICE#',
				'#TEST_ID#',
				'#TEST_PRICE#',
				'#OUT_PRICE#',
				'#BALNCE_PRICE#',
				'#BE_ORDER_LN_STATUS#',
				'#BE_OBJ_STS_OP#',
				'#ORDER_LN_STATUS#',
				'#OBJ_STS_OP#',
				'#MEMO#',
				'#VALIDFLAG#',
				'#CREATE_NAME#',
				SYSDATE,
				'#ORD_LN_PK_OLD#',
				'#ISLOCK#',
				'#CUST_ALPHA_NO2#',
				'#ORDER_CHGE_NO#',
				'#CHGE_ORD_LN_PK#',
				'#BALNCE_PRICE_STS#',
				'#BALNCE_PRICE_ORG#',
				'#BALNCE_PRICE_ORG_STS#',
				'#PAK_PRICE#',
				'#AW#',
				'#MPS_NO_INPUT#',
				'#MAN_INSPECTION#',
				'#INSPECTION_VALUE#',
				'#MPS_NO_FILE#',
				'#QUALITY_USER#',
				'#QUALITY_USER_DESC#',
				'#OUTPUT_STD_NO#',
				'#PROJECT_NO#',
				'#CRAFT_NO#',
				'#CRAFT_NO_V#',
				'#ORDER_COUNT#',
				'#MPS_ID#',
				'#LOGOUT_REVIEW_NO#',
				'#PIC_FD_CHECK#',
				'#BALNCE_PRICE_UNIT#',
				'#TON_PRICE#')
		]]>
	</query>

	<query id="CoreOrderCopy.queryDelivery" desc="查询交货行">
		<![CDATA[
			 SELECT
				   T.ORD_PK,
				   T.ORD_LN_PK,
				   T.ORD_LN_DLY_PK,
				   T.DELIVERY_NO,
				   TO_CHAR(T.DELVRY_BDATE, 'YYYY-MM-DD HH24:MI:SS') DELVRY_BDATE,
				   TO_CHAR(T.DELVRY_EDATE, 'YYYY-MM-DD HH24:MI:SS') DELVRY_EDATE,
				   T.DELVRY_QTY,
				   T.ORDER_UNIT,
				   T.WGT_ESTMT,
				   T.ENSU_TOTL_LEN,
				   T.RECEIV_NO,
				   T.RECEIV_NM,
				   T.DELVRY_ADDR,
				   T.AGENCY_FL,
				   T.RECEIV_ADDR,
				   T.TRANSIT_TYP,
				   T.TRANSIT_PLAN,
				   T.TRANSIT_MNY,
				   T.BE_DELIVERY_STATUS,
				   T.BE_OBJ_STS_OP,
				   T.DELIVERY_STATUS,
				   T.OBJ_STS_OP,
				   T.VALIDFLAG,
				   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.ISLOCK,
				   T.PICKUP_FLAG,
				   T.EXTRA_FLAG,
				   T.IS_ADD,
				   T.IS_LIKU,
				   T.NLK_RSN,
				   T.NLK_CHECK,
				   T.LK_ID,
				   T.TD_ID
			 FROM SLM_ORDER_LINE_DELIVERY T
			 WHERE
					T.ORD_PK = {0} and T.ORD_LN_PK = {1} AND t.VALIDFLAG = '1'
			 ORDER BY T.ORD_LN_DLY_PK
		]]>
	</query>

	<query id="CoreOrderCopy.addDelivery" desc="添加交货行">
		<![CDATA[
			  INSERT INTO SLM_ORDER_LINE_DELIVERY(
					ORD_PK,
					ORD_LN_PK,
					ORD_LN_DLY_PK,
					DELIVERY_NO,
					DELVRY_BDATE,
					DELVRY_EDATE,
					DELVRY_QTY,
					ORDER_UNIT,
					WGT_ESTMT,
					ENSU_TOTL_LEN,
					RECEIV_NO,
					RECEIV_NM,
					DELVRY_ADDR,
					AGENCY_FL,
					RECEIV_ADDR,
					TRANSIT_TYP,
					TRANSIT_PLAN,
					TRANSIT_MNY,
					BE_DELIVERY_STATUS,
					BE_OBJ_STS_OP,
					DELIVERY_STATUS,
					OBJ_STS_OP,
					VALIDFLAG,
					CREATE_NAME,
					CREATE_TIME,
					ISLOCK,
					PICKUP_FLAG,
					EXTRA_FLAG,
					IS_ADD,
					IS_LIKU,
					NLK_RSN,
					NLK_CHECK,
					LK_ID,
					TD_ID)
			 VALUES(
					'#ORD_PK#',
					'#ORD_LN_PK#',
					'#ORD_LN_DLY_PK#',
					'#DELIVERY_NO#',
					TO_DATE('#DELVRY_BDATE#','YYYY-MM-DD HH24:MI:SS'),
					TO_DATE('#DELVRY_EDATE#','YYYY-MM-DD HH24:MI:SS'),
					'#DELVRY_QTY#',
					'#ORDER_UNIT#',
					'#WGT_ESTMT#',
					'#ENSU_TOTL_LEN#',
					'#RECEIV_NO#',
					'#RECEIV_NM#',
					'#DELVRY_ADDR#',
					'#AGENCY_FL#',
					'#RECEIV_ADDR#',
					'#TRANSIT_TYP#',
					'#TRANSIT_PLAN#',
					'#TRANSIT_MNY#',
					'#BE_DELIVERY_STATUS#',
					'#BE_OBJ_STS_OP#',
					'#DELIVERY_STATUS#',
					'#OBJ_STS_OP#',
					'#VALIDFLAG#',
					'#CREATE_NAME#',
					SYSDATE,
					'#ISLOCK#',
					'#PICKUP_FLAG#',
					'#EXTRA_FLAG#',
					'#IS_ADD#',
					'#IS_LIKU#',
					'#NLK_RSN#',
					'#NLK_CHECK#',
					'#LK_ID#',
					'#TD_ID#')
		]]>
	</query>

	<query id="CoreOrderCopy.queryTransit" desc="查询运输方案">
		<![CDATA[
			  SELECT
				   T.ORD_PK,
				   T.ORD_LN_PK,
				   T.ORD_LN_DLY_PK,
				   T.INDEX_SEQ,
				   T.AGENCY_FL,
				   T.TRANSIT_TYP,
				   T.DESTINATION,
				   T.STATION_NO,
				   T.STATION_NM,
				   T.SPCL_LN_NO,
				   T.SPCL_LN_NM,
				   T.PORT_NO,
				   T.PORT_DESC,
				   T.CARRIER_UNIT,
				   T.RECEIVOR,
				   T.TRANSIT_LN_MNY,
				   T.VALIDFLAG,
				   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.LV_FACTY_TYP
			 FROM SLM_ORDER_DELIVERY_TRANSIT T
			 WHERE
				T.ORD_LN_DLY_PK = {0}
		]]>
	</query>

	<query id="CoreOrderCopy.addTransit" desc="添加运输方案">
		<![CDATA[
			   INSERT INTO SLM_ORDER_DELIVERY_TRANSIT(
					ORD_PK,
					ORD_LN_PK,
					ORD_LN_DLY_PK,
					INDEX_SEQ,
					AGENCY_FL,
					TRANSIT_TYP,
					DESTINATION,
					STATION_NO,
					STATION_NM,
					SPCL_LN_NO,
					SPCL_LN_NM,
					PORT_NO,
					PORT_DESC,
					CARRIER_UNIT,
					RECEIVOR,
					TRANSIT_LN_MNY,
					VALIDFLAG,
					CREATE_NAME,
					CREATE_TIME,
					LV_FACTY_TYP)
			 VALUES(
					'#ORD_PK#',
					'#ORD_LN_PK#',
					'#ORD_LN_DLY_PK#',
					'#INDEX_SEQ#',
					'#AGENCY_FL#',
					'#TRANSIT_TYP#',
					'#DESTINATION#',
					'#STATION_NO#',
					'#STATION_NM#',
					'#SPCL_LN_NO#',
					'#SPCL_LN_NM#',
					'#PORT_NO#',
					'#PORT_DESC#',
					'#CARRIER_UNIT#',
					'#RECEIVOR#',
					'#TRANSIT_LN_MNY#',
					'#VALIDFLAG#',
					'#CREATE_NAME#',
					SYSDATE,
					'#LV_FACTY_TYP#')
		]]>
	</query>


	<query id="CoreOrderCopy.queryLineByLnPk" desc="查询合同行">
		<![CDATA[
		 SELECT
			   T.ORD_PK,
			   T.ORD_LN_PK,
			   T.ORDER_SEQ,
			   T.CUST_ALPHA_NO,
			   T.PSC,
			   T.PSC_DESC,
			   T.MSC,
			   T.MSC_DESC,
			   T.MSC_STYLE,
			   T.USE_CODE,
			   T.USE_DESC,
			   T.PRD_CLS,
			   T.PRODUCCODE,
			   T.PRODUCNAME,
			   T.STD_CODE,
			   T.STD_NAME,
			   T.STEELCODE,
			   T.STEELNAME,
			   T.STD_STYLE,
			   T.STD_STYLE_DESC,
			   T.ORDER_SPEC_CODE,
			   T.ORDER_SPEC_DESC,
			   T.SPEC_CODE,
			   T.SPEC_NAME,
			   T.DIMATER,
			   T.HEIGHT,
			   T.MODEL_CODE,
			   T.MODEL_DESC,
			   T.LEN_NO,
			   T.LEN_DESC,
			   T.LEN_UNIT,
			   T.LEN_MIN,
			   T.LEN_MAX,
			   T.SHRT_LEN_RATO,
			   T.SHORTEST,
			   T.LONG_LEN_RATO,
			   T.LONGEST,
			   T.SHRT_STOVE,
			   T.AVG_LEN_MIN,
			   T.DIFRNC_LEN_MAX,
			   T.ENDLEN_SPECSTD,
			   T.SIGL_LEN,
			   T.ORDER_UNIT,
			   T.ORDER_QTY,
			   T.ORD_ENSU_TOTL_LEN,
			   T.PRDCT_WGT,
			   T.DELVRY_RANGE_TPE,
			   T.DELVRY_RANGE_MIN,
			   T.DELVRY_RANGE_MAX,
			   T.FINAL_USER,
			   T.FINAL_USER_DESC,
			   T.OUTS_BILLET_FL,
			   T.OUTS_STL_PIPE_FL,
			   T.ASSEL_FL,
			   T.PRODUCER_FL,
			   T.PRDCR_NO,
			   T.PRDCR_DESC,
			   T.MPS_FL,
			   T.MPS_NO,
			   T.MPS_DESC,
			   TO_CHAR(T.DELVRY_BDATE, 'YYYY-MM-DD HH24:MI:SS') DELVRY_BDATE,
			   TO_CHAR(T.DELVRY_EDATE, 'YYYY-MM-DD HH24:MI:SS') DELVRY_EDATE,
			   T.DELVRY_DESC,
			   T.TRANS_DESC,
			   T.ADD_ASK_NO,
			   T.ORDER_ADD_DESC,
			   T.ORDER_SPECIAL_FL,
			   T.ORDER_SPECIAL_HEAD,
			   T.ORDER_SPECIAL_PATH,
			   T.ORDER_SPECIAL_DESC,
			   T.ZBS,
			   T.ORDER_PRICE,
			   T.TRANS_PRICE,
			   T.TEST_ID,
			   T.TEST_PRICE,
			   T.OUT_PRICE,
			   T.BALNCE_PRICE,
			   T.BE_ORDER_LN_STATUS,
			   T.BE_OBJ_STS_OP,
			   T.ORDER_LN_STATUS,
			   T.OBJ_STS_OP,
			   T.MEMO,
			   T.VALIDFLAG,
			   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.ORD_LN_PK_OLD,
			   T.ISLOCK,
			   T.CUST_ALPHA_NO2,
			   T.ORDER_CHGE_NO,
			   T.CHGE_ORD_LN_PK,
			   T.BALNCE_PRICE_STS,
			   T.BALNCE_PRICE_ORG,
			   T.BALNCE_PRICE_ORG_STS,
			   T.PAK_PRICE,
			   T.AW,
			   T.MPS_NO_INPUT,
			   T.MAN_INSPECTION,
			   T.INSPECTION_VALUE,
			   T.MPS_NO_FILE,
			   T.QUALITY_USER,
			   T.QUALITY_USER_DESC,
			   T.OUTPUT_STD_NO,
			   T.PROJECT_NO,
			   T.CRAFT_NO,
			   T.CRAFT_NO_V,
			   T.ORDER_COUNT,
			   T.MPS_ID,
			   T.LOGOUT_REVIEW_NO,
			   T.PIC_FD_CHECK,
			   T.BALNCE_PRICE_UNIT,
			   T.TON_PRICE
		 FROM SLM_ORDER_LINE T
		 WHERE
		T.ORD_LN_PK = {0} and t.VALIDFLAG = '1'
	]]>
	</query>
</queryMap>
