<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="合同信息维护界面">

	<query id="CoreOrderInfoUpdate.UpdateOrderHead" 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  = ?,
       PRINT_PRICE       = ?,
       CONTAIN_TAX       = ?,
       PRICE_PLAN        = ?,
       TRADE_TYPE        = ?,
       ORDER_CLASSIFY    = ?,
       BUSINESS_TYPE     = ?,
       ABRVITION         = ?,
       LOCAL_LAW         = ?,
       BE_ORDER_STS      = ORDER_STS,
       BE_OBJ_STS_OP     = '合同头维护界面修改',
       DOCUMENTARY_NAME         = ?,
       DOCUMENTARY_DEPT         = ?,
       ORDER_REQUIRE_STATUS     = ?,
       PORT_OF_DESTINATION      = ?,
       PENALTY_DESC      = ?
       WHERE ORD_PK      = ?
				
		]]>
	</query>
	
		<query id="CoreOrderInfoUpdate.updateCrmHead" desc="合同头修改">
		<![CDATA[
	   UPDATE CRM_SLM_ORDER 
	   SET ORDER_NO='#ORDER_NO#',
	    CUSTM_ORDER_NO='#CUSTM_ORDER_NO#',
	    ORDER_TYP='#ORDER_TYP#',
	    ORDER_TYP_DESC='#ORDER_TYP_DESC#',
	    REGION_NO='#REGION_NO#',
	    REGION_NAME='#REGION_NAME#',
	    SALE_ORG='#SALE_ORG#',
	    SALE_ORG_DESC='#SALE_ORG_DESC#',
	    SALE_AREA_NO='#SALE_AREA_NO#',
	    SALE_AREA_DESC='#SALE_AREA_DESC#',
	    CUSTOMER_NO='#CUSTOMER_NO#',
	    CUSTOMER_NM='#CUSTOMER_NM#',
	    PRICE_FL='#PRICE_FL#',
	    CURRENCY='#CURRENCY#',
	    MNY_ASK_TYP='#MNY_ASK_TYP#',
	    CONTAIN_TAX='#CONTAIN_TAX#',
	    MNY_ASK_DESC='#MNY_ASK_DESC#',
	    STLMT_UNIT_NO='#STLMT_UNIT_NO#',
	    STLMT_UNIT_NM='#STLMT_UNIT_NM#',
	    ORDER_STS='#ORDER_STS#',
	    ORDER_STS_DESC='#ORDER_STS_DESC#',
	    SUPPLY_UNIT_CODE='#SUPPLY_UNIT_CODE#',
	    SUPPLY_UNIT='#SUPPLY_UNIT#',
	    EFFECT_TIME=TO_DATE('#EFFECT_TIME#','YYYY-MM-DD'),
	    DATA_STATUS='1',
		IS_FLAG='0'
	    WHERE ORD_PK = '#ORD_PK#'
				
		]]>
	</query>
	
	<query id="CoreOrderInfoUpdate.getCrmOrderHeadInfo" desc="获取评审明细表">
		<![CDATA[
	SELECT   H.ORD_PK,
    H.ORDER_NO,
    H.CUSTM_ORDER_NO,
    H.ORDER_TYP,
    H.ORDER_TYP_DESC,
    C.REGION_NO,
    (SELECT T.REGION_NM FROM SEL_ADMIN_REGION T WHERE T.REGION_NO=C.REGION_NO) REGION_NAME,
    H.SALE_ORG,
    H.SALE_ORG_DESC,
    H.SALE_AREA_NO,
    H.SALE_AREA_DESC,
    H.CUSTOMER_NO,
    H.CUSTOMER_NM,
    (SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.PRICE_FL) PRICE_FL,
    (SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.CURRENCY) CURRENCY,
    (SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.MNY_ASK_TYP) MNY_ASK_TYP,
    H.CONTAIN_TAX,
    H.MNY_ASK_DESC,
    H.STLMT_UNIT_NO,
    H.STLMT_UNIT_NM,
    H.ORDER_STS,
    H.ORDER_STS_DESC,
    H.SUPPLY_UNIT SUPPLY_UNIT_CODE,
    (SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.SUPPLY_UNIT) SUPPLY_UNIT,
    to_char(H.EFFECT_TIME,'YYYY-MM-DD') EFFECT_TIME
    FROM SLM_ORDER_HEAD H,
    SLM_BASE_CUSTOMER C
    WHERE  H.CUSTOMER_NO=C.CUSTOMER_NO
    and H.ORD_PK=?
		 
		]]>
	</query>
	
		<query id="CoreOrderInfoUpdate.getCrmOrderHeadAndLine" desc="获取评审明细表">
		<![CDATA[
	SELECT   H.ORD_PK,
		L.ORD_LN_PK,
		H.ORDER_NO,
		L.ORDER_SEQ,
		H.CUSTM_ORDER_NO,
		H.ORDER_TYP,
		H.ORDER_TYP_DESC,
		C.REGION_NO,
		(SELECT T.REGION_NM FROM SEL_ADMIN_REGION T WHERE T.REGION_NO=C.REGION_NO) REGION_NAME,
		H.SALE_ORG,
		H.SALE_ORG_DESC,
		H.SALE_AREA_NO,
		H.SALE_AREA_DESC,
		H.CUSTOMER_NO,
		H.CUSTOMER_NM,
		(SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.PRICE_FL) PRICE_FL,
		L.BALNCE_PRICE,
		(SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.CURRENCY) CURRENCY,
	    (SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.MNY_ASK_TYP) MNY_ASK_TYP,
	    H.CONTAIN_TAX,
	    L.PRODUCCODE,
	    L.PRODUCNAME,
	    L.STD_CODE,
	    L.STD_NAME,
	    L.STEELCODE,
	    L.STEELNAME,
	    L.STD_STYLE,
	    L.STD_STYLE_DESC,
	    L.MODEL_CODE,
	    L.MODEL_DESC,
	    L.ORDER_SPEC_CODE,
	    L.ORDER_SPEC_DESC,
	    L.SPEC_CODE,
	    L.SPEC_NAME,
	    L.DIMATER,
	    L.HEIGHT,
	    L.LEN_NO,
	    L.LEN_DESC,
	    L.LEN_UNIT,
	    (SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=L.OUTS_BILLET_FL) OUTS_BILLET_FL,
	    (SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=L.OUTS_STL_PIPE_FL) OUTS_STL_PIPE_FL,
	    H.MNY_ASK_DESC,
	    L.ISLOCK,
	    L.PRDCR_DESC,
	    L.MPS_DESC,
	    H.STLMT_UNIT_NO,
	    H.STLMT_UNIT_NM,
	    L.DELVRY_RANGE_TPE,
	    L.DELVRY_RANGE_MIN,
	    L.DELVRY_RANGE_MAX,
	    L.ADD_ASK_NO,
	    L.ORDER_ADD_DESC,
	    L.ORDER_SPECIAL_DESC,
	    H.ORDER_STS,
	    H.ORDER_STS_DESC,
	    H.SUPPLY_UNIT SUPPLY_UNIT_CODE,
	    (SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.SUPPLY_UNIT) SUPPLY_UNIT,
	    to_char(H.EFFECT_TIME,'YYYY-MM-DD') EFFECT_TIME
	    FROM SLM_ORDER_HEAD H,SLM_ORDER_LINE L ,
	    SLM_BASE_CUSTOMER C
	    WHERE H.ORD_PK=L.ORD_PK 
	    AND H.CUSTOMER_NO=C.CUSTOMER_NO
	    AND L.ORD_LN_PK=?
	    AND L.VALIDFLAG='1'
		 
		]]>
	</query>
	
			<query id="CoreOrderInfoUpdate.updateCrmHeadAndLine" desc="合同头修改">
		<![CDATA[
	   UPDATE CRM_SLM_ORDER 
	   SET ORDER_NO='#ORDER_NO#',
		ORDER_SEQ='#ORDER_SEQ#',
		CUSTM_ORDER_NO='#CUSTM_ORDER_NO#',
		ORDER_TYP='#ORDER_TYP#',
		ORDER_TYP_DESC='#ORDER_TYP_DESC#',
		REGION_NO='#REGION_NO#',
		REGION_NAME='#REGION_NAME#',
		SALE_ORG='#SALE_ORG#',
		SALE_ORG_DESC='#SALE_ORG_DESC#',
		SALE_AREA_NO='#SALE_AREA_NO#',
		SALE_AREA_DESC='#SALE_AREA_DESC#',
		CUSTOMER_NO='#CUSTOMER_NO#',
		CUSTOMER_NM='#CUSTOMER_NM#',
		PRICE_FL='#PRICE_FL#',
		BALNCE_PRICE='#BALNCE_PRICE#',
		CURRENCY='#CURRENCY#',
	    MNY_ASK_TYP='#MNY_ASK_TYP#',
	    CONTAIN_TAX='#CONTAIN_TAX#',
	    PRODUCCODE='#PRODUCCODE#',
	    PRODUCNAME='#PRODUCNAME#',
	    STD_CODE='#STD_CODE#',
	    STD_NAME='#STD_NAME#',
	    STEELCODE='#STEELCODE#',
	    STEELNAME='#STEELNAME#',
	    STD_STYLE='#STD_STYLE#',
	    STD_STYLE_DESC='#STD_STYLE_DESC#',
	    MODEL_CODE='#MODEL_CODE#',
	    MODEL_DESC='#MODEL_DESC#',
	    ORDER_SPEC_CODE='#ORDER_SPEC_CODE#',
	    ORDER_SPEC_DESC='#ORDER_SPEC_DESC#',
	    SPEC_CODE='#SPEC_CODE#',
	    SPEC_NAME='#SPEC_NAME#',
	    DIMATER='#DIMATER#',
	    HEIGHT='#HEIGHT#',
	    LEN_NO='#LEN_NO#',
	    LEN_DESC='#LEN_DESC#',
	    LEN_UNIT='#LEN_UNIT#',
	    OUTS_BILLET_FL='#OUTS_BILLET_FL#',
	    OUTS_STL_PIPE_FL='#OUTS_STL_PIPE_FL#',
	    MNY_ASK_DESC='#MNY_ASK_DESC#',
	    ISLOCK='#ISLOCK#',
	    PRDCR_DESC='#PRDCR_DESC#',
	    MPS_DESC='#MPS_DESC#',
	    STLMT_UNIT_NO='#STLMT_UNIT_NO#',
	    STLMT_UNIT_NM='#STLMT_UNIT_NM#',
	    DELVRY_RANGE_TPE='#DELVRY_RANGE_TPE#',
	    DELVRY_RANGE_MIN='#DELVRY_RANGE_MIN#',
	    DELVRY_RANGE_MAX='#DELVRY_RANGE_MAX#',
	    ADD_ASK_NO='#ADD_ASK_NO#',
	    ORDER_ADD_DESC='#ORDER_ADD_DESC#',
	    ORDER_SPECIAL_DESC='#ORDER_SPECIAL_DESC#',
	    ORDER_STS='#ORDER_STS#',
	    ORDER_STS_DESC='#ORDER_STS_DESC#',
	    SUPPLY_UNIT_CODE='#SUPPLY_UNIT_CODE#',
	    SUPPLY_UNIT='#SUPPLY_UNIT#',
	    EFFECT_TIME=TO_DATE('#EFFECT_TIME#','YYYY-MM-DD'),
	    DATA_STATUS='1',
		IS_FLAG='0'
	    WHERE ORD_LN_PK='#ORD_LN_PK#'

				
		]]>
	</query>
	
	<query id="CoreOrderInfoUpdate.updateCrmStatus" desc="合同头修改">
		<![CDATA[
	   UPDATE CRM_SLM_ORDER 
	   SET ORDER_STS= ? ,
	   	ORDER_STS_DESC= ? ,
	    DATA_STATUS='1',
		IS_FLAG='0'
	    WHERE ORD_PK=?
		
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.GetOrderLinePkWithAdd" desc="合同行新增时LnPk">
		<![CDATA[
    SELECT ? || LPAD(TO_NUMBER(NVL(MAX(SUBSTR(ORD_LN_PK, 33, 3)), '0')) + 1,
                   3,
                   '0')
  
    FROM SLM_ORDER_LINE
    WHERE ORD_PK = ?

		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOrderHeadStatus" desc="合同头状态修改">
		<![CDATA[
	   UPDATE SLM_ORDER_HEAD
       SET ORDER_STS = ?, 
       ORDER_STS_DESC      = ?,
       BE_ORDER_STS = ?
       WHERE ORD_PK = ?
       AND VALIDFLAG = '1'
	  	
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOrderHeadOneStatus" desc="合同头状态修改">
		<![CDATA[
	   UPDATE SLM_ORDER_HEAD
       SET ORDER_STS = ?, 
       ORDER_STS_DESC   = ?
       WHERE ORD_PK = ?
       AND VALIDFLAG = '1'
	  	
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.updateOrderHeadIPMac" desc="合同头状态修改">
		<![CDATA[
	   UPDATE SLM_ORDER_HEAD
       SET IPMAC = ?
       WHERE ORD_PK = ?
       AND VALIDFLAG = '1'

		]]>
	</query>


	<query id="CoreOrderInfoUpdate.UpdateOrderLineStatus" desc="合同行状态批量修改">
		<![CDATA[
	   UPDATE SLM_ORDER_LINE
       SET ORDER_LN_STATUS = ?, 
       BE_ORDER_LN_STATUS = ORDER_LN_STATUS
       WHERE ORD_PK = ?
       AND VALIDFLAG = '1'
	  	
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOrderLineStatusWithBe" desc="合同行状态批量修改">
		<![CDATA[
	   UPDATE SLM_ORDER_LINE
       SET ORDER_LN_STATUS = ?, 
        BE_ORDER_LN_STATUS = ?
       WHERE ORD_PK = ?
       AND VALIDFLAG = '1'
	  	
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOneOrderLineStatus" desc="一条合同行状态修改">
		<![CDATA[
	   UPDATE SLM_ORDER_LINE
       SET ORDER_LN_STATUS = ?, 
        BE_ORDER_LN_STATUS = ?
       WHERE ORD_LN_PK = ?
       AND VALIDFLAG = '1'
	  	
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOneOrderLineOneStatus" desc="一条合同行状态修改">
		<![CDATA[
	   UPDATE SLM_ORDER_LINE
       SET ORDER_LN_STATUS = ?
         
       WHERE ORD_LN_PK = ?
       AND VALIDFLAG = '1'
	  	
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOneOrderLineStsValid" desc="一条合同行状态有效标志修改">
		<![CDATA[
	   UPDATE SLM_ORDER_LINE
       SET  
        BE_ORDER_LN_STATUS = ?,
        VALIDFLAG      =  ?
       WHERE ORD_LN_PK = ?
       AND VALIDFLAG = ?
	  	
		]]>
	</query>


	<query id="CoreOrderInfoUpdate.UpdateOrderLineOnlyStatus" desc="合同行状态修改">
		<![CDATA[
	   UPDATE SLM_ORDER_LINE
       SET ORDER_LN_STATUS = ?
        
       WHERE ORD_PK = ?
       AND VALIDFLAG = '1'
	  	
		]]>
	</query>


	<query id="CoreOrderInfoUpdate.UpdateOrderDeliveryLineStatus"
		desc="交货行状态批量修改">
		<![CDATA[
	 UPDATE SLM_ORDER_LINE_DELIVERY
     SET DELIVERY_STATUS = ?, BE_DELIVERY_STATUS = DELIVERY_STATUS
     WHERE ORD_PK = ?
     AND VALIDFLAG = '1'
	 		
		]]>
	</query>


	<query id="CoreOrderInfoUpdate.UpdateOrderDeliveryLineOneStatus"
		desc="交货行状态批量修改">
		<![CDATA[
	 UPDATE SLM_ORDER_LINE_DELIVERY
     SET DELIVERY_STATUS = ?
     WHERE ORD_PK = ?
     AND VALIDFLAG = '1'
	 		
		]]>
	</query>


	<query id="CoreOrderInfoUpdate.UpdateSingleOrderDeliveryLineStatus"
		desc="交货行状态批量修改">
		<![CDATA[
	 UPDATE SLM_ORDER_LINE_DELIVERY
     SET DELIVERY_STATUS = ?, 
     BE_DELIVERY_STATUS = ?
     WHERE ORD_PK = ?
     AND VALIDFLAG = '1'
	 		
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOrderDeliveryLineStatusOrdLnPk"
		desc="交货行状态批量修改">
		<![CDATA[
	 UPDATE SLM_ORDER_LINE_DELIVERY
     SET DELIVERY_STATUS = ?, 
     BE_DELIVERY_STATUS = ?
     WHERE ORD_LN_PK = ?
     AND VALIDFLAG = '1'
	 		
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOrderDeliveryLineOneStatusOrdLnPk"
		desc="交货行状态批量修改">
		<![CDATA[
	 UPDATE SLM_ORDER_LINE_DELIVERY
     SET DELIVERY_STATUS = ?
     
     WHERE ORD_LN_PK = ?
     AND VALIDFLAG = '1'
	 		
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.GetAllDeliveryLinePk" desc="获取合同行所有交货行的PK">
		<![CDATA[
	     SELECT ORD_PK
	     FROM SLM_ORDER_LINE_DELIVERY
	     WHERE ORD_PK = ?
	     AND VALIDFLAG = '1'
				
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.SelectREVIEWNO" desc="获取评审单号">
		<![CDATA[
	     SELECT REVIEW_NO
	     FROM SLM_ORDER_REVIEW
	     WHERE ORD_PK = ?
	     AND REVIEW_SRC = 'H'
	     AND VALIDFLAG = '1'
				
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.SelectAllOrderLineReviewSts" desc="获取评审单号下所有明细的状态">
		<![CDATA[
	     SELECT REVIEW_STATUS
    FROM SLM_ORDER_REVIEW_ITEM_LIST T
    WHERE T.LIST_TYP = 'L'
    AND REVIEW_NO = ?
    AND IS_CURT_REVIEW = '1'

		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOrderReviewItem" desc="更新合同评审项目">
		<![CDATA[
    UPDATE SLM_ORDER_REVIEW_ITEM
       SET REVIEW_STATUS = ?
    WHERE REVIEW_NO = ?
    AND REVIEW_ITM = ?
    AND VALIDFLAG ='1'
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOrderReviewAllItem" desc="更新同一评审单号所有合同评审项目">
		<![CDATA[
    UPDATE SLM_ORDER_REVIEW_ITEM
       SET REVIEW_STATUS = ?
    WHERE REVIEW_NO = ?
    AND REVIEW_STATUS = ?
    AND VALIDFLAG ='1'
	  
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOrderReviewItemList" desc="更新合同评审明细">
		<![CDATA[
     UPDATE SLM_ORDER_REVIEW_ITEM_LIST
     SET IS_CURT_REVIEW = '0'
     WHERE REVIEW_NO = ?
     AND REVIEW_ITM = ?
     AND LIST_TYP = ?
     AND LIST_PK_VAL = ?
    
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOrderReviewAllItemList"
		desc="更新合同评审明细">
		<![CDATA[
     UPDATE SLM_ORDER_REVIEW_ITEM_LIST
     SET IS_CURT_REVIEW = '0'
     WHERE REVIEW_NO = ?
     AND LIST_TYP = ?
     AND LIST_PK_VAL = ?
    
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.UpdateOrderReviewItemListAll"
		desc="更新合同评审明细">
		<![CDATA[
     UPDATE SLM_ORDER_REVIEW_ITEM_LIST
     SET REVIEW_STATUS = ?
     WHERE REVIEW_NO = ?
     AND REVIEW_STATUS = ?
     AND IS_CURT_REVIEW = ?
    
		]]>
	</query>


	<query id="CoreOrderInfoUpdate.InsertOrderReviewItemList" 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,
   REVIEW_DEPT)
 VALUES
  (?,
   ?,
   ?,
   ?,
   (SELECT LPAD(TO_NUMBER(NVL(MAX(TO_NUMBER(REVIEW_TIMES)),'0')) + 1, 4, '0')
      FROM SLM_ORDER_REVIEW_ITEM_LIST
     WHERE REVIEW_NO = ?
       AND REVIEW_ITM = ?
       AND LIST_TYP = ?
       AND LIST_PK_VAL = ?),
    '1',
    ?,?,SYSDATE,?)
     
		]]>
	</query>
	
		<query id="CoreOrderInfoUpdate.getThDeliveryCount" desc="合同头状态">
		<![CDATA[
	     SELECT COUNT(1) COUNT
	     FROM SLM_ORDER_LINE_DELIVERY 
	     WHERE ORD_PK  = ?
	     AND VALIDFLAG = '1'
		 AND DELVRY_ADDR NOT IN ('指定地点','天淮库房车板')		
		]]>
	</query>
	
		<query id="CoreOrderInfoUpdate.getTgDeliveryCount" desc="合同头状态">
		<![CDATA[
	     SELECT COUNT(1) COUNT
	     FROM SLM_ORDER_LINE_DELIVERY 
	     WHERE ORD_PK  = ?
	     AND VALIDFLAG = '1'
		 AND DELVRY_ADDR  LIKE '%天淮%'		
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.SelectOrderHeadStatus" desc="合同头状态">
		<![CDATA[
	     SELECT ORDER_STS,ORDER_STS_DESC,BE_ORDER_STS
	     FROM SLM_ORDER_HEAD 
	     WHERE ORD_PK  = ?
	     AND VALIDFLAG = '1'
				
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.SelectOrderLineStatus" desc="合同行状态">
		<![CDATA[
	     SELECT ORDER_LN_STATUS
	     FROM SLM_ORDER_LINE
	     WHERE ORD_LN_PK = ?
	     AND VALIDFLAG = '1'
				
		]]>
	</query>
	
	<query id="CoreOrderInfoUpdate.SelectOrderLineDeliveryStatus" desc="合同行状态">
		<![CDATA[
	     SELECT DELIVERY_STATUS
	     FROM SLM_ORDER_LINE_DELIVERY
	     WHERE ORD_LN_DLY_PK = ?
	     AND VALIDFLAG = '1'
				
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.SetOrderDeliveryLineValidFlag"
		desc="設置交货行的有效状态">
		<![CDATA[
	     UPDATE  SLM_ORDER_LINE_DELIVERY
	     SET   VALIDFLAG = ?
	     WHERE ORD_LN_PK = ?
	     AND VALIDFLAG = ?
				
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.SetOrderDeliveryLineStsValid"
		desc="设置交货行的有效标志和状态">
		<![CDATA[
	     UPDATE  SLM_ORDER_LINE_DELIVERY
	     SET   VALIDFLAG = ?,
	     BE_DELIVERY_STATUS = ?
	     WHERE ORD_LN_PK = ?
	     AND VALIDFLAG = ?
				
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.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 = ?,
				       MEMO = ?,
				       UPDATE_NAME = ?,
				       UPDATE_TIME = SYSDATE,
				       MSC = ?,
				       MSC_DESC = ?,
				       PRODUCER_FL = ?,
				       MPS_FL = ?,
				       STD_STYLE = ?,
				       STD_STYLE_DESC = ?,
				       MSC_STYLE = ?
				       
				 WHERE ORD_LN_PK = ?
					            
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.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="CoreOrderInfoUpdate.GetOrderReviewItemList" desc="获取评审明细表">
		<![CDATA[
		SELECT REVIEW_NO,
       REVIEW_ITM,
       LIST_TYP,
       LIST_PK_VAL,
       REVIEW_TIMES,
       IS_CURT_REVIEW,
       REVIEW_STATUS,
       REVIEW_F_RS,
       RT_REVIEW_ITM,
       REVIEW_MAN,
       REVIEW_DEPT,
       REVIEW_BDATE,
       REVIEW_EDATE,
       CREATE_NAME,
       CREATE_TIME,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME
       FROM SLM_ORDER_REVIEW_ITEM_LIST
       WHERE REVIEW_NO = ?
       AND LIST_TYP    = 'L'
       AND IS_CURT_REVIEW = '1'
				 
		]]>
	</query>
	

	
	<query id="CoreOrderInfoUpdate.insertCrmOrder" desc="删除冶金规范码科室">
		<![CDATA[
	 	INSERT INTO CRM_SLM_ORDER
  (	ORD_PK,
	ORD_LN_PK,
	ORD_LN_DLY_PK,
	ORDER_NO,
	ORDER_SEQ,
	DELIVERY_NO,
	CUSTM_ORDER_NO,
	ORDER_TYP,
	ORDER_TYP_DESC,
	REGION_NO,
	REGION_NAME,
	SALE_ORG,
	SALE_ORG_DESC,
	SALE_AREA_NO,
	SALE_AREA_DESC,
	CUSTOMER_NO,
	CUSTOMER_NM,
	RECEIV_NO,
	RECEIV_NM,
	PRICE_FL,
	ORDER_QTY,
	BALNCE_PRICE,
	CURRENCY,
	MNY_ASK_TYP,
	CONTAIN_TAX,
	ORDER_UNIT,
	PRODUCCODE,
	PRODUCNAME,
	STD_CODE,
	STD_NAME,
	STEELCODE,
	STEELNAME,
	STD_STYLE,
	STD_STYLE_DESC,
	MODEL_CODE,
	MODEL_DESC,
	ORDER_SPEC_CODE,
	ORDER_SPEC_DESC,
	SPEC_CODE,
	SPEC_NAME,
	DIMATER,
	HEIGHT,
	LEN_NO,
	LEN_DESC,
	LEN_UNIT,
	OUTS_BILLET_FL,
	OUTS_STL_PIPE_FL,
	MNY_ASK_DESC,
	ISLOCK,
	PRDCR_DESC,
	MPS_DESC,
	STLMT_UNIT_NO,
	STLMT_UNIT_NM,
	DELVRY_RANGE_TPE,
	DELVRY_RANGE_MIN,
	DELVRY_RANGE_MAX,
	ADD_ASK_NO,
	ORDER_ADD_DESC,
	ORDER_SPECIAL_DESC,
	ORDER_STS,
	ORDER_STS_DESC,
	ORDER_LN_STS,
	ORDER_LN_STS_DESC,
	SUPPLY_UNIT_CODE,
	SUPPLY_UNIT,
	WGT_ESTMT,
	DELVRY_EDATE,
	EFFECT_TIME,
	TIBAO_TIME,
	DATA_STATUS,
	CREATE_TIME,
	CREATE_NAME,
	FST_DRAWEE_UNIT,
	BALNCE_PRICE_STS,
	DATA_FLAG,
	KEEP_TYPE,
	ORDER_HEAD_STS,
    ORDER_HEAD_STS_DESC)
VALUES
  (
    '#ORD_PK#',
	'#ORD_LN_PK#',
	'#ORD_LN_DLY_PK#',
	'#ORDER_NO#',
	'#ORDER_SEQ#',
	'#DELIVERY_NO#',
	'#CUSTM_ORDER_NO#',
	'#ORDER_TYP#',
	'#ORDER_TYP_DESC#',
	'#REGION_NO#',
	'#REGION_NAME#',
	'#SALE_ORG#',
	'#SALE_ORG_DESC#',
	'#SALE_AREA_NO#',
	'#SALE_AREA_DESC#',
	'#CUSTOMER_NO#',
	'#CUSTOMER_NM#',
	'#RECEIV_NO#',
	'#RECEIV_NM#',
	'#PRICE_FL#',
	'#ORDER_QTY#',
	'#BALNCE_PRICE#',
	'#CURRENCY#',
	'#MNY_ASK_TYP#',
	'#CONTAIN_TAX#',
	'#ORDER_UNIT#',
	'#PRODUCCODE#',
	'#PRODUCNAME#',
	'#STD_CODE#',
	'#STD_NAME#',
	'#STEELCODE#',
	'#STEELNAME#',
	'#STD_STYLE#',
	'#STD_STYLE_DESC#',
	'#MODEL_CODE#',
	'#MODEL_DESC#',
	'#ORDER_SPEC_CODE#',
	'#ORDER_SPEC_DESC#',
	'#SPEC_CODE#',
	'#SPEC_NAME#',
	'#DIMATER#',
	'#HEIGHT#',
	'#LEN_NO#',
	'#LEN_DESC#',
	'#LEN_UNIT#',
	'#OUTS_BILLET_FL#',
	'#OUTS_STL_PIPE_FL#',
	'#MNY_ASK_DESC#',
	'#ISLOCK#',
	'#PRDCR_DESC#',
	'#MPS_DESC#',
	'#STLMT_UNIT_NO#',
	'#STLMT_UNIT_NM#',
	'#DELVRY_RANGE_TPE#',
	'#DELVRY_RANGE_MIN#',
	'#DELVRY_RANGE_MAX#',
	'#ADD_ASK_NO#',
	'#ORDER_ADD_DESC#',
	'#ORDER_SPECIAL_DESC#',
	'#ORDER_STS#',
	'#ORDER_STS_DESC#',
	'#ORDER_LN_STS#',
	'#ORDER_LN_STS_DESC#',
	'#SUPPLY_UNIT_CODE#',
	'#SUPPLY_UNIT#',
	'#WGT_ESTMT#',
	TO_DATE('#DELVRY_EDATE#','YYYY-MM-DD'),
	TO_DATE('#EFFECT_TIME#','YYYY-MM-DD'),
	TO_DATE('#TIBAO_TIME#','YYYY-MM-DD'),
	'#DATA_STATUS#',
	SYSDATE,
	'#CREATE_NAME#',
	'#FST_DRAWEE_UNIT#',
	'#BALNCE_PRICE_STS#',
	'#DATA_FLAG#',
	'#KEEP_TYPE#',
	'#ORDER_HEAD_STS#',
    '#ORDER_HEAD_STS_DESC#'
)	
		]]>
	</query>
	
			<query id="CoreOrderInfoUpdate.getCrmOrderInfo" desc="获取评审明细表">
		<![CDATA[
	SELECT   H.ORD_PK,
		L.ORD_LN_PK,
		D.ORD_LN_DLY_PK,
		H.ORDER_NO,
		L.ORDER_SEQ,
		D.DELIVERY_NO,
		H.CUSTM_ORDER_NO,
		H.ORDER_TYP,
		H.ORDER_TYP_DESC,
		C.REGION_NO,
		(SELECT T.REGION_NM FROM SEL_ADMIN_REGION T WHERE T.REGION_NO=C.REGION_NO) REGION_NAME,
		H.SALE_ORG,
		H.SALE_ORG_DESC,
		H.SALE_AREA_NO,
		H.SALE_AREA_DESC,
		H.CUSTOMER_NO,
		H.CUSTOMER_NM,
		H.CREATE_NAME,
		D.RECEIV_NO,
		D.RECEIV_NM,
		(SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.PRICE_FL) PRICE_FL,
		D.DELVRY_QTY ORDER_QTY,
		L.BALNCE_PRICE,
		(SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.CURRENCY) CURRENCY,
		(SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.MNY_ASK_TYP) MNY_ASK_TYP,
		H.CONTAIN_TAX,
		D.ORDER_UNIT,
		L.PRODUCCODE,
		L.PRODUCNAME,
		L.STD_CODE,
		L.STD_NAME,
		L.STEELCODE,
		L.STEELNAME,
		L.STD_STYLE,
		L.STD_STYLE_DESC,
		L.MODEL_CODE,
		L.MODEL_DESC,
		L.ORDER_SPEC_CODE,
		L.ORDER_SPEC_DESC,
		L.SPEC_CODE,
		L.SPEC_NAME,
		L.DIMATER,
		L.HEIGHT,
		L.LEN_NO,
		L.LEN_DESC,
		L.LEN_UNIT,
		(SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=L.OUTS_BILLET_FL) OUTS_BILLET_FL,
		(SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=L.OUTS_STL_PIPE_FL) OUTS_STL_PIPE_FL,
		H.MNY_ASK_DESC,
		L.ISLOCK,
		L.PRDCR_DESC,
		L.MPS_DESC,
		H.STLMT_UNIT_NO,
		H.STLMT_UNIT_NM,
		L.DELVRY_RANGE_TPE,
		L.DELVRY_RANGE_MIN,
		L.DELVRY_RANGE_MAX,
		L.ADD_ASK_NO,
		L.ORDER_ADD_DESC,
		L.ORDER_SPECIAL_DESC,
		D.DELIVERY_STATUS ORDER_STS,
		(SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=D.DELIVERY_STATUS) ORDER_STS_DESC,
		L.ORDER_LN_STATUS ORDER_LN_STS,
		(SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=L.ORDER_LN_STATUS) ORDER_LN_STS_DESC,
		H.SUPPLY_UNIT SUPPLY_UNIT_CODE,
		(SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.SUPPLY_UNIT) SUPPLY_UNIT,
		D.WGT_ESTMT,
		to_char(D.DELVRY_EDATE,'YYYY-MM-DD') DELVRY_EDATE,
		to_char(H.EFFECT_TIME,'YYYY-MM-DD') EFFECT_TIME,
		to_char((SELECT T.CREATE_TIME FROM PLN_SALEORD T WHERE T.ORD_LN_DLY_PK=D.ORD_LN_DLY_PK),'YYYY-MM-DD') TIBAO_TIME,
		P.PORDERSTATUS,
		L.BALNCE_PRICE_STS,
		DECODE(l.KEEP_TYPE,'0','保单价','1','保总价') KEEP_TYPE,
		(SELECT T.BASENAME FROM COM_BASE_INFO T WHERE T.BASECODE=H.FST_DRAWEE_UNIT) FST_DRAWEE_UNIT,
		H.ORDER_STS ORDER_HEAD_STS,
		H.ORDER_STS_DESC ORDER_HEAD_STS_DESC
		FROM 	SLM_ORDER_HEAD H
		LEFT join SLM_ORDER_LINE L on H.ORD_PK = L.ORD_PK
		LEFT JOIN SLM_BASE_CUSTOMER C ON H.CUSTOMER_NO = C.CUSTOMER_NO
		LEFT JOIN SLM_ORDER_LINE_DELIVERY D ON L.ORD_LN_PK = D.ORD_LN_PK
		LEFT JOIN PLN_SALEORD P ON D.ORD_LN_DLY_PK = P.ORD_LN_DLY_PK
		WHERE 1 = 1

		]]>
	</query>
	
	<query id="CoreOrderInfoUpdate.updateCrmOrder" desc="删除冶金规范码科室">
		<![CDATA[
	 	UPDATE CRM_SLM_ORDER
	 	SET ORDER_NO='#ORDER_NO#',
	ORDER_SEQ='#ORDER_SEQ#',
	DELIVERY_NO='#DELIVERY_NO#',
	CUSTM_ORDER_NO='#CUSTM_ORDER_NO#',
	ORDER_TYP='#ORDER_TYP#',
	ORDER_TYP_DESC='#ORDER_TYP_DESC#',
	REGION_NO='#REGION_NO#',
	REGION_NAME='#REGION_NAME#',
	SALE_ORG='#SALE_ORG#',
	SALE_ORG_DESC='#SALE_ORG_DESC#',
	SALE_AREA_NO='#SALE_AREA_NO#',
	SALE_AREA_DESC='#SALE_AREA_DESC#',
	CUSTOMER_NO='#CUSTOMER_NO#',
	CUSTOMER_NM='#CUSTOMER_NM#',
	RECEIV_NO='#RECEIV_NO#',
	RECEIV_NM='#RECEIV_NM#',
	PRICE_FL='#PRICE_FL#',
	ORDER_QTY='#ORDER_QTY#',
	BALNCE_PRICE='#BALNCE_PRICE#',
	CURRENCY='#CURRENCY#',
	MNY_ASK_TYP='#MNY_ASK_TYP#',
	CONTAIN_TAX='#CONTAIN_TAX#',
	ORDER_UNIT='#ORDER_UNIT#',
	PRODUCCODE='#PRODUCCODE#',
	PRODUCNAME='#PRODUCNAME#',
	STD_CODE='#STD_CODE#',
	STD_NAME='#STD_NAME#',
	STEELCODE='#STEELCODE#',
	STEELNAME='#STEELNAME#',
	STD_STYLE='#STD_STYLE#',
	STD_STYLE_DESC='#STD_STYLE_DESC#',
	MODEL_CODE='#MODEL_CODE#',
	MODEL_DESC='#MODEL_DESC#',
	ORDER_SPEC_CODE='#ORDER_SPEC_CODE#',
	ORDER_SPEC_DESC='#ORDER_SPEC_DESC#',
	SPEC_CODE='#SPEC_CODE#',
	SPEC_NAME='#SPEC_NAME#',
	DIMATER='#DIMATER#',
	HEIGHT='#HEIGHT#',
	LEN_NO='#LEN_NO#',
	LEN_DESC='#LEN_DESC#',
	LEN_UNIT='#LEN_UNIT#',
	OUTS_BILLET_FL='#OUTS_BILLET_FL#',
	OUTS_STL_PIPE_FL='#OUTS_STL_PIPE_FL#',
	MNY_ASK_DESC='#MNY_ASK_DESC#',
	ISLOCK='#ISLOCK#',
	PRDCR_DESC='#PRDCR_DESC#',
	MPS_DESC='#MPS_DESC#',
	STLMT_UNIT_NO='#STLMT_UNIT_NO#',
	STLMT_UNIT_NM='#STLMT_UNIT_NM#',
	DELVRY_RANGE_TPE='#DELVRY_RANGE_TPE#',
	DELVRY_RANGE_MIN='#DELVRY_RANGE_MIN#',
	DELVRY_RANGE_MAX='#DELVRY_RANGE_MAX#',
	ADD_ASK_NO='#ADD_ASK_NO#',
	ORDER_ADD_DESC='#ORDER_ADD_DESC#',
	ORDER_SPECIAL_DESC='#ORDER_SPECIAL_DESC#',
	ORDER_STS='#ORDER_STS#',
	ORDER_STS_DESC='#ORDER_STS_DESC#',
	SUPPLY_UNIT_CODE='#SUPPLY_UNIT_CODE#',
	SUPPLY_UNIT='#SUPPLY_UNIT#',
	WGT_ESTMT='#WGT_ESTMT#',
	DELVRY_EDATE=TO_DATE('#DELVRY_EDATE#','YYYY-MM-DD'),
	EFFECT_TIME=TO_DATE('#EFFECT_TIME#','YYYY-MM-DD'),
	TIBAO_TIME=TO_DATE('#TIBAO_TIME#','YYYY-MM-DD'),
	DATA_STATUS='1',
	IS_FLAG='0'
	WHERE ORD_LN_DLY_PK='#ORD_LN_DLY_PK#'
		]]>
	</query>
	
		<query id="CoreOrderInfoUpdate.updateCrmOrdeValidFlag" desc="删除冶金规范码科室">
		<![CDATA[
	 	UPDATE CRM_SLM_ORDER
	 	SET DATA_STATUS='2',
		IS_FLAG='0',
		VALIDFLAG='0'
		WHERE ORD_LN_DLY_PK= ?
		]]>
	</query>
	
	<query id="CoreOrderInfoUpdate.getCrmCount" desc="删除冶金规范码科室">
		<![CDATA[
	 	SELECT COUNT(1) FROM CRM_SLM_ORDER
		WHERE ORD_LN_DLY_PK= ?
		]]>
	</query>
	
	<query id="CoreOrderInfoUpdate.deleteCrmOrder" desc="删除冶金规范码科室">
		<![CDATA[
	 	DELETE CRM_SLM_ORDER
		WHERE ORD_LN_DLY_PK= ?
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.GetOrderReviewItemSts" desc="交货信息更新">
		<![CDATA[
	     SELECT REVIEW_STATUS
         FROM SLM_ORDER_REVIEW_ITEM T
         WHERE T.REVIEW_NO = ?
         AND REVIEW_ITM    = ?
         AND VALIDFLAG     = '1'
				 
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.QueryOrderStatus" desc="交货信息更新">
		<![CDATA[
	 SELECT BASECODE, BASENAME
     FROM COM_BASE_INFO T
     WHERE T.VALIDFLAG = '1'
     AND T.BASECODE >= '12020212'
     AND T.BASECODE <= '12020402'
     AND LENGTH(T.BASECODE) = 8
	 
		]]>
	</query>

	<query id="CoreOrderInfoUpdate.DeleteDisignPLSTITC" desc="清除质量设计制程工艺参数表">
		<![CDATA[
	 DELETE FROM SLM_ORD_DESIGN_MSC_PL_STI_TC T
    WHERE T.ORD_PK = ?
    AND T.ORD_LN_PK = ?
 
		]]>
	</query>

  <query id="CoreOrderInfoUpdate.SELECTAllLineStatus" desc="清除质量设计制程工艺参数表">
		<![CDATA[
	 SELECT ORDER_LN_STATUS FROM SLM_ORDER_LINE
	 WHERE ORD_PK = ?
	 AND VALIDFLAG = '1'
 
		]]>
	</query>
	
	<query id="CoreOrderInfoUpdate.doAddLine" desc="合同行新增">
		<![CDATA[
				INSERT INTO SLM_ORDER_LINE(
					            ORD_LN_PK,ORD_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,OUTBOUND_CALCULATE,
								ORDER_TEAM,MODE_OF_TRANSPORT
								) 
					            VALUES
					            (?, ?,
								(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="CoreOrderInfoUpdate.DeleteMscDepartment" desc="删除冶金规范码科室">
		<![CDATA[
	  DELETE  FROM SLM_ORD_DESIGN_DEPT
	  WHERE ORD_LN_PK = ?
		]]>
	</query>
	
	<query id="CoreOrderInfoUpdate.ClearOrderLineCustAlpha" desc="删除冶金规范码科室">
		<![CDATA[
	  UPDATE  SLM_ORDER_LINE 
	  SET CUST_ALPHA_NO2 = ''
	  WHERE ORD_LN_PK = ? AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="CoreOrderInfoUpdate.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_LN_PK = ?
    AND T.PRODUCT_FLAG = '801403'
    AND T.MAT_STATUS = '80150301'

        ]]>
	</query>
	
	 <query id="CoreOrderInfoUpdate.AddOrderLine" desc="删除冶金规范码科室">
		<![CDATA[
	 	INSERT INTO SLM_ORDER_LINE
  (ORD_PK,
   ORD_LN_PK,
   ORDER_SEQ,
   PSC,
   PSC_DESC,
   PRODUCCODE,
   PRODUCNAME,
   PRD_CLS,
   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,
   PRDCT_WGT,
   DELVRY_RANGE_TPE,
   DELVRY_RANGE_MIN,
   DELVRY_RANGE_MAX,
   FINAL_USER,
   FINAL_USER_DESC,
   ORDER_LN_STATUS,
   CREATE_NAME,
   CREATE_TIME)
VALUES
  ('#ORD_PK#',
   '#ORD_LN_PK#',
   (SELECT DECODE(MAX(ORDER_SEQ),
                  '',
                  '001',
                  LPAD(MAX(ORDER_SEQ) + 1, 3, '0'))
      FROM SLM_ORDER_LINE
     WHERE ORD_PK = '#ORD_PK#'
       AND VALIDFLAG = '1'),
   '#PSC#',
   '#PSC_DESC#',
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   (SELECT A.PRODUC_STYLE FROM COM_BASE_PRODUCT A WHERE A.PRODUCCODE = '#PRODUCCODE#'),
   '#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#',
   '#PRDCT_WGT#',
   '#DELVRY_RANGE_TPE#',
   '#DELVRY_RANGE_MIN#',
   '#DELVRY_RANGE_MAX#',
   '#FINAL_USER#',
   '#FINAL_USER_DESC#',
   '#ORDER_LN_STATUS#',
   '#CREATE_NAME#',
    SYSDATE)
	 	
		]]>
	</query>
	
	 <query id="CoreOrderInfoUpdate.AddPurchaseLine" desc="删除冶金规范码科室">
		<![CDATA[
	 		INSERT INTO SLM_ORDER_LINE_PURCHASE
  (ORD_PK,
   ORD_LN_PK,
   ORDER_SEQ,
   ORDER_SEQ_INDEX,
   PRODUCCODE,
   PRODUCNAME,
   STD_CODE,
   STD_NAME,
   STEELCODE,
   STEELNAME,
   STD_STYLE,
   STD_STYLE_DESC,
   SPEC_CODE,
   SPEC_NAME,
   ORDER_SPEC_CODE,
   ORDER_SPEC_DESC,
   DIMATER,
   HEIGHT,
   MODEL_CODE,
   MODEL_DESC,
   LEN_DESC,
   LEN_UNIT,
   LEN_MIN,
   LEN_MAX,
   ORDER_UNIT,
   ORDER_QTY,
   DELVRY_RANGE_TPE,
   DELVRY_RANGE_MIN,
   DELVRY_RANGE_MAX,
   FINAL_USER,
   FINAL_USER_DESC,
   CREATE_NAME,
   CREATE_TIME)
   VALUES
  ('#ORD_PK#',
   '#ORD_LN_PK#',
   (SELECT T.ORDER_SEQ
      FROM SLM_ORDER_LINE T
     WHERE T.ORD_LN_PK = '#ORD_LN_PK#'),
   (SELECT LPAD(TO_NUMBER(NVL(SUBSTR(MAX(A.ORDER_SEQ_INDEX), 4, 2), 0)) + 1,
                2,
                '0')
      FROM SLM_ORDER_LINE_PURCHASE A ,SLM_ORDER_LINE B
     WHERE A.ORD_LN_PK = '#ORD_LN_PK#'
       AND A.ORD_LN_PK = B.ORD_LN_PK
       AND A.ORDER_SEQ = B.ORDER_SEQ),
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   '#STD_CODE#',
   '#STD_NAME#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#STD_STYLE#',
   '#STD_STYLE_DESC#',
   '#SPEC_CODE#',
   '#SPEC_NAME#',
   '#ORDER_SPEC_CODE#',
   '#ORDER_SPEC_DESC#',
   '#DIMATER#',
   '#HEIGHT#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#LEN_DESC#',
   '#LEN_UNIT#',
   '#LEN_MIN#',
   '#LEN_MAX#',
   '#ORDER_UNIT#',
   '#ORDER_QTY#',
   '#DELVRY_RANGE_TPE#',
   '#DELVRY_RANGE_MIN#',
   '#DELVRY_RANGE_MAX#',
   '#FINAL_USER#',
   '#FINAL_USER_DESC#',
   '#CREATE_NAME#',
   SYSDATE)
	 		
		]]>
	</query>
	
	<query id="CoreOrderInfoUpdate.UpdateOrderLine" desc="删除冶金规范码科室">
		<![CDATA[
	   		UPDATE SLM_ORDER_LINE T
   SET T.PRODUCCODE       = '#PRODUCCODE#',
       T.PRODUCNAME       = '#PRODUCNAME#',
       T.PRD_CLS          = (SELECT A.PRODUC_STYLE FROM COM_BASE_PRODUCT A WHERE A.PRODUCCODE = '#PRODUCCODE#'),
       T.STD_CODE         = '#STD_CODE#',
       T.STD_NAME         = '#STD_NAME#',
       T.STEELCODE        = '#STEELCODE#',
       T.STEELNAME        = '#STEELNAME#',
       T.STD_STYLE        = '#STD_STYLE#',
       T.STD_STYLE_DESC   = '#STD_STYLE_DESC#',
       T.ORDER_SPEC_CODE  = '#ORDER_SPEC_CODE#',
       T.ORDER_SPEC_DESC  = '#ORDER_SPEC_DESC#',
       T.SPEC_CODE        = '#SPEC_CODE#',
       T.SPEC_NAME        = '#SPEC_NAME#',
       T.DIMATER          = '#DIMATER#',
       T.HEIGHT           = '#HEIGHT#',
       T.MODEL_CODE       = '#MODEL_CODE#',
       T.MODEL_DESC       = '#MODEL_DESC#',
       T.LEN_NO           = '#LEN_NO#',
       T.LEN_DESC         = '#LEN_DESC#',
       T.LEN_UNIT         = '#LEN_UNIT#',
       T.LEN_MIN          = '#LEN_MIN#',
       T.LEN_MAX          = '#LEN_MAX#',
       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.ENDLEN_SPECSTD   = '#ENDLEN_SPECSTD#',
       T.SIGL_LEN         = '#SIGL_LEN#',
       T.ORDER_UNIT       = '#ORDER_UNIT#',
       T.ORDER_QTY        = '#ORDER_QTY#',
       T.PRDCT_WGT        = '#PRDCT_WGT#',
       T.DELVRY_RANGE_TPE = '#DELVRY_RANGE_TPE#',
       T.DELVRY_RANGE_MIN = '#DELVRY_RANGE_MIN#',
       T.DELVRY_RANGE_MAX = '#DELVRY_RANGE_MAX#',
       T.FINAL_USER       = '#FINAL_USER#',
       T.FINAL_USER_DESC  = '#FINAL_USER_DESC#',
       T.UPDATE_NAME      = '#UPDATE_NAME#',
       T.UPDATE_TIME      = SYSDATE
 WHERE T.ORD_PK = '#ORD_PK#'
   AND T.ORD_LN_PK = '#ORD_LN_PK#'
	   		
	  
		]]>
	</query>
	
	<query id="CoreOrderInfoUpdate.UpdatePurchaseLine" desc="删除冶金规范码科室">
		<![CDATA[
	   UPDATE SLM_ORDER_LINE_PURCHASE T
   SET T.PRODUCCODE       = '#PRODUCCODE#',
       T.PRODUCNAME       = '#PRODUCNAME#',
       T.STD_CODE         = '#STD_CODE#',
       T.STD_NAME         = '#STD_NAME#',
       T.STEELCODE        = '#STEELCODE#',
       T.STEELNAME        = '#STEELNAME#',
       T.STD_STYLE        = '#STD_STYLE#',
       T.STD_STYLE_DESC   = '#STD_STYLE_DESC#',
       T.SPEC_CODE        = '#SPEC_CODE#',
       T.SPEC_NAME        = '#SPEC_NAME#',
       T.ORDER_SPEC_CODE  = '#ORDER_SPEC_CODE#',
       T.ORDER_SPEC_DESC  = '#ORDER_SPEC_DESC#',
       T.DIMATER          = '#DIMATER#',
       T.HEIGHT           = '#HEIGHT#',
       T.MODEL_CODE       = '#MODEL_CODE#',
       T.MODEL_DESC       = '#MODEL_DESC#',
       T.LEN_DESC         = '#LEN_DESC#',
       T.LEN_UNIT         = '#LEN_UNIT#',
       T.LEN_MIN          = '#LEN_MIN#',
       T.LEN_MAX          = '#LEN_MAX#',
       T.ORDER_UNIT       = '#ORDER_UNIT#',
       T.ORDER_QTY        = '#ORDER_QTY#',
       T.DELVRY_RANGE_TPE = '#DELVRY_RANGE_TPE#',
       T.DELVRY_RANGE_MIN = '#DELVRY_RANGE_MIN#',
       T.DELVRY_RANGE_MAX = '#DELVRY_RANGE_MAX#',
       T.FINAL_USER       = '#FINAL_USER#',
       T.FINAL_USER_DESC  = '#FINAL_USER_DESC#',
       T.UPDATE_NAME      = '#UPDATE_NAME#',
       T.UPDATE_TIME      = SYSDATE

 WHERE T.ORD_LN_PK = '#ORD_LN_PK#'
    
		]]>
	</query>
	
	 <query id="CoreOrderInfoUpdate.UpdateOrderLineDesc" desc="是否存在指定炉批组号的材料库存">
	 <![CDATA[
   		 UPDATE  SLM_ORDER_LINE T
   		 SET T.DELVRY_DESC  = ?,
   		     T.DELVRY_EDATE = (SELECT MAX(DELVRY_EDATE) FROM  SLM_ORDER_LINE_DELIVERY A 
   		     WHERE A.ORD_LN_PK = ? AND A.VALIDFLAG = '1')
   		 WHERE T.ORD_LN_PK = ?
   		 
		]]>
	 </query>
	 
	  <query id="CoreOrderInfoUpdate.DeletePurchaseLine" desc="是否存在指定炉批组号的材料库存">
	 <![CDATA[
   		 DELETE FROM SLM_ORDER_LINE_PURCHASE T
   		 WHERE T.ORD_LN_PK   =  ?
   		 
		]]>
	 </query>
	 
	 <query id="CoreOrderInfoUpdate.AddOrdLine" 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_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,
   CREATE_NAME,
   CREATE_TIME,
   AW,
   MAN_INSPECTION,
   QUALITY_USER,
   QUALITY_USER_DESC,
   OUTPUT_STD_NO,
   PROJECT_NO)
VALUES
  ('#ORD_PK#',
   '#ORD_LN_PK#',
   (SELECT DECODE(MAX(ORDER_SEQ),
                  '',
                  '001',
                  LPAD(MAX(ORDER_SEQ) + 1, 3, '0'))
      FROM SLM_ORDER_LINE
     WHERE ORD_PK = '#ORD_PK#'
       AND VALIDFLAG = '1'),
   '#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_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#',
   '#CREATE_NAME#',
   SYSDATE,
   '#AW#',
   '#MAN_INSPECTION#',
   '#QUALITY_USER#',
   '#QUALITY_USER_DESC#',
   '#OUTPUT_STD_NO#',
   '#PROJECT_NO#')
   		 
   		 
		]]>
	 </query>
	 
	 <query id="CoreOrderInfoUpdate.AddPurLine" desc="新增采购期货加工的采购清单">
	 <![CDATA[
   		 	 		INSERT INTO SLM_ORDER_LINE_PURCHASE
  (ORD_PK,
   ORD_LN_PK,
   ORDER_SEQ,
   ORDER_SEQ_INDEX,
   PRODUCCODE,
   PRODUCNAME,
   STD_CODE,
   STD_NAME,
   STEELCODE,
   STEELNAME,
   STD_STYLE,
   STD_STYLE_DESC,
   SPEC_CODE,
   SPEC_NAME,
   ORDER_SPEC_CODE,
   ORDER_SPEC_DESC,
   DIMATER,
   HEIGHT,
   MODEL_CODE,
   MODEL_DESC,
   LEN_DESC,
   LEN_UNIT,
   LEN_MIN,
   LEN_MAX,
   ORDER_UNIT,
   ORDER_QTY,
   DELVRY_RANGE_TPE,
   DELVRY_RANGE_MIN,
   DELVRY_RANGE_MAX,
   FINAL_USER,
   FINAL_USER_DESC,
   CREATE_NAME,
   CREATE_TIME,
   ORDER_ADD_DESC)
   VALUES
  ('#ORD_PK#',
   '#ORD_LN_PK#',
   (SELECT T.ORDER_SEQ
      FROM SLM_ORDER_LINE T
     WHERE T.ORD_LN_PK = '#ORD_LN_PK#'),
   (SELECT LPAD(TO_NUMBER(NVL(SUBSTR(MAX(A.ORDER_SEQ_INDEX), 4, 2), 0)) + 1,
                2,
                '0')
      FROM SLM_ORDER_LINE_PURCHASE A ,SLM_ORDER_LINE B
     WHERE A.ORD_LN_PK = '#ORD_LN_PK#'
       AND A.ORD_LN_PK = B.ORD_LN_PK
       AND A.ORDER_SEQ = B.ORDER_SEQ),
   '#PRODUCCODE#',
   '#PRODUCNAME#',
   '#STD_CODE#',
   '#STD_NAME#',
   '#STEELCODE#',
   '#STEELNAME#',
   '#STD_STYLE#',
   '#STD_STYLE_DESC#',
   '#SPEC_CODE#',
   '#SPEC_NAME#',
   '#ORDER_SPEC_CODE#',
   '#ORDER_SPEC_DESC#',
   '#DIMATER#',
   '#HEIGHT#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#LEN_DESC#',
   '#LEN_UNIT#',
   '#LEN_MIN#',
   '#LEN_MAX#',
   '#ORDER_UNIT#',
   '#ORDER_QTY#',
   '#DELVRY_RANGE_TPE#',
   '#DELVRY_RANGE_MIN#',
   '#DELVRY_RANGE_MAX#',
   '#FINAL_USER#',
   '#FINAL_USER_DESC#',
   '#CREATE_NAME#',
    SYSDATE,
    '#ORDER_ADD_DESC#')
   		 
		]]>
	 </query>
	
	  <query id="CoreOrderInfoUpdate.UpdateOrdLine" desc="是否存在指定炉批组号的材料库存">
	 <![CDATA[
   	 	UPDATE SLM_ORDER_LINE T
   SET T.CUST_ALPHA_NO      = '#CUST_ALPHA_NO#',
       T.PSC                = '#PSC#',
       T.PSC_DESC           = '#PSC_DESC#',
       T.MSC                = '#MSC#',
       T.MSC_DESC           = '#MSC_DESC#',
       T.MSC_STYLE          = '#MSC_STYLE#',
       T.USE_CODE           = '#USE_CODE#',
       T.USE_DESC           = '#USE_DESC#',
       T.PRD_CLS            = '#PRD_CLS#',
       T.PRODUCCODE         = '#PRODUCCODE#',
       T.PRODUCNAME         = '#PRODUCNAME#',
       T.STD_CODE           = '#STD_CODE#',
       T.STD_NAME           = '#STD_NAME#',
       T.STEELCODE          = '#STEELCODE#',
       T.STEELNAME          = '#STEELNAME#',
       T.STD_STYLE          = '#STD_STYLE#',
       T.STD_STYLE_DESC     = '#STD_STYLE_DESC#',
       T.ORDER_SPEC_CODE    = '#ORDER_SPEC_CODE#',
       T.ORDER_SPEC_DESC    = '#ORDER_SPEC_DESC#',
       T.SPEC_CODE          = '#SPEC_CODE#',
       T.SPEC_NAME          = '#SPEC_NAME#',
       T.DIMATER            = '#DIMATER#',
       T.HEIGHT             = '#HEIGHT#',
       T.MODEL_CODE         = '#MODEL_CODE#',
       T.MODEL_DESC         = '#MODEL_DESC#',
       T.LEN_NO             = '#LEN_NO#',
       T.LEN_DESC           = '#LEN_DESC#',
       T.LEN_UNIT           = '#LEN_UNIT#',
       T.LEN_MIN            = '#LEN_MIN#',
       T.LEN_MAX            = '#LEN_MAX#',
       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.ENDLEN_SPECSTD     = '#ENDLEN_SPECSTD#',
       T.SIGL_LEN           = '#SIGL_LEN#',
       T.ORDER_UNIT         = '#ORDER_UNIT#',
       T.ORDER_QTY          = '#ORDER_QTY#',
       T.ORD_ENSU_TOTL_LEN  = '#ORD_ENSU_TOTL_LEN#',
       T.PRDCT_WGT          = '#PRDCT_WGT#',
       T.DELVRY_RANGE_TPE   = '#DELVRY_RANGE_TPE#',
       T.DELVRY_RANGE_MIN   = '#DELVRY_RANGE_MIN#',
       T.DELVRY_RANGE_MAX   = '#DELVRY_RANGE_MAX#',
       T.FINAL_USER         = '#FINAL_USER#',
       T.FINAL_USER_DESC    = '#FINAL_USER_DESC#',
       T.OUTS_BILLET_FL     = '#OUTS_BILLET_FL#',
       T.OUTS_STL_PIPE_FL   = '#OUTS_STL_PIPE_FL#',
       T.ASSEL_FL           = '#ASSEL_FL#',
       T.PRODUCER_FL        = '#PRODUCER_FL#',
       T.PRDCR_NO           = '#PRDCR_NO#',
       T.PRDCR_DESC         = '#PRDCR_DESC#',
       T.MPS_FL             = '#MPS_FL#',
       T.MPS_NO             = '#MPS_NO#',
       T.MPS_DESC           = '#MPS_DESC#',
       T.ADD_ASK_NO         = '#ADD_ASK_NO#',
       T.ORDER_ADD_DESC     = '#ORDER_ADD_DESC#',
       T.ORDER_SPECIAL_FL   = '#ORDER_SPECIAL_FL#',
       T.ORDER_SPECIAL_HEAD = '#ORDER_SPECIAL_HEAD#',
       T.ORDER_SPECIAL_PATH = '#ORDER_SPECIAL_PATH#',
       T.ORDER_SPECIAL_DESC = '#ORDER_SPECIAL_DESC#',
       T.ZBS                = '#ZBS#',
       T.ORDER_PRICE        = '#ORDER_PRICE#',
       T.TRANS_PRICE        = '#TRANS_PRICE#',
       T.TEST_ID            = '#TEST_ID#',
       T.TEST_PRICE         = '#TEST_PRICE#',
       T.OUT_PRICE          = '#OUT_PRICE#',
       T.BALNCE_PRICE       = '#BALNCE_PRICE#',
       T.BE_ORDER_LN_STATUS = '#BE_ORDER_LN_STATUS#',
       T.BE_OBJ_STS_OP      = '#BE_OBJ_STS_OP#',
       T.ORDER_LN_STATUS    = '#ORDER_LN_STATUS#',
       T.OBJ_STS_OP         = '#OBJ_STS_OP#',
       T.MEMO               = '#MEMO#',
       T.UPDATE_NAME        = '#UPDATE_NAME#',
       T.UPDATE_TIME        = SYSDATE,
       T.AW                 = '#AW#',
       T.MAN_INSPECTION     = '#MAN_INSPECTION#',
       T.QUALITY_USER       = '#QUALITY_USER#',
       T.QUALITY_USER_DESC  = '#QUALITY_USER_DESC#',
       T.OUTPUT_STD_NO      = '#OUTPUT_STD_NO#',
       T.PROJECT_NO         = '#PROJECT_NO#'
 WHERE T.ORD_PK = '#ORD_PK#'
   AND T.ORD_LN_PK = '#ORD_LN_PK#'
   	 	
   		 
		]]>
	 </query>
	 
	  <query id="CoreOrderInfoUpdate.UpdatePurLine" desc="是否存在指定炉批组号的材料库存">
	 <![CDATA[
   	 	   UPDATE SLM_ORDER_LINE_PURCHASE T
   SET T.PRODUCCODE       = '#PRODUCCODE#',
       T.PRODUCNAME       = '#PRODUCNAME#',
       T.STD_CODE         = '#STD_CODE#',
       T.STD_NAME         = '#STD_NAME#',
       T.STEELCODE        = '#STEELCODE#',
       T.STEELNAME        = '#STEELNAME#',
       T.STD_STYLE        = '#STD_STYLE#',
       T.STD_STYLE_DESC   = '#STD_STYLE_DESC#',
       T.SPEC_CODE        = '#SPEC_CODE#',
       T.SPEC_NAME        = '#SPEC_NAME#',
       T.ORDER_SPEC_CODE  = '#ORDER_SPEC_CODE#',
       T.ORDER_SPEC_DESC  = '#ORDER_SPEC_DESC#',
       T.DIMATER          = '#DIMATER#',
       T.HEIGHT           = '#HEIGHT#',
       T.MODEL_CODE       = '#MODEL_CODE#',
       T.MODEL_DESC       = '#MODEL_DESC#',
       T.LEN_DESC         = '#LEN_DESC#',
       T.LEN_UNIT         = '#LEN_UNIT#',
       T.LEN_MIN          = '#LEN_MIN#',
       T.LEN_MAX          = '#LEN_MAX#',
       T.ORDER_UNIT       = '#ORDER_UNIT#',
       T.ORDER_QTY        = '#ORDER_QTY#',
       T.DELVRY_RANGE_TPE = '#DELVRY_RANGE_TPE#',
       T.DELVRY_RANGE_MIN = '#DELVRY_RANGE_MIN#',
       T.DELVRY_RANGE_MAX = '#DELVRY_RANGE_MAX#',
       T.FINAL_USER       = '#FINAL_USER#',
       T.FINAL_USER_DESC  = '#FINAL_USER_DESC#',
       T.UPDATE_NAME      = '#UPDATE_NAME#',
       T.UPDATE_TIME      = SYSDATE,
       T.ORDER_ADD_DESC   = '#ORDER_ADD_DESC#'

 WHERE T.ORD_LN_PK = '#ORD_LN_PK#'
   		 
		]]>
	 </query>
	 
	 <query id="CoreOrderInfoUpdate.getComBaseInfo" desc="合同行新增时LnPk">
		<![CDATA[
   			SELECT BASECODE,BASENAME 
   			FROM COM_BASE_INFO T
   			WHERE T.SORTCODE = ?
   			AND T.VALIDFLAG = '1'
   			
		]]>
	</query>
	<query id = "CoreOrderInfoUpdate.selectMatZcMOrderLn" desc = "查询合同行下库存信息">
	SELECT T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       (SELECT T1.PROCESS_CODE
          FROM COM_BASE_PLINE T1
         WHERE T1.PLINE_CODE = T.PLINE_CODE) PROCESS_CODE
  FROM MAT_ZC_M T
 WHERE T.ORD_LN_PK = ?
   AND T.BELONG_CODE IN ('100101', '100102', '100103','100105')
 GROUP BY T.JUDGE_STOVE_NO, T.BATCH_NO, T.BATCH_GROUD_NO, T.PLINE_CODE
	</query>

	<query id = "CoreOrderInfoUpdate.getSlmOrderLine" desc = "查询合同行信息">
		SELECT * FROM SLM_ORDER_LINE WHERE ORD_LN_PK = {0} and VALIDFLAG = '1'
	</query>

</queryMap>


