<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="合同录入功能表查询">
	<query id="CoreOrderManager.GetSts" desc="">
		<![CDATA[
			SELECT BASECODE,BASENAME FROM COM_BASE_INFO WHERE SORTCODE='1202' ORDER BY BASECODE
		]]>
	</query>
	<query id="CoreOrderManager.GetDepartId" desc="查询科室名字">
		<![CDATA[
			SELECT DEPARTID,DEPARTNAME,PID,REMARK,ISROOT,IDX,DEPARTNO,DEPTTYPE FROM CORE_APP_DEPARTMENT WHERE DEPARTID = ?
		]]>
	</query>
	<query id="CoreOrderManager.GetCustmRight" desc="查询客户授权信息">
		<![CDATA[
			SELECT CUSTOMER_NO FROM SLM_BASE_CUSTM_RIGHT WHERE CUSTOMER_NO = ? AND SALE_ORG = ?
		]]>
	</query>
	<query id="CoreOrderManager.GetCustmUse" desc="查询客户用户信息">
		<![CDATA[
			SELECT CUSTOMER_NO FROM SLM_BASE_CUSTM_USE WHERE CUSTOMER_NO = ? AND SALE_ORG = ?
		]]>
	</query>
	<query id="CoreOrderManager.QUERY" desc="">
		<![CDATA[ 
		SELECT   MANAG_NO, ORDER_NO, CUSTM_ORDER_NO, ORDER_TYP, ORDER_TYP_DESC,
                 PROTCL_NO, CUSTOMER_NO, CUSTOMER_NM,
                 (SELECT BASENAME
                    FROM COM_BASE_INFO
                   WHERE BASECODE = SUPPLY_UNIT) SUPPLY_UNIT_NM,
                 (SELECT BASENAME
                    FROM COM_BASE_INFO
                   WHERE BASECODE = PRICE_FL) PRICE_FL_NM,
                 (SELECT BASENAME
                    FROM COM_BASE_INFO
                   WHERE BASECODE = CURRENCY) CURRENCY_NM, STLMT_UNIT_NO,
                 STLMT_UNIT_NM, (SELECT BASENAME
                                   FROM COM_BASE_INFO
                                  WHERE BASECODE = FST_DRAWEE_UNIT)
                                                                   FST_DRAWEE_UNIT_NM,
                 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_CHAR (SIGN_DATE, 'YYYY-MM-DD') SIGN_DATE,
                 ORDER_BDATE, ORDER_EDATE, ORDER_SCAN_NO, CUSTOMER_MODEL_FL,
                 ORDER_MODEL_NO, SALE_ORG, SALE_ORG_DESC, SALE_AREA_NO,
                 SALE_AREA_DESC, MEMO, ORDER_STS,(SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = ORDER_STS AND VALIDFLAG = '1' ) ORDER_STS_DESC, 
                 APPROVAL_MAN,APPROVAL_TIME,
                 CASE
					WHEN ORDER_NO LIKE 'TH%' THEN
						(SELECT max(VALIDFLAG) VALIDFLAG FROM SLM_ORDER_HEAD WHERE ORDER_NO = H.CUSTM_ORDER_NO)
					ELSE
						H.VALIDFLAG
				 END VALIDFLAG,
				 CREATE_NAME, TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') CREATE_TIME, UPDATE_NAME,
                 TO_CHAR(UPDATE_TIME,'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME, ORDER_YEAR, EFFECT_TIME,
                 EFFECT_MAN, CLOSE_TIME, CLOSE_MAN,
                 (SELECT BASENAME
                    FROM COM_BASE_INFO
                   WHERE BASECODE = MNY_ASK_TYP) MNY_ASK_TYP_NM, SIGN_ADDRESS,
                 SUPPLY_UNIT, PRICE_FL, CURRENCY, FST_DRAWEE_UNIT, MNY_ASK_TYP,
                 NVL (ORDER_MODEL_DESC, ' ') ORDER_MODEL_DESC, ORD_PK, CREATE_DEPT,
                 MARKET_SYS, MARKET_SYS_DESC, ABRVITION,REVW_RPT_NO,PRINT_PRICE,PRICE_PLAN,CONTAIN_TAX,
                 DECODE(CONTAIN_TAX,'1','是','否') CONTAIN_TAX_DESC,
                 DECODE(ORDER_ARCHIVE,'1','是','否') ORDER_ARCHIVE,
                 (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE= TRADE_TYPE) TRADE_TYPE ,
                 (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE= ORDER_CLASSIFY) ORDER_CLASSIFY ,
                 BUSINESS_TYPE ,TRADE_TYPE TRADE_TYPE_CODE,ORDER_CLASSIFY ORDER_CLASSIFY_CODE,LOCAL_LAW,DOCUMENTARY_NAME,DOCUMENTARY_DEPT,
                 ORDER_REQUIRE_STATUS,PORT_OF_DESTINATION,PENALTY_DESC
                    
             FROM  SLM_ORDER_HEAD  H
             WHERE  ORDER_NO ||'&' LIKE '%' || ? || '%' 
             AND CREATE_TIME>=TO_DATE(?,'YYYY-MM-DD HH24:MI:SS') 
             AND CREATE_TIME <=TO_DATE(?,'YYYY-MM-DD HH24:MI:SS') 
             AND VALIDFLAG IN (1,?)
             
		]]>
	</query>
	<query id="CoreOrderManager.QUERYHEAD" desc="">
	<![CDATA[
		SELECT DISTINCT
	       H.MANAG_NO,
	       H.ORDER_NO,
	       H.CUSTM_ORDER_NO,
	       H.ORDER_TYP,
	       H.ORDER_TYP_DESC,
	       H.PROTCL_NO,
	       H.CUSTOMER_NO,
	       H.CUSTOMER_NM,
	       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = H.SUPPLY_UNIT) SUPPLY_UNIT_NM,
	       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = H.PRICE_FL) PRICE_FL_NM,
	       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = H.CURRENCY) CURRENCY_NM,
	       H.STLMT_UNIT_NO,
	       H.STLMT_UNIT_NM,
	       (SELECT BASENAME
	          FROM COM_BASE_INFO
	         WHERE BASECODE = H.FST_DRAWEE_UNIT) FST_DRAWEE_UNIT_NM,
	       H.LEGAL_PSN,
	       H.AGENT,
	       H.ADDRESS,
	       H.ZIP_CODE,
	       H.BANK,
	       H.ACCOUNT,
	       H.TAX_ID,
	       H.PHONE,
	       H.FAX,
	       H.ORDER_WGT,
	       H.ORDER_MNY_TAX,
	       H.ORDER_MNY_NTAX,
	       H.MNY_ASK_DESC,
	       H.SIGN_PERSON,
	       TO_CHAR(H.SIGN_DATE, 'YYYY-MM-DD') SIGN_DATE,
	       H.ORDER_BDATE,
	       H.ORDER_EDATE,
	       H.ORDER_SCAN_NO,
	       H.CUSTOMER_MODEL_FL,
	       H.ORDER_MODEL_NO,
	       H.SALE_ORG,
	       H.SALE_ORG_DESC,
	       H.SALE_AREA_NO,
	       H.SALE_AREA_DESC,
	       H.MEMO,
	       H.ORDER_STS,
	       (SELECT BASENAME
	          FROM COM_BASE_INFO
	         WHERE BASECODE = H.ORDER_STS
	           AND VALIDFLAG = '1') ORDER_STS_DESC,
	       H.APPROVAL_MAN,
	       H.APPROVAL_TIME,
	       CASE
	         WHEN H.ORDER_NO LIKE 'TH%' THEN
	          (SELECT max(VALIDFLAG) VALIDFLAG
	             FROM SLM_ORDER_HEAD
	            WHERE ORDER_NO = H.CUSTM_ORDER_NO)
	         ELSE
	          H.VALIDFLAG
	       END VALIDFLAG,
	       H.CREATE_NAME,
	       TO_CHAR(H.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
	       H.UPDATE_NAME,
	       TO_CHAR(H.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
	       H.ORDER_YEAR,
	       H.EFFECT_TIME,
	       H.EFFECT_MAN,
	       H.CLOSE_TIME,
	       H.CLOSE_MAN,
	       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = H.MNY_ASK_TYP) MNY_ASK_TYP_NM,
	       H.SIGN_ADDRESS,
	       H.SUPPLY_UNIT,
	       H.PRICE_FL,
	       H.CURRENCY,
	       H.FST_DRAWEE_UNIT,
	       H.MNY_ASK_TYP,
	       NVL(H.ORDER_MODEL_DESC, ' ') ORDER_MODEL_DESC,
	       H.ORD_PK,
	       H.CREATE_DEPT,
	       H.MARKET_SYS,
	       H.MARKET_SYS_DESC,
	       H.ABRVITION,
	       H.REVW_RPT_NO,
	       H.PRINT_PRICE,
	       H.PRICE_PLAN,
	       H.CONTAIN_TAX,
	       DECODE(H.CONTAIN_TAX, '1', '是', '否') CONTAIN_TAX_DESC,
	       DECODE(H.ORDER_ARCHIVE, '1', '是', '否') ORDER_ARCHIVE,
	       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = H.TRADE_TYPE) TRADE_TYPE,
	       (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = H.ORDER_CLASSIFY) ORDER_CLASSIFY,
	       H.BUSINESS_TYPE,
	       H.TRADE_TYPE TRADE_TYPE_CODE,
	       H.ORDER_CLASSIFY ORDER_CLASSIFY_CODE,
	       H.LOCAL_LAW,
	       H.DOCUMENTARY_NAME,
	       H.DOCUMENTARY_DEPT,
	       H.ORDER_REQUIRE_STATUS,
	       H.PORT_OF_DESTINATION,
	       H.PENALTY_DESC
	  FROM SLM_ORDER_HEAD H
	  LEFT JOIN PLN_SALEORD T
	    ON H.ORD_PK = T.ORD_PK
	   AND H.VALIDFLAG = '1'
	  LEFT JOIN SLM_ORDER_LINE L
	    ON L.ORD_PK = H.ORD_PK
	   AND L.VALIDFLAG = '1'
	  LEFT JOIN (SELECT DECODE(K.DESIGN_STS,
	                           'W',
	                           '等待',
	                           'S',
	                           '通过',
	                           'F',
	                           '失败') DESIGN_STS,
	                    H.ORD_LN_PK
	               FROM SLM_ORDER_LINE H, CRAFT_ORD_DESIGN M
	               LEFT JOIN CRAFT_ORD_DESIGN_STS_TKLG K
	                 ON K.DESGIN_KEY = M.DESGIN_KEY
	                AND K.VALIDFLAG = '1'
	              WHERE M.CRAFT_SEQ =
	                    (SELECT MAX(CRAFT_SEQ)
	                       FROM CRAFT_ORD_DESIGN
	                      WHERE ORD_LN_PK = M.ORD_LN_PK)
	                AND H.VALIDFLAG <> '0'
	                AND M.ORD_LN_PK = H.ORD_LN_PK
	                AND M.VALIDFLAG <> '0') T2
	    ON T2.ORD_LN_PK = T.ORD_LN_PK
	  LEFT JOIN COM_MSC M
	  LEFT JOIN CORE_APP_DEPARTMENT E
	    ON E.DEPARTID = M.UNIT_CODE_PROCESS
	  LEFT JOIN CORE_APP_DEPARTMENT F
	    ON F.DEPARTID = E.PID ON T.MSC = M.MSC
	 WHERE H.ORDER_NO || '&' LIKE '%' || ? || '%'
	   AND H.CREATE_TIME >=
	       TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
	   AND H.CREATE_TIME <=
	       TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
	   AND H.VALIDFLAG IN (1, ?)
	   AND H.SALE_ORG IN ('100101', '100102', '100105')
	   AND H.SUPPLY_UNIT = '120504'
	]]>
	</query>
	<query id="CoreOrderManager.LINEHEADQUERY" desc="">
		<![CDATA[
			SELECT   MANAG_NO, ORDER_NO, CUSTM_ORDER_NO, ORDER_TYP, ORDER_TYP_DESC,
                 PROTCL_NO, CUSTOMER_NO, CUSTOMER_NM,
                 (SELECT BASENAME
                    FROM COM_BASE_INFO
                   WHERE BASECODE = SUPPLY_UNIT) SUPPLY_UNIT_NM,
                 (SELECT BASENAME
                    FROM COM_BASE_INFO
                   WHERE BASECODE = PRICE_FL) PRICE_FL_NM,
                 (SELECT BASENAME
                    FROM COM_BASE_INFO
                   WHERE BASECODE = CURRENCY) CURRENCY_NM, STLMT_UNIT_NO,
                 STLMT_UNIT_NM, (SELECT BASENAME
                                   FROM COM_BASE_INFO
                                  WHERE BASECODE = FST_DRAWEE_UNIT)
                                                                   FST_DRAWEE_UNIT_NM,
                 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_CHAR (SIGN_DATE, 'YYYY-MM-DD') SIGN_DATE,
                 ORDER_BDATE, ORDER_EDATE, ORDER_SCAN_NO, CUSTOMER_MODEL_FL,
                 ORDER_MODEL_NO, SALE_ORG, SALE_ORG_DESC, SALE_AREA_NO,
                 SALE_AREA_DESC, MEMO, ORDER_STS, ORDER_STS_DESC, APPROVAL_MAN,
                 APPROVAL_TIME, VALIDFLAG, CREATE_NAME, CREATE_TIME, UPDATE_NAME,
                 UPDATE_TIME, DELETE_NAME, DELETE_TIME, ORDER_YEAR, EFFECT_TIME,
                 EFFECT_MAN, CLOSE_TIME, CLOSE_MAN,
                 (SELECT BASENAME
                    FROM COM_BASE_INFO
                   WHERE BASECODE = MNY_ASK_TYP) MNY_ASK_TYP_NM, SIGN_ADDRESS,
                 SUPPLY_UNIT, PRICE_FL, CURRENCY, FST_DRAWEE_UNIT, MNY_ASK_TYP,
                 NVL (ORDER_MODEL_DESC, ' ') ORDER_MODEL_DESC, ORD_PK, CREATE_DEPT,
                 MARKET_SYS, MARKET_SYS_DESC, ABRVITION,REVW_RPT_NO
			    FROM SLM_ORDER_HEAD
			   WHERE ORD_PK = ?
			ORDER BY ORDER_NO
		]]>
	</query>
      <!-- /*DECODE (SUBSTR (?, 0, 2),
				                'LS', (SELECT DECODE(MAX(ORDER_NO),'',?||'001', SUBSTR (MAX(ORDER_NO), 0, 10)
				                             || LPAD (SUBSTR (MAX(ORDER_NO), 11, 3) + 1, 3, 0))
				                        FROM SLM_ORDER_HEAD
				                       WHERE SUBSTR (ORDER_NO, 0, 10) = SUBSTR (?, 0, 10)),
				                ?
				                )*/-->
				                
	<query id="CoreOrderManager.doAdd" desc="">
		<![CDATA[
				INSERT INTO SLM_ORDER_HEAD(
					            ORD_PK,MANAG_NO,ORDER_NO,CUSTM_ORDER_NO,ORDER_TYP,ORDER_TYP_DESC,
								PROTCL_NO,CUSTOMER_NO,CUSTOMER_NM,SUPPLY_UNIT,PRICE_FL,
								CURRENCY,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,ORDER_BDATE,
								ORDER_EDATE,ORDER_SCAN_NO,CUSTOMER_MODEL_FL,ORDER_MODEL_NO,SALE_ORG ,
								SALE_ORG_DESC,SALE_AREA_NO,SALE_AREA_DESC,MEMO,ORDER_STS,
								ORDER_STS_DESC,VALIDFLAG,CREATE_NAME,
								CREATE_TIME,ORDER_YEAR,SIGN_ADDRESS,MNY_ASK_TYP,
								CREATE_DEPT,MARKET_SYS,MARKET_SYS_DESC,REVW_RPT_NO,ABRVITION,
								PRINT_PRICE,PRICE_PLAN,CONTAIN_TAX,LOCAL_LAW,DOCUMENTARY_NAME,DOCUMENTARY_DEPT,ORDER_REQUIRE_STATUS,PORT_OF_DESTINATION,PENALTY_DESC,TRADE_TYPE,ORDER_CLASSIFY,BUSINESS_TYPE
								
								) 
					            VALUES
					            (?,?,?,?,?,?,
					            ?,?,?,?,?,
					            ?,?,?,?,?,
					            ?,?,?,?,?,
					            ?,?,?,?,?,
					            ?,?,?,TO_DATE(?,'YYYY/MM/DD'),?,
					            ?,?,?,?,?,
					            ?,?,?,?,?,
					            ?,?,?,
					            SYSDATE,?,?,?,?,?,?,?,(SELECT A.ABRVITION FROM SLM_BASE_CUSTOMER A WHERE A.CUSTOMER_NO = ?),
					            ?,?,?,?,?,?,?,?,?,?,?,?)
					          
		]]>
	</query>


	<query id="CoreOrderManager.doAddLine" desc="合同行新增">
		<![CDATA[
				INSERT INTO SLM_ORDER_LINE(
					            ORD_PK,ORD_LN_PK,ORDER_SEQ,CUST_ALPHA_NO,
								PSC,PSC_DESC,PRD_CLS,PRODUCCODE,PRODUCNAME,
								STD_CODE,STD_NAME,STEELCODE,STEELNAME,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,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,DELVRY_BDATE,DELVRY_EDATE,DELVRY_DESC,
								TRANS_DESC,ADD_ASK_NO,ORDER_SPECIAL_DESC,ORDER_ADD_DESC,ORDER_PRICE,
								TRANS_PRICE,TEST_ID,TEST_PRICE,OUT_PRICE,BALNCE_PRICE,AVG_LEN_MAX,
								ORDER_LN_STATUS,MEMO,VALIDFLAG,CREATE_NAME,CREATE_TIME,MSC,MSC_DESC,PRODUCER_FL,
								MPS_FL,STD_STYLE,STD_STYLE_DESC,MSC_STYLE,USE_CODE,USE_DESC,ENDLEN_SPECSTD,AW,
								MAN_INSPECTION,QUALITY_USER,QUALITY_USER_DESC,OUTPUT_STD_NO,PROJECT_NO
								) 
					            VALUES
					            (?,(  SELECT ? || LPAD(TO_NUMBER(NVL(MAX(SUBSTR(ORD_LN_PK, 33, 3)), '0')) + 1,
                                     3, '0') FROM SLM_ORDER_LINE
                                  WHERE ORD_PK = ?
                                      ),
								(SELECT DECODE (MAX (ORDER_SEQ),
								                '', '001',
								                LPAD (MAX(ORDER_SEQ)+1, 3, '0')
								               )
								   FROM SLM_ORDER_LINE
								  WHERE ORD_PK = ?  AND VALIDFLAG = '1'),?,
					            ?,?,?,?,?,
					            ?,?,?,?,?,
					            ?,?,?,?,?,
					            ?,?,?,?,?,
					            ?,?,?,?,?,
					            ?,?,?,?,?,
					            ?,?,?,?,?,
					            ?,?,?,?,?,
					            ?,?,?,TO_DATE(?,'YYYY-MM-DD'),?,
					            ?,?,?,?,?,
					            ?,?,?,?,?,?,
					            ?,?,1,?,SYSDATE,?,?,?,?,?,?,?,?,?,?
					            ,?,?,?,?,?,?
					            )
		]]>
	</query>

	<query id="CoreOrderManager.doUpdateLine" desc="合同行修改">
		<![CDATA[ 
				UPDATE SLM_ORDER_LINE
				   SET CUST_ALPHA_NO = ?,
				       PSC = ?,
				       PSC_DESC = ?,
				       PRD_CLS = ?,
				       PRODUCCODE = ?,
				       PRODUCNAME = ?,
				       STD_CODE = ?,
				       STD_NAME = ?,
				       STEELCODE = ?,
				       STEELNAME = ?,
				       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 = ?,
				       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 = ?,
				       DELVRY_BDATE = ?,
				       DELVRY_EDATE = TO_DATE (?, 'YYYY-MM-DD'),
				       DELVRY_DESC = ?,
				       TRANS_DESC = ?,
				       ADD_ASK_NO = ?,
				       ORDER_SPECIAL_DESC = ?,
				       ORDER_ADD_DESC = ?,
				       ORDER_PRICE = ?,
				       TRANS_PRICE = ?,
				       TEST_ID = ?,
				       TEST_PRICE = ?,
				       OUT_PRICE = ?,
				       BALNCE_PRICE = ?,
				       AVG_LEN_MAX = ?,
				       MEMO = ?,
				       UPDATE_NAME = ?,
				       UPDATE_TIME = SYSDATE,
				       MSC = ?,
				       MSC_DESC = ?,
				       PRODUCER_FL = ?,
				       MPS_FL = ?,
				       STD_STYLE = ?,
				       STD_STYLE_DESC = ?,
				       MSC_STYLE = ?,
				       USE_CODE = ?,
				       USE_DESC = ?,
				       ENDLEN_SPECSTD = ?,
				       AW = ?,
				       MAN_INSPECTION  = ?,
                       QUALITY_USER    = ?,
                       QUALITY_USER_DESC  = ?,
                       OUTPUT_STD_NO = ?,
                       PROJECT_NO = ?,
                       OUTBOUND_CALCULATE = ?,
                       ORDER_TEAM = ?,
                       MODE_OF_TRANSPORT = ?
				       
				 WHERE ORD_LN_PK = ?
					            
		]]>
	</query>

	<query id="CoreOrderManager.UpdateOrderDeliveryDesc" desc="交货信息更新">
		<![CDATA[
				UPDATE SLM_ORDER_LINE
					   SET DELVRY_EDATE = TO_DATE (?, 'YYYY-MM-DD'),
					       DELVRY_DESC = ?,
					       TRANS_DESC = ?,
					       UPDATE_NAME = ?,
					       UPDATE_TIME = SYSDATE
					 WHERE ORD_LN_PK = ?        
		]]>
	</query>


	<query id="CoreOrderManager.doUpdate" desc="合同头修改">
		<![CDATA[
				UPDATE SLM_ORDER_HEAD
                                SET
                                ORDER_NO=?,CUSTM_ORDER_NO=?,
                                ORDER_TYP=?,ORDER_TYP_DESC=?,
                                PROTCL_NO=?,CUSTOMER_NO=?,CUSTOMER_NM=?,SUPPLY_UNIT=?,PRICE_FL=?,
                                CURRENCY=?,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=TO_DATE(?,'YYYY/MM/DD'),ORDER_BDATE=?,
                                ORDER_EDATE=?,ORDER_SCAN_NO=?,CUSTOMER_MODEL_FL=?,ORDER_MODEL_NO=?, 
                                SALE_AREA_NO=?,SALE_AREA_DESC=?,MEMO=?,ORDER_STS=?,
                                ORDER_STS_DESC=?,VALIDFLAG=?,UPDATE_NAME=?,
                                UPDATE_TIME=SYSDATE,ORDER_YEAR=?,SIGN_ADDRESS=?,MNY_ASK_TYP=?,ORDER_MODEL_DESC=?,BE_ORDER_STS = ORDER_STS,
                                BE_OBJ_STS_OP = '合同头维护界面修改'
                                WHERE ORD_PK = ? 
		]]>
	</query>

	<query id="CoreOrderManager.doUpdate_01" desc="合同头修改_带出修改合同行">
		<![CDATA[
				UPDATE SLM_ORDER_LINE
                                SET
                                BE_ORDER_LN_STATUS=?,
                                OBJ_STS_OP=?,
                                ORDER_LN_STATUS=?
                                WHERE ORD_PK = ? 
		]]>
	</query>

	<query id="CoreOrderManager.doUpdate_02" desc="合同头修改_带出修改交货">
		<![CDATA[
				UPDATE SLM_ORDER_LINE_DELIVERY
                                SET
                                BE_DELIVERY_STATUS=?,
                                DELIVERY_STATUS=?,
                                OBJ_STS_OP=?
                                WHERE ORD_PK = ? 
		]]>
	</query>

	<query id="CoreOrderManager.addBalnceMny" desc="">
		<![CDATA[
				insert into SLM_ORDER_BALNCE_MNY(
					            ORD_PK,BALNCE_MNY_NO,BALNCE_MNY_SEQ,
					            PAYMENT_NODE,TERM,TERM_UNIT,PAYMENT_RATIO,
					            MEMO,VALIDFLAG,CREATE_NAME,CREATE_TIME
								) 
					            values
					            (?,?,?,
					            ?,?,?,?,
					            ?,?,?,SYSDATE)
		]]>
	</query>
	<query id="CoreOrderManager.sysGuid" desc="">
		<![CDATA[
				SELECT UPPER(SYS_GUID()) odr_pk FROM DUAL
		]]>
	</query>
	<query id="CoreOrderManager.addSlmOrderLineDelivery" desc="">
		<![CDATA[
				insert into SLM_ORDER_LINE_DELIVERY(
					            ORD_PK,ORD_LN_PK,ORD_LN_DLY_PK,MANAG_NO,ORDER_NO,ORDER_SEQ,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_PLAN,
					            TRANSIT_MNY,VALIDFLAG,CREATE_NAME,CREATE_TIME
								) 
					            values
					            (?,?,(SELECT DECODE (MAX (ord_ln_dly_pk),
								                '', ? || '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 = ?),?,?,?,?,
					            to_date(?,'yyyy/mm/dd'),to_date(?,'yyyy/mm/dd'),?,?,
					            ?,?,?,?,
					            ?,?,?,?,
					            ?,1,?,SYSDATE)
		]]>
	</query>

	<query id="CoreOrderManager.addOrderDeliveryTransit" desc="">
		<![CDATA[
				insert into SLM_ORDER_DELIVERY_TRANSIT(
					            ORD_PK,ORD_LN_PK,ORD_LN_DLY_PK,MANAG_NO,ORDER_NO,ORDER_SEQ,DELIVERY_NO,
					            INDEX_SEQ,AGENCY_FL,LV_FACTY_TYP,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
								) 
					            values
					            (?,?,(SELECT DECODE (MAX (ord_ln_dly_pk),
							                '', ? || '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 = ?),?,?,?,?,
					            to_date(?,'yyyy/mm/dd'),to_date(?,'yyyy/mm/dd'),
					            ?,?,?,?,
					            ?,?,?,?,
					            ?,?,?,?,
					            ?,?,?,?,
					            ?,?,?,?,
					            SYSDATE)
		]]>
	</query>


	<query id="CoreOrderManager.GetWeiGht" desc="查询单米重重量">
		<![CDATA[
			 SELECT NVL(DIMATER,'0') ,NVL(HEIGHT,'0'),MSC_STYLE FROM COM_BASE_SPEC WHERE SPEC_CODE = ?
		]]>
	</query>

	<query id="CoreOrderManager.Get4052" desc="BaseCode4052">
		<![CDATA[
	  SELECT BASENAME,
       CASE
         WHEN INSTR(MEMO, '钢管') > 0 THEN
          'A'
         WHEN INSTR(MEMO, '管坯') > 0 THEN
          'B'
       END MSC_TYPE
   FROM COM_BASE_INFO
   WHERE SORTCODE = '4052'
   AND VALIDFLAG = '1'

		]]>
	</query>

	<query id="CoreOrderManager.GetOrderLineNo" desc="">
		<![CDATA[
				SELECT MAX(ORDER_SEQ) FROM SLM_ORDER_LINE WHERE ORD_LN_PK=? 
		]]>
	</query>

	<query id="CoreOrderManager.GetManagNo" desc="">
		<![CDATA[
				SELECT MAX(MANAG_NO) FROM SLM_ORDER_HEAD WHERE MANAG_NO LIKE ? || '%'
		]]>
	</query>


	<query id="CoreOrderManager.GetOrderLineDt" desc="获取合同行主信息">
		<![CDATA[
		 SELECT ORD_PK,
       LE.ORD_LN_PK,
       ORDER_SEQ,
       CUST_ALPHA_NO,
       MSC_STYLE,
       NVL(ORDER_QTY * ORDER_PRICE, '0') SUMPRICE,
       PSC,
       PSC_DESC,
       PRD_CLS,
       PRODUCCODE,
       PRODUCNAME,
       STD_CODE,
       STD_NAME,
       STEELCODE,
       STEELNAME,
       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,
       AVG_LEN_MAX,
       DIFRNC_LEN_MAX,
       SIGL_LEN,
       ORDER_UNIT,
       ORDER_QTY,
       ORD_ENSU_TOTL_LEN,
       ROUND(PRDCT_WGT, 3) PRDCT_WGT,
       DELVRY_RANGE_TPE,
       DELVRY_RANGE_MIN,
       DELVRY_RANGE_MAX,
       FINAL_USER,
       FINAL_USER_DESC,
       STD_STYLE,
       STD_STYLE_DESC,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = LE.OUTS_BILLET_FL) OUTS_BILLET_FL,
       OUTS_BILLET_FL OUTS_BILLET_FL_ID,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = LE.OUTS_STL_PIPE_FL) OUTS_STL_PIPE_FL,
       OUTS_STL_PIPE_FL OUTS_STL_PIPE_FL_ID,
       ASSEL_FL,
       USE_CODE,
       USE_DESC,
       TO_CHAR(DELVRY_BDATE, 'YYYY-MM-DD') DELVRY_BDATE,
       TO_CHAR(DELVRY_EDATE, 'YYYY-MM-DD') DELVRY_EDATE,
       DELVRY_DESC,
       TRANS_DESC,
       M.CRAFT_NO,
       ADD_ASK_NO,
       ORDER_SPECIAL_DESC,
       ORDER_ADD_DESC,
       ORDER_PRICE,
       TRANS_PRICE,
       TEST_ID,
       TEST_PRICE,
       OUT_PRICE,
       BALNCE_PRICE,
       ORDER_LN_STATUS,
       DECODE(MAN_INSPECTION, '1', '可手探', '不可手探') MAN_INSPECTION,
       (SELECT A.BASENAME
          FROM COM_BASE_INFO A
         WHERE A.BASECODE = OUTPUT_STD_NO
           AND A.VALIDFLAG = '1') OUTPUT_STD_NO,
       PROJECT_NO,
       QUALITY_USER,
       QUALITY_USER_DESC,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = LE.ORDER_LN_STATUS) ORDER_LN_STATUS_NAME,
       LE.MEMO,
       LE.VALIDFLAG,
       LE.CREATE_NAME,
       LE.CREATE_TIME,
       LE.UPDATE_NAME,
       LE.UPDATE_TIME,
       LE.DELETE_NAME,
       LE.DELETE_TIME,
       MSC,
       MSC_DESC,
       PRODUCER_FL,
       (SELECT ORDER_NO FROM SLM_ORDER_HEAD WHERE ORD_PK = LE.ORD_PK) ORDER_NO,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = LE.OUTS_BILLET_FL) OUTS_BILLET_DESC,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = LE.OUTS_STL_PIPE_FL) OUTS_STL_PIPE_DESC,
       '(-' || TO_CHAR(DELVRY_RANGE_MIN) ||
       DECODE(DELVRY_RANGE_TPE, '%', '%', ORDER_UNIT) || ',' ||
       TO_CHAR(DELVRY_RANGE_MAX) ||
       DECODE(DELVRY_RANGE_TPE, '%', '%', ORDER_UNIT) || ')' MIN_MAX_TPE,
       MPS_FL,
       ISLOCK,
       ORDER_CHGE_NO,ORDER_COUNT,
       CHGE_ORD_LN_PK,ENDLEN_SPECSTD,OUTBOUND_CALCULATE,ORDER_TEAM,MODE_OF_TRANSPORT,
			     DECODE(IS_CONFIRMED,'0','未确认','已确认') IS_CONFIRMED,
			     CONFIRM_USER,  CONFIRM_DATE
  FROM SLM_ORDER_LINE LE
    LEFT JOIN CRAFT_ORD_DESIGN M ON M.ORD_LN_PK=LE.ORD_LN_PK AND M.VALIDFLAG='1'
    WHERE LE.ORD_PK = ? AND LE.VALIDFLAG IN (1,?)
		]]>
	</query>

	<query id="CoreOrderManager.ChgeGetOrderLineDt" desc="获取合同行主信息">
		<![CDATA[
		  SELECT ORD_PK, ORD_LN_PK, ORDER_SEQ, CUST_ALPHA_NO, MSC_STYLE,
			     NVL (ORDER_QTY * ORDER_PRICE, '0') SUMPRICE, PSC, PSC_DESC, PRD_CLS,
			     PRODUCCODE, PRODUCNAME, STD_CODE, STD_NAME, STEELCODE, STEELNAME,
			     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,AVG_LEN_MAX, DIFRNC_LEN_MAX, SIGL_LEN, ORDER_UNIT, ORDER_QTY,
			     ORD_ENSU_TOTL_LEN, ROUND(PRDCT_WGT,3) PRDCT_WGT, DELVRY_RANGE_TPE, DELVRY_RANGE_MIN,
			     DELVRY_RANGE_MAX, FINAL_USER, FINAL_USER_DESC,STD_STYLE,STD_STYLE_DESC,
			     (SELECT BASENAME
			        FROM COM_BASE_INFO
			       WHERE BASECODE = LE.OUTS_BILLET_FL) OUTS_BILLET_FL,
			     OUTS_BILLET_FL OUTS_BILLET_FL_ID,
			     (SELECT BASENAME
			        FROM COM_BASE_INFO
			       WHERE BASECODE = LE.OUTS_STL_PIPE_FL) OUTS_STL_PIPE_FL,
			     OUTS_STL_PIPE_FL OUTS_STL_PIPE_FL_ID, ASSEL_FL,USE_CODE,USE_DESC,
			     TO_CHAR (DELVRY_BDATE, 'YYYY-MM-DD') DELVRY_BDATE,
			     TO_CHAR (DELVRY_EDATE, 'YYYY-MM-DD') DELVRY_EDATE, DELVRY_DESC,
			     TRANS_DESC, ADD_ASK_NO, ORDER_SPECIAL_DESC, ORDER_ADD_DESC,
			     ORDER_PRICE, TRANS_PRICE, TEST_ID, TEST_PRICE, OUT_PRICE, BALNCE_PRICE,
			     ORDER_LN_STATUS, DECODE(MAN_INSPECTION,'1','可手探','不可手探') MAN_INSPECTION,
			     (SELECT A.BASENAME FROM COM_BASE_INFO A WHERE A.BASECODE = OUTPUT_STD_NO AND A.VALIDFLAG = '1') OUTPUT_STD_NO,
			     PROJECT_NO,
			     QUALITY_USER ,QUALITY_USER_DESC,
			     (SELECT BASENAME
			        FROM COM_BASE_INFO
			       WHERE BASECODE = LE.ORDER_LN_STATUS) ORDER_LN_STATUS_NAME, MEMO,
			     VALIDFLAG, CREATE_NAME, CREATE_TIME, UPDATE_NAME, UPDATE_TIME,
			     DELETE_NAME, DELETE_TIME, MSC, MSC_DESC, PRODUCER_FL,
			     (SELECT ORDER_NO
			        FROM SLM_ORDER_HEAD
			       WHERE ORD_PK = LE.ORD_PK) ORDER_NO,
			     (SELECT BASENAME
			        FROM COM_BASE_INFO
			       WHERE BASECODE = LE.OUTS_BILLET_FL) OUTS_BILLET_DESC,
			     (SELECT BASENAME
			        FROM COM_BASE_INFO
			       WHERE BASECODE = LE.OUTS_STL_PIPE_FL) OUTS_STL_PIPE_DESC,
			        '(-'
			     || TO_CHAR (DELVRY_RANGE_MIN)
			     || DECODE (DELVRY_RANGE_TPE, '%', '%', ORDER_UNIT)
			     || ','
			     || TO_CHAR (DELVRY_RANGE_MAX)
			     || DECODE (DELVRY_RANGE_TPE, '%', '%', ORDER_UNIT)
			     || ')' MIN_MAX_TPE,
			     MPS_FL,ISLOCK,ORDER_CHGE_NO,CHGE_ORD_LN_PK,ENDLEN_SPECSTD,OUTBOUND_CALCULATE,ORDER_TEAM,MODE_OF_TRANSPORT,
			     DECODE(IS_CONFIRMED,'0','未确认','已确认') IS_CONFIRMED,
			     CONFIRM_USER,  CONFIRM_DATE
			FROM SLM_ORDER_LINE LE 
			WHERE ORD_PK = ?  
			 

		]]>
	</query>

	<query id="CoreOrderManager.GetOrderLineDtZc" desc="获取合同行主信息">
		<![CDATA[
		SELECT LE.ORD_PK,
       LE.ORD_LN_PK,
       ORDER_SEQ,
       CUST_ALPHA_NO,
       MSC_STYLE,
       NVL(ORDER_QTY * ORDER_PRICE, '0') SUMPRICE,
       PSC,
       PSC_DESC,
       PRD_CLS,
       PRODUCCODE,
       PRODUCNAME,
       STD_CODE,
       STD_NAME,
       STEELCODE,
       STEELNAME,
       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,
       SIGL_LEN,
       ORDER_UNIT,
       ORDER_QTY,
       ORD_ENSU_TOTL_LEN,
       ROUND(PRDCT_WGT, 3) PRDCT_WGT,
       DELVRY_RANGE_TPE,
       DELVRY_RANGE_MIN,
       DELVRY_RANGE_MAX,
       FINAL_USER,
       FINAL_USER_DESC,
       STD_STYLE,
       STD_STYLE_DESC,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = LE.OUTS_BILLET_FL) OUTS_BILLET_FL,
       OUTS_BILLET_FL OUTS_BILLET_FL_ID,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = LE.OUTS_STL_PIPE_FL) OUTS_STL_PIPE_FL,
       OUTS_STL_PIPE_FL OUTS_STL_PIPE_FL_ID,
       ASSEL_FL,
       USE_CODE,
       USE_DESC,
       TO_CHAR(DELVRY_BDATE, 'YYYY-MM-DD') DELVRY_BDATE,
       TO_CHAR(DELVRY_EDATE, 'YYYY-MM-DD') DELVRY_EDATE,
       DELVRY_DESC,
       TRANS_DESC,
       M.CRAFT_NO,
       ADD_ASK_NO,
       ORDER_SPECIAL_DESC,
       ORDER_ADD_DESC,
       ORDER_PRICE,
       TRANS_PRICE,
       TEST_ID,
       TEST_PRICE,
       OUT_PRICE,
       BALNCE_PRICE,
       AVG_LEN_MAX,
      (SELECT DECODE(BALNCE_PRICE_ORG_STS, '1', '确认', '未确认') FROM SLM_ORDER_LINE L WHERE L.ORD_PK=(select ORD_PK from slm_order_head where order_no = h.CUSTM_ORDER_NO and VALIDFLAG = '1') AND L.VALIDFLAG = '1' AND L.ORDER_SEQ = LE.ORDER_SEQ)BALNCE_PRICE_ORG_STS,
	  (SELECT BALNCE_PRICE_ORG FROM SLM_ORDER_LINE L WHERE L.ORD_PK=(select ORD_PK from slm_order_head where order_no = h.CUSTM_ORDER_NO and VALIDFLAG = '1') AND L.VALIDFLAG = '1' AND L.ORDER_SEQ = LE.ORDER_SEQ)BALNCE_PRICE_ORG,
       ORDER_LN_STATUS,
       DECODE(MAN_INSPECTION, '1', '可手探', '不可手探') MAN_INSPECTION,
       (SELECT A.BASENAME
          FROM COM_BASE_INFO A
         WHERE A.BASECODE = OUTPUT_STD_NO
           AND A.VALIDFLAG = '1') OUTPUT_STD_NO,
       PROJECT_NO,
       QUALITY_USER,
       QUALITY_USER_DESC,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = LE.ORDER_LN_STATUS) ORDER_LN_STATUS_NAME,
       LE.MEMO,
       LE.VALIDFLAG,
       LE.CREATE_NAME,
       LE.CREATE_TIME,
       LE.UPDATE_NAME,
       LE.UPDATE_TIME,
       LE.DELETE_NAME,
       LE.DELETE_TIME,
       MSC,
       MSC_DESC,
       PRODUCER_FL,
       (SELECT ORDER_NO FROM SLM_ORDER_HEAD WHERE ORD_PK = LE.ORD_PK) ORDER_NO,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = LE.OUTS_BILLET_FL) OUTS_BILLET_DESC,
       (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = LE.OUTS_STL_PIPE_FL) OUTS_STL_PIPE_DESC,
       '(-' || TO_CHAR(DELVRY_RANGE_MIN) ||
       DECODE(DELVRY_RANGE_TPE, '%', '%', ORDER_UNIT) || ',' ||
       TO_CHAR(DELVRY_RANGE_MAX) ||
       DECODE(DELVRY_RANGE_TPE, '%', '%', ORDER_UNIT) || ')' MIN_MAX_TPE,
       MPS_FL,
       ISLOCK,
       ORDER_CHGE_NO,
       CHGE_ORD_LN_PK,ENDLEN_SPECSTD
  FROM SLM_ORDER_LINE LE
    LEFT JOIN CRAFT_ORD_DESIGN M ON M.ORD_LN_PK=LE.ORD_LN_PK AND M.VALIDFLAG='1'
    left join (SELECT ord_pk,VALIDFLAG,CUSTM_ORDER_NO FROM slm_order_head) H on le.ord_pk = h.ord_pk and h.VALIDFLAG='1'
    WHERE LE.ORD_PK = ? AND LE.VALIDFLAG IN (1,?)
		]]>
	</query>

	<query id="CoreOrderManager.GetBlanceMny" desc="">
		<![CDATA[
				SELECT 
					ORD_PK,BALNCE_MNY_NO,BALNCE_MNY_SEQ,
					PAYMENT_NODE,TERM,TERM_UNIT,PAYMENT_RATIO,MEMO,
					VALIDFLAG,CREATE_NAME,CREATE_TIME,UPDATE_NAME,
					UPDATE_TIME,DELETE_NAME,DELETE_TIME
					FROM 
					SLM_ORDER_BALNCE_MNY WHERE ORD_PK=?  and VALIDFLAG = '1'  
		]]>
	</query>
	<query id="CoreOrderManager.deleteBalnceMny" desc="">
		<![CDATA[
				DELETE SLM_ORDER_BALNCE_MNY WHERE ORD_PK=?
		]]>
	</query>

	<query id="CoreOrderManager.orderNoIsRepeat" desc="合同号是否已存在">
		<![CDATA[
				SELECT ORD_PK FROM SLM_ORDER_HEAD WHERE ORDER_NO=?  and VALIDFLAG = '1'  
		]]>
	</query>

	<query id="CoreOrderManager.clearSlmOrderDeliveryTransit" desc="清除运输线路信息">
		<![CDATA[
				DELETE SLM_ORDER_DELIVERY_TRANSIT WHERE ORD_LN_PK=?  
		]]>
	</query>

	<query id="CoreOrderManager.clearSlmOrderLineDelivery" desc="清除交货信息">
		<![CDATA[
				DELETE SLM_ORDER_LINE_DELIVERY WHERE ORD_LN_PK=? 
		]]>
	</query>

	<query id="CoreOrderManager.DELETE" desc="废除">
		<![CDATA[
				UPDATE SLM_ORDER_LINE SET DELETE_NAME=?,DELETE_TIME=SYSDATE,VALIDFLAG=0 WHERE ORD_LN_PK=?  
		]]>
	</query>

	<query id="CoreOrderManager.RESUME" desc="恢复">
		<![CDATA[
				UPDATE SLM_ORDER_LINE SET DELETE_NAME=?,DELETE_TIME=SYSDATE,VALIDFLAG=1 WHERE ORD_LN_PK=? 
		]]>
	</query>

	<query id="CoreOrderManager.DELETEHead" desc="废除合同头">
		<![CDATA[
				UPDATE SLM_ORDER_HEAD SET DELETE_NAME=?,DELETE_TIME=SYSDATE,VALIDFLAG=0 WHERE ORD_PK=?  
		]]>
	</query>

	<query id="CoreOrderManager.DELETELine" desc="废除合同行">
		<![CDATA[
				UPDATE SLM_ORDER_LINE SET DELETE_NAME=?,DELETE_TIME=SYSDATE,VALIDFLAG=0 WHERE ORD_PK=?  
		]]>
	</query>

	<query id="CoreOrderManager.DELETEDeliveryLine" desc="废除交货行">
		<![CDATA[
				UPDATE SLM_ORDER_LINE_DELIVERY SET DELETE_NAME=?,DELETE_TIME=SYSDATE,VALIDFLAG=0 WHERE ORD_PK=?  
		]]>
	</query>
	

	<query id="CoreOrderManager.RESUMEHead" desc="恢复合同头">
		<![CDATA[
				UPDATE SLM_ORDER_HEAD SET DELETE_NAME=?,DELETE_TIME=SYSDATE,VALIDFLAG=1 WHERE ORD_PK=?  
		]]>
	</query>

	<query id="CoreOrderManager.RESUMELine" desc="恢复合同行">
		<![CDATA[
				UPDATE SLM_ORDER_LINE SET DELETE_NAME=?,DELETE_TIME=SYSDATE,VALIDFLAG=1 WHERE ORD_LN_PK=?  
		]]>
	</query>

	<query id="CoreOrderManager.isRepeatOrderLine" desc="订货产品、订货规格、扣型、长度要求是否已存在">
		<![CDATA[
    SELECT *
   FROM SLM_ORDER_LINE
   WHERE ORD_PK = ?
   AND PSC = ?
   AND SPEC_CODE = ?
   AND MODEL_CODE = ?
   AND LEN_NO = ?
   AND FINAL_USER = ?
      
   AND DECODE(?, NULL, '1', ADD_ASK_NO) = DECODE(?, NULL, '1', ?)
   AND DECODE(?, NULL, ADD_ASK_NO, NULL) IS NULL
      
   AND DECODE(?, NULL, '1', CUST_ALPHA_NO) = DECODE(?, NULL, '1', ?)
   AND DECODE(?, NULL, CUST_ALPHA_NO, NULL) IS NULL
   AND VALIDFLAG = '1'
		 
  
		]]>
	</query>

	<query id="CoreOrderManager.upOrderHead" desc="修改合同头状态">
		<![CDATA[
				UPDATE SLM_ORDER_HEAD SET ORDER_STS = ?,ORDER_STS_DESC = ?,BE_ORDER_STS = ?,obj_sts_op = ?,BE_OBJ_STS_OP=OBJ_STS_OP WHERE ORD_PK=? 
		]]>
	</query>

	<!-- <query id="CoreOrderManager.upOrderHead2" desc="修改合同头状态"> <![CDATA[ 
		UPDATE SLM_ORDER_HEAD SET ORDER_STS = ?,ORDER_STS_DESC = ?,BE_ORDER_STS = 
		?,BE_ORDER_STS_DESC= ? ,obj_sts_op = ?,BE_OBJ_STS_OP=OBJ_STS_OP WHERE ORD_PK=? 
		]]> </query> -->

	<query id="CoreOrderManager.upOrderLine" desc="修改合同行状态">
		<![CDATA[  
					UPDATE SLM_ORDER_LINE
			   SET ORDER_LN_STATUS = ?,
			       BE_ORDER_LN_STATUS = ?,
			       BE_OBJ_STS_OP = ?, 
			       OBJ_STS_OP = BE_OBJ_STS_OP
			 WHERE ORD_PK = ?
 	]]>
	</query>

	<query id="CoreOrderManager.upOrderLineTrans" desc="修改合同交货发运要求">
		<![CDATA[  
			 UPDATE SLM_ORDER_LINE
			   SET  DELVRY_DESC = '',TRANS_DESC = ''
             WHERE ORD_LN_PK = ?
 		]]>
	</query>

	<query id="CoreOrderManager.upOrderLineAsk" desc="修改合同附加要求">
		<![CDATA[  
			 UPDATE SLM_ORDER_LINE
			   SET  ORDER_ADD_DESC = '',ADD_ASK_NO = ''
             WHERE ORD_LN_PK = ?
 		]]>
	</query>

	<query id="CoreOrderManager.upOrderLineSpecal" desc="修改合同技术特殊要求">
		<![CDATA[  
			 UPDATE SLM_ORDER_LINE
			   SET  ORDER_SPECIAL_FL = '',ORDER_SPECIAL_HEAD = '',
                    ORDER_SPECIAL_PATH = '',ORDER_SPECIAL_DESC = ''
             WHERE ORD_LN_PK = ?
 		]]>
	</query>

	<query id="CoreOrderManager.upOrderDelivery" desc="修改合同交货发运要求状态">
		<![CDATA[ 
			UPDATE slm_order_line_delivery
				   SET delivery_status = ?,
				       be_delivery_status = ?,
				       be_obj_sts_op = ?, 
				       obj_sts_op =be_obj_sts_op 
				 WHERE ORD_LN_PK = ?
		]]>
	</query>

	<query id="CoreOrderManager.slmOredHeadRevwRptNo" desc="查询最大评审单号">
		<![CDATA[ 
				SELECT DECODE (MAX (revw_rpt_no),
		               '', '0001',
		               LPAD(SUBSTR (MAX (revw_rpt_no), 7, 4)+1,4,0)) revw_rpt_no
					  FROM slm_order_head
					 WHERE revw_rpt_no LIKE ?
		]]>
	</query>


	<!-- 针对合同提报评审SQL块 -->
	<query id="CoreOrderManager.getOrderHeadStatus" desc="查询合同头状态">
		<![CDATA[
		    	SELECT ORDER_STS FROM SLM_ORDER_HEAD WHERE ORD_PK = ? AND VALIDFLAG = '1'
		]]>
	</query>

	<query id="CoreOrderManager.getOrderLineStatus" desc="查询合同头状态">
		<![CDATA[
		    	SELECT ORDER_LN_STATUS,ORD_PK FROM SLM_ORDER_LINE WHERE ORD_LN_PK = ? AND VALIDFLAG = '1'
		]]>
	</query>

	<query id="CoreOrderManager.getORDReview" desc="查询提报评审主表">
		<![CDATA[ 
			 SELECT REVIEW_NO FROM SLM_ORDER_REVIEW WHERE ORD_PK = ? AND  VALIDFLAG = '1'
		]]>
	</query>
	<query id="CoreOrderManager.getORDReviewItemList" desc="根据提报评审主表的REVIEW_NO+REVIEW_ITM(手动赋值)+LIST_TYP(手动赋值)">
		<![CDATA[ 
	 		  SELECT REVIEW_NO,REVIEW_ITM,LIST_TYP,LIST_PK_VAL,REVIEW_TIMES,REVIEW_STATUS FROM SLM_ORDER_REVIEW_ITEM_LIST
	 		         WHERE REVIEW_NO = ? AND REVIEW_ITM = ? AND LIST_TYP = ? AND IS_CURT_REVIEW = '1'
		]]>
	</query>
	<query id="CoreOrderManager.UpdateORDReviewItemList" desc="修改提报评审从表数据">
		<![CDATA[ 
				UPDATE SLM_ORDER_REVIEW_ITEM_LIST SET IS_CURT_REVIEW = ?,REVIEW_STATUS = ? 
				       WHERE REVIEW_NO = ? AND REVIEW_ITM = ? AND LIST_TYP = ? AND LIST_PK_VAL = ? AND REVIEW_TIMES = ? 
		]]>
	</query>
	<query id="CoreOrderManager.InsertReviewItemList" desc="新增提报评审数据">
		<![CDATA[ 
				INSERT INTO SLM_ORDER_REVIEW_ITEM_LIST
		               (REVIEW_NO, REVIEW_ITM, LIST_TYP, LIST_PK_VAL, REVIEW_TIMES,
		                IS_CURT_REVIEW, REVIEW_STATUS, CREATE_NAME, CREATE_TIME)
				     	VALUES (?, ?, ?, ?, ?, ?, ?, ?, sysdate)
		]]>
	</query>
	<query id="CoreOrderManager.upOrderHead2" desc="修改合同头状态">
		<![CDATA[
				UPDATE SLM_ORDER_HEAD SET ORDER_STS = ?,ORDER_STS_DESC = ?,BE_ORDER_STS = ?,BE_ORDER_STS_DESC= ? ,obj_sts_op = ?,BE_OBJ_STS_OP=OBJ_STS_OP WHERE ORD_PK=? 
	]]>
	</query>

	<query id="CoreOrderManager.GetMsc0" desc="查询基础ＭＳＣ">
		<![CDATA[
	       SELECT T1.MSC
           FROM COM_PSC_R_MSC T, COM_MSC T1
           WHERE PSC = ?
           AND T.MSC = T1.MSC
           AND TRIM(MSC_SEQ) IS NULL
           AND T1.VALIDFLAG !='D'
        ]]>
	</query>

	<query id="CoreOrderManager.GetProductType" desc="查询基础ＭＳＣ">
		<![CDATA[
	        SELECT T.PRODUC_TYPE
      FROM COM_BASE_PRODUCT T
      WHERE T.PRODUCCODE = ?
      AND T.VALIDFLAG = '1'
	        
        ]]>
	</query>

	<query id="CoreOrderManager.GetLineReviewFRn" desc="查询基础ＭＳＣ">
		<![CDATA[
			SELECT  REVIEW_F_RS FROM SLM_ORDER_REVIEW_ITEM_LIST T
			WHERE T.LIST_PK_VAL = ? AND  T.IS_CURT_REVIEW = '1'
			AND T.REVIEW_STATUS = 'F'
        ]]>
	</query>

	<query id="CoreOrderManager.UpdateOrderHeadArchive" desc="查询基础ＭＳＣ">
		<![CDATA[
			 UPDATE SLM_ORDER_HEAD
   SET ORDER_ARCHIVE = '1'
 WHERE ORD_PK = ?
   AND VALIDFLAG = '1'

			 
        ]]>
	</query>

	<query id="CoreOrderManager.getOrderLineDlyAddress" desc="获取交货地点">
		<![CDATA[
			SELECT DELVRY_ADDR FROM  SLM_ORDER_LINE_DELIVERY  T
			WHERE T.ORD_LN_PK = ? AND T.VALIDFLAG = '1'
 
        ]]>
	</query>

	<query id="CoreOrderManager.getOrderStatus" desc="获取交货地点">
		<![CDATA[
			SELECT 1 FROM  SLM_ORDER_HEAD  T
			WHERE T.ORD_PK = ? AND T.VALIDFLAG = '1'
			AND T.ORDER_STS <='12020301'
 
        ]]>
	</query>
	
	<query id="CoreOrderManager.updateOrderNo" desc="获取交货地点">
		<![CDATA[
			 UPDATE SLM_ORDER_HEAD T
			 SET T.ORDER_NO = ?
			 WHERE T.ORD_PK = ? 
			 AND T.VALIDFLAG = '1'
        ]]>
	</query>
	
	<query id="CoreOrderManager.getOrderType" desc="获取交货地点">
		<![CDATA[
			  SELECT ORDER_TYP FROM SLM_ORDER_HEAD T 
			  WHERE T.ORD_PK = ? AND T.VALIDFLAG = '1'
        ]]>
	</query>
	
	<query id="CoreOrderManager.getOrderMat" desc="是否存在材料表">
		<![CDATA[
			  SELECT 1 FROM MAT_ZC_M T 
			  WHERE T.ORD_PK = ?  
        ]]>
	</query>
	
	<query id="CoreOrderManager.getAddAskDesc" desc="是否存在材料表">
		<![CDATA[
	       SELECT DISTINCT T.ORDER_ADD_DESC
       FROM SLM_ORDER_LINE T
       WHERE T.ADD_ASK_NO = ?
       AND T.VALIDFLAG = '1'
       AND T.CREATE_TIME > TO_DATE('2015-10-26', 'YYYY-MM-DD')
       AND T.ORD_LN_PK != ?
        ]]>
	</query>
	
	<query id="CoreOrderManager.getValidAddAskNo" desc="是否存在材料表">
		<![CDATA[
	       SELECT  T.ADD_ASK_NO
        FROM SLM_ORDER_ADD_ASK T
        WHERE T.ADD_ASK_NO = ?
        AND T.VALIDFLAG = '1'
       
        ]]>
	</query>
	
	<query id="CoreOrderManager.getValidSpecial" desc="是否存在材料表">
		<![CDATA[
	       SELECT  T.CUST_ALPHA_NO
        FROM SLM_CUST_ALPHA T
        WHERE T.CUST_ALPHA_NO = ?
        AND T.VALIDFLAG = '1'
       
        ]]>
	</query>
	
	<query id="CoreOrderManager.queryOrderQty" desc="是否存在材料表">
		<![CDATA[
	     SELECT A.ORDER_QTY - B.DELVRY_QTY
   FROM (SELECT SUM(T.ORDER_QTY) ORDER_QTY
          FROM SLM_ORDER_LINE T
         WHERE T.ORD_PK = ?
           AND T.VALIDFLAG = '1') A,
       
       (SELECT SUM(T1.DELVRY_QTY) DELVRY_QTY
          FROM SLM_ORDER_LINE_DELIVERY T1
         WHERE T1.ORD_PK = ?
           AND T1.VALIDFLAG = '1') B

        ]]>
	</query>

	<query id="CoreOrderManager.queryOrderWgt" desc="判断重量估算">
		<![CDATA[
	     SELECT A.ORDER_QTY - B.DELVRY_QTY,ORDER_SEQ
   FROM (SELECT t.ORD_LN_PK,sum(round(T.PRDCT_WGT,3)) ORDER_QTY,max(t.ORDER_SEQ) ORDER_SEQ
          FROM SLM_ORDER_LINE T
         WHERE T.ORD_PK = ? and ORDER_UNIT != '支' and ORDER_UNIT != '米'
           AND T.VALIDFLAG = '1' group by t.ORD_LN_PK) A
					 LEFT JOIN

       (SELECT t1.ORD_LN_PK,SUM(T1.WGT_ESTMT) DELVRY_QTY
          FROM SLM_ORDER_LINE_DELIVERY T1
         WHERE T1.ORD_PK = ?
           AND T1.VALIDFLAG = '1' group by t1.ORD_LN_PK) B on a.ORD_LN_PK=b.ORD_LN_PK

        ]]>
	</query>
	
	<query id="CoreOrderManager.TakeOff" desc="脱单">
		<![CDATA[
	    UPDATE MAT_ZC_M T
   SET T.ORDER_NO      = '',
       T.ORDER_SEQ     = '',
       T.ORDER_SEQ_NO  = '',
       T.ORD_PK        = '',
       T.ORD_LN_PK     = '',
       T.ORD_LN_DLY_PK = '',
       T.PRODUCT_FLAG  = '801402',
       T.MAT_STATUS    = '80150202'
    WHERE T.ORD_PK = ?
    AND T.PRODUCT_FLAG = '801403'
    AND T.MAT_STATUS = '80150301'

        ]]>
	</query>
	
	<query id="CoreOrderManager.queryStdName" desc="脱单">
		<![CDATA[
 			SELECT T.STD_NAME, T.STD_CODE
            FROM COM_BASE_STD T
            WHERE T.VALIDFLAG = '1'
            AND T.STDSTYLE IN ('G', 'X')
            AND T.FORBIDDEN_ORDER = '0'
        ]]>
	</query>
	
	<query id="CoreOrderManager.queryProName" desc="脱单">
		<![CDATA[
 		SELECT T.PRODUC_JX, T.PRODUCCODE
          FROM COM_BASE_PRODUCT T
          WHERE T.VALIDFLAG = '1'
        ]]>
	</query>
	
	<query id="CoreOrderManager.querySteel" desc="脱单">
		<![CDATA[
 			SELECT T.STEELNAME, T.STEELCODE
            FROM COM_BASE_STEEL T
            WHERE T.VALIDFLAG = '1'
 			
        ]]>
	</query>
	
	<query id="CoreOrderManager.queryModel" desc="脱单">
		<![CDATA[
           SELECT T.MODEL_DESC, T.MODEL_CODE
           FROM COM_BASE_MODEL T
           WHERE T.VALIDFLAG = '1'
           
        ]]>
	</query>
	
	<query id="CoreOrderManager.queryStdStyle" desc="脱单">
		<![CDATA[
 			SELECT T.STD_STYLE_DESC, T.STD_STYLE
            FROM COM_BASE_STD_STYLE T
            WHERE T.VALIDFLAG = '1'
 			
        ]]>
	</query>
	
	<query id="CoreOrderManager.querySpec" desc="脱单">
		<![CDATA[
 			SELECT T.SPEC_NAME, T.SPEC_CODE
             FROM COM_BASE_SPEC T
            WHERE T.VALIDFLAG = '1'
 				
        ]]>
	</query>
	
	<query id="CoreOrderManager.querySpecInfo" desc="脱单">
		<![CDATA[
 			SELECT  NVL(T.DIMATER,'0') DIMATER,
 			        NVL(T.HEIGHT,'0') HEIGHT
              FROM COM_BASE_SPEC T
             WHERE T.VALIDFLAG = '1'
               AND T.SPEC_CODE = ?
 				
        ]]>
	</query>
	
	<query id="CoreOrderManager.deletePurchase" desc="脱单">
		<![CDATA[
 		
           DELETE FROM  SLM_ORDER_LINE_PURCHASE T 
             WHERE T.VALIDFLAG = '1'
                AND  T.ORD_PK = ?
 				
        ]]>
	</query>
	
	<query id="CoreOrderManager.updateOrderAddDesc" desc="脱单">
		<![CDATA[
 		
          UPDATE SLM_ORDER_LINE_PURCHASE T 
          SET T.ORDER_ADD_DESC = ?,
              T.AFFIRM_STATUS  = 'L',
              T.BACK_REASON = ''
          WHERE  T.ORD_LN_PK = ?
 				
        ]]>
	</query>
	
	<query id="CoreOrderManager.updateOrderAreaDesc" desc="脱单">
		<![CDATA[
         UPDATE SLM_ORDER_HEAD T 
          SET T.SALE_AREA_NO = ?,
              T.SALE_AREA_DESC  = ?,
              T.CREATE_NAME = ?,
              T.CREATE_DEPT = ?,
              T.AREA_FLAG = '1'
          WHERE  T.ORD_PK = ?
        ]]>
	</query>

	<query id="CoreOrderManager.updateSendplanAreaDesc" desc="修改发运片区">
		<![CDATA[
			UPDATE YDM_ZC_SENDPLAN_M T
			SET T.MANAGEMENT_NO =?,T.MANAGEMENT_NAME =?,T.CREATE_NAME=?
			WHERE
			SEND_PLAN_NO IN
				(SELECT SEND_PLAN_NO
				FROM YDM_ZC_SENDPLAN_C
				WHERE ORD_PK = ?
				GROUP BY SEND_PLAN_NO
				)
        ]]>
	</query>

	<query id="CoreOrderManager.updateBillAreaDesc" desc="修改提单片区">
		<![CDATA[
			UPDATE YDM_ZC_BILL_M T SET T.MANAGEMENT_NO =?,T.MANAGEMENT_NAME =?,T.CREATE_NAME=?
			WHERE
			ORD_PK = ?
        ]]>
	</query>

	<query id="CoreOrderManager.updateBalanceinfoAreaDesc" desc="修改结算片区">
		<![CDATA[
         UPDATE SLM_BALANCEINFO T
          SET T.SALE_AREA_NO = ?,
              T.SALE_AREA_DESC  = ?,
              T.CREATE_DEPT = ?
          WHERE  T.ORD_PK = ?
        ]]>
	</query>

	<query id="CoreOrderManager.updateOrderLine" desc="脱单">
		<![CDATA[
 		
 		UPDATE SLM_ORDER_LINE T 
          SET T.CREATE_NAME = ?,
              T.UPDATE_NAME  = DECODE(T.UPDATE_NAME,NULL,NULL,?)
          WHERE  T.ORD_PK = ?
          
 				
        ]]>
	</query>
	
	<query id="CoreOrderManager.updateOrderDelivery" desc="脱单">
		<![CDATA[
 		
          UPDATE SLM_ORDER_LINE_DELIVERY T 
          SET T.CREATE_NAME = ?,
              T.UPDATE_NAME  = DECODE(T.UPDATE_NAME,NULL,NULL,?)
          WHERE  T.ORD_PK = ?
 				
        ]]>
	</query>
	
		<query id="CoreOrderManager.insertAreaInfo" desc="脱单">
		<![CDATA[
 		
          INSERT INTO  SLM_AREA_INFO 
           (ORD_PK,
              ORDER_NO,
              SALE_AREA_NO_OLD,
              SALE_AREA_DESC_OLD,
              CREATE_NAME_OLD,
              SALE_AREA_NO,
              SALE_AREA_DESC,
              CREATE_NAME,
              UPDATE_NAME,
              UPDATE_TIME)
            VALUES(?,?,?,?,?,
            	   ?,?,?,?,SYSDATE)
 				
        ]]>
	</query>
	
	<query id="CoreOrderManager.getPurLineAddDesc" desc="脱单">
		<![CDATA[
 		SELECT  ORDER_ADD_DESC
 		FROM  SLM_ORDER_LINE_PURCHASE T 
          WHERE  T.ORD_LN_PK = ?
 				
        ]]>
	</query>
	
		<query id="CoreOrderManager.doQueryForUpdate" desc="">
		<![CDATA[ 
		SELECT   MANAG_NO, ORDER_NO, CUSTM_ORDER_NO, ORDER_TYP, ORDER_TYP_DESC,
                 PROTCL_NO, CUSTOMER_NO, CUSTOMER_NM,
                 (SELECT BASENAME
                    FROM COM_BASE_INFO
                   WHERE BASECODE = SUPPLY_UNIT) SUPPLY_UNIT_NM,
                 (SELECT BASENAME
                    FROM COM_BASE_INFO
                   WHERE BASECODE = PRICE_FL) PRICE_FL_NM,
                 (SELECT BASENAME
                    FROM COM_BASE_INFO
                   WHERE BASECODE = CURRENCY) CURRENCY_NM, STLMT_UNIT_NO,
                 STLMT_UNIT_NM, (SELECT BASENAME
                                   FROM COM_BASE_INFO
                                  WHERE BASECODE = FST_DRAWEE_UNIT)
                                                                   FST_DRAWEE_UNIT_NM,
                 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_CHAR (SIGN_DATE, 'YYYY-MM-DD') SIGN_DATE,
                 ORDER_BDATE, ORDER_EDATE, ORDER_SCAN_NO, CUSTOMER_MODEL_FL,
                 ORDER_MODEL_NO, SALE_ORG, SALE_ORG_DESC, SALE_AREA_NO,
                 SALE_AREA_DESC, MEMO, ORDER_STS,(SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = ORDER_STS AND VALIDFLAG = '1' ) ORDER_STS_DESC, 
                 APPROVAL_MAN,APPROVAL_TIME, VALIDFLAG, CREATE_NAME, TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') CREATE_TIME, UPDATE_NAME,
                 TO_CHAR(UPDATE_TIME,'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME, ORDER_YEAR, EFFECT_TIME,
                 EFFECT_MAN, CLOSE_TIME, CLOSE_MAN,
                 (SELECT BASENAME
                    FROM COM_BASE_INFO
                   WHERE BASECODE = MNY_ASK_TYP) MNY_ASK_TYP_NM, SIGN_ADDRESS,
                 SUPPLY_UNIT, PRICE_FL, CURRENCY, FST_DRAWEE_UNIT, MNY_ASK_TYP,
                 NVL (ORDER_MODEL_DESC, ' ') ORDER_MODEL_DESC, ORD_PK, CREATE_DEPT,
                 MARKET_SYS, MARKET_SYS_DESC, ABRVITION,REVW_RPT_NO,PRINT_PRICE,PRICE_PLAN,CONTAIN_TAX,
                 DECODE(CONTAIN_TAX,'1','是','否') CONTAIN_TAX_DESC,
                 DECODE(ORDER_ARCHIVE,'1','是','否') ORDER_ARCHIVE,
                 (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE= TRADE_TYPE) TRADE_TYPE ,
                 (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE= ORDER_CLASSIFY) ORDER_CLASSIFY ,
                 BUSINESS_TYPE ,TRADE_TYPE TRADE_TYPE_CODE,ORDER_CLASSIFY ORDER_CLASSIFY_CODE,LOCAL_LAW
                    
             FROM  SLM_ORDER_HEAD          
             WHERE  ORDER_NO ||'&' LIKE '%' || ? || '%'
             and VALIDFLAG = '1'
             AND CREATE_TIME>=TO_DATE(?,'YYYY-MM-DD HH24:MI:SS') 
             AND CREATE_TIME <=TO_DATE(?,'YYYY-MM-DD HH24:MI:SS') 
             AND SALE_ORG= ?
		]]>
	</query>
	
		<query id="CoreOrderManager.doQueryAreaInfo" desc="">
		<![CDATA[ 
		SELECT ORDER_NO,
              SALE_AREA_NO_OLD,
              SALE_AREA_DESC_OLD,
              CREATE_NAME_OLD,
              SALE_AREA_NO,
              SALE_AREA_DESC,
              CREATE_NAME,
              UPDATE_NAME,
              UPDATE_TIME   
             FROM  SLM_AREA_INFO          
             WHERE  ORDER_NO ||'&' LIKE '%' || ? || '%' 
             AND UPDATE_TIME>=TO_DATE(?,'YYYY-MM-DD HH24:MI:SS') 
             AND UPDATE_TIME <=TO_DATE(?,'YYYY-MM-DD HH24:MI:SS') 
		]]>
	</query>
	
	<query id="CoreOrderManager.getUserByDept" desc="脱单">
		<![CDATA[
 		SELECT T.deptid,T.USERNAME  FROM CORE_APP_USER T,SLM_BASE_SALE_AREA_TYP T1 
 			WHERE T.DEPTID=T1.DEPARTID AND T1.VALIDFLAG='1' AND T1.SALE_AREA_NO=?
 				
        ]]>
	</query>
</queryMap>


