<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="加工实绩">
	<query id="FrmJgxReport.doQueryAppResult" desc="查询倒凌实绩">
        <![CDATA[
         SELECT T.*,
        TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK
   FROM MCH_CHAMFERING_RESULT T, PLN_ZY_JGX_M M
  WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
        ]]>
	</query>
	<query id="FrmJgxReport.doQueryBundingResult" desc="打捆">
		<![CDATA[
 SELECT T.*,
        TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK
   FROM MCH_BUNDLING_RESULT T, PLN_ZY_JGX_M M
  WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
        ]]>
	</query>



	<query id="FrmJgxReport.doQueryLoadResult" desc="查询上料台账">
        <![CDATA[
   SELECT T.RESULT_NO,
       T.HEAT_PLAN_NO,
       T.ZY_BATCH_ID,
       T.PROD_INDEX,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       M.JUDGE_STOVE_NO,
       T.BATCH_NO,
       DECODE(T.IF_MONITOR_RCL, '1', '是', '否') IF_MONITOR_RCL,
       T.MONITORDEMAND,
       T.PRDCR_NO,
       T.PRODUCER,
       TO_CHAR(T.PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       NVL(T.PRO_NUM, 0) PRO_NUM,
       NVL(T.PRO_WT, 0) PRO_WT,
       NVL(T.FAIL_NUM, 0) FAIL_NUM,
       NVL(T.FAIL_WT, 0) FAIL_WT,
       T.OFFLINE_NUM,
       T.OFFLINE_WT,
       T.RE_NUM,
       T.RE_WT,
       TO_CHAR(T.LOAD_TIME, 'YYYY-MM-DD HH24:MI:SS') LOAD_TIME,
       DECODE(T.LOAD_SHIFT, '1', '早', '2', '中', '3', '晚','0','白') LOAD_SHIFT,
       DECODE(T.LOAD_GROUP, '1', '甲', '2', '乙', '3', '丙', '4', '丁') LOAD_GROUP,
       T.CREATET_USER,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.UPDATE_NAME,
        DECODE(T.COL_MODE, '1', '人工录入', '2', '接口采集') COL_MODE,
       TO_CHAR(TO_DATE(T.PRO_YEAR_MONTH_DAY, 'YYYY-MM-DD'), 'YYYY-MM-DD') PRO_YEAR_MONTH_DAY,
       TO_CHAR(TO_DATE(T.BAL_YEAR_MONTH, 'YYYY-MM'), 'YYYY-MM') BAL_YEAR_MONTH,
          DECODE((SELECT T1.STATION_STATUS
                FROM MCH_COM_INFO T1
               WHERE T1.RESULT_NO = T.RESULT_NO),
              '1',
              '生产中',
              '2',
              '生产完成') STATION_STATUS,
              M.ORDER_NO||'/'|| M.ORDER_SEQ ORDER_NO,MAT_SOURCE
  FROM MCH_LOADING_RESULT T,PLN_ZY_JGX_M M
 WHERE 1=1  AND T.HEAT_PLAN_NO=M.HEAT_PLAN_NO AND NVL(T.ZY_BATCH_ID,'/') = NVL(M.ZY_BATCH_ID,'/')
          ]]>
	</query>


	<query id="FrmJgxReport.doQueryLoadResult1" desc="查询上料台账">
		<![CDATA[
    SELECT T.*,
        TO_CHAR(T.LOAD_TIME, 'YYYY-MM-DD HH24:MI:SS') LOAD_TIME,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK,
        M.OUTNUM_CUT
   FROM MCH_LOADING_RESULT T, PLN_ZY_JGX_M M
  WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
          ]]>
	</query>

	<query id="FrmJgxReport.doQueryCutResult" desc="查询分切台账">
        <![CDATA[
        SELECT T.*,
        TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK,
        M.OUTNUM_CUT
   FROM MCH_CUT_RESULT T, PLN_ZY_JGX_M M
  WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
          ]]>
	</query>
	<query id="FrmJgxReport.doQueryHreadResult" desc="查询螺纹检验台帐">
        <![CDATA[
          SELECT T.*,
        TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK,
        M.OUTNUM_CUT
   FROM MCH_HREAD_RESULT T, PLN_ZY_JGX_M M
  WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
          ]]>
	</query>





	<query id="FrmJgxReport.doQueryTreatment" desc="">
		<![CDATA[
          SELECT T.*,
        TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
        TO_CHAR(T.REPLY_TIME, 'YYYY-MM-DD HH24:MI:SS') REPLY_TIME,
        TO_CHAR(T.APPROVAL_TIME, 'YYYY-MM-DD HH24:MI:SS') APPROVAL_TIME,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK,
        M.OUTNUM_CUT
   FROM MCH_FINAL_CHECK_TREATMENT T, PLN_ZY_JGX_M M
  WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
          ]]>
	</query>


	<query id="FrmJgxReport.doQueryMeasureResult" desc="查询测量点台账">
        <![CDATA[
            SELECT T.*,
        TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK,
        M.OUTNUM_CUT
   FROM MCH_MEASURE_RESULT T, PLN_ZY_JGX_M M
  WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
          ]]>
	</query>
	<query id="FrmJgxReport.doQueryThreaderResult" desc="查询车丝台账">
        <![CDATA[
                  SELECT T.*,
        TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK,
        M.OUTNUM_CUT
   FROM MCH_THREADER_RESULT T, PLN_ZY_JGX_M M
  WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
          ]]>
	</query>
	<query id="FrmJgxReport.doQueryWaterResult" desc="查询水压台账">
        <![CDATA[
               SELECT T.*,
        TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK,
        M.OUTNUM_CUT
   FROM MCH_WATERGAGE_RESULT T, PLN_ZY_JGX_M M
  WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
          ]]>
	</query>
	<query id="FrmJgxReport.doQueryPathResult" desc="查询T通径台账">
        <![CDATA[
          SELECT  T.*,TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,    M.ORDER_NO||'/'|| M.ORDER_SEQ ORDER_NO
  FROM MCH_PATH_RESULT T ,PLN_ZY_JGX_M M
 WHERE  T.HEAT_PLAN_NO=M.HEAT_PLAN_NO
        ]]>
	</query>

	<query id="FrmJgxReport.doQueryRemanenceResult" desc="">
		<![CDATA[
          SELECT T.*,
        TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK,
        M.OUTNUM_CUT
   FROM MCH_REMANENCE_RESULT T, PLN_ZY_JGX_M M
  WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
        ]]>
	</query>

	<query id="FrmJgxReport.doQueryTwistinResult" desc="查询拧接台账">
        <![CDATA[
                  SELECT T.*,
        TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK,
        M.OUTNUM_CUT
   FROM MCH_TWISTINGLY_RESULT T, PLN_ZY_JGX_M M
  WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
      
          ]]>
	</query>
	<query id="FrmJgxReport.doQueryMtResult" desc="查询磁粉探伤台账">
        <![CDATA[
        SELECT T.RESULT_NO,
       T.HEAT_PLAN_NO,
       T.ZY_BATCH_ID,
       T.PROD_INDEX,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       M.JUDGE_STOVE_NO,
       DECODE(T.IF_MONITOR_RCL, '1', '是', '否') IF_MONITOR_RCL,
       T.MONITORDEMAND,
       T.PRDCR_NO,
       T.PRODUCER,
       TO_CHAR(T.PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       T.TESTING_STANDARD1,
       T.TESTING_GRADE1,
       T.TESTING_STANDARD2,
       T.TESTING_GRADE2,
       T.TESTING_STANDARD3,
       T.TESTING_GRADE3,
       T.TESTING_STANDARD4,
       T.TESTING_GRADE4,
       T.SHIM_MAG_INDIC,
       T.SHIM_MAG_TYPE,
       T.MT_TYPE,
       T.MAG_SUSP_LIQ_CON,
       T.COIL_CUR_INT,
       T.CTR_STI_CUR_INT,
       T.DEMAG_VOL,
       T.MT_NOTE,
       NVL(T.TET_NUM, 0) TET_NUM,
       NVL(T.TET_WT, 0) TET_WT,
       NVL(T.PRO_NUM, 0) PRO_NUM,
       NVL(T.PRO_WT, 0) PRO_WT,
       NVL(T.FAIL_NUM, 0) FAIL_NUM,
       NVL(T.FAIL_WT, 0) FAIL_WT,
       T.FAIL_BILL,
       NVL(T.CUT_NUM, 0) CUT_NUM,
       NVL(T.CUT_WT, 0) CUT_WT,
       NVL(T.DUBIOUS_NUM, 0) DUBIOUS_NUM,
       NVL(T.DUBIOUS_WT, 0) DUBIOUS_WT,
       T.DUBIOUS_BILL,
       NVL(T.FTESTING_NUM, 0) FTESTING_NUM,
       NVL(T.FTESTING_WT, 0) FTESTING_WT,
       NVL(T.FPASS_NUM, 0) FPASS_NUM,
       NVL(T.FPASS_WT, 0) FPASS_WT,
       T.OFFLINE_NUM,
       T.OFFLINE_WT,
       T.RE_NUM,
       T.RE_WT,
       T.UT_MAN,
       T.UT_MAN_GRADE,
       T.SIGN_MAN,
       T.SIGN_MAN_GRADE,
        DECODE(T.COL_MODE, '1', '人工录入', '2', '接口采集') COL_MODE,
       TO_CHAR(TO_DATE(T.PRO_YEAR_MONTH_DAY, 'YYYY-MM-DD'), 'YYYY-MM-DD') PRO_YEAR_MONTH_DAY,
       TO_CHAR(TO_DATE(T.BAL_YEAR_MONTH, 'YYYY-MM'), 'YYYY-MM') BAL_YEAR_MONTH,
       DECODE((SELECT T1.STATION_STATUS
                FROM MCH_COM_INFO T1
               WHERE T1.RESULT_NO = T.RESULT_NO),
              '1',
              '生产中',
              '2',
              '生产完成') STATION_STATUS
       TO_CHAR(T.RRO_TIME, 'YYYY-MM-DD HH24:MI:SS') RRO_TIME,
       T.RRO_TIME_NU,
       DECODE(T.PRO_SHIFT, '1', '早', '2', '中', '3', '夜') PRO_SHIFT,
       DECODE(T.PRO_GROUP, '1', '甲', '2', '乙', '3', '丙', '4', '丁') PRO_GROUP,
       T.CREATE_USER,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME
  FROM MCH_MT_RESULT T,PLN_ZY_JGX_M M
 WHERE 1 = 1 AND T.HEAT_PLAN_NO=M.HEAT_PLAN_NO AND NVL(T.ZY_BATCH_ID,'/') = NVL(M.ZY_BATCH_ID,'/') AND T.PLINE_CODE = M.PLINE_CODE

          ]]>
	</query>
	<query id="FrmJgxReport.doSendFrimResult" desc="加工线探伤送审">
		<![CDATA[
UPDATE HTT_CRACK_DETECTION_ET SET  FRIM_FLAG='1' WHERE RESULT_NO
          ]]>
	</query>
	<query id="FrmJgxReport.doConfirmFrimResult" desc="加工线探伤审核">
		<![CDATA[
UPDATE HTT_CRACK_DETECTION_ET SET  FRIM_FLAG='2' WHERE RESULT_NO
          ]]>
	</query>
	<query id="FrmJgxReport.doQueryUtResult" desc="查询超声探伤台账">
        <![CDATA[
          SELECT T.*,
        TO_CHAR(T.COL_TIME, 'YYYY-MM-DD HH24:MI:SS') COL_TIME,
          TO_CHAR(T.COL_END_TIME, 'YYYY-MM-DD HH24:MI:SS') COL_END_TIME,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK,
        M.OUTNUM_CUT,
        P.REPORT_PATH,
        p.WALL_THICKNESS,
        P.Memo
   FROM HTT_CRACK_DETECTION_ET T, PLN_ZY_JGX_M M,HTT_CRACK_DETECTION_PARA P
  WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
    AND T.RESULT_NO = P.RESULT_NO

          ]]>
	</query>
	
	<query id="FrmJgxReport.doQueryGoDown" desc="查询入库台账数据">
        <![CDATA[
        SELECT T.INSTOCK_DOC,
       T.LOT_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.STD_CODE,
       T.STD_NAME,
       T.STEELCODE,
       T.STEELNAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
       TO_CHAR(T.ACT_LEN_MIN, 'FM999990.00') AS ACT_LEN_MIN,
       TO_CHAR(T.ACT_LEN_MAX, 'FM999990.00') AS ACT_LEN_MAX,
       SUM(T.ACT_COUNT) AS ACT_COUNT,
       TO_CHAR(SUM(T.ACT_WEIGHT), 'FM999999990.000') AS ACT_WEIGHT,
       --T.ACT_LEN,
       T.BELONG_CODE,
       T.BELONG_NAME,
       T.STORAGE_NO,
       T.MEMO,
       T.CREATE_NAME,
       MAX(TO_CHAR(T.INSTOCK_TIME, 'YYYY-MM-DD HH24:MI:SS')) AS INSTOCK_TIME,
       MAX(TO_CHAR(T.IN_TIME_F, 'YYYY-MM-DD')) AS IN_TIME_F,
       TO_CHAR(TO_DATE(T.BAL_YEAR_MONTH, 'YYYY-MM'), 'YYYY-MM') AS BAL_YEAR_MONTH,
       T.ORDER_NO,
       T.ORDER_SEQ,
       T.DELIVERY_NO,
       T.JUDGE_STD_CODE,
       T.JUDGE_STD_NAME,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.GRADECODE,
       T.GRADENAME,
       T.MATERIAL_NO,
       T.MATERIAL_NAME,
       DECODE(T.PRODUCT_FLAG,
              '801401',
              '在制品',
              '801402',
              '成品',
              '801403',
              '商品') PRODUCT_FLAG,
       T.MAT_STATUS,
       T.PIPMEMO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       DECODE(T.IN_BC, '0','白班','1','早班','2','中班','3','晚班') IN_BC,
       DECODE(T.IN_BZ,'1','甲班','2','乙班','3','丙班','3','丁班') IN_BZ
  FROM YDM_BC_INLIST T
 WHERE T.INSTOCK_TYPE_CODE = '800701'
   AND T.HAND_FLAG = '0'
   AND T.QCM_STAUS = '00'
          ]]>
	</query>

	<query id="FrmJgxReport.doQueryMeasureDetailsResultzb" desc="质保部查询测量点明细">
		<![CDATA[
           SELECT 'FALSE' CHK,
           R.KEY_ID,
         TO_CHAR(R.MSAUER_DATE, 'YYYY-MM-DD HH24:MI:SS') MSAUER_DATE,
       R.PLINE_CODE,
       NVL(R.PLINE_NAME,(SELECT PLINE_NAME FROM COM_BASE_PLINE WHERE PLINE_CODE= R.PLINE_CODE)) PLINE_NAME,
       DECODE(R.PRO_BC, '0','白班' , '1', '早班', '2', '中班', '3', '晚班') PRO_BC,
       DECODE(R.PRO_BZ, '1', '甲班', '2', '乙班', '3', '丙班', '4', '丁班') PRO_BZ,
       R.JUDGE_STOVE_NO,
       R.BATCH_NO,
       R.MAT_NO,
       R.MAT_INFO,
       R.ACT_LEN / 1000 ACT_LEN,
       R.ACT_WEIGHT / 1000 ACT_WEIGHT,
       M.PRODUCNAME,
       DECODE(M.ORDER_NO,NULL,R.PRO_ORDER_NO, M.ORDER_NO || '/' || M.ORDER_SEQ) ORDER_NO,
       M.GRADENAME,
       M.STEELNAME,
       M.MODEL_DESC,
       M.STD_NAME,
       M.OUTDIAMETER,
       M.WALLTHICK,
       (select max(s.lengthmin || '-' || s.lengthmax)
          from PLN_ORDER_JGX_S s
         where s.order_no || '/' || s.order_seq =
               DECODE(M.ORDER_NO,
                      NULL,
                      R.PRO_ORDER_NO,
                      M.ORDER_NO || '/' || M.ORDER_SEQ)) lengthscope
  FROM    RTD_MEASURE_POSDATA          R
       LEFT JOIN PORT_MCH_BATCH_SAMPLE_RESULT T ON T.JUDGE_STOVE_NO = R.JUDGE_STOVE_NO AND T.PHY_BATCH_NO = R.BATCH_NO
   AND T.MAT_NO = R.MAT_NO_CX
   AND T.MEASURING_SEQ = R.MAT_NO
       LEFT JOIN PLN_ZY_JGX_M M ON M.HEAT_PLAN_NO = T.HEAT_PLAN_NO AND  T.JUDGE_STOVE_NO = M.JUDGE_STOVE_NO
 WHERE 1= 1
          ]]>
	</query>
	<query id="FrmJgxReport.doQueryMeasureDetailsResult" desc="查询测量点明细">
        <![CDATA[
           SELECT 'FALSE' CHK,
           R.KEY_ID,
         TO_CHAR(R.MSAUER_DATE, 'YYYY-MM-DD HH24:MI:SS') MSAUER_DATE,
       R.PLINE_CODE,
       NVL(R.PLINE_NAME,(SELECT PLINE_NAME FROM COM_BASE_PLINE WHERE PLINE_CODE= R.PLINE_CODE)) PLINE_NAME,
       DECODE(R.PRO_BC, '0','白班' , '1', '早班', '2', '中班', '3', '晚班') PRO_BC,
       DECODE(R.PRO_BZ, '1', '甲班', '2', '乙班', '3', '丙班', '4', '丁班') PRO_BZ,
       R.JUDGE_STOVE_NO,
       R.BATCH_NO,
       R.MAT_NO,
       R.MAT_INFO,
       R.ACT_LEN / 1000 ACT_LEN,
       R.ACT_WEIGHT / 1000 ACT_WEIGHT,
       M.PRODUCNAME,
       DECODE(M.ORDER_NO,NULL,R.PRO_ORDER_NO, M.ORDER_NO || '/' || M.ORDER_SEQ) ORDER_NO,
       M.GRADENAME,
       M.STEELNAME,
       M.MODEL_DESC,
       M.STD_NAME,
       M.OUTDIAMETER,
       M.WALLTHICK
  FROM    RTD_MEASURE_POSDATA          R
       LEFT JOIN PORT_MCH_BATCH_SAMPLE_RESULT T ON T.JUDGE_STOVE_NO = R.JUDGE_STOVE_NO AND T.PHY_BATCH_NO = R.BATCH_NO
   AND T.MAT_NO = R.MAT_NO_CX
   AND T.MEASURING_SEQ = R.MAT_NO
       LEFT JOIN PLN_ZY_JGX_M M ON M.HEAT_PLAN_NO = T.HEAT_PLAN_NO AND  T.JUDGE_STOVE_NO = M.JUDGE_STOVE_NO
 WHERE 1= 1
          ]]>
	</query>
	
	<query id="FrmJgxReport.doQueryWaster" desc="查询废品台账">
        <![CDATA[
       SELECT *
  FROM (SELECT T.INSTOCK_TIME,
               T.PLINE_CODE,
               T.MAT_NO,
               T.PLINE_NAME,
               T.SOURE_NAME,
               T.JUDGE_STOVE_NO,
               T.BATCH_NO,
               T.PRO_ORDER_NO,
               T1.CUSTOMER_NM,
               T.PRODUCNAME,
               T.ACT_DIMATER,
               T.ACT_HEIGHT,
               T.STEELNAME,
               T.GRADENAME,
               T.MODEL_DESC,
               T.ACT_LEN_MIN || '-' || T.ACT_LEN_MAX LEN_RANG,
               T.STD_NAME,
               T.ACT_COUNT,
               T.ACT_WEIGHT,
               T.ACT_THEORY_WEIGHT,
               T.SCRAP_REASON,
               T2.STORAGE_NAME,
               T2.LOCATION_NAME,
               '在库' STATE
          FROM MAT_BC_M T,
               SLM_ORDER_HEAD T1,
               (select A.MAT_NO,
                       A.JUDGE_STOVE_NO,
                       A.STORAGE_NO,
                       B.STORAGE_NAME,
                       A.LOCATION_NO,
                       C.LOCATION_NAME
                  from YDM_BC_BUTTRESS A, YDM_BS_STORAGE B, YDM_BS_LOCATION C
                 WHERE A.STORAGE_NO = B.STORAGE_NO(+)
                   AND A.LOCATION_NO = C.LOCATION_NO(+)) T2
         WHERE T.QCM_STAUS = '22'
           AND T.ORDER_NO = T1.ORDER_NO(+)
           AND T.MAT_NO = T2.MAT_NO(+) #something#
        
        UNION ALL
        
        SELECT T.INSTOCK_TIME,
               T.PLINE_CODE,
               T.MAT_NO,
               T.PLINE_NAME,
               T.SOURE_NAME,
               T.JUDGE_STOVE_NO,
               T.BATCH_NO,
               T.PRO_ORDER_NO,
               T1.CUSTOMER_NM,
               T.PRODUCNAME,
               T.ACT_DIMATER,
               T.ACT_HEIGHT,
               T.STEELNAME,
               T.GRADENAME,
               T.MODEL_DESC,
               T.ACT_LEN_MIN || '-' || T.ACT_LEN_MAX LEN_RANG,
               T.STD_NAME,
               T.ACT_COUNT,
               T.ACT_WEIGHT,
               T.ACT_THEORY_WEIGHT,
               T.SCRAP_REASON,
               T2.STORAGE_NAME,
               T2.LOCATION_NAME,
               '出库' STATE
          FROM MAT_BC_BACKUP T,
               SLM_ORDER_HEAD T1,
               (select A.MAT_NO,
                       A.JUDGE_STOVE_NO,
                       A.STORAGE_NO,
                       B.STORAGE_NAME,
                       A.LOCATION_NO,
                       C.LOCATION_NAME
                  from YDM_BC_BUTTRESS A, YDM_BS_STORAGE B, YDM_BS_LOCATION C
                 WHERE A.STORAGE_NO = B.STORAGE_NO(+)
                   AND A.LOCATION_NO = C.LOCATION_NO(+)) T2
         WHERE T.QCM_STAUS = '22'
           AND T.ORDER_NO = T1.ORDER_NO(+)
           AND T.MAT_NO = T2.MAT_NO(+) #something#)
 ORDER BY INSTOCK_TIME, PLINE_CODE, JUDGE_STOVE_NO
          ]]>
	</query>
	
	<query id="FrmJgxReport.doQueryWasterAudit" desc="查询待审核废品">
        <![CDATA[
       SELECT T.INSTOCK_TIME,
               T.PLINE_CODE,
               T.PLINE_NAME,
               T.MAT_NO,
               T.SOURE_NAME,
               T.JUDGE_STOVE_NO,
               T.BATCH_NO,
               T.PRO_ORDER_NO,
               T1.CUSTOMER_NM,
               T.PRODUCNAME,
               T.ACT_DIMATER,
               T.ACT_HEIGHT,
               T.STEELNAME,
               T.GRADENAME,
               T.MODEL_DESC,
               T.ACT_LEN_MIN || '-' || T.ACT_LEN_MAX LEN_RANG,
               T.STD_NAME,
               T.ACT_COUNT,
               T.ACT_WEIGHT,
               T.SCRAP_REASON,
               T2.STORAGE_NAME,
               T2.LOCATION_NAME
          FROM MAT_BC_M T,
               SLM_ORDER_HEAD T1,
               (select A.MAT_NO,
                       A.JUDGE_STOVE_NO,
                       A.STORAGE_NO,
                       B.STORAGE_NAME,
                       A.LOCATION_NO,
                       C.LOCATION_NAME
                  from YDM_BC_BUTTRESS A, YDM_BS_STORAGE B, YDM_BS_LOCATION C
                 WHERE A.STORAGE_NO = B.STORAGE_NO(+)
                   AND A.LOCATION_NO = C.LOCATION_NO(+)) T2
         WHERE T.QCM_STAUS = '33'
           AND T.ORDER_NO = T1.ORDER_NO(+)
           AND T.MAT_NO = T2.MAT_NO(+) #something#
 ORDER BY INSTOCK_TIME, PLINE_CODE, JUDGE_STOVE_NO
          ]]>
	</query>

	<query id="FrmJgxReport.doQueryENTRUST" desc="查询包含探伤委托项目">
		<![CDATA[
   select judge_stove_no
  from HTT_ENTRUST t
 where subcontract_no in
       (select   distinct subcontract_no
          from HTT_ENTRUST_PROJECT
       where project_name like '%人工超声波探伤%')
          ]]>
	</query>
	<query id="FrmJgxReport.doQueryWasterAuditRecords" desc="查询废品审核记录">
        <![CDATA[
      select t.*  from HTT_FAIL_APPROVAL t WHERE 1=1
          ]]>
	</query>
	
	<query id="FrmJgxReport.doQueryWasterAuditRecordsByID" desc="根据废品审核单号查询废品审核记录">
        <![CDATA[
       SELECT *
  FROM (SELECT T.INSTOCK_TIME,
               T.PLINE_CODE,
               T.MAT_NO,
               T.PLINE_NAME,
               T.SOURE_NAME,
               T.JUDGE_STOVE_NO,
               T.BATCH_NO,
               T.PRO_ORDER_NO,
               T1.CUSTOMER_NM,
               T.PRODUCNAME,
               T.ACT_DIMATER,
               T.ACT_HEIGHT,
               T.STEELNAME,
               T.GRADENAME,
               T.MODEL_DESC,
               T.ACT_LEN_MIN || '-' || T.ACT_LEN_MAX LEN_RANG,
               T.STD_NAME,
               T.ACT_COUNT,
               T.ACT_WEIGHT,
               T.SCRAP_REASON,
               T2.STORAGE_NAME,
               T2.LOCATION_NAME,
               '在库' STATE
          FROM MAT_BC_M T,
               SLM_ORDER_HEAD T1,
               (select A.MAT_NO,
                       A.JUDGE_STOVE_NO,
                       A.STORAGE_NO,
                       B.STORAGE_NAME,
                       A.LOCATION_NO,
                       C.LOCATION_NAME
                  from YDM_BC_BUTTRESS A, YDM_BS_STORAGE B, YDM_BS_LOCATION C
                 WHERE A.STORAGE_NO = B.STORAGE_NO(+)
                   AND A.LOCATION_NO = C.LOCATION_NO(+)) T2
         WHERE T.QCM_STAUS = '22'
           AND T.ORDER_NO = T1.ORDER_NO(+)
           AND T.MAT_NO = T2.MAT_NO(+) #something#
        
        UNION ALL
        
        SELECT T.INSTOCK_TIME,
               T.PLINE_CODE,
               T.MAT_NO,
               T.PLINE_NAME,
               T.SOURE_NAME,
               T.JUDGE_STOVE_NO,
               T.BATCH_NO,
               T.PRO_ORDER_NO,
               T1.CUSTOMER_NM,
               T.PRODUCNAME,
               T.ACT_DIMATER,
               T.ACT_HEIGHT,
               T.STEELNAME,
               T.GRADENAME,
               T.MODEL_DESC,
               T.ACT_LEN_MIN || '-' || T.ACT_LEN_MAX LEN_RANG,
               T.STD_NAME,
               T.ACT_COUNT,
               T.ACT_WEIGHT,
               T.SCRAP_REASON,
               T2.STORAGE_NAME,
               T2.LOCATION_NAME,
               '出库' STATE
          FROM MAT_BC_BACKUP T,
               SLM_ORDER_HEAD T1,
               (select A.MAT_NO,
                       A.JUDGE_STOVE_NO,
                       A.STORAGE_NO,
                       B.STORAGE_NAME,
                       A.LOCATION_NO,
                       C.LOCATION_NAME
                  from YDM_BC_BUTTRESS A, YDM_BS_STORAGE B, YDM_BS_LOCATION C
                 WHERE A.STORAGE_NO = B.STORAGE_NO(+)
                   AND A.LOCATION_NO = C.LOCATION_NO(+)) T2
         WHERE T.QCM_STAUS = '22'
           AND T.ORDER_NO = T1.ORDER_NO(+)
           AND T.MAT_NO = T2.MAT_NO(+) #something#)
 ORDER BY INSTOCK_TIME, PLINE_CODE, JUDGE_STOVE_NO
          ]]>
	</query>
	
	<query id="FrmJgxReport.doAudit" desc="审核">
        <![CDATA[
      UPDATE MAT_BC_M T
   SET T.QCM_STAUS = '22', T.FAIL_APPROVAL_CODE = ?
 WHERE T.QCM_STAUS = '33'
   AND T.MAT_NO = ?
   AND T.PLINE_CODE = ?
          ]]>
	</query>
	
	<query id="FrmJgxReport.doCancelAudit" desc="取消审核">
        <![CDATA[
      UPDATE MAT_BC_M T
   SET T.QCM_STAUS = '33', T.FAIL_APPROVAL_CODE = ''
 WHERE T.QCM_STAUS = '22'
   AND T.MAT_NO = ?
   AND T.PLINE_CODE = ?
          ]]>
	</query>
	
	<query id="FrmJgxReport.updatePortSql" desc="修改队列表">
        <![CDATA[
      UPDATE #TABLE# T
   SET T.IS_FAIL_CHECK       = ?,
       T.BAL_YEAR_MONTH_FAIL = DECODE(?,
                                      '1',
                                      TO_CHAR(SYSDATE + 3 / 24, 'YYYYMM'),
                                      '0',
                                      '')
 WHERE (T.MAT_STATUS = '10' OR T.MAT_STATUS = '40')
   AND T.MAT_NO = ?
   AND T.PLINE_CODE = ?
          ]]>
	</query>
	
	<query id="FrmJgxReport.insertAuditRecordsSql" desc="新增废品审核记录">
        <![CDATA[
      INSERT INTO HTT_FAIL_APPROVAL(FAIL_APPROVAL_CODE,APPROVAL_NAME,APPROVAL_TIME,PLINE_CODE,PLINE_NAME) VALUES(?,?,SYSDATE,?,?)
          ]]>
	</query>
	
	<query id="FrmJgxReport.doQueryFailAppovalCode" desc="生成废品审核单号">
        <![CDATA[
      SELECT TO_CHAR(SYSDATE, 'YYYYMMDD') ||
       LPAD(NVL(MAX(SUBSTR(T.FAIL_APPROVAL_CODE, 9, 5)), 0) + 1, 5, 0) FAIL_APPROVAL_CODE
  FROM HTT_FAIL_APPROVAL T
 WHERE TRUNC(T.APPROVAL_TIME) = TRUNC(SYSDATE)
          ]]>
	</query>
	
	<query id="FrmJgxReport.doUpdateWasteRecords" desc="清理废品审核记录">
        <![CDATA[
      DECLARE
  V_FAIL_APPROVAL_CODE HTT_FAIL_APPROVAL.FAIL_APPROVAL_CODE%type := ?;
  V_ACT_COUNT          MAT_BC_M.ACT_COUNT%type := NULL;
BEGIN
  SELECT (SELECT COUNT(1)
            FROM MAT_BC_M T
           WHERE T.FAIL_APPROVAL_CODE = V_FAIL_APPROVAL_CODE) +
         (SELECT COUNT(1)
            FROM MAT_BC_BACKUP T
           WHERE T.FAIL_APPROVAL_CODE = V_FAIL_APPROVAL_CODE)
    INTO V_ACT_COUNT
    FROM DUAL;
  IF (V_ACT_COUNT = 0) THEN
    DELETE HTT_FAIL_APPROVAL
     WHERE FAIL_APPROVAL_CODE = V_FAIL_APPROVAL_CODE;
  END IF;
END;
          ]]>
	</query>


	<query id="FrmJgxReport.doQueryOffLine" desc="查询离线实绩">
		<![CDATA[
	 SELECT T.*,TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME, (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE=T.RETURN_PROCESS)  RETURN_PROCESS_NAME
  FROM MCH_OFFLINE_RESULT T
 WHERE 1=1
	  ]]>
	</query>

	<query id="FrmJgxReport.updateSource" desc="修改收料来源">
		<![CDATA[
	  UPDATE MCH_LOADING_RESULT T SET MAT_SOURCE = ? WHERE 1=1
	  ]]>
	</query>

	<query id="FrmJgxReport.ChangePline1" desc="修改收料来源">
		<![CDATA[
	  UPDATE PORT_MCH_BATCH_SAMPLE_RESULT SET PLINE_CODE = ?,PLINE_NAME = ? WHERE HEAT_PLAN_NO = ? AND BATCH_NO = ?
	  ]]>
	</query>


	<query id="FrmJgxReport.ChangePline2" desc="修改收料来源">
		<![CDATA[
	  UPDATE MCH_LOADING_RESULT SET  PLINE_CODE = ?,PLINE_NAME = ? WHERE HEAT_PLAN_NO = ? AND BATCH_NO = ?
	  ]]>
	</query>


	<query id="FrmJgxReport.ChangePlineFinalCheck" desc="修改入库检验产线">
		<![CDATA[
UPDATE MCH_FINAL_CHECK_RESULT
   SET PLINE_CODE = ?,
       PLINE_NAME =
       (SELECT PLINE_NAME FROM COM_BASE_PLINE WHERE PLINE_CODE = ?)
 WHERE RESULT_NO = ?
	  ]]>
	</query>

	<query id="FrmJgxReport.doQueryFinalCheck" desc="查询螺纹检验台帐">
		<![CDATA[
          SELECT T.*,
         TO_CHAR(T.PRO_TIME, 'YYYY-MM-DD HH24:MI:SS') PRO_TIME,
         DECODE((SELECT MAX(STATION_STATUS)
                  FROM MCH_COM_INFO
                 WHERE STATION_CODE = '701313'
                   AND HEAT_PLAN_NO = T.HEAT_PLAN_NO
                   AND BATCH_NO = T.BATCH_NO),
                2,
                '结炉',
                '未结炉') BESIDE_STATUS,
         M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
         M.STEELCODE,
         M.STEELNAME,
         M.GRADECODE,
         M.GRADENAME,
         M.PRODUCCODE,
         M.PRODUCNAME,
         M.MODEL_CODE,
         M.MODEL_DESC,
         M.OUTDIAMETER,
         M.WALLTHICK,
         M.OUTNUM_CUT
    FROM MCH_FINAL_CHECK_RESULT T, PLN_ZY_JGX_M M
   WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO

          ]]>
	</query>


	<query id="FrmJgxReport.doQueryUnLoadReport" desc="查询未上料报表">
		<![CDATA[
	  SELECT T.*,
       (SELECT SUM(PRO_NUM)
          FROM MCH_LOADING_RESULT
         WHERE HEAT_PLAN_NO = T.HEAT_PLAN_NO
           AND BATCH_NO = T.BATCH_NO
           AND BATCH_GROUD_NO = T.BATCH_GROUD_NO) PRO_COUNT,
       (SELECT SUM(PRO_WT)
          FROM MCH_LOADING_RESULT
         WHERE HEAT_PLAN_NO = T.HEAT_PLAN_NO
           AND BATCH_NO = T.BATCH_NO
           AND BATCH_GROUD_NO = T.BATCH_GROUD_NO) PRO_WEIGHT,
       NVL((SELECT SUM(M.ACT_COUNT)
             FROM MAT_BC_M M, YDM_BC_BUTTRESS B
            WHERE M.MAT_NO = B.MAT_NO
              AND M.HEAT_PLAN_NO_NEXT = T.HEAT_PLAN_NO
              AND M.PRODUCT_FLAG = '801401'
              AND M.MAT_STATUS = '80150103'
              AND (T.IF_MATCH_ODD = '5' OR
                  (NVL(M.BATCH_NO, '/') = NVL(T.BATCH_NO, '/') AND
                  NVL(M.BATCH_GROUD_NO, '/') = NVL(T.BATCH_GROUD_NO, '/')))),
           0) ACT_COUNT,
       NVL((SELECT SUM(M.ACT_WEIGHT)
             FROM MAT_BC_M M, YDM_BC_BUTTRESS B
            WHERE M.MAT_NO = B.MAT_NO
              AND M.HEAT_PLAN_NO_NEXT = T.HEAT_PLAN_NO
              AND M.PRODUCT_FLAG = '801401'
              AND M.MAT_STATUS = '80150103'
              AND (T.IF_MATCH_ODD = '5' OR
                  (NVL(M.BATCH_NO, '/') = NVL(T.BATCH_NO, '/') AND
                  NVL(M.BATCH_GROUD_NO, '/') = NVL(T.BATCH_GROUD_NO, '/')))),
           0) ACT_WEIGHT
  FROM (SELECT T.HEAT_PLAN_NO HEAT_PLAN_NO,
               MAX(T.ZY_BATCH_ID) ZY_BATCH_ID,
               MAX(T.STOVE_NO) STOVE_NO,
               MAX(T.JUDGE_STOVE_NO) JUDGE_STOVE_NO,
               T2.BATCH_NO,
               T2.BATCH_GROUD_NO,
               MAX(T.PLANSTATUS) PLANSTATUS,
               MAX(T2.PER_STATUS) PER_STATUS,
               MAX(T2.BESIDE_STATUS) BESIDE_STATUS,
               MAX(T.UPPER_HEATPLAN_ID) UPPER_HEATPLAN_ID,
               MAX(T.PRO_PLAN_ID) PRO_PLAN_ID,
               MAX(T.GX_PLAN_NO) GX_PLAN_NO,
               MAX(NVL(T2.PLINE_CODE_W, T2.PLINE_CODE)) PLINE_CODE,
               MAX(NVL(T2.PLINE_NAME_W, T2.PLINE_NAME)) PLINE_NAME,
               MAX(T.PROCESS_CODE_C) PROCESS_CODE_C,
               MAX(T.PROCESS_DESC_C) PROCESS_DESC_C,
               MAX(T.UPPER_PROCESS_CODE) UPPER_PROCESS_CODE,
               MAX(T.NEXT_PROCESS_CODE) NEXT_PROCESS_CODE,
               MAX(T.GOWHERE_CODE) GOWHERE_CODE,
               MAX(T.GOWHERE_NAME) GOWHERE_NAME,
               MAX(T.PROD_STANDARD) PROD_STANDARD,
               MAX(T.OUTPUT_STANDARD) OUTPUT_STANDARD,
               MAX(T.ISENDGX) ISENDGX,
               MAX(T.IF_MATCH_ODD) IF_MATCH_ODD,
               MAX(T.IF_DO_HEAT_PLAN) IF_DO_HEAT_PLAN,
               MAX(T.ORDER_SOURCE) ORDER_SOURCE,
               MAX(T.ORD_LN_DLY_PK) ORD_LN_DLY_PK,
               MAX(T.ORDER_NO) ORDER_NO,
               MAX(T.ORDER_SEQ) ORDER_SEQ,
               MAX(T.DELIVERY_NO) DELIVERY_NO,
               MAX(T.REQ_BL_ID) REQ_BL_ID,
               MAX(T.IF_EXPORT) IF_EXPORT,
               MAX(T.PRIORITY) PRIORITY,
               MAX(T.PRIORITY_MEMO) PRIORITY_MEMO,
               MAX(T.PRO_MONTH) PRO_MONTH,
               MAX(T.PRO_DAY) PRO_DAY,
               MAX(T.BAL_YEAR_MONTH) BAL_YEAR_MONTH,
               MAX(T.IF_MONITOR) IF_MONITOR,
               MAX(T.PRDCR_NO) PRDCR_NO,
               MAX(T.MONITOR_POINT) MONITOR_POINT,
               MAX(T.MONITOR_MENT) MONITOR_MENT,
               MAX(T.MONITOR_MAN) MONITOR_MAN,
               MAX(T.BOM) BOM,
               MAX(T.WHOLE_BACKLOG) WHOLE_BACKLOG,
               MAX(T.WHOLE_BACKLOG_DESC) WHOLE_BACKLOG_DESC,
               MAX(T.STATION_ROAD) STATION_ROAD,
               MAX(T.CIC) CIC,
               MAX(T.PIC) PIC,
               MAX(T.SIC) SIC,
               MAX(T.DIC) DIC,
               MAX(T.WIC) WIC,
               MAX(T.GIC) GIC,
               MAX(T.CRAFT_FILE_NO) CRAFT_FILE_NO,
               MAX(T.CRAFT_SEQ) CRAFT_SEQ,
               MAX(T.CRAFT_FILE_MAN) CRAFT_FILE_MAN,
               MAX(T.SEC_CRAFT_FILE_NO) SEC_CRAFT_FILE_NO,
               MAX(T.INWL_ID) INWL_ID,
               MAX(T.INWL_DESC) INWL_DESC,
               MAX(T.OUTWL_ID) OUTWL_ID,
               MAX(T.OUTWL_DESC) OUTWL_DESC,
               MAX(T.STEELCODE) STEELCODE,
               MAX(T.STEELNAME) STEELNAME,
               MAX(T.GRADECODE) GRADECODE,
               MAX(T.GRADENAME) GRADENAME,
               MAX(T.PRODUCCODE) PRODUCCODE,
               MAX(T.PRODUCNAME) PRODUCNAME,
               MAX(T.MODEL_CODE) MODEL_CODE,
               MAX(T.MODEL_DESC) MODEL_DESC,
               MAX(T.OUTDIAMETER) OUTDIAMETER,
               MAX(T.WALLTHICK) WALLTHICK,
               MAX(T.LENGTHMIN) LENGTHMIN,
               MAX(T.LENGTHMAX) LENGTHMAX,
               MAX(T.OUTDIAMETER_IN) OUTDIAMETER_IN,
               MAX(T.WALLTHICK_IN) WALLTHICK_IN,
               MAX(T.OUTNUM_CUT) OUTNUM_CUT,
               MAX(T.LENGTH_IN) LENGTH_IN,
               MAX(T.LENGTHMAX_IN) LENGTHMAX_IN,
               MAX(T.LENGTHMIN_IN) LENGTHMIN_IN,
               MAX(T.PLN_INSINGLE_NUM) PLN_INSINGLE_NUM,
               MAX(T.PLN_INSINGLE_WT) PLN_INSINGLE_WT,
               MAX(T.PLN_INDOUBLE_NUM) PLN_INDOUBLE_NUM,
               MAX(T.PLN_INDOUBLE_WT) PLN_INDOUBLE_WT,
               MAX(T.PLN_OUTSINGLE_NUM) PLN_OUTSINGLE_NUM,
               MAX(T.PLN_OUTSINGLE_W) PLN_OUTSINGLE_W,
               MAX(T.PLN_OUTDOUBLE_NUM) PLN_OUTDOUBLE_NUM,
               MAX(T.PLN_OUTDOUBLE_W) PLN_OUTDOUBLE_W,
               MAX(T.CREATE_NAME) CREATE_NAME,
               MAX(T.CREATE_TIME) CREATE_TIME,
               MAX(T.UPDATE_NAME) UPDATE_NAME,
               MAX(T.UPDATE_TIME) UPDATE_TIME,
               MAX(T.DOWNMAN) DOWNMAN,
               MAX(T.DOWNTIME) DOWNTIME,
               MAX(T.INDEX_SEQ) INDEX_SEQ,
               MAX(T.GX_PRO_SEQ) GX_PRO_SEQ,
               MAX(T.SPEC_CODE) SPEC_CODE,
               MAX(T.SPEC_NAME) SPEC_NAME,
               MAX(T.STD_CODE) STD_CODE,
               MAX(T.STD_NAME) STD_NAME,
               MAX(T.STD_STYLE) STD_STYLE,
               MAX(T.STD_STYLE_DESC) STD_STYLE_DESC,
               MAX(T.DECISION) DECISION,
               MAX(T.FEED_HEAT_NO) FEED_HEAT_NO,
               MAX(T.FLAG_STOVE_NO) FLAG_STOVE_NO,
               MAX(T.MEMO) MEMO,
               MAX(T.ZY_BATCH_ID_ZG) ZY_BATCH_ID_ZG,
               MAX(T.HEAT_PLAN_NO_OLD) HEAT_PLAN_NO_OLD,
               MAX(T.IF_PRODUCT) IF_PRODUCT,
                MAX(T2.PLAN_INDOUBLE_NUM) PLAN_INDOUBLE_NUM,
                 MAX(T2.PLAN_INDOUBLE_WT) PLAN_INDOUBLE_WT,
               MAX(T2.REAL_INDOUBLE_NUM) REAL_INDOUBLE_NUM,
                  MAX(T2.REAL_INDOUBLE_WT) REAL_INDOUBLE_WT
          FROM PLN_ZY_JGX_M T, PLN_ZY_JGX_C T2
         WHERE T.HEAT_PLAN_NO = T2.HEAT_PLAN_NO
              AND T2.PLAN_INDOUBLE_NUM > T2.REAL_INDOUBLE_NUM
              #CONDITION#
         GROUP BY T.HEAT_PLAN_NO, T2.BATCH_NO, T2.BATCH_GROUD_NO) T
 ORDER BY PLINE_CODE, JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO ASC
	  ]]>
	</query>



	<query id="FrmJgxReport.ChangeRtdPline" desc="更新测量点明显数据">
		<![CDATA[
        UPDATE RTD_MEASURE_POSDATA
   SET PLINE_CODE = ?,
       PLINE_NAME =
       (SELECT PLINE_NAME FROM COM_BASE_PLINE WHERE PLINE_CODE = ?)
 WHERE 1 = 1

          ]]>
	</query>



	<query id="FrmJgxReport.doQueryMchWaste" desc="">
		<![CDATA[
    SELECT T.*,
        M.ORDER_NO || '/' || M.ORDER_SEQ ORDER_NO,
        M.STEELCODE,
        M.STEELNAME,
        M.GRADECODE,
        M.GRADENAME,
        M.PRODUCCODE,
        M.PRODUCNAME,
        M.MODEL_CODE,
        M.MODEL_DESC,
        M.OUTDIAMETER,
        M.WALLTHICK,
        M.OUTNUM_CUT
   FROM (SELECT HEAT_PLAN_NO,
                BAL_YEAR_MONTH_FAIL,
                POINT,
                REASON,
                JUDGE_STOVE_NO,
                PHY_BATCH_NO,
                PLINE_CODE,
                PLINE_NAME,
                COUNT(1) ACT_COUNT,
                SUM(ACT_WEIGHT) ACT_WEIGHT

           FROM (SELECT T.HEAT_PLAN_NO,
                        T.BAL_YEAR_MONTH_FAIL,
                        I.BASENAME            POINT,
                        D.FAIL_TYPE_NAME      REASON,
                        T.ACT_WEIGHT,
                        T.JUDGE_STOVE_NO,
                        T.PHY_BATCH_NO,
                        T.PLINE_CODE,
                        T.PLINE_NAME
                   FROM PORT_MCH_BATCH_SAMPLE_RESULT T
                   LEFT JOIN COM_BASE_INFO I
                     ON T.OP_PROCESS = I.BASECODE
                   LEFT JOIN (SELECT T1.RESULT_NO,
                                    T1.FAIL_TYPE_NAME,
                                    T1.CREATTIME,
                                    T2.MAT_NO
                               FROM MCH_BUG_D T1, MCH_WASTE_MAT_NO T2
                              WHERE T1.FAIL_BILL = T2.FAIL_BILL
                                AND T1.FAIL_BILL_SQE = T2.FAIL_BILL_SQE
                                AND T1.FAIL_SORT = '10') D
                     ON T.RESULT_NO = D.RESULT_NO
                    AND D.MAT_NO = T.MAT_NO
                  WHERE T.MAT_STATUS = '10'
                    AND T.BAL_YEAR_MONTH_FAIL IS NOT NULL
                 UNION ALL
                 SELECT T.HEAT_PLAN_NO,
                        T.BAL_YEAR_MONTH_FAIL,
                        '[委托]' || D.PROJECT_NAME,
                        D.FAIL_TYPE_NAME,
                        T.ACT_WEIGHT,
                        T.JUDGE_STOVE_NO,
                        T.PHY_BATCH_NO,
                        T.PLINE_CODE,
                        T.PLINE_NAME
                   FROM PORT_MCH_BATCH_SAMPLE_RESULT T
                   LEFT JOIN (SELECT E1.RESULT_NO,
                                    T1.FAIL_TYPE_NAME,
                                    T1.CREATTIME,
                                    T2.MAT_NO,
                                    E2.PROJECT_NAME
                               FROM MCH_BUG_D          T1,
                                    MCH_WASTE_MAT_NO   T2,
                                    HTT_ENTRUST        E1,
                                    HTT_ENTRUST_RESULT E2
                              WHERE T1.FAIL_BILL = T2.FAIL_BILL
                                AND T1.FAIL_BILL_SQE = T2.FAIL_BILL_SQE
                                AND T1.FAIL_SORT = '10'
                                AND T1.RESULT_NO = E2.RESULT_NO
                                AND E1.SUBCONTRACT_NO = E2.SUBCONTRACT_NO
                                AND E2.SUBCONTRACT_NO_SEQ =
                                    E2.SUBCONTRACT_NO_SEQ) D
                     ON T.RESULT_NO = D.RESULT_NO
                    AND D.MAT_NO = T.MAT_NO
                  WHERE T.MAT_STATUS = '40'
                    AND T.BAL_YEAR_MONTH_FAIL IS NOT NULL)
          GROUP BY HEAT_PLAN_NO,
                   BAL_YEAR_MONTH_FAIL,
                   POINT,
                   REASON,
                   JUDGE_STOVE_NO,
                   PHY_BATCH_NO,
                   PLINE_CODE,
                   PLINE_NAME) T
   LEFT JOIN PLN_ZY_JGX_M M
     ON T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
  WHERE 1 = 1


          ]]>
	</query>

</queryMap>