<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="查询合同子项信息">
	<query id="CoreOrderLineChild.doQueryLineDelivery" desc="查询交货信息">
		<![CDATA[  
		   SELECT ORD_PK,ORD_LN_PK,ORD_LN_DLY_PK, DELIVERY_NO, DELVRY_BDATE, TO_CHAR(DELVRY_EDATE,'YYYY-MM-DD')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, TO_CHAR(CREATE_TIME,'YYYY-MM-DD')CREATE_TIME, UPDATE_NAME, TO_CHAR(UPDATE_TIME,'YYYY-MM-DD')UPDATE_TIME,
			      DELETE_NAME, TO_CHAR(DELETE_TIME,'YYYY-MM-DD')DELETE_TIME
			  FROM SLM_ORDER_LINE_DELIVERY
			 WHERE ORD_LN_PK = ? AND VALIDFLAG = '1'
            ]]>
	</query>
	<query id="CoreOrderLineChild.doQueryTransitDelivery" desc="查询交货运输信息">
		<![CDATA[  
		   SELECT ORD_PK,ORD_LN_PK,ORD_LN_DLY_PK,INDEX_SEQ, AGENCY_FL,
			       TRANSIT_TYP, DESTINATION, STATION_NO, STATION_NM,
			      SPCL_LN_NO SPCL_LN_NM, PORT_NO, PORT_DESC, CARRIER_UNIT, RECEIVOR,
			      TRANSIT_LN_MNY, VALIDFLAG, CREATE_NAME, TO_CHAR(CREATE_TIME,'YYYY-MM-DD')CREATE_TIME, UPDATE_NAME,
			      TO_CHAR(UPDATE_TIME,'YYYY-MM-DD')UPDATE_TIME, DELETE_NAME, TO_CHAR(DELETE_TIME,'YYYY-MM-DD')DELETE_TIME
			  FROM SLM_ORDER_DELIVERY_TRANSIT
			 WHERE ORD_LN_PK = ?  AND VALIDFLAG = '1'
            ]]>
	</query>
	<query id="CoreOrderLineChild.doQueryMscStdChem" desc="查询成分项信息">
		<![CDATA[  
	SELECT CHEM_CODE, CHEM_NAME, CHEM_FORMULA, STDMIN_SIGN, STDMIN, STDMAX_SIGN,
       STDMAX,
       (SELECT DECODE (MAX (STDMIN_SIGN),
                       '', ' ',
                       MAX (STDMIN_SIGN)
                      )
          FROM SLM_CUST_ALPHA_CHEM
         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPHA_STDMIN_SIGN,
       (SELECT DECODE (MAX (STDMAX), '', '0', MAX (STDMIN))
          FROM SLM_CUST_ALPHA_CHEM
         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPHA_STDMIN,
       (SELECT DECODE (MAX (STDMAX_SIGN),
                       '', ' ',
                       MAX (STDMAX_SIGN)
                      )
          FROM SLM_CUST_ALPHA_CHEM
         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPHA_STDMAX_SIGN,
       (SELECT DECODE (MAX (STDMAX), '', '0', MAX (STDMAX))
          FROM SLM_CUST_ALPHA_CHEM
         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPHA_STDMAX
  FROM COM_MSC_STD_CHEM
 WHERE CIC IN (SELECT CIC
                 FROM COM_MSC_STD_CIC
                WHERE MSC = ? AND VALIDFLAG = '1') AND MODEL_CODE = ?
            ]]>
	</query>
	<query id="CoreOrderLineChild.doQueryMscStdDetection" desc="查询探伤项信息">
		<![CDATA[   
		SELECT POSITION_CODE, POSITION_DESC, STD_DESC, LV_CODE, LV_DESC, COVERAGE,
		       (SELECT DECODE (POSITION_CODE,
		                       '', ' ',
		                       POSITION_CODE
		                      )
		          FROM SLM_CUST_ALPHA_DETECTION
		         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPPOSITION_CODE,
		       (SELECT DECODE (POSITION_DESC,
		                       '', '0',
		                       POSITION_DESC
		                      )
		          FROM SLM_CUST_ALPHA_DETECTION
		         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPPOSITION_DESC,
		       (SELECT DECODE (STD_DESC, '', ' ', STD_DESC)
		          FROM SLM_CUST_ALPHA_DETECTION
		         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPSTD_DESC,
		       (SELECT DECODE (LV_CODE, '', '0', LV_CODE)
		          FROM SLM_CUST_ALPHA_DETECTION
		         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPLV_CODE,
		       (SELECT DECODE (LV_DESC, '', '0', LV_DESC)
		          FROM SLM_CUST_ALPHA_DETECTION
		         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPLV_DESC,
		       (SELECT DECODE (COVERAGE, '', '0', COVERAGE)
		          FROM SLM_CUST_ALPHA_DETECTION
		         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPCOVERAGE
		  FROM COM_MSC_STD_DETECTION_C
		 WHERE DIC IN (SELECT DIC
		                 FROM COM_MSC_STD_DETECTION
		                WHERE MSC = ? AND VALIDFLAG = '1' AND MODEL_CODE = ?)
            ]]>
	</query>
	<query id="CoreOrderLineChild.doQueryMscStdWater" desc="查询水压项信息">
		<![CDATA[   
		SELECT PRESSURE_Y, PRESSURE, SAVE_TIME,
		       (SELECT DECODE (PRESSURE_Y, '', ' ', PRESSURE_Y)
		          FROM SLM_CUST_ALPHA_WATER
		         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPPRESSURE_Y,
		       (SELECT DECODE (PRESSURE, '', ' ', PRESSURE)
		          FROM SLM_CUST_ALPHA_WATER
		         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPPRESSURE,
		       (SELECT DECODE (SAVE_TIME, '', ' ', SAVE_TIME)
		          FROM SLM_CUST_ALPHA_WATER
		         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPSAVE_TIME
		  FROM COM_MSC_STD_WATER_C
		 WHERE WIC IN (SELECT WIC
		                 FROM COM_MSC_STD_WATER
		                WHERE MSC = ? AND VALIDFLAG = '1' AND MODEL_CODE = ?)
            ]]>
	</query>
	<query id="CoreOrderLineChild.doQueryMscStdPic" desc="查询理化项信息">
		<![CDATA[    
			SELECT PHY_CODE_MAX, PHY_NAME_MAX, PHY_CODE_MIN, PHY_NAME_MIN, PHY_CODE,
			       PHY_NAME, ITEM_CODE_F, ITEM_NAME_F, ITEM_CODE_W, ITEM_NAME_W,
			       ITEM_CODE_S, ITEM_NAME_S, STDMIN_SIGN, STDMIN, STDMAX_SIGN, STDMAX,
			       (SELECT STDMIN_SIGN
			          FROM SLM_CUST_ALPHA_PHY
			         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPSTDMIN_SIGN,
			       (SELECT STDMIN
			          FROM SLM_CUST_ALPHA_PHY
			         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPSTDMIN,
			       (SELECT STDMAX_SIGN
			          FROM SLM_CUST_ALPHA_PHY
			         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPSTDMAX_SIGN,
			       (SELECT STDMAX
			          FROM SLM_CUST_ALPHA_PHY
			         WHERE CUST_ALPHA_NO = ? AND VALIDFLAG = '1') ALPSTDMAX
			  FROM COM_MSC_STD_PHY
			 WHERE PIC IN (SELECT PIC
			                 FROM COM_MSC_STD_PIC
			                WHERE MSC = ?) AND VALIDFLAG = '1'  AND MODEL_CODE = ?
            ]]>
	</query>
	<query id="CoreOrderLineChild.doQueryMscStdSpec_c" desc="查询公差项信息">
		<![CDATA[     
	SELECT V.BIAS_CODE,
       V.BIAS_NAME,
       T.STD_MIN_VAL,
       T.STD_MAX_VAL,
       T.STD_MIN_PERCENT,
       T.STD_MAX_PERCENT,
       T.STD_MIN_FORMULA_V,
       T.STD_MAX_FORMULA_V,
       V.STD_MIN_VAL       ALPSTD_MIN_VAL,
       V.STD_MAX_VAL       ALPSTD_MAX_VAL,
       V.STD_MIN_PERCENT   ALPSTD_MIN_PERCENT,
       V.STD_MAX_PERCENT   ALPSTD_MAX_PERCENT,
       V.STD_MIN_FORMULA_V ALPSTD_MIN_FORMULA_V,
       V.STD_MAX_FORMULA_V ALPSTD_MAX_FORMULA_V
  FROM (SELECT *
          FROM COM_MSC_STD_SPEC_C
         WHERE SIC = (SELECT MIN(SIC)
                        FROM COM_MSC_STD_SPEC
                       WHERE MSC = ?
                         AND VALIDFLAG = '1'
                         AND MODEL_CODE = ?)) T,
       SLM_CUST_ALPHA_SPEC V
 WHERE V.CUST_ALPHA_NO = ?
   AND V.VALIDFLAG = '1'
   AND T.BIAS_CODE(+) = V.BIAS_CODE


            ]]>
	</query>
	<query id="CoreOrderLineChild.doQueryMscStdSpec_Tional" desc="查询附加要求">
		<![CDATA[      
				SELECT ASK_ITME, ASK_ITME_DESC, ASK_SUB_ITME, ASK_SUB_ITME_DESC, STD_CODE,
				       STD_NAME, ASK_SUB_ITME_VAL, PIC,
				       (SELECT ASK_SUB_ITME_VAL
				          FROM SLM_ORDER_ADD_ASK
				         WHERE ASK_ITME = A.ASK_ITME
				           AND ASK_SUB_ITME = A.ASK_SUB_ITME
				           AND ADD_ASK_NO = ?) ASK_ORDER_SUB_ITME_VAL,
				       (SELECT PIC
				          FROM SLM_ORDER_ADD_ASK
				         WHERE ASK_ITME = A.ASK_ITME
				           AND ASK_SUB_ITME = A.ASK_SUB_ITME
				           AND ADD_ASK_NO = ?) ORDER_PIC
				  FROM COM_BASE_ADDITIONAL A
				 WHERE A.STD_CODE IN (SELECT S.STD_CODE
				                        FROM COM_BASE_STD S JOIN COM_MSC M
				                             ON S.STD_CODE = M.STD_CODE
				                       WHERE M.MSC = ?)
            ]]>
	</query>
</queryMap>