<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc=" 接箍合同综合信息">

	<query id="FrmYieldInOutputQuery.doQuery" desc="查询信息">
          <![CDATA[
SELECT
 T.JUDGE_STOVE_NO,
 T.BATCH_NO,
 T.BATCH_GROUD_NO,
 T.ACT_COUNT,
 T.ACT_WEIGHT,
 T.MATERIAL_NAME,
 T.PRODUCNAME,
 T.STEELNAME,
 T.GRADENAME,
 T.SPEC_NAME,
 T.MODEL_DESC,
 T.STD_NAME,
 T.STD_STYLE_DESC,
 T.LOT_NO,
 T.PLINE_NAME,
 T.PRO_ORDER_NO,
 T.ACT_DIMATER,
 T.ACT_HEIGHT,
 T.SUPPLY_UNIT_DESC,
 T2.JUDGE_STOVE_NO JUDGE_STOVE_NO2,
 T3.DIMATER,
 T3.GRADENAME GRADENAME2,
 T.TARGET,
 T7.CUSTOMER_NM,
 (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE=T7.FST_DRAWEE_UNIT) FST_DRAWEE_UNIT,
 ROUND(AVG(T4.ORDER_PRICE), 3) ORDER_PRICE,
 ROUND(AVG(DECODE(T7.FST_DRAWEE_UNIT,'120607',T6.BALNCE_PRICE,T6.BALNCE_PRICE_ORG)),3) BALNCE_PRICE
  FROM QCM_ZG_JUGDE_APPLY T
  LEFT JOIN PLN_ZY_ZG_C T2
    ON T2.HEAT_PLAN_NO = T.HEAT_PLAN_NO
  LEFT JOIN MAT_GP_M_HISTORY T3
    ON T3.JUDGE_STOVE_NO = T2.JUDGE_STOVE_NO
   AND T3.STOVE_NO = T2.STOVE_NO
  LEFT JOIN BUY_GP_ORDER T4
    ON T4.GPBUYPLANID = T3.GPREQ_ID
  LEFT JOIN SLM_ORDER_LINE_DELIVERY T5
    ON T5.ORD_LN_DLY_PK = T.ORD_LN_DLY_PK
  LEFT JOIN SLM_ORDER_LINE T6
    ON T6.ORD_LN_PK = T5.ORD_LN_PK
  LEFT JOIN SLM_ORDER_HEAD T7
    ON T7.ORD_PK = T5.ORD_PK
 WHERE T.PROCESS_CODE = 'D'
   AND T.PLINE_CODE = 'C072'
   AND ((T.TARGET = 'A' AND T.JUDGE_TOLRESULT_CODE = '40740701') OR
       (T.TARGET IN ('B', 'C') AND T.JUDGE_RESULT_CODE = '40740701') OR
       T.INSTANCY_FLAG = '1')
   AND T.IS_ALL_SCRAP IN ('0', '2')
            ]]>
	</query>

</queryMap>