<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="探伤实际操作">
	<query id="FrmEddyCurrentTestingResult.ETResultQuery" desc="探伤实际简单查询">
		
        <![CDATA[
      SELECT t.DETECTION_NUM1,
       t.DETECTION_NUM2,
       t.DETECTION_NUM3,
       t.SUSPECT_PRODUCT_NUM1,
       t.SUSPECT_PRODUCT_NUM2,
       t.SUSPECT_PRODUCT_NUM3,
       t.SCRAP_NUM1,
       t.QUALIFIED_NUM1,
       t.REINSPECTION_NUM1,
       t.REINSPECTION_QUALIFIED_NUM1,
       t.SCRAP_NUM2,
       t.QUALIFIED_NUM2,
       t.REINSPECTION_NUM2,
       t.REINSPECTION_QUALIFIED_NUM2,
       t.SCRAP_NUM3,
       t.QUALIFIED_NUM3,
       t.REINSPECTION_NUM3,
       t.REINSPECTION_QUALIFIED_NUM3,
       t.PRODUCT_STANDARDS,
       t.INSPECTION_STANDARD,
       t.TESTING_METHOD,
       t.CALIBRATION_METHOD,
       t.ARTIFICIAL_DEFECT_SHAPE,
       t.EXCITATION_FREQUENCY1,
       t.EXCITATION_FREQUENCY2,
       t.EXCITATION_FREQUENCY3,
       t.TESTING_SPEED1,
       t.TESTING_SPEED2,
       t.TESTING_SPEED3,
       t.DETECTION_NUM,
       t.SUSPECT_PRODUCT_NUM,
       t.SUSPICIOUS_REASON,
       t.REINSPECTION_NUM,
       t.REINSPECTION_QUALIFIED_NUM,
       t.SCRAP_NUM,
       t.SCRAP_REASON,
       t.QUALIFIED_NUM,
       t.USERID,
       t.SIGNID,
       t.COL_USER,
       t.COL_SHIFT,
       t.COL_GROUP,
       t.NODE_FUR_FLAG,
       t.NODE_FUR_FLAG1,
       t.NODE_FUR_FLAG2,
       t.NODE_FUR_FLAG3,
       TO_CHAR(t.START_TIME, 'YYYY-MM-DD HH24:MI:SS') START_TIME,
       t.INSPECTIONED_OFFLINE_NUM,
       t.SAMPLE_NUM,
       t.REMARK,
       t.PLINE_CODE,
       t.JUDGE_STOVE_NO,
       t.LOT_NO,
       t.RESULT_NO,
       T.USERID1,
       T.USERID2,
       t.USERID_GRADE1,
       t.USERID_GRADE2,
       T.USERID1JD,
       T.USERID2JD,
        t.USERID_GRADE1JD,
      t.USERID_GRADE2JD,
       t.ACCEPTANCE_GRADE,
       t.SAMPLE_NEWS,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.NOTCH_INFO,
       T.NOTCH_LENGTH,
       T.NOTCH_WIDTH,
       T.NOTCH_DEPTH
  FROM MIL_ET_RESULT t
 WHERE 1 = 1
   AND t.judge_stove_no = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
--AND T.COL_SHIFT = ?
--AND T.COL_GROUP = ?
        ]]>
	</query>
	<query id="FrmEddyCurrentTestingResult.GetMTResult" desc="查询MT探伤实绩">
	 SELECT T.DETECTION_NUM1,
       T.DETECTION_NUM2,
       T.SUSPECT_PRODUCT_NUM1,
       T.SUSPECT_PRODUCT_NUM2,
       T.NODE_FUR_FLAG1,
       T.NODE_FUR_FLAG2,
       T.SCRAP_NUM2,
       T.QUALIFIED_NUM2,
       T.REINSPECTION_NUM2,
       T.REINSPECTION_QUALIFIED_NUM2,
       T.SCRAP_NUM1,
       T.QUALIFIED_NUM1,
       T.REINSPECTION_NUM1,
       T.REINSPECTION_QUALIFIED_NUM1,
       T.PRODUCT_STANDARDS,
       T.LO_SURFACE,
       T.LI_SURFACE,
       T.TO_SURFACE,
       T.TI_SURFACE,
       T.GROOVE_SHAPE,
       T.INSPECTION_STANDARD,
       T.LONGITUDINAL_CURRENT1,
       T.TRANSVERSE_CURRENT1,
       T.LONGITUDINAL_CURRENT2,
       T.TRANSVERSE_CURRENT2,
       T.SPEED1,
       T.SPEED2,
       T.DETECTION_SPEED1,
       T.DETECTION_SPEED2,
       T.DETECTION_NUM,
       T.ALARM_NUM,
       T.REINSPECTION_NUM,
       T.REINSPECTION_QUALIFIED_NUM,
       T.SCRAP_NUM,
       T.QUALIFIED_NUM,
       T.SIGNID,
       TO_CHAR(T.START_TIME, 'YYYY-MM-DD HH24:MI:SS') START_TIME,
       TO_CHAR(T.END_TIME, 'YYYY-MM-DD HH24:MI:SS') END_TIME,
       T.EXECUTIVE_PRODUCER,
       TO_CHAR(T.PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       T.REMARK,
       T.REMARK1,
       T.NODE_FUR_FLAG,
       T.PLINE_CODE,
       T.JUDGE_STOVE_NO,
       T.LOT_NO,
       T.RESULT_NO,
       T.INSPECTIONED_OFFLINE_NUM,
       T.SAMPLE_NUM,
       --(SELECT T1.USER_NAME FROM MIL_SIGNATURE T1 WHERE T1.USER_ID = T.USERID1) USERID1,
       --(SELECT T1.USER_NAME FROM MIL_SIGNATURE T1 WHERE T1.USER_ID = T.USERID2) USERID2,
       t.USERID1,
       t.USERID2,
       T.USERID_GRADE1,
       T.USERID_GRADE2,
        t.USERID1jd,
        t.USERID2jd,
        T.USERID_GRADE1jd,
        T.USERID_GRADE2jd,
       T.STANDARDS_NO,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.NOTCH_INFO,
       T.NOTCH_LENGTH,
       T.NOTCH_WIDTH,
       T.NOTCH_DEPTH,
       T.COVERAGE
  FROM MIL_MT_RESULT T
 WHERE 1 = 1
   AND T.judge_stove_no = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
--AND COL_SHIFT = ?
-- AND COL_GROUP = ?
	</query>
	<query id="FrmEddyCurrentTestingResult.GetUTResult" desc ="查询UT探伤实绩">
	 SELECT 
	   DETECTION_NUM1,
       DETECTION_NUM2,
       SUSPECT_PRODUCT_NUM1,
       SUSPECT_PRODUCT_NUM2,
	   NODE_FUR_FLAG1,
       NODE_FUR_FLAG2,
	   SCRAP_NUM2,
       QUALIFIED_NUM2,
       REINSPECTION_NUM2,
       REINSPECTION_QUALIFIED_NUM2,
       SCRAP_NUM1,
       QUALIFIED_NUM1,
       REINSPECTION_NUM1,
       REINSPECTION_QUALIFIED_NUM1,
       SIGNID,
       TO_CHAR(START_TIME, 'YYYY-MM-DD HH24:MI:SS') START_TIME,
       TO_CHAR(END_TIME, 'YYYY-MM-DD HH24:MI:SS') END_TIME,
       EXECUTIVE_PRODUCER,
       TO_CHAR(PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       REMARK,
       PRODUCT_STANDARDS,
       INSTRUMENT_TYPE,
       PROBE_TYPE,
       SENSTIVITY,
       INHIBITION,
       COUPLING_AGENT,
       SURFACE_APPEARANCE,
       LO_SURFACE,
       LI_SURFACE,
       TO_SURFACE,
       TI_SURFACE,
       DETECTION_NUM,
       ALARM_NUM,
       REINSPECTION_NUM,
       REINSPECTION_QUALIFIED_NUM,
       SCRAP_NUM,
       QUALIFIED_NUM,
       NODE_FUR_FLAG
       FROM MIL_UL_RESUL
       WHERE
       1=1
       AND judge_stove_no=?
       AND NVL(PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(GX_PLAN_NO, '/') = NVL(?, '/')
	</query>
<query id = "EddyCurrentTestingResult.getRollCard168" desc = "查询168流通卡信息">
<![CDATA[
      	SELECT A.AFTER_SCRAP_NUM AS SCRAP_DBFEED,
      	A.BEFORE_SCRAP_NUM AS SCRAP_FEED,
      	A.FEED_NUM AS QUALIFIED_FEED,
        A.CUT_NUM AS QUALIFIED_DBFEED,
        B.SCRAP_NUM AS SCRAP_FUR,
        B.OUT_FUR_NUM AS QUALIFIED_FUR,
        C.SCRAP_NUM AS SCRAP_PER,
        C.PERFORATION_NUM AS QUALIFIED_PER,
        D.SCRAP_NUM AS SCRAP_ROLLING,
        D.QUALIFIED_NUM AS QUALIFIED_ROLLING,
        E.SCRAP_NUM AS SCRAP_REFUR,
        E.OUT_FUR_NUM AS QUALIFIED_REFUR,
        G.SCRAP_NUM AS SCRAP_SIZING,
        G.PRODUCT_NUM AS QUALIFIED_SIZING,
        H.SCRAP_NUM AS SCRAP_SAW_BE,
        H.CUT_NUM AS QUALIFIED_SAW_BE,
        H.SCRAP_DBNUM AS SCRAP_SAW,
        H.CUT_DBNUM AS QUALIFIED_SAW,
        I.SCRAP_NUM AS SCRAP_STRAIGHT,
        I.Qualified_Num AS QUALIFIED_STRAIGHT,
        I.OFFLINE_NUM_TOTAL AS OFFLINE_STRAIGHT,
                I.BACKLINE_NUM_TOTAL AS BACKLINE_STRAIGHT,
        --COALESCE(K.SCRAP_NUM,0) AS SCRAP_TESTING,
        --COALESCE(K.QUALIFIED_NUM,0) AS QUALIFIED_TESTING,
        --COALESCE(K.OFFLINE_NUM,0)   AS OFFLINE_TESTING,
        --COALESCE(K.BACKLINE_NUM,0 ) AS BACKLINE_TESTING
        J.SCRAP_NUM AS SCRAP_TESTING,
        J.QUALIFIED_NUM AS QUALIFIED_TESTING,
        J.OFFLINE_NUM   AS OFFLINE_TESTING,
        J.BACKLINE_NUM AS BACKLINE_TESTING,
         M.QUALIFIED_BRANCH AS QUALIFIED_BRANCH,
        M.OFFLINE_QUANTITY AS OFFLINE_QUANTITY,
        M.WASTE_QUANTITY AS WASTE_QUANTITY
        FROM MIL_FEEDSAW_RESULT A 
        , MIL_FUR_RESULT B 
        , MIL_PERFORATION_RESULT C
        , MIL_ROLLING_RESULT D
        , MIL_REFUR_RESULT E
        , MIL_SIZING_RESULT G
        , MIL_SAW_RESULT H
        , MIL_STRAIGHTENING_RESULT I
        , MIL_ET_RESULT J
        --, MIL_MT_RESULT K
        --, MIL_UL_RESUL L
         ,mil_surface_result M
        WHERE A.JUDGE_STOVE_NO = B.JUDGE_STOVE_NO (+)
        AND A.JUDGE_STOVE_NO = C.JUDGE_STOVE_NO (+)
        AND A.JUDGE_STOVE_NO = D.JUDGE_STOVE_NO (+)
        AND A.JUDGE_STOVE_NO = E.JUDGE_STOVE_NO (+)
        AND A.JUDGE_STOVE_NO = G.JUDGE_STOVE_NO (+)
        AND A.JUDGE_STOVE_NO = H.JUDGE_STOVE_NO (+)
        AND A.JUDGE_STOVE_NO = I.JUDGE_STOVE_NO (+)
        AND A.JUDGE_STOVE_NO = M.JUDGE_STOVE_NO (+)
        --AND I.JUDGE_STOVE_NO = K.JUDGE_STOVE_NO (+)
        AND A.JUDGE_STOVE_NO = J.JUDGE_STOVE_NO (+)
        --AND K.JUDGE_STOVE_NO = L.JUDGE_STOVE_NO (+)
        AND A.JUDGE_STOVE_NO = ?
        AND NVL(A.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(A.GX_PLAN_NO, '/') = NVL(?, '/')   
        ]]>
</query>
<query id = "EddyCurrentTestingResult.getRollCard168BackLine" desc = "返线流通卡">
SELECT 
        I.SCRAP_NUM AS SCRAP_STRAIGHT,
        I.Qualified_Num AS QUALIFIED_STRAIGHT,
        I.OFFLINE_NUM_TOTAL AS OFFLINE_STRAIGHT,
        I.BACKLINE_NUM_TOTAL AS BACKLINE_STRAIGHT,
        
        J.SCRAP_NUM AS SCRAP_TESTING,
        J.QUALIFIED_NUM AS QUALIFIED_TESTING,
        J.OFFLINE_NUM   AS OFFLINE_TESTING,
        J.BACKLINE_NUM AS BACKLINE_TESTING,
        M.QUALIFIED_BRANCH AS QUALIFIED_BRANCH,
        M.OFFLINE_QUANTITY AS OFFLINE_QUANTITY,
        M.WASTE_QUANTITY AS WASTE_QUANTITY
        FROM MIL_STRAIGHTENING_RESULT I
        , MIL_ET_RESULT J
        , MIL_SURFACE_RESULT M
        WHERE I.JUDGE_STOVE_NO = J.JUDGE_STOVE_NO (+)
        AND I.JUDGE_STOVE_NO = M.JUDGE_STOVE_NO (+)
        AND I.JUDGE_STOVE_NO = ?  
        AND NVL(I.PRO_PLAN_ID, '/') = NVL(?, '/')
        AND NVL(I.GX_PLAN_NO, '/') = NVL(?, '/')   
</query>
	<query id="FrmEddyCurrentTestingResult.UpdateMilPlanStatus" desc="更新主表Status">
	 <![CDATA[ 
	 update MIL_PLAN t set t.STATUS ='#STATUS#'
        where t.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#' 
        AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
        AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         ]]>
	</query>
	
	<query id="FrmEddyCurrentTestingResult.getTestingPosition" desc="取探伤位置">
	 <![CDATA[ 
SELECT NVL(DECODE(MAX(D.POSITION_DESC), '管端', '1', '全长', '2', '0'), '0') TESTING_POSITION
  FROM MIL_PLAN T, CRAFT_ORD_DESIGN_STD_DIC D, CRAFT_ORD_DESIGN C
 WHERE C.DESGIN_KEY = D.DESGIN_KEY
   AND T.INDEX_SEQ = D.MSC_PLINE
   and D.PROCESS_CODE = 'D'
   AND C.VALIDFLAG = '1'
   AND D.SPECL_FL = '2'
      --AND D.PHY_CODE = 'P0044'
   AND SUBSTR(T.ORD_LN_DLY_PK, 1, 35) = C.ORD_LN_PK
   AND T.ID = ?
         ]]>
	</query>

	<query id="FrmEddyCurrentTestingResult.InsertETResult" desc="插入ET实绩">
	 <![CDATA[
      insert into Mil_Et_Result
  (RESULT_NO,
   LOT_NO,
   STOVE_NO,
   JUDGE_STOVE_NO,
   PLINE_CODE,
   START_TIME,
   COL_MODE,
   COL_USER,
   COL_SHIFT,
   COL_GROUP,
   PRODUCT_STANDARDS,
   INSPECTION_STANDARD,
   TESTING_METHOD,
   CALIBRATION_METHOD,
   USERID,
   SIGNID,
   ARTIFICIAL_DEFECT_SHAPE,
   EXCITATION_FREQUENCY1,
   EXCITATION_FREQUENCY2,
   EXCITATION_FREQUENCY3,
   TESTING_SPEED1,
   TESTING_SPEED2,
   TESTING_SPEED3,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   TESTING_POSITION)

values
  ('#RESULT_NO#',
   '#LOT_NO#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#PLINE_CODE#',
   SYSDATE,
   '#COL_MODE#',
   '#COL_USER#',
   '#COL_SHIFT#',
   '#COL_GROUP#',
   
   '#PRODUCT_STANDARDS#',
   '#INSPECTION_STANDARD#',
   '#TESTING_METHOD#',
   '#CALIBRATION_METHOD#',
   '#USERID#',
   '#SIGNID#',
   '#ARTIFICIAL_DEFECT_SHAPE#',
   '#EXCITATION_FREQUENCY1#',
   '#EXCITATION_FREQUENCY2#',
   '#EXCITATION_FREQUENCY3#',
   '#TESTING_SPEED1#',
   '#TESTING_SPEED2#',
   '#TESTING_SPEED3#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#TESTING_POSITION#')
     ]]>
	</query>
	<query id="FrmEddyCurrentTestingResult.InsertMTResult" desc="插入MT实绩">
	 INSERT INTO MIL_MT_RESULT
  (RESULT_NO,
   LOT_NO,
   STOVE_NO,
   JUDGE_STOVE_NO,
   PLINE_CODE,
   PRODUCT_STANDARDS,
   LO_SURFACE,
   LI_SURFACE,
   TO_SURFACE,
   TI_SURFACE,
   GROOVE_SHAPE,
   INSPECTION_STANDARD,
   LONGITUDINAL_CURRENT1,
   TRANSVERSE_CURRENT1,
   LONGITUDINAL_CURRENT2,
   TRANSVERSE_CURRENT2,
   SPEED1,
   SPEED2,
   DETECTION_SPEED1,
   DETECTION_SPEED2,
   SIGNID,
   START_TIME,
   EXECUTIVE_PRODUCER,
   PRODUCER_TIME,
   COL_MODE,
   COL_TIME,
   COL_USER,
   COL_SHIFT,
   COL_GROUP,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   TESTING_POSITION)
VALUES
  ('#RESULT_NO#',
   '#LOT_NO#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#PLINE_CODE#',
   '#PRODUCT_STANDARDS#',
   '#LO_SURFACE#',
   '#LI_SURFACE#',
   '#TO_SURFACE#',
   '#TI_SURFACE#',
   '#GROOVE_SHAPE#',
   '#INSPECTION_STANDARD#',
   '#LONGITUDINAL_CURRENT1#',
   '#TRANSVERSE_CURRENT1#',
   '#LONGITUDINAL_CURRENT2#',
   '#TRANSVERSE_CURRENT2#',
   '#SPEED1#',
   '#SPEED2#',
   '#DETECTION_SPEED1#',
   '#DETECTION_SPEED2#',
   '#SIGNID#',
   SYSDATE,
   '#EXECUTIVE_PRODUCER#',
   SYSDATE,
   '#COL_MODE#',
   SYSDATE,
   '#COL_USER#',
   '#COL_SHIFT#',
   '#COL_GROUP#',
   '#PRO_PLAN_ID#',
   '#GX_PLAN_NO#',
   '#TESTING_POSITION#')
	</query>
	
	<query id="FrmEddyCurrentTestingResult.InsertUTResult" desc="插入UT实绩">
	INSERT INTO MIL_UL_RESUL(
	RESULT_NO,
        SIGNID,
        START_TIME,
        EXECUTIVE_PRODUCER,
        PRODUCER_TIME,
        COL_MODE,
        COL_TIME,
        COL_USER,
        COL_SHIFT,
        COL_GROUP,
        
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        PLINE_CODE,
        PRODUCT_STANDARDS,
        INSTRUMENT_TYPE,
        PROBE_TYPE,
        SENSTIVITY,
        INHIBITION,
        COUPLING_AGENT,
        SURFACE_APPEARANCE,
        LO_SURFACE,
        LI_SURFACE,
        TO_SURFACE,
        TI_SURFACE,
    PRO_PLAN_ID,
    GX_PLAN_NO)
 VALUES( 
 		'#RESULT_NO#',
        '#SIGNID#',
        SYSDATE,
        '#EXECUTIVE_PRODUCER#',
        SYSDATE,
        '#COL_MODE#',
        SYSDATE,
        '#COL_USER#',
        '#COL_SHIFT#',
        '#COL_GROUP#',
        
        '#LOT_NO#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#PLINE_CODE#',
        '#PRODUCT_STANDARDS#',
        '#INSTRUMENT_TYPE#',
        '#PROBE_TYPE#',
        '#SENSTIVITY#',
        '#INHIBITION#',
        '#COUPLING_AGENT#',
        '#SURFACE_APPEARANCE#',
        '#LO_SURFACE#',
        '#LI_SURFACE#',
        '#TO_SURFACE#',
        '#TI_SURFACE#',
    '#PRO_PLAN_ID#',
    '#GX_PLAN_NO#')
	</query>

	<query id="FrmEddyCurrentTestingResult.TestingRackQuery" desc="查询探伤跟踪记录">
	<![CDATA[
		SELECT
		MAT_NO,
		LOT_NO,
		STOVE_NO,
		JUDGE_STOVE_NO,
		STEELCODE,
		STEELNAME,
		GRADECODE,
		GRADENAME,
		PLINE_CODE,
		CASE STATUS
		WHEN '0' THEN '正常轧制'
		WHEN '1'
		THEN '判废'
		WHEN '2' THEN '报警'
		END AS STATUS,
		ALARM_REASON,
		SCRAP_REASON,
		TO_CHAR(START_INSPECTION_TIME,
		'YYYY-MM-DD HH24:MI:SS') START_INSPECTION_TIME,
		TO_CHAR(END_INSPECTION_TIME, 'YYYY-MM-DD HH24:MI:SS')
		END_INSPECTION_TIME,
		CASE OFFLINE_FLAG
		WHEN '0' THEN '未下线'
		WHEN '1' THEN '下线'
		WHEN '2' THEN '返线'
		End AS OFFLINE_FLAG,
		TO_CHAR(OFFLINE_TIME, 'YYYY-MM-DD HH24:MI:SS')
		OFFLINE_TIME,
		CASE FOLLOW_FLAG
		WHEN '0' THEN '未跟队'
		WHEN '1' THEN '跟队'
		END
		AS FOLLOW_FLAG,
		
		CASE GROUP_FLAG
		WHEN '0' THEN '未组炉'
		WHEN '1'
		THEN '组炉'
		END AS GROUP_FLAG,
		REMARK,
		SEQ,
		RETEST_NUM,
		  case COL_SHIFT 
       WHEN '0' THEN '常白班'
       WHEN '1' THEN '早班'
       WHEN '2' THEN '中班'
       WHEN '3' THEN '晚班' end as COL_SHIFT,
       case COL_GROUP
       WHEN '1' THEN '甲'
       WHEN '2' THEN '乙'
       WHEN '3' THEN '丙'
       WHEN '4' THEN '丁'  end as COL_GROUP,
       case SUSPECT_FLAG
       WHEN '0' THEN '正常轧制'
       WHEN '1' THEN '可疑'
       END AS SUSPECT_FLAG,
       case RECUT_FLAG
       WHEN '0' THEN '不再切'
       WHEN '1' THEN '再切'
       END AS RECUT_FLAG,
       RECUT_LENGTH,
       CASE CHANGE_FLAG
        WHEN '0' THEN ''
       WHEN '1' THEN '确认交班'
       WHEN '2' THEN '待接班确认'
         END AS CHANGE_FLAG,
         PIPE_LENGTH,
         DECODE(COL_NO,'1','1号操作台','2','2号操作台',3,'3号操作台') COL_NO,
         '交班'CHANGE_GROUP,
	     '接班'TAKE_OVER,
	     DECODE(OFFLINE_TYPE,'1','未探伤下线','2','已探伤下线')OFFLINE_TYPE,
	     OFFLINE_REASON,
	     DECODE(SAMPLE_FLAG,'0','正常','1','留样')SAMPLE_FLAG
		FROM MIL_TESTING_RACK
		WHERE
		1=1
		AND JUDGE_STOVE_NO=?
		AND NVL(PRO_PLAN_ID, '/') = NVL(?, '/')
        AND NVL(GX_PLAN_NO, '/') = NVL(?, '/')
		--AND offline_flag in (0,?)
		--AND COL_NO=?
		ORDER BY SEQ ASC
		]]>
		<!-- CASE ALARM_REASON
		WHEN '1'
		THEN 'LOD'
		WHEN '2' THEN 'LID'
		WHEN '3' THEN 'TOD'
		WHEN '4' THEN 'TID'
		END AS  -->
	</query>
	<query id="FrmEddyCurrentTestingResult.CheckTestRack" desc="">
	SELECT * FROM MIL_TESTING_RACK
		WHERE
		1=1
		AND JUDGE_STOVE_NO=?
		AND COL_NO=?
		ORDER BY SEQ ASC,STATUS ASC
	</query>
	<query id="FrmEddyCurrentTestingResult.AddScrapSlabSeq" desc="新增剔除管号序列">
		 <![CDATA[
       INSERT INTO MIL_SLAB_SCRAP_SEQ(
        JUDGE_STOVE_NO,
        PROCESS_NO,
        SEQ,
        TIME,
        FLAG,
        REMARK,
        COL_MODE,
        COL_TIME,
        COL_USER,
        COL_SHIFT,
        COL_GROUP,
        COL_NO)
        VALUES( 
        '#JUDGE_STOVE_NO#',
        '#PROCESS_NO#',
        '#SEQ#',
        SYSDATE,
        '#FLAG#',
        '#REMARK#',
        '#COL_MODE#',
        SYSDATE,
        '#COL_USER#',
        '#COL_SHIFT#',
        '#COL_GROUP#',
        '#COL_NO#')
        ]]>

	</query>
	<query id="FrmEddyCurrentTestingResult.UpdateFurStatue" desc="修改探伤跟踪表物料状态">
		UPDATE Mil_Testing_Rack T
		SET
		STATUS = '1',
		SCRAP_REASON='#SCRAP_REASON#',
		SCRAP_TIME=SYSDATE
		WHERE
		SEQ = '#SEQ#'
		AND JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#' 
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdateETFurScrapNum1" desc="修改探伤实绩表剔除支数">
		UPDATE Mil_Et_Result SET
		SCRAP_NUM1 = SCRAP_NUM1 + 1,
		SCRAP_NUM = SCRAP_NUM+1,
		QUALIFIED_NUM1= (case nvl(QUALIFIED_NUM1, 0) when 0 then 0 else QUALIFIED_NUM1- 1 end),
		QUALIFIED_NUM= (case nvl(QUALIFIED_NUM, 0) when 0 then 0 else QUALIFIED_NUM - 1 end)
		WHERE
		JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdateETFurScrapNum2" desc="修改探伤实绩表剔除支数">
		UPDATE Mil_Et_Result SET
		SCRAP_NUM2 = SCRAP_NUM2 + 1,
		SCRAP_NUM = SCRAP_NUM + 1,
		QUALIFIED_NUM2= (case nvl(QUALIFIED_NUM2, 0) when 0 then 0 else QUALIFIED_NUM2- 1 end),
		QUALIFIED_NUM= (case nvl(QUALIFIED_NUM, 0) when 0 then 0 else QUALIFIED_NUM- 1 end)
		WHERE
		JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdateETFurScrapNum3" desc="修改探伤实绩表剔除支数">
		UPDATE Mil_Et_Result SET
		SCRAP_NUM3 = SCRAP_NUM3 + 1,
		SCRAP_NUM = SCRAP_NUM + 1,
		QUALIFIED_NUM3= (case nvl(QUALIFIED_NUM3, 0) when 0 then 0 else QUALIFIED_NUM3- 1 end),
		QUALIFIED_NUM= (case nvl(QUALIFIED_NUM, 0) when 0 then 0 else QUALIFIED_NUM- 1 end)
		WHERE
		JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdateMTFurScrapNum1" desc="修改探伤实绩表剔除支数">
	    UPDATE Mil_Mt_Result SET
		SCRAP_NUM1 = SCRAP_NUM1 + 1,
		SCRAP_NUM = SCRAP_NUM + 1,
		QUALIFIED_NUM1= (case nvl(QUALIFIED_NUM1, 0) when 0 then 0 else QUALIFIED_NUM1 - 1 end),
		QUALIFIED_NUM= (case nvl(QUALIFIED_NUM, 0) when 0 then 0 else QUALIFIED_NUM - 1 end)
		WHERE
		JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdateMTFurScrapNum2" desc="修改探伤实绩表剔除支数">
	    UPDATE Mil_Mt_Result SET
		SCRAP_NUM2 = SCRAP_NUM2 + 1,
		SCRAP_NUM = SCRAP_NUM + 1,
		QUALIFIED_NUM2 = (case nvl(QUALIFIED_NUM2, 0) when 0 then 0 else QUALIFIED_NUM2 - 1 end),
		QUALIFIED_NUM = (case nvl(QUALIFIED_NUM, 0) when 0 then 0 else QUALIFIED_NUM - 1 end)
		WHERE
		JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdateULFurScrapNum1" desc="修改探伤实绩表剔除支数">
		UPDATE Mil_Ul_Resul SET
		SCRAP_NUM1 =SCRAP_NUM1 + 1,
		SCRAP_NUM = SCRAP_NUM + 1,
		QUALIFIED_NUM1=(case nvl(QUALIFIED_NUM1, 0) when 0 then 0 else QUALIFIED_NUM1 - 1 end),
		QUALIFIED_NUM= (case nvl(QUALIFIED_NUM, 0) when 0 then 0 else QUALIFIED_NUM - 1 end)
		WHERE
		JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdateULFurScrapNum2" desc="修改探伤实绩表剔除支数">
		UPDATE Mil_Ul_Resul SET
		SCRAP_NUM2 =SCRAP_NUM2 + 1,
		SCRAP_NUM = SCRAP_NUM + 1,
		QUALIFIED_NUM2=(case nvl(QUALIFIED_NUM2, 0) when 0 then 0 else QUALIFIED_NUM2 - 1 end),
		QUALIFIED_NUM= (case nvl(QUALIFIED_NUM, 0) when 0 then 0 else QUALIFIED_NUM - 1 end)
		WHERE
		JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
	</query>
	<query id="FrmEddyCurrentTestingResult.UPdateTestRAckStatus"
		desc="更新复探跟踪表（插入状态，复探原因，更新复探支数">
		update
		MIL_TESTING_RACK t
		set t.STATUS ='2',
		
		t.RETEST_NUM=RETEST_NUM+1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
		AND t.SEQ='#SEQ#'
    </query>
	<query id="FrmEddyCurrentTestingResult.UPdateETResultREINSPECTION_NUM1"
		desc="探伤实绩表复探支数+1">
		update MIL_ET_RESULT t
		set t.reinspection_num1=t.reinspection_num1+1,
            t.reinspection_num=t.reinspection_num+1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
     <query id="FrmEddyCurrentTestingResult.UPdateETResultREINSPECTION_NUM2"
		desc="探伤实绩表复探支数+1">
		update MIL_ET_RESULT t
		set t.reinspection_num2=t.reinspection_num2+1,
            t.reinspection_num=t.reinspection_num+1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
     <query id="FrmEddyCurrentTestingResult.UPdateETResultREINSPECTION_NUM3"
		desc="探伤实绩表复探支数+1">
		update MIL_ET_RESULT t
		set t.reinspection_num3=t.reinspection_num3+1,
            t.reinspection_num=t.reinspection_num+1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
     <query id="FrmEddyCurrentTestingResult.UPdateMTResultREINSPECTION_NUM1" desc="探伤实绩表复探支数+1">
     update MIL_MT_RESULT t
		set
		t.REINSPECTION_NUM=REINSPECTION_NUM+1,
		t.reinspection_num1=t.reinspection_num1+1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
      <query id="FrmEddyCurrentTestingResult.UPdateMTResultREINSPECTION_NUM2" desc="探伤实绩表复探支数+1">
     update MIL_MT_RESULT t
		set
		t.REINSPECTION_NUM=REINSPECTION_NUM+1,
		t.reinspection_num2=t.reinspection_num2+1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
     <query id="FrmEddyCurrentTestingResult.UPdateUTResultREINSPECTION_NUM1" desc="探伤实绩表复探支数+1">
     update Mil_Ul_Resul t
		set
		t.REINSPECTION_NUM=REINSPECTION_NUM+1,
		t.reinspection_num1=t.reinspection_num1+1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
      <query id="FrmEddyCurrentTestingResult.UPdateUTResultREINSPECTION_NUM2" desc="探伤实绩表复探支数+1">
     update Mil_Ul_Resul t
		set
		t.REINSPECTION_NUM=REINSPECTION_NUM+1,
		t.reinspection_num2=t.reinspection_num2+1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
     <query id="FrmEddyCurrentTestingResult.UPdateTestRAckStatusBACK" desc="">
     update
		MIL_TESTING_RACK t
		set t.STATUS ='0',
		t.RETEST_NUM=0
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
		AND t.SEQ='#SEQ#'
     </query>
     <query id="FrmEddyCurrentTestingResult.UPdateTestRAckNumBACK" desc="">
     update
		MIL_TESTING_RACK t
		set 
		t.RETEST_NUM=t.RETEST_NUM-1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
		AND t.SEQ='#SEQ#'
     </query>
     <query id="FrmEddyCurrentTestingResult.UPdateETResultREINSPECTION_NUM1BACK"
		desc="探伤实绩表复探支数+1">
		update MIL_ET_RESULT t
		set t.reinspection_num1=t.reinspection_num1-1,
            t.reinspection_num=t.reinspection_num-1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
     <query id="FrmEddyCurrentTestingResult.UPdateETResultREINSPECTION_NUM2BACK"
		desc="探伤实绩表复探支数+1">        
		update MIL_ET_RESULT t
		set t.reinspection_num2=t.reinspection_num2-1,
            t.reinspection_num=t.reinspection_num-1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
     <query id="FrmEddyCurrentTestingResult.UPdateETResultREINSPECTION_NUM3BACK"
		desc="探伤实绩表复探支数+1">
		update MIL_ET_RESULT t
		set t.reinspection_num3=t.reinspection_num3-1,
            t.reinspection_num=t.reinspection_num-1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
     <query id="FrmEddyCurrentTestingResult.UPdateMTResultREINSPECTION_NUM1BACK" desc="探伤实绩表复探支数+1">
     update MIL_MT_RESULT t
		set
		t.REINSPECTION_NUM=REINSPECTION_NUM-1,
		t.reinspection_num1=t.reinspection_num1-1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
      <query id="FrmEddyCurrentTestingResult.UPdateMTResultREINSPECTION_NUM2BACK" desc="探伤实绩表复探支数+1">
     update MIL_MT_RESULT t
		set
		t.REINSPECTION_NUM=REINSPECTION_NUM-1,
		t.reinspection_num2=t.reinspection_num2-1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
     <query id="FrmEddyCurrentTestingResult.UPdateUTResultREINSPECTION_NUM1BACK" desc="探伤实绩表复探支数+1">
     update Mil_Ul_Resul t
		set
		t.REINSPECTION_NUM=REINSPECTION_NUM-1,
		t.reinspection_num1=t.reinspection_num1-1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>
      <query id="FrmEddyCurrentTestingResult.UPdateUTResultREINSPECTION_NUM2BACK" desc="探伤实绩表复探支数+1">
     update Mil_Ul_Resul t
		set
		t.REINSPECTION_NUM=REINSPECTION_NUM-1,
		t.reinspection_num2=t.reinspection_num2-1
		where
		t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
     </query>

	<query id="FrmEddyCurrentTestingResult.UpdatETResult" desc="更新ET探伤实绩表">
		UPDATE MIL_ET_RESULT
   SET PRODUCT_STANDARDS       = '#PRODUCT_STANDARDS#',
       INSPECTION_STANDARD     = '#INSPECTION_STANDARD#',
       TESTING_METHOD          = '#TESTING_METHOD#',
       CALIBRATION_METHOD      = '#CALIBRATION_METHOD#',
       ARTIFICIAL_DEFECT_SHAPE = '#ARTIFICIAL_DEFECT_SHAPE#',
       EXCITATION_FREQUENCY1   = '#EXCITATION_FREQUENCY1#',
       EXCITATION_FREQUENCY2   = '#EXCITATION_FREQUENCY2#',
       EXCITATION_FREQUENCY3   = '#EXCITATION_FREQUENCY3#',
       TESTING_SPEED1          = '#TESTING_SPEED1#',
       TESTING_SPEED2          = '#TESTING_SPEED2#',
       TESTING_SPEED3          = '#TESTING_SPEED3#',
       EXECUTIVE_PRODUCER      = '#EXECUTIVE_PRODUCER#',
       PRODUCER_TIME           = '#PRODUCER_TIME#',
       PRODUCER_TEL            = '#PRODUCER_TEL#',
       REMARK                  = '#REMARK#',
       USERID                  = '#USERID#',
       SIGNID                  = '#SIGNID#',
       TESTING_TIME            = '#TESTING_TIME#',
       REMARK2                 = '#REMARK2#',
       START_TIME              = to_date('#START_TIME#',
                                         'yyyy-mm-dd hh24:mi:ss')
 WHERE JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
   AND NVL(PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
   AND NVL(GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
	</query>
	
	<query id="FrmEddyCurrentTestingResult.UpdatETResultnum1" desc="ET1#台更新支数">
	UPDATE MIL_ET_RESULT SET
	NODE_FUR_FLAG1='#NODE_FUR_FLAG1#',
	SCRAP_NUM1='#SCRAP_NUM1#',
	QUALIFIED_NUM1='#QUALIFIED_NUM1#',
	REINSPECTION_NUM1='#REINSPECTION_NUM1#',
	REINSPECTION_QUALIFIED_NUM1='#REINSPECTION_QUALIFIED_NUM1#',
	DETECTION_NUM1='#DETECTION_NUM1#',
	SUSPECT_PRODUCT_NUM1='#SUSPECT_PRODUCT_NUM1#',
	SCRAP_NUM='#SCRAP_NUM1#'+SCRAP_NUM2+SCRAP_NUM3,
	QUALIFIED_NUM='#QUALIFIED_NUM1#'+QUALIFIED_NUM2+QUALIFIED_NUM3,
	REINSPECTION_NUM='#REINSPECTION_NUM1#'+REINSPECTION_NUM2+REINSPECTION_NUM3,
	REINSPECTION_QUALIFIED_NUM='#REINSPECTION_QUALIFIED_NUM1#'+REINSPECTION_QUALIFIED_NUM2+REINSPECTION_QUALIFIED_NUM3,
	DETECTION_NUM='#DETECTION_NUM1#'+DETECTION_NUM2+DETECTION_NUM3,
	SUSPECT_PRODUCT_NUM='#SUSPECT_PRODUCT_NUM1#'+SUSPECT_PRODUCT_NUM2+SUSPECT_PRODUCT_NUM3,
	QA_TON=QA_TON+'#QA_TON#'
	WHERE JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdatETResultnum2" desc="ET2#台更新支数">
	UPDATE MIL_ET_RESULT SET
	NODE_FUR_FLAG2='#NODE_FUR_FLAG2#',
	SCRAP_NUM2='#SCRAP_NUM2#',
	QUALIFIED_NUM2='#QUALIFIED_NUM2#',
	REINSPECTION_NUM2='#REINSPECTION_NUM2#',
	REINSPECTION_QUALIFIED_NUM2='#REINSPECTION_QUALIFIED_NUM2#',
	DETECTION_NUM2='#DETECTION_NUM2#',
	SUSPECT_PRODUCT_NUM2='#SUSPECT_PRODUCT_NUM2#',
	SCRAP_NUM='#SCRAP_NUM2#'+SCRAP_NUM1+SCRAP_NUM3,
	QUALIFIED_NUM='#QUALIFIED_NUM2#'+QUALIFIED_NUM1+QUALIFIED_NUM3,
	REINSPECTION_NUM='#REINSPECTION_NUM2#'+REINSPECTION_NUM1+REINSPECTION_NUM3,
	REINSPECTION_QUALIFIED_NUM='#REINSPECTION_QUALIFIED_NUM2#'+REINSPECTION_QUALIFIED_NUM1+REINSPECTION_QUALIFIED_NUM3,
	DETECTION_NUM='#DETECTION_NUM2#'+DETECTION_NUM1+DETECTION_NUM3,
	SUSPECT_PRODUCT_NUM='#SUSPECT_PRODUCT_NUM2#'+SUSPECT_PRODUCT_NUM1+SUSPECT_PRODUCT_NUM3,
	QA_TON=QA_TON+'#QA_TON#'
	WHERE JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdatETResultnum3" desc="ET3#台更新支数">
	UPDATE MIL_ET_RESULT SET
	NODE_FUR_FLAG3='#NODE_FUR_FLAG3#',
	SCRAP_NUM3='#SCRAP_NUM3#',
	QUALIFIED_NUM3='#QUALIFIED_NUM3#',
	REINSPECTION_NUM3='#REINSPECTION_NUM3#',
	REINSPECTION_QUALIFIED_NUM3='#REINSPECTION_QUALIFIED_NUM3#',
	DETECTION_NUM3='#DETECTION_NUM3#',
	SUSPECT_PRODUCT_NUM3='#SUSPECT_PRODUCT_NUM3#',
	SCRAP_NUM='#SCRAP_NUM3#'+SCRAP_NUM1+SCRAP_NUM2,
	QUALIFIED_NUM='#QUALIFIED_NUM3#'+QUALIFIED_NUM1+QUALIFIED_NUM2,
	REINSPECTION_NUM='#REINSPECTION_NUM3#'+REINSPECTION_NUM1+REINSPECTION_NUM2,
	REINSPECTION_QUALIFIED_NUM='#REINSPECTION_QUALIFIED_NUM3#'+REINSPECTION_QUALIFIED_NUM1+REINSPECTION_QUALIFIED_NUM2,
	DETECTION_NUM='#DETECTION_NUM3#'+DETECTION_NUM1+DETECTION_NUM2,
	SUSPECT_PRODUCT_NUM='#SUSPECT_PRODUCT_NUM3#'+SUSPECT_PRODUCT_NUM1+SUSPECT_PRODUCT_NUM2,
	QA_TON=QA_TON+'#QA_TON#'
	WHERE JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdatMTResult" desc="更新MT探伤实绩表">
	UPDATE MIL_MT_RESULT
   SET PRODUCT_STANDARDS     = '#PRODUCT_STANDARDS#',
       LO_SURFACE            = '#LO_SURFACE#',
       LI_SURFACE            = '#LI_SURFACE#',
       TO_SURFACE            = '#TO_SURFACE#',
       TI_SURFACE            = '#TI_SURFACE#',
       GROOVE_SHAPE          = '#GROOVE_SHAPE#',
       INSPECTION_STANDARD   = '#INSPECTION_STANDARD#',
       LONGITUDINAL_CURRENT1 = '#LONGITUDINAL_CURRENT1#',
       TRANSVERSE_CURRENT1   = '#TRANSVERSE_CURRENT1#',
       LONGITUDINAL_CURRENT2 = '#LONGITUDINAL_CURRENT2#',
       TRANSVERSE_CURRENT2   = '#TRANSVERSE_CURRENT2#',
       SPEED1                = '#SPEED1#',
       SPEED2                = '#SPEED2#',
       DETECTION_SPEED1      = '#DETECTION_SPEED1#',
       DETECTION_SPEED2      = '#DETECTION_SPEED2#',
       USERID                = '#USERID#',
       SIGNID                = '#SIGNID#',
       EXECUTIVE_PRODUCER    = '#EXECUTIVE_PRODUCER#',
       PRODUCER_TEL          = '#PRODUCER_TEL#',
       REMARK                = '#REMARK#',
       START_TIME            = to_date('#START_TIME#',
                                       'yyyy-mm-dd hh24:mi:ss')
 WHERE JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
   AND NVL(PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
   AND NVL(GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdatMTResultnum1" desc="MT1#台更新支数">
	UPDATE MIL_MT_RESULT SET
	NODE_FUR_FLAG1='#NODE_FUR_FLAG1#',
	SCRAP_NUM1='#SCRAP_NUM1#',
	QUALIFIED_NUM1='#QUALIFIED_NUM1#',
	REINSPECTION_NUM1='#REINSPECTION_NUM1#',
	REINSPECTION_QUALIFIED_NUM1='#REINSPECTION_QUALIFIED_NUM1#',
	DETECTION_NUM1='#DETECTION_NUM1#',
	SUSPECT_PRODUCT_NUM1='#SUSPECT_PRODUCT_NUM1#',
	SCRAP_NUM='#SCRAP_NUM1#'+SCRAP_NUM2,
	QUALIFIED_NUM='#QUALIFIED_NUM1#'+QUALIFIED_NUM2,
	REINSPECTION_NUM='#REINSPECTION_NUM1#'+REINSPECTION_NUM2,
	REINSPECTION_QUALIFIED_NUM='#REINSPECTION_QUALIFIED_NUM1#'+REINSPECTION_QUALIFIED_NUM2,
	DETECTION_NUM='#DETECTION_NUM1#'+DETECTION_NUM2,
	ALARM_NUM='#SUSPECT_PRODUCT_NUM1#'+SUSPECT_PRODUCT_NUM2,
	QA_TON=QA_TON+'#QA_TON#'
	WHERE JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdatMTResultnum2" desc="MT2#台更新支数">
	UPDATE MIL_MT_RESULT SET
	NODE_FUR_FLAG2='#NODE_FUR_FLAG2#',
	SCRAP_NUM2='#SCRAP_NUM2#',
	QUALIFIED_NUM2='#QUALIFIED_NUM2#',
	REINSPECTION_NUM2='#REINSPECTION_NUM2#',
	REINSPECTION_QUALIFIED_NUM2='#REINSPECTION_QUALIFIED_NUM2#',
	DETECTION_NUM2='#DETECTION_NUM2#',
	SUSPECT_PRODUCT_NUM2='#SUSPECT_PRODUCT_NUM2#',
	SCRAP_NUM='#SCRAP_NUM2#'+SCRAP_NUM1,
	QUALIFIED_NUM='#QUALIFIED_NUM2#'+QUALIFIED_NUM1,
	REINSPECTION_NUM='#REINSPECTION_NUM2#'+REINSPECTION_NUM1,
	REINSPECTION_QUALIFIED_NUM='#REINSPECTION_QUALIFIED_NUM2#'+REINSPECTION_QUALIFIED_NUM1,
	DETECTION_NUM='#DETECTION_NUM2#'+DETECTION_NUM1,
	ALARM_NUM='#SUSPECT_PRODUCT_NUM2#'+SUSPECT_PRODUCT_NUM1,
	QA_TON=QA_TON+'#QA_TON#'
	WHERE JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
	</query>
	
	
	<query id="FrmEddyCurrentTestingResult.UpdatUTResult" desc="更新UT探伤实绩">
	 UPDATE MIL_UL_RESUL
   SET PRODUCT_STANDARDS  = '#PRODUCT_STANDARDS#',
       INSTRUMENT_TYPE    = '#INSTRUMENT_TYPE#',
       PROBE_TYPE         = '#PROBE_TYPE#',
       SENSTIVITY         = '#SENSTIVITY#',
       INHIBITION         = '#INHIBITION#',
       COUPLING_AGENT     = '#COUPLING_AGENT#',
       SURFACE_APPEARANCE = '#SURFACE_APPEARANCE#',
       LO_SURFACE         = '#LO_SURFACE#',
       LI_SURFACE         = '#LI_SURFACE#',
       TO_SURFACE         = '#TO_SURFACE#',
       TI_SURFACE         = '#TI_SURFACE#',
       USERID             = '#USERID#',
       SIGNID             = '#SIGNID#',
       EXECUTIVE_PRODUCER = '#EXECUTIVE_PRODUCER#',
       PRODUCER_TIME      = SYSDATE,
       PRODUCER_TEL       = '#PRODUCER_TEL#',
       REMARK             = '#REMARK#',
       START_TIME         = to_date('#START_TIME#', 'yyyy-mm-dd hh24:mi:ss')
 WHERE JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
   AND NVL(PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
   AND NVL(GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdatUTResultnum1" desc="UT1#台更新支数">
	UPDATE MIL_UL_RESUL
   SET NODE_FUR_FLAG1              = '#NODE_FUR_FLAG1#',
       SCRAP_NUM1                  = '#SCRAP_NUM1#',
       QUALIFIED_NUM1              = '#QUALIFIED_NUM1#',
       REINSPECTION_NUM1           = '#REINSPECTION_NUM1#',
       REINSPECTION_QUALIFIED_NUM1 = '#REINSPECTION_QUALIFIED_NUM1#',
       DETECTION_NUM1              = '#DETECTION_NUM1#',
       SUSPECT_PRODUCT_NUM1        = '#SUSPECT_PRODUCT_NUM1#',
       SCRAP_NUM                   = '#SCRAP_NUM1#' + SCRAP_NUM2,
       QUALIFIED_NUM               = '#QUALIFIED_NUM1#' + QUALIFIED_NUM2,
       REINSPECTION_NUM            = '#REINSPECTION_NUM1#' +
                                     REINSPECTION_NUM2,
       REINSPECTION_QUALIFIED_NUM  = '#REINSPECTION_QUALIFIED_NUM1#' +
                                     REINSPECTION_QUALIFIED_NUM2,
       DETECTION_NUM               = '#DETECTION_NUM1#' + DETECTION_NUM2,
       ALARM_NUM                   = '#SUSPECT_PRODUCT_NUM1#' +
                                     SUSPECT_PRODUCT_NUM2,
       QA_TON                      = QA_TON + '#QA_TON#'
 WHERE JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
   AND NVL(PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
   AND NVL(GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
	</query>
	<query id="FrmEddyCurrentTestingResult.UpdatUTResultnum2" desc="UT2#台更新支数">
	UPDATE MIL_UL_RESUL
   SET NODE_FUR_FLAG2              = '#NODE_FUR_FLAG2#',
       SCRAP_NUM2                  = '#SCRAP_NUM2#',
       QUALIFIED_NUM2              = '#QUALIFIED_NUM2#',
       REINSPECTION_NUM2           = '#REINSPECTION_NUM2#',
       REINSPECTION_QUALIFIED_NUM2 = '#REINSPECTION_QUALIFIED_NUM2#',
       DETECTION_NUM2              = '#DETECTION_NUM2#',
       SUSPECT_PRODUCT_NUM2        = '#SUSPECT_PRODUCT_NUM2#',
       SCRAP_NUM                   = '#SCRAP_NUM2#' + SCRAP_NUM1,
       QUALIFIED_NUM               = '#QUALIFIED_NUM2#' + QUALIFIED_NUM1,
       REINSPECTION_NUM            = '#REINSPECTION_NUM2#' +
                                     REINSPECTION_NUM1,
       REINSPECTION_QUALIFIED_NUM  = '#REINSPECTION_QUALIFIED_NUM2#' +
                                     REINSPECTION_QUALIFIED_NUM1,
       DETECTION_NUM               = '#DETECTION_NUM2#' + DETECTION_NUM1,
       ALARM_NUM                   = '#SUSPECT_PRODUCT_NUM2#' +
                                     SUSPECT_PRODUCT_NUM1,
       QA_TON                      = QA_TON + '#QA_TON#'
 WHERE JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
   AND NVL(PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
   AND NVL(GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
	</query>
	
	<query id="FrmEddyCurrentTestingResult.GetMIL_STRAIGHTENING_RESULT"
		desc="查询矫直实绩表">
		select t.Node_Fur_Flag, QUALIFIED_NUM
  from Mil_Straightening_Result t
 where t.judge_stove_no = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
    </query>
    
    <query id="FrmEddyCurrentTestingResult.UpdateETResultNODE" desc="更新实绩表（包括结炉时间,结炉状态）">
    UPDATE MIL_ET_RESULT
   SET PRODUCT_STANDARDS          = '#PRODUCT_STANDARDS#',
       INSPECTION_STANDARD        = '#INSPECTION_STANDARD#',
       TESTING_METHOD             = '#TESTING_METHOD#',
       CALIBRATION_METHOD         = '#CALIBRATION_METHOD#',
       ARTIFICIAL_DEFECT_SHAPE    = '#ARTIFICIAL_DEFECT_SHAPE#',
       EXCITATION_FREQUENCY1      = '#EXCITATION_FREQUENCY1#',
       EXCITATION_FREQUENCY2      = '#EXCITATION_FREQUENCY2#',
       EXCITATION_FREQUENCY3      = '#EXCITATION_FREQUENCY3#',
       TESTING_SPEED1             = '#TESTING_SPEED1#',
       TESTING_SPEED2             = '#TESTING_SPEED2#',
       TESTING_SPEED3             = '#TESTING_SPEED3#',
       DETECTION_NUM              = '#DETECTION_NUM#',
       SUSPECT_PRODUCT_NUM        = '#SUSPECT_PRODUCT_NUM#',
       SUSPICIOUS_REASON          = '#SUSPICIOUS_REASON#',
       REINSPECTION_NUM           = '#REINSPECTION_NUM#',
       REINSPECTION_QUALIFIED_NUM = '#REINSPECTION_QUALIFIED_NUM#',
       SCRAP_NUM                  = '#SCRAP_NUM#',
       SCRAP_REASON               = '#SCRAP_REASON#',
       QUALIFIED_NUM              = '#QUALIFIED_NUM#',
       EXECUTIVE_PRODUCER         = '#EXECUTIVE_PRODUCER#',
       PRODUCER_TIME              = '#PRODUCER_TIME#',
       PRODUCER_TEL               = '#PRODUCER_TEL#',
       REMARK                     = '#REMARK#',
       USERID                     = '#USERID#',
       SIGNID                     = '#SIGNID#',
       TESTING_TIME               = '#TESTING_TIME#',
       REMARK2                    = '#REMARK2#',
       END_TIME                   = SYSDATE,
       NODE_FUR_FLAG              = '1'
 WHERE JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
   AND NVL(PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
   AND NVL(GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
    </query>
    <query id="FrmEddyCurrentTestingResult.UpdateMTResultNODE" desc="更新MT结炉时间，结炉状态">
    update MIL_MT_RESULT t set 
    t.end_time=SYSDATE,
    t.node_fur_flag='1'
    where t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
    </query>
    <query id="FrmEddyCurrentTestingResult.UpdateUTResultNODE" desc="更新UT结炉时间，结炉状态">
    update Mil_Ul_Resul t set 
    t.end_time=SYSDATE,
    t.node_fur_flag='1'
    where t.JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
    </query>
	<query id="FrmEddyCurrentTestingResult.UpdateMilPlanNode" desc="更新主表NODE_STATUS">
		update MIL_PLAN t set t.node_status='90' 
		WHERE JUDGE_STOVE_NO='#JUDGE_STOVE_NO#'
    </query>
    <query id="FrmEddyCurrentTestingResult.UpdateRackShift" desc="">
    UPDATE MIL_TESTING_RACK T
     SET 
        T.COL_USER = '#COL_USER#',
        T.COL_SHIFT = '#COL_SHIFT#',
        T.COL_GROUP = '#COL_GROUP#'
    WHERE
    T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
    AND T.COL_USER is  null
    AND T.COL_SHIFT is  null
    AND T.COL_GROUP is  null
    AND T.MAT_NO is not null
    </query>
    <query id="FrmEddyCurrentTestingResult.UpdateETResultShift" desc="">
    UPDATE MIL_ET_RESULT T
   SET T.COL_SHIFT = '#COL_SHIFT#',
       T.COL_GROUP = '#COL_GROUP#',
       T.COL_USER  = '#COL_USER#'
 WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
 AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
    </query>
    <query id="FrmEddyCurrentTestingResult.UpdateMTResultShift" desc="">
    UPDATE MIL_MT_RESULT T
   SET T.COL_SHIFT = '#COL_SHIFT#',
       T.COL_GROUP = '#COL_GROUP#',
       T.COL_USER  = '#COL_USER#'
 WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
 AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
    </query>
    <query id="FrmEddyCurrentTestingResult.UpdateUTResultShift" desc="">
    UPDATE MIL_UL_RESUL T
   SET T.COL_SHIFT = '#COL_SHIFT#',
       T.COL_GROUP = '#COL_GROUP#',
       T.COL_USER  = '#COL_USER#'
 WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
 AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
    </query>
    <query id = "FrmEddyCurrentTestingResult.UpdtaeRackShift" desc = "修改管号队列班次班组">
    <![CDATA[
    DECLARE
  V_SEQ          MIL_TESTING_RACK.SEQ%TYPE := 0;
  V_OFFLINECOUNT MIL_TESTING_RACK.SEQ%TYPE := 0;
BEGIN
  SELECT NVL(COUNT(1), 0)
    INTO V_OFFLINECOUNT
    FROM MIL_TESTING_RACK T
   WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
     AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
     AND T.RESULT_NO = '#RESULT_NO#';
  SELECT NVL(MAX(T.SEQ), 0)
    INTO V_SEQ
    FROM MIL_TESTING_RACK T
   WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
     AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
     AND T.RESULT_NO = '#RESULT_NO#'
     AND T.CHANGE_FLAG = '1';
  UPDATE MIL_TESTING_RACK T
     SET T.COL_SHIFT = '#COL_SHIFT#', T.COL_GROUP = '#COL_GROUP#'
   WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
     AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
     AND T.OFFLINE_FLAG = '1'
     AND T.COL_SHIFT IS NULL
     AND T.COL_GROUP IS NULL;
  UPDATE MIL_TESTING_RACK T
     SET T.COL_SHIFT = '#COL_SHIFT#', T.COL_GROUP = '#COL_GROUP#'
   WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
     AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
     AND T.OFFLINE_FLAG = '0'
     AND T.COL_SHIFT IS NULL
     AND T.COL_GROUP IS NULL
     AND T.SEQ >= 1
     AND ROWNUM <= #QUALIFIED_NUM# + #SCRAP_NUM# + #SAMPLE_NUM# +
         V_OFFLINECOUNT - V_SEQ;
END;
]]>
    </query>
    <query id="FrmEddyCurrentTestingResult.GetETResultNodeQuery"  desc="查询结炉实绩">
    SELECT 
       SCRAP_NUM1,
       QUALIFIED_NUM1,
       REINSPECTION_NUM1,
       REINSPECTION_QUALIFIED_NUM1,
       OFFLINE_NUM1,
       BACKLINE_NUM1,
       SCRAP_NUM2,
       QUALIFIED_NUM2,
       REINSPECTION_NUM2,
       REINSPECTION_QUALIFIED_NUM2,
       OFFLINE_NUM2,
       BACKLINE_NUM2,
       SCRAP_NUM3,
       QUALIFIED_NUM3,
       REINSPECTION_NUM3,
       REINSPECTION_QUALIFIED_NUM3,
       OFFLINE_NUM3,
       BACKLINE_NUM3,
       DETECTION_NUM1,
       DETECTION_NUM2,
       DETECTION_NUM3,
       SUSPECT_PRODUCT_NUM1,
       SUSPECT_PRODUCT_NUM2,
       SUSPECT_PRODUCT_NUM3,
       RESULT_NO,
       LOT_NO,
       STOVE_NO,
       JUDGE_STOVE_NO,
       PLINE_CODE,
       BACKLINE_NUM,
       OFFLINE_NUM,
       PRODUCT_STANDARDS,
       INSPECTION_STANDARD,
       TESTING_METHOD,
       CALIBRATION_METHOD,
       ARTIFICIAL_DEFECT_SHAPE,
       EXCITATION_FREQUENCY1,
       EXCITATION_FREQUENCY2,
       EXCITATION_FREQUENCY3,
       TESTING_SPEED1,
       TESTING_SPEED2,
       TESTING_SPEED3,
       DETECTION_NUM,
       SUSPECT_PRODUCT_NUM,
       REINSPECTION_NUM,
       REINSPECTION_QUALIFIED_NUM,
       SCRAP_NUM,
       SCRAP_REASON,
       QUALIFIED_NUM,
       TO_CHAR(START_TIME, 'YYYY-MM-DD HH24:MI:SS') START_TIME,
       TO_CHAR(END_TIME, 'YYYY-MM-DD HH24:MI:SS') END_TIME,
       EXECUTIVE_PRODUCER,
       TO_CHAR(PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       PRODUCER_TEL,
       REMARK,
       USERID,
       SIGNID,
       TO_CHAR(TESTING_TIME, 'YYYY-MM-DD HH24:MI:SS') TESTING_TIME,
       DECODE(NODE_FUR_FLAG,'0','未结炉','1','结炉')NODE_FUR_FLAG,
       REMARK2,
       COL_MODE,
       TO_CHAR(COL_TIME, 'YYYY-MM-DD HH24:MI:SS') COL_TIME,
       COL_USER,
		  case COL_SHIFT 
       WHEN '0' THEN '常白班'
       WHEN '1' THEN '早班'
       WHEN '2' THEN '中班'
       WHEN '3' THEN '晚班' end as COL_SHIFT,
       case COL_GROUP
       WHEN '1' THEN '甲'
       WHEN '2' THEN '乙'
       WHEN '3' THEN '丙'
       WHEN '4' THEN '丁'  end as COL_GROUP,
       QA_TON,
       CHANGE_NUM
 FROM MIL_ET_RESULT
 WHERE
 1=1
       AND PLINE_CODE=?
       AND COL_SHIFT=?
       AND COL_GROUP=?
       AND END_TIME BETWEEN TO_DATE(?,'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(?,'YYYY-MM-DD HH24:MI:SS')
       AND NODE_FUR_FLAG='1'
    </query>
    
    <query id="FrmEddyCurrentTestingResult.GetMTResultNodeQuery" desc="查询结炉实绩">
     SELECT 
       SCRAP_NUM2,
       QUALIFIED_NUM2,
       REINSPECTION_NUM2,
       REINSPECTION_QUALIFIED_NUM2,
       OFFLINE_NUM2,
       BACKLINE_NUM2,
       SCRAP_NUM1,
       QUALIFIED_NUM1,
       REINSPECTION_NUM1,
       REINSPECTION_QUALIFIED_NUM1,
       OFFLINE_NUM1,
       BACKLINE_NUM1,
       DETECTION_NUM1,
       DETECTION_NUM2,
       SUSPECT_PRODUCT_NUM1,
       SUSPECT_PRODUCT_NUM2,
       BACKLINE_NUM,
       OFFLINE_NUM,
       COL_NO,
       RESULT_NO,
       LOT_NO,
       STOVE_NO,
       JUDGE_STOVE_NO,
       PLINE_CODE,
       PRODUCT_STANDARDS,
       LO_SURFACE,
       LI_SURFACE,
       TO_SURFACE,
       TI_SURFACE,
       GROOVE_SHAPE,
       INSPECTION_STANDARD,
       LONGITUDINAL_CURRENT1,
       TRANSVERSE_CURRENT1,
       LONGITUDINAL_CURRENT2,
       TRANSVERSE_CURRENT2,
       SPEED1,
       SPEED2,
       DETECTION_SPEED1,
       DETECTION_SPEED2,
       DETECTION_NUM,
       ALARM_NUM,
       SUSPICIOUS_REASON,
       REINSPECTION_NUM,
       REINSPECTION_QUALIFIED_NUM,
       SCRAP_NUM,
       SCRAP_REASON,
       QUALIFIED_NUM,
       USERID,
       SIGNID,
       TO_CHAR(START_TIME, 'YYYY-MM-DD HH24:MI:SS') START_TIME,
       TO_CHAR(END_TIME, 'YYYY-MM-DD HH24:MI:SS') END_TIME,
       EXECUTIVE_PRODUCER,
       TO_CHAR(PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       PRODUCER_TEL,
       DECODE(NODE_FUR_FLAG,'0','未结炉','1','结炉')NODE_FUR_FLAG,
       REMARK,
       COL_MODE,
       TO_CHAR(COL_TIME, 'YYYY-MM-DD HH24:MI:SS') COL_TIME,
       COL_USER,
		  case COL_SHIFT 
       WHEN '0' THEN '常白班'
       WHEN '1' THEN '早班'
       WHEN '2' THEN '中班'
       WHEN '3' THEN '晚班' end as COL_SHIFT,
       case COL_GROUP
       WHEN '1' THEN '甲'
       WHEN '2' THEN '乙'
       WHEN '3' THEN '丙'
       WHEN '4' THEN '丁'  end as COL_GROUP,
       QA_TON,
       CHANGE_NUM
 FROM MIL_MT_RESULT
 WHERE
 1=1
       AND PLINE_CODE=?
       AND COL_SHIFT=?
       AND COL_GROUP=?
       AND END_TIME BETWEEN TO_DATE(?,'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(?,'YYYY-MM-DD HH24:MI:SS')
       AND NODE_FUR_FLAG='1'
    </query>
    <query id="FrmEddyCurrentTestingResult.GetUTResultNodeQuery" desc="查询结炉实绩">
     SELECT 
       SCRAP_NUM2,
       QUALIFIED_NUM2,
       REINSPECTION_NUM2,
       REINSPECTION_QUALIFIED_NUM2,
       OFFLINE_NUM2,
       BACKLINE_NUM2,
       SCRAP_NUM1,
       QUALIFIED_NUM1,
       REINSPECTION_NUM1,
       REINSPECTION_QUALIFIED_NUM1,
       OFFLINE_NUM1,
       BACKLINE_NUM1,
       DETECTION_NUM1,
       DETECTION_NUM2,
       SUSPECT_PRODUCT_NUM1,
       SUSPECT_PRODUCT_NUM2,
       BACKLINE_NUM,
       OFFLINE_NUM,
       COL_NO,
       RESULT_NO,
       LOT_NO,
       STOVE_NO,
       JUDGE_STOVE_NO,
       PLINE_CODE,
       PRODUCT_STANDARDS,
       INSTRUMENT_TYPE,
       PROBE_TYPE,
       SENSTIVITY,
       INHIBITION,
       COUPLING_AGENT,
       SURFACE_APPEARANCE,
       LO_SURFACE,
       LI_SURFACE,
       TO_SURFACE,
       TI_SURFACE,
       DETECTION_NUM,
       ALARM_NUM,
       SUSPICIOUS_REASON,
       REINSPECTION_NUM,
       REINSPECTION_QUALIFIED_NUM,
       SCRAP_NUM,
       SCRAP_REASON,
       QUALIFIED_NUM,
       USERID,
       SIGNID,
       TO_CHAR(START_TIME, 'YYYY-MM-DD HH24:MI:SS') START_TIME,
       TO_CHAR(END_TIME, 'YYYY-MM-DD HH24:MI:SS') END_TIME,
       EXECUTIVE_PRODUCER,
       TO_CHAR(PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       PRODUCER_TEL,
       NODE_FUR_FLAG,
       REMARK,
       COL_MODE,
       TO_CHAR(COL_TIME, 'YYYY-MM-DD HH24:MI:SS') COL_TIME,
       COL_USER,
		  case COL_SHIFT 
       WHEN '0' THEN '常白班'
       WHEN '1' THEN '早班'
       WHEN '2' THEN '中班'
       WHEN '3' THEN '晚班' end as COL_SHIFT,
       case COL_GROUP
       WHEN '1' THEN '甲'
       WHEN '2' THEN '乙'
       WHEN '3' THEN '丙'
       WHEN '4' THEN '丁'  end as COL_GROUP,
       QA_TON,
               CHANGE_NUM
 FROM MIL_UL_RESUL
 WHERE
 1=1
       AND PLINE_CODE=?
       AND COL_SHIFT=?
       AND COL_GROUP=?
       AND END_TIME BETWEEN TO_DATE(?,'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(?,'YYYY-MM-DD HH24:MI:SS')
       AND NODE_FUR_FLAG='1'
    </query>
    <query id="FrmEddyCurrentTestingResult.UpdateSawRackASRowNo" desc="更新分切管号队列表修改数据">
     UPDATE MIL_SAW_RACK T
   SET 
        T.ORDER_LENGTH = '#ORDER_LENGTH#',
        T.CUT_HEAD_LENGTH = '#CUT_HEAD_LENGTH#',
        T.CUT_TRAIL_LENGTH = '#CUT_TRAIL_LENGTH#',
        T.SAW_NO = '#SAW_NO#',
        T.SAW_NO_N = '#SAW_NO_N#',
        T.LAST_ORDER_LENGTH = '#LAST_ORDER_LENGTH#',
        T.CUT_TYPE = '#CUT_TYPE#',
        T.REAL_ROLL_LENGTH = '#REAL_ROLL_LENGTH#'
 WHERE
T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
AND T.SEQ = '#SEQ#'
AND T.ROW_NO='#ROW_NO#'
    </query>
    <query id="FrmEddyCurrentTestingResult.QunumET1" desc="">
     UPDATE MIL_ET_RESULT T
    SET 
        T.DETECTION_NUM = '#DETECTION_NUM1#'+DETECTION_NUM2+DETECTION_NUM3,
        T.QUALIFIED_NUM = '#QUALIFIED_NUM1#'+QUALIFIED_NUM2+QUALIFIED_NUM3,
        T.QUALIFIED_NUM1 = '#QUALIFIED_NUM1#',
        T.DETECTION_NUM1 = '#DETECTION_NUM1#'     
    WHERE  T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
    </query>
    <query id="FrmEddyCurrentTestingResult.QunumET2" desc="">
     UPDATE MIL_ET_RESULT T
    SET 
        T.DETECTION_NUM = '#DETECTION_NUM2#'+DETECTION_NUM1+DETECTION_NUM3,
        T.QUALIFIED_NUM = '#QUALIFIED_NUM2#'+QUALIFIED_NUM1+QUALIFIED_NUM3,
        T.QUALIFIED_NUM2 = '#QUALIFIED_NUM2#',
        T.DETECTION_NUM2 = '#DETECTION_NUM2#'     
    WHERE  T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
    </query>
    <query id="FrmEddyCurrentTestingResult.QunumET3" desc="">
     UPDATE MIL_ET_RESULT T
    SET 
        T.DETECTION_NUM = '#DETECTION_NUM3#'+DETECTION_NUM1+DETECTION_NUM2,
        T.QUALIFIED_NUM = '#QUALIFIED_NUM3#'+QUALIFIED_NUM1+QUALIFIED_NUM2,
        T.QUALIFIED_NUM3 = '#QUALIFIED_NUM3#',
        T.DETECTION_NUM3 = '#DETECTION_NUM3#'     
    WHERE  T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
    </query>
    <query id="FrmEddyCurrentTestingResult.QunumMT1" desc="">
     UPDATE MIL_MT_RESULT T
     SET 
        T.DETECTION_NUM = '#DETECTION_NUM1#'+DETECTION_NUM2,
        T.QUALIFIED_NUM = '#QUALIFIED_NUM1#'+QUALIFIED_NUM2,
        T.QUALIFIED_NUM1 = '#QUALIFIED_NUM1#',
        T.DETECTION_NUM1 = '#DETECTION_NUM1#'
      WHERE  T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
    </query>
    <query id="FrmEddyCurrentTestingResult.QunumMT2" desc="">
     UPDATE MIL_MT_RESULT T
     SET 
        T.DETECTION_NUM = '#DETECTION_NUM2#'+DETECTION_NUM1,
        T.QUALIFIED_NUM = '#QUALIFIED_NUM2#'+QUALIFIED_NUM1,
        T.QUALIFIED_NUM2 = '#QUALIFIED_NUM2#',
        T.DETECTION_NUM2 = '#DETECTION_NUM2#'
      WHERE  T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
    </query>
    <query id="FrmEddyCurrentTestingResult.QunumUT1" desc="">
     UPDATE MIL_UL_RESUL T
     SET 
        T.DETECTION_NUM = '#DETECTION_NUM1#'+DETECTION_NUM2,
        T.QUALIFIED_NUM = '#QUALIFIED_NUM1#'+QUALIFIED_NUM2,
        T.QUALIFIED_NUM1 = '#QUALIFIED_NUM1#',
        T.DETECTION_NUM1 = '#DETECTION_NUM1#'
     WHERE  T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
    </query>
    <query id="FrmEddyCurrentTestingResult.QunumUT2" desc="">
     UPDATE MIL_UL_RESUL T
     SET 
        T.DETECTION_NUM = '#DETECTION_NUM2#'+DETECTION_NUM1,
        T.QUALIFIED_NUM = '#QUALIFIED_NUM2#'+QUALIFIED_NUM1,
        T.QUALIFIED_NUM2 = '#QUALIFIED_NUM2#',
        T.DETECTION_NUM2 = '#DETECTION_NUM2#'
     WHERE  T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
    </query>
    <query id="FrmEddyCurrentTestingResult.CheckIpAddressisin" desc="">
     SELECT 
       T.IP_ADDRESS1,
       T.IP_ADDRESS2,
       T.PROCESS_NO,
       T.OPERAT_CODE,
       T.OPERAT_NAME,
       T.PLINE_CODE,
       T.REMARK,
       T.IP_ADDRESS3,
       T.IP_ADDRESS4
 FROM MIL_BASE_ADDRESS T
 WHERE
T.PROCESS_NO != '#PROCESS_NO#'
OR T.OPERAT_CODE != '#OPERAT_CODE#'
AND T.PLINE_CODE = '#PLINE_CODE#'
    </query>
    <query id="FrmEddyCurrentTestingResult.Insertdetail1" desc="">
    INSERT INTO MIL_TESTING_RESULT_DETAIL(
        RESULT_NO,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        PLINE_CODE,
        START_TIME,
        COL_USER,
        COL_SHIFT,
        COL_GROUP,
        SCRAP_NUM1,
        QUALIFIED_NUM1,
        REINSPECTION_NUM1,
        REINSPECTION_QUALIFIED_NUM1,
        DETECTION_NUM1,
        SUSPECT_PRODUCT_NUM1,
        RECUT_NUM1,
        SCRAP_NUM,
        QUALIFIED_NUM,
        REINSPECTION_NUM,
        REINSPECTION_QUALIFIED_NUM,
        DETECTION_NUM,
        SUSPECT_PRODUCT_NUM,
        RECUT_NUM)
 VALUES( 
        '#RESULT_NO#',
        '#LOT_NO#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#PLINE_CODE#',
        SYSDATE,
        '#COL_USER#',
        '#COL_SHIFT#',
        '#COL_GROUP#',
        '#SCRAP_NUM1#',
        '#QUALIFIED_NUM1#',
        '#REINSPECTION_NUM1#',
        '#REINSPECTION_QUALIFIED_NUM1#',
        '#DETECTION_NUM1#',
        '#SUSPECT_PRODUCT_NUM1#',
        '#RECUT_NUM1#',
        '#SCRAP_NUM1#',
        '#QUALIFIED_NUM1#',
        '#REINSPECTION_NUM1#',
        '#REINSPECTION_QUALIFIED_NUM1#',
        '#DETECTION_NUM1#',
        '#SUSPECT_PRODUCT_NUM1#',
        '#RECUT_NUM1#')
    </query>
    <query id="FrmEddyCurrentTestingResult.Insertdetail2" desc="">
     INSERT INTO MIL_TESTING_RESULT_DETAIL(
        RESULT_NO,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        PLINE_CODE,
        START_TIME,
        COL_USER,
        COL_SHIFT,
        COL_GROUP,
        SCRAP_NUM2,
        QUALIFIED_NUM2,
        REINSPECTION_NUM2,
        REINSPECTION_QUALIFIED_NUM2,
        DETECTION_NUM2,
        SUSPECT_PRODUCT_NUM2,
        RECUT_NUM2,
        SCRAP_NUM,
        QUALIFIED_NUM,
        REINSPECTION_NUM,
        REINSPECTION_QUALIFIED_NUM,
        DETECTION_NUM,
        SUSPECT_PRODUCT_NUM,
        RECUT_NUM)
 VALUES( 
        '#RESULT_NO#',
        '#LOT_NO#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#PLINE_CODE#',
        SYSDATE,
        '#COL_USER#',
        '#COL_SHIFT#',
        '#COL_GROUP#',
        '#SCRAP_NUM2#',
        '#QUALIFIED_NUM2#',
        '#REINSPECTION_NUM2#',
        '#REINSPECTION_QUALIFIED_NUM2#',
        '#DETECTION_NUM2#',
        '#SUSPECT_PRODUCT_NUM2#',
        '#RECUT_NUM2#',
        '#SCRAP_NUM2#',
        '#QUALIFIED_NUM2#',
        '#REINSPECTION_NUM2#',
        '#REINSPECTION_QUALIFIED_NUM2#',
        '#DETECTION_NUM2#',
        '#SUSPECT_PRODUCT_NUM2#',
        '#RECUT_NUM2#')
    </query>
    <query id="FrmEddyCurrentTestingResult.Insertdetail3" desc="">
    INSERT INTO MIL_TESTING_RESULT_DETAIL(
        RESULT_NO,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        PLINE_CODE,
        START_TIME,
        COL_USER,
        COL_SHIFT,
        COL_GROUP,
        SCRAP_NUM3,
        QUALIFIED_NUM3,
        REINSPECTION_NUM3,
        REINSPECTION_QUALIFIED_NUM3,
        DETECTION_NUM3,
        SUSPECT_PRODUCT_NUM3,
        RECUT_NUM3,
        SCRAP_NUM,
        QUALIFIED_NUM,
        REINSPECTION_NUM,
        REINSPECTION_QUALIFIED_NUM,
        DETECTION_NUM,
        SUSPECT_PRODUCT_NUM,
        RECUT_NUM)
 VALUES( 
        '#RESULT_NO#',
        '#LOT_NO#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#PLINE_CODE#',
        SYSDATE,
        '#COL_USER#',
        '#COL_SHIFT#',
        '#COL_GROUP#',
        '#SCRAP_NUM3#',
        '#QUALIFIED_NUM3#',
        '#REINSPECTION_NUM3#',
        '#REINSPECTION_QUALIFIED_NUM3#',
        '#DETECTION_NUM3#',
        '#SUSPECT_PRODUCT_NUM3#',
        '#RECUT_NUM3#',
        '#SCRAP_NUM3#',
        '#QUALIFIED_NUM3#',
        '#REINSPECTION_NUM3#',
        '#REINSPECTION_QUALIFIED_NUM3#',
        '#DETECTION_NUM3#',
        '#SUSPECT_PRODUCT_NUM3#',
        '#RECUT_NUM3#')
    </query>
    <query id="FrmEddyCurrentTestingResult.Insertdetaildse" desc="">
     INSERT INTO MIL_TESTING_RESULT_DETAIL_DES(
        RESULT_NO,
        LOT_NO,
        STOVE_NO,
        JUDGE_STOVE_NO,
        PLINE_CODE,
        COL_USER,
        COL_SHIFT,
        COL_GROUP,
        REASON,
        REASON_NUMBER,
        REASON_FLAG,
        COL_NO)
 VALUES( 
        '#RESULT_NO#',
        '#LOT_NO#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#PLINE_CODE#',
        '#COL_USER#',
        '#COL_SHIFT#',
        '#COL_GROUP#',
        '#REASON#',
        '#REASON_NUMBER#',
        '#REASON_FLAG#',
        '#COL_NO#')
    </query>
    <query id = "EddyCurrentTestingResult.doQueryOffine" desc = "查询是否存在下线支数">
    SELECT T.JUDGE_STOVE_NO
  FROM MIL_TESTING_RACK T
 WHERE T.JUDGE_STOVE_NO = ?
   AND T.PLINE_CODE = ?
   AND T.OFFLINE_FLAG = '1'
   AND (T.OFFLINE_TYPE = '1' or T.OFFLINE_TYPE = '2')
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
    </query>
    <query id = "EddyCurrentTestingResult.selectStraith" desc = "查询矫直合格支数">
    SELECT T.QUALIFIED_NUM FROM MIL_STRAIGHTENING_RESULT T WHERE T.JUDGE_STOVE_NO = ?
    </query>
    <query id = "EddyCurrentTestingResult.insertSeq" desc = "插入剔除品序号">
    
    </query>
    <query id = "EddyCurrentTestingResult.getMtDetail" desc = "查询班次班组下的实绩">
     SELECT 
       RECUT_LEN3,
       TEST_NUM1,
       TEST_NUM2,
       TEST_NUM3,
       REINSPECTION_NUM3,
       REINSPECTION_QUALIFIED_NUM3,
       OFFLINE_NUM3,
       BACKLINE_NUM3,
       DETECTION_NUM3,
       SUSPECT_PRODUCT_NUM3,
       RECUT_NUM3,
       SCRAP_NUM,
       QUALIFIED_NUM,
       REINSPECTION_NUM,
       REINSPECTION_QUALIFIED_NUM,
       OFFLINE_NUM,
       RECUT_LEN2,
       DETECTION_NUM,
       SUSPECT_PRODUCT_NUM,
       RECUT_NUM,
       REMARK,
       COL_NO,
       RECUT_LEN1,
       RESULT_NO,
       LOT_NO,
       STOVE_NO,
       JUDGE_STOVE_NO,
       PLINE_CODE,
       TO_CHAR(START_TIME, 'YYYY-MM-DD HH24:MI:SS') START_TIME,
       TO_CHAR(END_TIME, 'YYYY-MM-DD HH24:MI:SS') END_TIME,
       COL_USER,
       COL_SHIFT,
       COL_GROUP,
       SCRAP_NUM1,
       QUALIFIED_NUM1,
       REINSPECTION_NUM1,
       REINSPECTION_QUALIFIED_NUM1,
       OFFLINE_NUM1,
       BACKLINE_NUM1,
       DETECTION_NUM1,
       SUSPECT_PRODUCT_NUM1,
       RECUT_NUM1,
       SCRAP_NUM2,
       QUALIFIED_NUM2,
       REINSPECTION_NUM2,
       REINSPECTION_QUALIFIED_NUM2,
       OFFLINE_NUM2,
       BACKLINE_NUM2,
       DETECTION_NUM2,
       SUSPECT_PRODUCT_NUM2,
       RECUT_NUM2,
       SCRAP_NUM3,
       QUALIFIED_NUM3,
       SAMPLE_NUM1,
       SAMPLE_NUM2,
       SAMPLE_NUM3
       
 FROM MIL_TESTING_RESULT_DETAIL 
 WHERE JUDGE_STOVE_NO = ?
 AND COL_SHIFT = ?
 AND COL_GROUP = ?
 AND NVL(PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(GX_PLAN_NO, '/') = NVL(?, '/')
    </query>
    <query id = "EddyCurrentTestingResult.doQueryAlarmNum" desc = "查询可疑品">
    SELECT T.REASON,T.REASON_NUMBER AS ACT_COUNT,'True' CHK
  FROM MIL_TESTING_RESULT_DETAIL_DES T
 WHERE T.RESULT_NO = ?
   AND T.LOT_NO = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.COL_SHIFT = ?
   AND T.COL_GROUP = ?
   AND T.COL_NO = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
   AND T.REASON_FLAG = '可疑'
    </query>
   <query id = "EddyCurrentTestingResult.doQueryScrapNumS" desc = "查询剔除品">
   SELECT T.REASON,T.REASON1,T.REASON_NUMBER AS ACT_COUNT,'True' CHK
  FROM MIL_TESTING_RESULT_DETAIL_DES T
 WHERE T.RESULT_NO = ?
   AND T.LOT_NO = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.COL_SHIFT = ?
   AND T.COL_GROUP = ?
   AND T.COL_NO = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
   AND T.REASON_FLAG = '剔除'
   </query>
   <query id = "EddyCurrentTestingResult.doQueryOffineNum" desc = "查询已探伤下线支数">
   SELECT T.REASON,T.REASON_NUMBER AS ACT_COUNT,'True' CHK
  FROM MIL_TESTING_RESULT_DETAIL_DES T
 WHERE T.RESULT_NO = ?
   AND T.LOT_NO = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.COL_SHIFT = ?
   AND T.COL_GROUP = ?
   AND T.COL_NO = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
   AND T.REASON_FLAG = '下线'
   </query>
   <query id = "saveScrapData.deleteSql" desc = "回滚该台所有可疑品下状态">
   <![CDATA[
  DECLARE
  V_OUT            MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := 0;
  V_OFFOUT         MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := 0;
  V_COUNT          MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := 0;
  V_OFFLINECOUNT   MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := 0;
  V_DETAILCOUNT    MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := 0;
  V_REASON_NUMBER  MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := 0;
  V_RESULT_NO      MIL_TESTING_RESULT_DETAIL_DES.RESULT_NO%TYPE := ?;
  V_JUDGE_STOVE_NO MIL_TESTING_RESULT_DETAIL_DES.JUDGE_STOVE_NO%TYPE := ?;
  V_COL_SHIFT      MIL_TESTING_RESULT_DETAIL_DES.COL_SHIFT%TYPE := ?;
  V_COL_GROUP      MIL_TESTING_RESULT_DETAIL_DES.COL_GROUP%TYPE := ?;
  V_COL_NO         MIL_TESTING_RESULT_DETAIL_DES.COL_NO%TYPE := ?;
  V_PRO_PLAN_ID    MIL_TESTING_RESULT_DETAIL_DES.PRO_PLAN_ID%TYPE := ?;
  V_GX_PLAN_NO     MIL_TESTING_RESULT_DETAIL_DES.GX_PLAN_NO%TYPE := ?;
BEGIN
  SELECT NVL(COUNT(1), 0)
    INTO V_OUT
    FROM MIL_TESTING_RESULT_DETAIL_DES T
   WHERE T.RESULT_NO = V_RESULT_NO
     AND T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO
     AND T.COL_SHIFT = V_COL_SHIFT
     AND T.COL_GROUP = V_COL_GROUP
     AND T.COL_NO = V_COL_NO
     AND NVL(T.PRO_PLAN_ID, '/') = NVL(V_PRO_PLAN_ID, '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL(V_GX_PLAN_NO, '/')
     AND T.REASON_FLAG = '下线';
  IF (V_OUT > 0) THEN
    SELECT NVL(SUM(T.REASON_NUMBER), 0)
      INTO V_COUNT
      FROM MIL_TESTING_RESULT_DETAIL_DES T
     WHERE T.RESULT_NO = V_RESULT_NO
       AND T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO
       AND T.COL_SHIFT = V_COL_SHIFT
       AND T.COL_GROUP = V_COL_GROUP
       AND T.COL_NO = V_COL_NO
       AND NVL(T.PRO_PLAN_ID, '/') = NVL(V_PRO_PLAN_ID, '/')
       AND NVL(T.GX_PLAN_NO, '/') = NVL(V_GX_PLAN_NO, '/')
       AND T.REASON_FLAG = '下线';
  END IF;
  DELETE FROM MIL_SLAB_SCRAP_SEQ T
   WHERE T.RESULT_NO = V_RESULT_NO
     AND T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO
     AND T.COL_SHIFT = V_COL_SHIFT
     AND T.COL_GROUP = V_COL_GROUP
     AND T.COL_NO = V_COL_NO
     AND NVL(T.PRO_PLAN_ID, '/') = NVL(V_PRO_PLAN_ID, '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL(V_GX_PLAN_NO, '/')
     AND T.PROCESS_NO = '10';
  IF (V_COUNT > 0) THEN
    UPDATE MIL_OFFLINE_RESLUT T
       SET T.ZP_HEIGHT   = TO_NUMBER(T.ZP_HEIGHT) -
                           TO_NUMBER(V_COUNT * T.ZP_HEIGHT / T.OFFLINE_NUM),
           T.OFFLINE_NUM = TO_NUMBER(T.OFFLINE_NUM) - TO_NUMBER(V_COUNT)
     WHERE T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO
       AND NVL(T.PRO_PLAN_ID, '/') = NVL(V_PRO_PLAN_ID, '/')
       AND NVL(T.GX_PLAN_NO, '/') = NVL(V_GX_PLAN_NO, '/')
       AND T.OFFLINE_PRO = 'TS'
       AND T.OFFLINE_TYPE = '2';
  END IF;
  UPDATE MIL_MT_RESULT T
     SET T.INSPECTIONED_OFFLINE_NUM = TO_NUMBER(T.INSPECTIONED_OFFLINE_NUM) -
                                      TO_NUMBER(V_COUNT)
   WHERE T.RESULT_NO = V_RESULT_NO;

  SELECT NVL(COUNT(1), 0)
    INTO V_OFFOUT
    FROM MIL_OFFLINE_RESLUT T
   WHERE T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO
     AND NVL(T.PRO_PLAN_ID, '/') = NVL(V_PRO_PLAN_ID, '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL(V_GX_PLAN_NO, '/')
     AND T.OFFLINE_PRO = 'TS'
     AND T.OFFLINE_TYPE = '2';
  IF (V_OFFOUT > 0) THEN
    SELECT T.OFFLINE_NUM
      INTO V_OFFLINECOUNT
      FROM MIL_OFFLINE_RESLUT T
     WHERE T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO
       AND NVL(T.PRO_PLAN_ID, '/') = NVL(V_PRO_PLAN_ID, '/')
       AND NVL(T.GX_PLAN_NO, '/') = NVL(V_GX_PLAN_NO, '/')
       AND T.OFFLINE_PRO = 'TS'
       AND T.OFFLINE_TYPE = '2';
  END IF;
  IF (V_OFFLINECOUNT = 0) THEN
    DELETE FROM MIL_OFFLINE_RESLUT T
     WHERE T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO
       AND NVL(T.PRO_PLAN_ID, '/') = NVL(V_PRO_PLAN_ID, '/')
       AND NVL(T.GX_PLAN_NO, '/') = NVL(V_GX_PLAN_NO, '/')
       AND T.OFFLINE_PRO = 'TS'
       AND T.OFFLINE_TYPE = '2';
  END IF;

  SELECT NVL(COUNT(1), 0)
    INTO V_DETAILCOUNT
    FROM MIL_TESTING_RESULT_DETAIL_DES T
   WHERE T.RESULT_NO = V_RESULT_NO
     AND T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO
     AND T.COL_SHIFT = V_COL_SHIFT
     AND T.COL_GROUP = V_COL_GROUP
     AND T.COL_NO = V_COL_NO
     AND NVL(T.PRO_PLAN_ID, '/') = NVL(V_PRO_PLAN_ID, '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL(V_GX_PLAN_NO, '/')
     AND T.REASON_FLAG = '可疑';
  IF (V_DETAILCOUNT > 0) THEN
    SELECT NVL(SUM(T.REASON_NUMBER), 0)
      INTO V_REASON_NUMBER
      FROM MIL_TESTING_RESULT_DETAIL_DES T
     WHERE T.RESULT_NO = V_RESULT_NO
       AND T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO
       AND T.COL_SHIFT = V_COL_SHIFT
       AND T.COL_GROUP = V_COL_GROUP
       AND T.COL_NO = V_COL_NO
       AND NVL(T.PRO_PLAN_ID, '/') = NVL(V_PRO_PLAN_ID, '/')
       AND NVL(T.GX_PLAN_NO, '/') = NVL(V_GX_PLAN_NO, '/')
       AND T.REASON_FLAG = '可疑';
  
    UPDATE MIL_TESTING_RACK T
       SET T.STATUS         = '0',
           T.COL_NO         = '',
           T.ALARM_REASON   = '',
           T.SCRAP_REASON   = '',
           T.SUSPECT_FLAG   = '0',
           T.OFFLINE_TYPE   = '0',
           T.OFFLINE_REASON = '',
           T.RECUT_LENGTH   = '',
           T.RECUT_FLAG     = '0',
           T.OFFLINE_FLAG   = '0',
           T.SAMPLE_FLAG    = '0'
     WHERE T.RESULT_NO = V_RESULT_NO
       AND T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO
       AND T.COL_NO = V_COL_NO
       AND NVL(T.PRO_PLAN_ID, '/') = NVL(V_PRO_PLAN_ID, '/')
       AND NVL(T.GX_PLAN_NO, '/') = NVL(V_GX_PLAN_NO, '/')
       AND T.SUSPECT_FLAG = '1'
       AND ROWNUM <= V_REASON_NUMBER;
    FOR MYROW1 IN (SELECT *
                     FROM (SELECT T.MAT_NO
                             FROM MAT_BC_M T, YDM_BC_BUTTRESS S
                            WHERE T.MAT_NO = S.MAT_NO
                              AND T.ZG_STOVE_SQE = V_JUDGE_STOVE_NO
                              AND T.QCM_STAUS = '11'
                              AND T.PRODUCT_FLAG = '801401'
                              AND T.MAT_STATUS = '80150104'
                            ORDER BY T.MAT_NO DESC)
                    WHERE ROWNUM <= V_COUNT) LOOP
      DELETE FROM MAT_BC_M T WHERE T.MAT_NO = MYROW1.MAT_NO;
      DELETE FROM YDM_BC_BUTTRESS T WHERE T.MAT_NO = MYROW1.MAT_NO;
      DELETE FROM YDM_BC_INLIST T WHERE T.MAT_NO = MYROW1.MAT_NO;
    END LOOP;
  END IF;
  DELETE FROM MIL_TESTING_RESULT_DETAIL_DES T
   WHERE T.RESULT_NO = V_RESULT_NO
     AND T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO
     AND T.COL_SHIFT = V_COL_SHIFT
     AND T.COL_GROUP = V_COL_GROUP
     AND T.COL_NO = V_COL_NO
     AND NVL(T.PRO_PLAN_ID, '/') = NVL(V_PRO_PLAN_ID, '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL(V_GX_PLAN_NO, '/');
END;
]]>
   </query>
   <query id = "saveScrapData.alarmNum" desc = "保存可疑品支数">
   <![CDATA[
  DECLARE
  V_COUNT MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := NULL;
BEGIN

  INSERT INTO MIL_TESTING_RESULT_DETAIL_DES
    (RESULT_NO,
     LOT_NO,
     JUDGE_STOVE_NO,
     PLINE_CODE,
     COL_SHIFT,
     COL_GROUP,
     REASON,
     REASON_NUMBER,
     REASON_FLAG,
     COL_NO,
     PRO_PLAN_ID,
     GX_PLAN_NO)
  VALUES
    (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
  FOR ALARMROW1 IN (SELECT SEQ
                      FROM (SELECT T.SEQ
                              FROM MIL_TESTING_RACK             T,
                                   PORT_MIL_BATCH_SAMPLE_RESULT T1
                             WHERE T.RESULT_NO = ?
                               AND T.JUDGE_STOVE_NO = ?
                               AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
                               AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
                                  --AND T.COL_SHIFT IS NULL
                                  --AND T.COL_GROUP IS NULL
                               AND T.MAT_NO = T1.MAT_NO(+)
                               AND T.JUDGE_STOVE_NO = T1.JUDGE_STOVE_NO(+)
                               AND T.OFFLINE_FLAG = '0'
                               AND T.STATUS = '0'
                               AND T.RETEST_NUM = '0'
                               AND T.RECUT_FLAG = '0'
                               AND T.SUSPECT_FLAG = '0'
                               AND T.SAMPLE_FLAG = '0'
                             ORDER BY T1.IS_SAMPLE_PIPE, T.MAT_NO)
                     WHERE ROWNUM <= ?) LOOP
    UPDATE MIL_TESTING_RACK T
       SET T.STATUS       = '2',
           T.COL_NO       = ?,
           T.ALARM_REASON = ?,
           T.SUSPECT_FLAG = '1'
     WHERE T.RESULT_NO = ?
       AND T.JUDGE_STOVE_NO = ?
       AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
       AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
       AND T.SEQ = ALARMROW1.SEQ;
  END LOOP;
END;
  ]]>
   </query>
   <query id = "saveScrapData.scrapNum" desc = "保存剔除品">
   <![CDATA[
  DECLARE
  V_COUNT MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := NULL;
BEGIN
  INSERT INTO MIL_TESTING_RESULT_DETAIL_DES
    (RESULT_NO,
     LOT_NO,
     JUDGE_STOVE_NO,
     PLINE_CODE,
     COL_SHIFT,
     COL_GROUP,
     REASON,
     REASON_NUMBER,
     REASON_FLAG,
     COL_NO,
     REASON1,
     PRO_PLAN_ID,
     GX_PLAN_NO)
  VALUES
    (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
  IF (? = 'C010') THEN
    FOR SCRAPROW1 IN (SELECT SEQ
                        FROM (SELECT T.SEQ
                                FROM MIL_TESTING_RACK T
                               WHERE T.RESULT_NO = ?
                                 AND T.JUDGE_STOVE_NO = ?
                                 AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
                                 AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
                                    --AND T.COL_SHIFT IS NULL
                                    --AND T.COL_GROUP IS NULL
                                 AND T.OFFLINE_FLAG = '0'
                                 AND T.SUSPECT_FLAG = '1'
                                 AND T.STATUS = '2'
                                 AND T.ALARM_REASON = ?
                                 AND T.COL_NO = ?
                               ORDER BY T.SEQ ASC)
                       WHERE ROWNUM <= ?) LOOP
    
      INSERT INTO MIL_SLAB_SCRAP_SEQ
        (COL_NO,
         COL_TYPE,
         JUDGE_STOVE_NO,
         PROCESS_NO,
         SEQ,
         TIME,
         FLAG,
         COL_MODE,
         COL_TIME,
         COL_USER,
         COL_SHIFT,
         COL_GROUP,
         RESULT_NO,
         PRO_PLAN_ID,
         GX_PLAN_NO)
      VALUES
        (?,
         ?,
         ?,
         ?,
         SCRAPROW1.SEQ,
         SYSDATE,
         ?,
         ?,
         SYSDATE,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?);
      UPDATE MIL_TESTING_RACK T
         SET T.STATUS = '1', T.COL_NO = ?, T.SCRAP_REASON = ?
       WHERE T.RESULT_NO = ?
         AND T.JUDGE_STOVE_NO = ?
         AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
         AND T.SEQ = SCRAPROW1.SEQ;
    END LOOP;
  ELSE
    FOR SCRAPROW2 IN (SELECT SEQ
                        FROM (SELECT T.SEQ
                                FROM MIL_TESTING_RACK T
                               WHERE T.RESULT_NO = ?
                                 AND T.JUDGE_STOVE_NO = ?
                                 AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
                                 AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
                                    --AND T.COL_SHIFT IS NULL
                                    --AND T.COL_GROUP IS NULL
                                 AND T.OFFLINE_FLAG = '0'
                                 AND T.SUSPECT_FLAG = '1'
                                 AND T.STATUS = '2'
                                 AND T.ALARM_REASON = ?
                                 AND T.COL_NO = ?
                               ORDER BY T.SEQ ASC)
                       WHERE ROWNUM <= ?) LOOP
      INSERT INTO MIL_SLAB_SCRAP_SEQ
        (COL_NO,
         COL_TYPE,
         JUDGE_STOVE_NO,
         PROCESS_NO,
         SEQ,
         TIME,
         FLAG,
         COL_MODE,
         COL_TIME,
         COL_USER,
         COL_SHIFT,
         COL_GROUP,
         RESULT_NO,
         PRO_PLAN_ID,
         GX_PLAN_NO)
      VALUES
        (?,
         ?,
         ?,
         ?,
         SCRAPROW2.SEQ,
         SYSDATE,
         ?,
         ?,
         SYSDATE,
         ?,
         ?,
         ?,
         ?,
         ?,
         ?);
      UPDATE MIL_TESTING_RACK T
         SET T.STATUS = '1', T.COL_NO = ?, T.SCRAP_REASON = ?
       WHERE T.RESULT_NO = ?
         AND T.JUDGE_STOVE_NO = ?
         AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
         AND T.SEQ = SCRAPROW2.SEQ;
    END LOOP;
  END IF;
END;
   ]]>
   </query>
   <query id = "saveScrapData.offlineNum" desc = "保存下线品">
   <![CDATA[
  DECLARE
  V_COUNT MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := NULL;
BEGIN
  INSERT INTO MIL_TESTING_RESULT_DETAIL_DES
    (RESULT_NO,
     LOT_NO,
     JUDGE_STOVE_NO,
     PLINE_CODE,
     COL_SHIFT,
     COL_GROUP,
     REASON,
     REASON_NUMBER,
     REASON_FLAG,
     COL_NO,
     PRO_PLAN_ID,
     GX_PLAN_NO)
  VALUES
    (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
  FOR SCRAPROW1 IN (SELECT SEQ
                      FROM (SELECT T.SEQ
                              FROM MIL_TESTING_RACK T
                             WHERE T.RESULT_NO = ?
                               AND T.JUDGE_STOVE_NO = ?
                               AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
                               AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
                                  --AND T.COL_SHIFT IS NULL
                                  --AND T.COL_GROUP IS NULL
                               AND T.OFFLINE_FLAG = '0'
                               AND T.STATUS = '2'
                               AND T.COL_NO = ?
                             ORDER BY T.SEQ ASC)
                     WHERE ROWNUM <= ?) LOOP
    UPDATE MIL_TESTING_RACK T
       SET T.OFFLINE_FLAG   = '1',
           T.OFFLINE_TYPE   = '2',
           T.COL_NO         = ?,
           T.OFFLINE_REASON = ?,
           T.OFFLINE_TIME   = sysdate
     WHERE T.RESULT_NO = ?
       AND T.JUDGE_STOVE_NO = ?
       AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
       AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
       AND T.SEQ = SCRAPROW1.SEQ;
    INSERT INTO MIL_SLAB_SCRAP_SEQ
      (COL_NO,
       COL_TYPE,
       JUDGE_STOVE_NO,
       PROCESS_NO,
       SEQ,
       TIME,
       FLAG,
       COL_MODE,
       COL_TIME,
       COL_USER,
       COL_SHIFT,
       COL_GROUP,
       RESULT_NO,
       OFFLINE_TYPE,
       PRO_PLAN_ID,
       GX_PLAN_NO)
    VALUES
      (?,
       ?,
       ?,
       ?,
       SCRAPROW1.SEQ,
       SYSDATE,
       ?,
       ?,
       SYSDATE,
       ?,
       ?,
       ?,
       ?,
       '2',
       ?,
       ?);
  END LOOP;
  UPDATE MIL_MT_RESULT T
     SET T.INSPECTIONED_OFFLINE_NUM = TO_NUMBER(T.INSPECTIONED_OFFLINE_NUM) +
                                      TO_NUMBER(?)
   WHERE T.RESULT_NO = ?
     AND T.JUDGE_STOVE_NO = ?
     AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/');

  UPDATE MIL_ET_RESULT T
     SET T.INSPECTIONED_OFFLINE_NUM = TO_NUMBER(T.INSPECTIONED_OFFLINE_NUM) +
                                      TO_NUMBER(?)
   WHERE T.RESULT_NO = ?
     AND T.JUDGE_STOVE_NO = ?
     AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/');
END;
   ]]>
   </query>
   <query id = "saveScrapData.insertOffResult" desc = "插入下线表">
  DECLARE
  V_COUNT          MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := 0;
  V_PIPSIZE        MIL_PLAN.PIPE_SIZE%TYPE := NULL;
  V_TARGET_LENGTH  MIL_PLAN.TARGET_LENGTH%TYPE := NULL;
  V_ID             MIL_PLAN.ID%TYPE := ?;
  V_JUDGE_STOVE_NO MIL_OFFLINE_RESLUT.JUDGE_STOVE_NO%TYPE := ?;

  V_PRO_PLAN_ID MIL_OFFLINE_RESLUT.PRO_PLAN_ID%TYPE := NULL;
  V_GX_PLAN_NO  MIL_OFFLINE_RESLUT.GX_PLAN_NO%TYPE := NULL;
  V_OFFLINE_DOC MIL_OFFLINE_RESLUT.OFFLINE_DOC%TYPE := NULL;
BEGIN
  SELECT T.PRO_PLAN_ID, T.GX_PLAN_NO
    INTO V_PRO_PLAN_ID, V_GX_PLAN_NO
    FROM MIL_PLAN T
   WHERE T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO
     AND T.ID = V_ID;

  SELECT T.PIPE_SIZE, T.TARGET_LENGTH
    INTO V_PIPSIZE, V_TARGET_LENGTH
    FROM MIL_PLAN T
   WHERE T.ID = V_ID
     AND T.JUDGE_STOVE_NO = V_JUDGE_STOVE_NO;

  SELECT NVL(COUNT(1), 0)
    INTO V_COUNT
    FROM MIL_OFFLINE_RESLUT T
   WHERE T.JUDGE_STOVE_NO = ?
     AND T.OFFLINE_PRO = 'TS'
     AND T.OFFLINE_TYPE = '2';

  SELECT 'D' || TO_CHAR(SYSDATE, 'YYYYMM') ||
         LPAD(NVL(MAX(SUBSTR(T.OFFLINE_DOC, 8, 4)), 0) + 1, 4, 0)
    INTO V_OFFLINE_DOC
    FROM MIL_OFFLINE_RESLUT T
   WHERE TO_CHAR(T.OFFLINE_TIME, 'YYYYMM') = TO_CHAR(SYSDATE, 'YYYYMM');

  IF (V_COUNT > 0) THEN
    UPDATE MIL_OFFLINE_RESLUT T
       SET T.OFFLINE_NUM = TO_NUMBER(T.OFFLINE_NUM) + TO_NUMBER(?),
           T.ZP_HEIGHT   = TO_NUMBER(T.ZP_HEIGHT) +
                           to_number(substr(0.02466 *
                                            SUBSTR(V_PIPSIZE,
                                                   INSTR(V_PIPSIZE, '*') + 1) *
                                            (SUBSTR(V_PIPSIZE,
                                                    0,
                                                    INSTR(V_PIPSIZE, '*') - 1) -
                                            SUBSTR(V_PIPSIZE,
                                                    INSTR(V_PIPSIZE, '*') + 1)) / 1000,
                                            0,
                                            instr(0.02466 *
                                                  SUBSTR(V_PIPSIZE,
                                                         INSTR(V_PIPSIZE, '*') + 1) *
                                                  (SUBSTR(V_PIPSIZE,
                                                          0,
                                                          INSTR(V_PIPSIZE, '*') - 1) -
                                                  SUBSTR(V_PIPSIZE,
                                                          INSTR(V_PIPSIZE, '*') + 1)) / 1000,
                                                  '.') + 3)) * to_number(?) *
                           to_number(V_TARGET_LENGTH)
     WHERE T.JUDGE_STOVE_NO = ?
       AND T.OFFLINE_PRO = 'TS'
       AND T.OFFLINE_TYPE = '2';
  ELSE
    FOR MYROW IN (SELECT *
                    FROM MIL_PLAN T
                   WHERE T.ID = ?
                     AND T.JUDGE_STOVE_NO = ?) LOOP
      INSERT INTO MIL_OFFLINE_RESLUT
        (RECHECK_NUM,
         PRODUCNAME,
         STEELCODE,
         STEELNAME,
         GRADECODE,
         GRADENAME,
         SPEC_CODE,
         SPEC_NAME,
         MODEL_CODE,
         MODEL_DESC,
         STD_CODE,
         STD_NAME,
         STD_STYLE,
         STD_STYLE_DESC,
         ACT_LEN_RANGE,
         CONTRACT_NO,
         PRODUCCODE,
         INSTORAGE_NUM,
         QUALIFIED_NUM,
         SCRAP_NUM,
         ZP_M_LH,
         LOT_NO,
         STOVE_NO,
         JUDGE_STOVE_NO,
         DIAMETER,
         THICKNESS,
         LENGTH,
         PLINE_CODE,
         OFFLINE_PRO,
         REAL_TIME_STATUS,
         OFFLINE_NUM,
         BACKLINE_NUM,
         GROUP_NUM,
         FINAL_NUM,
         ZP_FLAG,
         STATUS,
         TYPE_FLAG,
         OFFLINE_TIME,
         REMARK,
         COL_USER,
         COL_SHIFT,
         COL_GROUP,
         ZP_HEIGHT,
         OFFLINE_TYPE,
         TARGET,
         IMP_PROCESS,
         PRO_PLAN_ID,
         GX_PLAN_NO,
         OFFLINE_DOC,
         LOAD_JUDGE_STOVE_NO)
      VALUES
        ('0',
         MYROW.VARIETIES,
         MYROW.STEELCODE,
         MYROW.STEELNAME,
         MYROW.GRADECODE,
         MYROW.GRADENAME,
         MYROW.PIPE_SIZE_CODE,
         MYROW.PIPE_SIZE,
         MYROW.BUCKLE_TYPE_CODE,
         MYROW.BUCKLE_TYPE,
         MYROW.ROLL_STANDRAD_CODE,
         MYROW.ROLL_STANDRAD,
         MYROW.STD_STYLE,
         MYROW.STD_STYLE_DESC,
         MYROW.LENGTH_RANGE,
         MYROW.CONTRACT_NO,
         MYROW.VARIETIES_CODE,
         '0',
         '0',
         '0',
         '',
         MYROW.LOT_NO,
         MYROW.STOVE_NO,
         MYROW.JUDGE_STOVE_NO,
         SUBSTR(MYROW.PIPE_SIZE, 0, INSTR(MYROW.PIPE_SIZE, '*') - 1),
         SUBSTR(MYROW.PIPE_SIZE, INSTR(MYROW.PIPE_SIZE, '*') + 1),
         MYROW.TARGET_LENGTH,
         MYROW.PLINE_CODE,
         'TS',
         '0',
         ?,
         '0',
         '0',
         '',
         '0',
         '0',
         '0',
         SYSDATE,
         '',
         ?,
         ?,
         ?,
         to_number(substr(0.02466 *
                          SUBSTR(MYROW.PIPE_SIZE,
                                 INSTR(MYROW.PIPE_SIZE, '*') + 1) *
                          (SUBSTR(MYROW.PIPE_SIZE,
                                  0,
                                  INSTR(MYROW.PIPE_SIZE, '*') - 1) -
                          SUBSTR(MYROW.PIPE_SIZE,
                                  INSTR(MYROW.PIPE_SIZE, '*') + 1)) / 1000,
                          0,
                          instr(0.02466 *
                                SUBSTR(MYROW.PIPE_SIZE,
                                       INSTR(MYROW.PIPE_SIZE, '*') + 1) *
                                (SUBSTR(MYROW.PIPE_SIZE,
                                        0,
                                        INSTR(MYROW.PIPE_SIZE, '*') - 1) -
                                SUBSTR(MYROW.PIPE_SIZE,
                                        INSTR(MYROW.PIPE_SIZE, '*') + 1)) / 1000,
                                '.') + 3)) * to_number(?) *
         to_number(MYROW.TARGET_LENGTH),
         '2',
         MYROW.TARGET,
         MYROW.IMP_PROCESS,
         V_PRO_PLAN_ID,
         V_GX_PLAN_NO,
         ?,
         MYROW.FEED_HEAT_NO);
    END LOOP;
  END IF;
END;

   </query>
   <query id = "EddyCurrentTestingResult.saveMtResult" desc = "保存漏磁探伤实绩">
   <![CDATA[
  DECLARE
  V_COUNT                       MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := NULL;
  V_DETECTION_NUM1              MIL_TESTING_RESULT_DETAIL.DETECTION_NUM1%TYPE := NULL;
  V_SCRAP_NUM1                  MIL_TESTING_RESULT_DETAIL.SCRAP_NUM1%TYPE := NULL;
  V_QUALIFIED_NUM1              MIL_TESTING_RESULT_DETAIL.QUALIFIED_NUM1%TYPE := NULL;
  V_REINSPECTION_NUM1           MIL_TESTING_RESULT_DETAIL.REINSPECTION_NUM1%TYPE := NULL;
  V_SUSPECT_PRODUCT_NUM1        MIL_TESTING_RESULT_DETAIL.SUSPECT_PRODUCT_NUM1%TYPE := NULL;
  V_RECUT_NUM1                  MIL_TESTING_RESULT_DETAIL.RECUT_NUM1%TYPE := NULL;
  V_RECUT_LEN1                  MIL_TESTING_RESULT_DETAIL.RECUT_LEN1%TYPE := NULL;
  V_TEST_NUM1                   MIL_TESTING_RESULT_DETAIL.TEST_NUM1%TYPE := NULL;
  V_REINSPECTION_QUALIFIED_NUM1 MIL_TESTING_RESULT_DETAIL.REINSPECTION_QUALIFIED_NUM1%TYPE := NULL;
  V_SAMPLE_NUM1                 MIL_TESTING_RESULT_DETAIL.SAMPLE_NUM1%TYPE := NULL;
  V_DETECTION_NUM2              MIL_TESTING_RESULT_DETAIL.DETECTION_NUM2%TYPE := NULL;
  V_SCRAP_NUM2                  MIL_TESTING_RESULT_DETAIL.SCRAP_NUM2%TYPE := NULL;
  V_QUALIFIED_NUM2              MIL_TESTING_RESULT_DETAIL.QUALIFIED_NUM2%TYPE := NULL;
  V_REINSPECTION_NUM2           MIL_TESTING_RESULT_DETAIL.REINSPECTION_NUM2%TYPE := NULL;
  V_SUSPECT_PRODUCT_NUM2        MIL_TESTING_RESULT_DETAIL.SUSPECT_PRODUCT_NUM2%TYPE := NULL;
  V_RECUT_NUM2                  MIL_TESTING_RESULT_DETAIL.RECUT_NUM2%TYPE := NULL;
  V_RECUT_LEN2                  MIL_TESTING_RESULT_DETAIL.RECUT_LEN2%TYPE := NULL;
  V_TEST_NUM2                   MIL_TESTING_RESULT_DETAIL.TEST_NUM2%TYPE := NULL;
  V_REINSPECTION_QUALIFIED_NUM2 MIL_TESTING_RESULT_DETAIL.REINSPECTION_QUALIFIED_NUM2%TYPE := NULL;
  V_SAMPLE_NUM2                 MIL_TESTING_RESULT_DETAIL.SAMPLE_NUM2%TYPE := NULL;
  V_RACKCOUNT                   MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := NULL;
  V_QUALIFIED_NUM               MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := NULL;
BEGIN
  --查询实绩字表是否已存在实绩
  SELECT NVL(COUNT(1), 0)
    INTO V_COUNT
    FROM MIL_TESTING_RESULT_DETAIL T
   WHERE T.RESULT_NO = '#RESULT_NO#'
     AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
     AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
     AND T.COL_SHIFT = '#COL_SHIFT#'
     AND T.COL_GROUP = '#COL_GROUP#';
  SELECT T.QUALIFIED_NUM
    INTO V_QUALIFIED_NUM
    FROM MIL_MT_RESULT T
   WHERE T.RESULT_NO = '#RESULT_NO#'
     AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
     AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
  IF (V_COUNT > 0) THEN
    --存在看是哪个操作台
    IF ('#COL_NO#' = '1') THEN
      SELECT T.DETECTION_NUM1,
             T.SCRAP_NUM1,
             T.QUALIFIED_NUM1,
             T.REINSPECTION_NUM1,
             T.SUSPECT_PRODUCT_NUM1,
             T.RECUT_NUM1,
             T.REINSPECTION_QUALIFIED_NUM1,
             T.SAMPLE_NUM1
        INTO V_DETECTION_NUM1,
             V_SCRAP_NUM1,
             V_QUALIFIED_NUM1,
             V_REINSPECTION_NUM1,
             V_SUSPECT_PRODUCT_NUM1,
             V_RECUT_NUM1,
             V_REINSPECTION_QUALIFIED_NUM1,
             V_SAMPLE_NUM1
        FROM MIL_TESTING_RESULT_DETAIL T
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      --把该班次班组原支数在实绩主表减去
      IF (V_QUALIFIED_NUM > 0) THEN
        UPDATE MIL_MT_RESULT T
           SET T.DETECTION_NUM              = TO_NUMBER(T.DETECTION_NUM) -
                                              TO_NUMBER(V_DETECTION_NUM1),
               T.SCRAP_NUM                  = TO_NUMBER(T.SCRAP_NUM) -
                                              TO_NUMBER(V_SCRAP_NUM1),
               T.QUALIFIED_NUM              = TO_NUMBER(T.QUALIFIED_NUM) -
                                              TO_NUMBER(V_QUALIFIED_NUM1),
               T.REINSPECTION_NUM           = TO_NUMBER(T.REINSPECTION_NUM) -
                                              TO_NUMBER(V_REINSPECTION_NUM1),
               T.ALARM_NUM                  = TO_NUMBER(T.ALARM_NUM) -
                                              TO_NUMBER(V_SUSPECT_PRODUCT_NUM1),
               T.RECUT_NUM                  = TO_NUMBER(T.RECUT_NUM) -
                                              TO_NUMBER(V_RECUT_NUM1),
               T.QA_TON                     = TO_NUMBER(T.QA_TON) -
                                              TO_NUMBER(T.QA_TON /
                                                        QUALIFIED_NUM) *
                                              TO_NUMBER(V_QUALIFIED_NUM1),
               T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) -
                                              TO_NUMBER(V_REINSPECTION_QUALIFIED_NUM1),
               T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) -
                                              TO_NUMBER(V_SAMPLE_NUM1)
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      ELSIF (V_QUALIFIED_NUM = 0) THEN
        UPDATE MIL_MT_RESULT T
           SET T.DETECTION_NUM    = TO_NUMBER(T.DETECTION_NUM) -
                                    TO_NUMBER(V_DETECTION_NUM1),
               T.SCRAP_NUM        = TO_NUMBER(T.SCRAP_NUM) -
                                    TO_NUMBER(V_SCRAP_NUM1),
               T.QUALIFIED_NUM    = TO_NUMBER(T.QUALIFIED_NUM) -
                                    TO_NUMBER(V_QUALIFIED_NUM1),
               T.REINSPECTION_NUM = TO_NUMBER(T.REINSPECTION_NUM) -
                                    TO_NUMBER(V_REINSPECTION_NUM1),
               T.ALARM_NUM        = TO_NUMBER(T.ALARM_NUM) -
                                    TO_NUMBER(V_SUSPECT_PRODUCT_NUM1),
               T.RECUT_NUM        = TO_NUMBER(T.RECUT_NUM) -
                                    TO_NUMBER(V_RECUT_NUM1),
               
               T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) -
                                              TO_NUMBER(V_REINSPECTION_QUALIFIED_NUM1),
               T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) -
                                              TO_NUMBER(V_SAMPLE_NUM1)
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      END IF;
      --把实绩主表的支数增加
      UPDATE MIL_MT_RESULT T
         SET T.DETECTION_NUM              = TO_NUMBER(T.DETECTION_NUM) +
                                            TO_NUMBER('#DETECTION_NUM1#'),
             T.SCRAP_NUM                  = TO_NUMBER(T.SCRAP_NUM) +
                                            TO_NUMBER('#SCRAP_NUM1#'),
             T.QUALIFIED_NUM              = TO_NUMBER(T.QUALIFIED_NUM) +
                                            TO_NUMBER('#QUALIFIED_NUM1#'),
             T.REINSPECTION_NUM           = TO_NUMBER(T.REINSPECTION_NUM) +
                                            TO_NUMBER('#REINSPECTION_NUM1#'),
             T.ALARM_NUM                  = TO_NUMBER(T.ALARM_NUM) +
                                            TO_NUMBER('#SUSPECT_PRODUCT_NUM1#'),
             T.RECUT_NUM                  = TO_NUMBER(T.RECUT_NUM) +
                                            TO_NUMBER('#RECUT_NUM1#'),
             T.QA_TON                     = TO_NUMBER(T.QA_TON) +
                                            TO_NUMBER('#QA_TON#'),
             T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) +
                                            TO_NUMBER('#REINSPECTION_QUALIFIED_NUM1#'),
             T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) +
                                            TO_NUMBER('#SAMPLE_NUM1#'),
             T.PRODUCT_STANDARDS          = '#PRODUCT_STANDARDS#',
             T.LO_SURFACE                 = '#LO_SURFACE#',
             T.LI_SURFACE                 = '#LI_SURFACE#',
             T.TO_SURFACE                 = '#TO_SURFACE#',
             T.TI_SURFACE                 = '#TI_SURFACE#',
             T.GROOVE_SHAPE               = '#GROOVE_SHAPE#',
             T.INSPECTION_STANDARD        = '#INSPECTION_STANDARD#',
             T.LONGITUDINAL_CURRENT1      = '#LONGITUDINAL_CURRENT1#',
             T.TRANSVERSE_CURRENT1        = '#TRANSVERSE_CURRENT1#',
             T.LONGITUDINAL_CURRENT2      = '#LONGITUDINAL_CURRENT2#',
             T.TRANSVERSE_CURRENT2        = '#TRANSVERSE_CURRENT2#',
             T.SPEED1                     = '#SPEED1#',
             T.SPEED2                     = '#SPEED2#',
             T.DETECTION_SPEED1           = '#DETECTION_SPEED1#',
             T.DETECTION_SPEED2           = '#DETECTION_SPEED2#',
             T.REMARK                     = '#REMARK#',
             T.REMARK1                    = '#REMARK1#',
             T.NOTCH_INFO                 = '#NOTCH_INFO#',
             T.NOTCH_LENGTH               = '#NOTCH_LENGTH#',
             T.NOTCH_WIDTH                = '#NOTCH_WIDTH#',
             T.NOTCH_DEPTH                = '#NOTCH_DEPTH#',
             T.NOTCH_FX                   = '#NOTCH_FX#',
             T.COVERAGE                   = '#COVERAGE#',
             T.SAMPLE_NO                  = '#SAMPLE_NO#',
             T.SIGNID                     = '#SIGNID#',
             T.SIGNID_GRADE               = '2',
             T.USERID1                    = '#USERID1#',
             T.USERID2                    = '#USERID2#',
             T.USERID_GRADE1              = '#USERID_GRADE1#',
             T.USERID_GRADE2              = '#USERID_GRADE2#',
               T.USERID1JD                    = '#USERID1JD#',
             T.USERID2JD                    = '#USERID2JD#',
             T.USERID_GRADE1JD              = '#USERID_GRADE1JD#',
             T.USERID_GRADE2JD              = '#USERID_GRADE2JD#',
             T.STANDARDS_NO               = '#STANDARDS_NO#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      --修改实绩子表
      UPDATE MIL_TESTING_RESULT_DETAIL T
         SET T.DETECTION_NUM1              = '#DETECTION_NUM1#',
             T.SCRAP_NUM1                  = '#SCRAP_NUM1#',
             T.QUALIFIED_NUM1              = '#QUALIFIED_NUM1#',
             T.REINSPECTION_NUM1           = '#REINSPECTION_NUM1#',
             T.REINSPECTION_QUALIFIED_NUM1 = '#REINSPECTION_QUALIFIED_NUM1#',
             T.SUSPECT_PRODUCT_NUM1        = '#SUSPECT_PRODUCT_NUM1#',
             T.RECUT_NUM1                  = '#RECUT_NUM1#',
             T.RECUT_LEN1                  = '#RECUT_LEN1#',
             T.TEST_NUM1                   = '#TEST_NUM1#',
             T.SAMPLE_NUM1                 = '#SAMPLE_NUM1#',
             T.COL_USER                    = '#COL_USER#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      --处理1号台管号队列
      SELECT NVL(COUNT(1), 0)
        INTO V_RACKCOUNT
        FROM MIL_TESTING_RACK T
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT IS NULL
         AND T.COL_GROUP IS NULL;
      IF (V_RACKCOUNT > 0) THEN
        UPDATE MIL_TESTING_RACK T
           SET T.RETEST_NUM   = '0',
               T.RECUT_LENGTH = '',
               T.RECUT_FLAG   = '0',
               T.SAMPLE_FLAG  = '0'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.COL_SHIFT IS NULL
           AND T.COL_GROUP IS NULL;
        FOR MYROW IN (SELECT SEQ
                        FROM (SELECT T.SEQ
                                FROM MIL_TESTING_RACK T
                               WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                 AND NVL(T.PRO_PLAN_ID, '/') =
                                     NVL('#PRO_PLAN_ID#', '/')
                                 AND NVL(T.GX_PLAN_NO, '/') =
                                     NVL('#GX_PLAN_NO#', '/')
                                 AND T.RESULT_NO = '#RESULT_NO#'
                                 AND T.SUSPECT_FLAG = '1'
                                 AND T.RETEST_NUM = '0'
                                 AND T.OFFLINE_FLAG = '0'
                                 AND T.COL_NO = '#COL_NO#'
                                 AND T.COL_SHIFT IS NULL
                                 AND T.COL_GROUP IS NULL
                               ORDER BY T.SEQ ASC)
                       WHERE ROWNUM <= #REINSPECTION_NUM1#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.RETEST_NUM = '#TEST_NUM1#'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW.SEQ;
        END LOOP;
        FOR MYROW1 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '1'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.RECUT_FLAG = '0'
                                  AND T.COL_NO = '#COL_NO#'
                                  AND T.STATUS = '2'
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #RECUT_NUM1#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.RECUT_LENGTH = '#RECUT_LEN1#', T.RECUT_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW1.SEQ;
        END LOOP;
        FOR MYROW4 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                     
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #SAMPLE_NUM1#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.SAMPLE_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW4.SEQ;
        END LOOP;
      ELSE
        FOR MYROW2 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '1'
                                  AND T.RETEST_NUM = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.COL_NO = '#COL_NO#'
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #REINSPECTION_NUM1#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.RETEST_NUM = '#TEST_NUM1#'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW2.SEQ;
        END LOOP;
        FOR MYROW3 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '1'
                                  AND T.RECUT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.STATUS = '2'
                                  AND T.COL_NO = '#COL_NO#'
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #RECUT_NUM1#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.RECUT_LENGTH = '#RECUT_LEN1#', T.RECUT_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW3.SEQ;
        END LOOP;
        FOR MYROW5 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #SAMPLE_NUM1#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.SAMPLE_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW5.SEQ;
        END LOOP;
      END IF;
    ELSE
      --258二号操作台
      SELECT T.DETECTION_NUM2,
             T.SCRAP_NUM2,
             T.QUALIFIED_NUM2,
             T.REINSPECTION_NUM2,
             T.SUSPECT_PRODUCT_NUM2,
             T.RECUT_NUM2,
             T.REINSPECTION_QUALIFIED_NUM2,
             T.SAMPLE_NUM2
        INTO V_DETECTION_NUM2,
             V_SCRAP_NUM2,
             V_QUALIFIED_NUM2,
             V_REINSPECTION_NUM2,
             V_SUSPECT_PRODUCT_NUM2,
             V_RECUT_NUM2,
             V_REINSPECTION_QUALIFIED_NUM2,
             V_SAMPLE_NUM2
        FROM MIL_TESTING_RESULT_DETAIL T
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      IF (V_QUALIFIED_NUM > 0) THEN
        UPDATE MIL_MT_RESULT T
           SET T.DETECTION_NUM              = TO_NUMBER(T.DETECTION_NUM) -
                                              TO_NUMBER(V_DETECTION_NUM2),
               T.SCRAP_NUM                  = TO_NUMBER(T.SCRAP_NUM) -
                                              TO_NUMBER(V_SCRAP_NUM2),
               T.QUALIFIED_NUM              = TO_NUMBER(T.QUALIFIED_NUM) -
                                              TO_NUMBER(V_QUALIFIED_NUM2),
               T.REINSPECTION_NUM           = TO_NUMBER(T.REINSPECTION_NUM) -
                                              TO_NUMBER(V_REINSPECTION_NUM2),
               T.ALARM_NUM                  = TO_NUMBER(T.ALARM_NUM) -
                                              TO_NUMBER(V_SUSPECT_PRODUCT_NUM2),
               T.RECUT_NUM                  = TO_NUMBER(T.RECUT_NUM) -
                                              TO_NUMBER(V_RECUT_NUM2),
               T.QA_TON                     = TO_NUMBER(T.QA_TON) -
                                              TO_NUMBER(T.QA_TON /
                                                        QUALIFIED_NUM) *
                                              TO_NUMBER(V_QUALIFIED_NUM2),
               T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) -
                                              TO_NUMBER(V_REINSPECTION_QUALIFIED_NUM2),
               T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) -
                                              TO_NUMBER(V_SAMPLE_NUM2)
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      END IF;
      UPDATE MIL_MT_RESULT T
         SET T.DETECTION_NUM              = TO_NUMBER(T.DETECTION_NUM) +
                                            TO_NUMBER('#DETECTION_NUM2#'),
             T.SCRAP_NUM                  = TO_NUMBER(T.SCRAP_NUM) +
                                            TO_NUMBER('#SCRAP_NUM2#'),
             T.QUALIFIED_NUM              = TO_NUMBER(T.QUALIFIED_NUM) +
                                            TO_NUMBER('#QUALIFIED_NUM2#'),
             T.REINSPECTION_NUM           = TO_NUMBER(T.REINSPECTION_NUM) +
                                            TO_NUMBER('#REINSPECTION_NUM2#'),
             T.ALARM_NUM                  = TO_NUMBER(T.ALARM_NUM) +
                                            TO_NUMBER('#SUSPECT_PRODUCT_NUM2#'),
             T.RECUT_NUM                  = TO_NUMBER(T.RECUT_NUM) +
                                            TO_NUMBER('#RECUT_NUM2#'),
             T.QA_TON                     = TO_NUMBER(T.QA_TON) +
                                            TO_NUMBER('#QA_TON#'),
             T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) +
                                            TO_NUMBER('#REINSPECTION_QUALIFIED_NUM2#'),
             T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) +
                                            TO_NUMBER('#SAMPLE_NUM2#'),
             T.PRODUCT_STANDARDS          = '#PRODUCT_STANDARDS#',
             T.LO_SURFACE                 = '#LO_SURFACE#',
             T.LI_SURFACE                 = '#LI_SURFACE#',
             T.TO_SURFACE                 = '#TO_SURFACE#',
             T.TI_SURFACE                 = '#TI_SURFACE#',
             T.GROOVE_SHAPE               = '#GROOVE_SHAPE#',
             T.INSPECTION_STANDARD        = '#INSPECTION_STANDARD#',
             T.LONGITUDINAL_CURRENT1      = '#LONGITUDINAL_CURRENT1#',
             T.TRANSVERSE_CURRENT1        = '#TRANSVERSE_CURRENT1#',
             T.LONGITUDINAL_CURRENT2      = '#LONGITUDINAL_CURRENT2#',
             T.TRANSVERSE_CURRENT2        = '#TRANSVERSE_CURRENT2#',
             T.SPEED1                     = '#SPEED1#',
             T.SPEED2                     = '#SPEED2#',
             T.DETECTION_SPEED1           = '#DETECTION_SPEED1#',
             T.DETECTION_SPEED2           = '#DETECTION_SPEED2#',
             T.REMARK                     = '#REMARK#',
             T.REMARK1                    = '#REMARK1#',
             T.NOTCH_INFO                 = '#NOTCH_INFO#',
             T.NOTCH_LENGTH               = '#NOTCH_LENGTH#',
             T.NOTCH_WIDTH                = '#NOTCH_WIDTH#',
             T.NOTCH_DEPTH                = '#NOTCH_DEPTH#',
             T.NOTCH_FX                   = '#NOTCH_FX#',
             T.COVERAGE                   = '#COVERAGE#',
             T.SAMPLE_NO                  = '#SAMPLE_NO#',
             T.SIGNID                     = '#SIGNID#',
             T.SIGNID_GRADE               = '2',
             T.USERID1                    = '#USERID1#',
             T.USERID2                    = '#USERID2#',
             T.USERID_GRADE1              = '#USERID_GRADE1#',
             T.USERID_GRADE2              = '#USERID_GRADE2#',
               T.USERID1JD                    = '#USERID1JD#',
             T.USERID2JD                    = '#USERID2JD#',
             T.USERID_GRADE1JD              = '#USERID_GRADE1JD#',
             T.USERID_GRADE2JD              = '#USERID_GRADE2JD#',
             T.STANDARDS_NO               = '#STANDARDS_NO#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
    
      UPDATE MIL_TESTING_RESULT_DETAIL T
         SET T.DETECTION_NUM2              = '#DETECTION_NUM2#',
             T.SCRAP_NUM2                  = '#SCRAP_NUM2#',
             T.QUALIFIED_NUM2              = '#QUALIFIED_NUM2#',
             T.REINSPECTION_NUM2           = '#REINSPECTION_NUM2#',
             T.REINSPECTION_QUALIFIED_NUM2 = '#REINSPECTION_QUALIFIED_NUM2#',
             T.SUSPECT_PRODUCT_NUM2        = '#SUSPECT_PRODUCT_NUM2#',
             T.RECUT_NUM2                  = '#RECUT_NUM2#',
             T.RECUT_LEN2                  = '#RECUT_LEN2#',
             T.TEST_NUM2                   = '#TEST_NUM2#',
             T.SAMPLE_NUM2                 = '#SAMPLE_NUM2#',
             T.COL_USER                    = '#COL_USER#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      --处理二号台管号队列
      SELECT NVL(COUNT(1), 0)
        INTO V_RACKCOUNT
        FROM MIL_TESTING_RACK T
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      IF (V_RACKCOUNT > 0) THEN
        UPDATE MIL_TESTING_RACK T
           SET T.RETEST_NUM   = '0',
               T.RECUT_LENGTH = '',
               T.RECUT_FLAG   = '0',
               T.SAMPLE_FLAG  = '0'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.COL_SHIFT = '#COL_SHIFT#'
           AND T.COL_GROUP = '#COL_GROUP#';
        FOR MYROW IN (SELECT SEQ
                        FROM (SELECT T.SEQ
                                FROM MIL_TESTING_RACK T
                               WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                 AND NVL(T.PRO_PLAN_ID, '/') =
                                     NVL('#PRO_PLAN_ID#', '/')
                                 AND NVL(T.GX_PLAN_NO, '/') =
                                     NVL('#GX_PLAN_NO#', '/')
                                 AND T.RESULT_NO = '#RESULT_NO#'
                                 AND T.SUSPECT_FLAG = '1'
                                 AND T.RETEST_NUM = '0'
                                 AND T.OFFLINE_FLAG = '0'
                                 AND T.COL_NO = '#COL_NO#'
                                 AND T.COL_SHIFT = '#COL_SHIFT#'
                                 AND T.COL_GROUP = '#COL_GROUP#'
                               ORDER BY T.SEQ ASC)
                       WHERE ROWNUM <= #REINSPECTION_NUM2#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.RETEST_NUM = '#TEST_NUM2#'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW.SEQ;
        END LOOP;
        FOR MYROW1 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.STATUS = '0'
                                  AND T.RECUT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.STATUS = '2'
                                  AND T.COL_NO = '#COL_NO#'
                                  AND T.COL_SHIFT = '#COL_SHIFT#'
                                  AND T.COL_GROUP = '#COL_GROUP#'
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #RECUT_NUM2#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.RECUT_LENGTH = '#RECUT_LEN2#', T.RECUT_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW1.SEQ;
        END LOOP;
        FOR MYROW4 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #SAMPLE_NUM2#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.SAMPLE_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW4.SEQ;
        END LOOP;
      ELSE
        FOR MYROW2 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '1'
                                  AND T.RETEST_NUM = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.COL_NO = '#COL_NO#'
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #REINSPECTION_NUM2#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.RETEST_NUM = '#TEST_NUM2#'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW2.SEQ;
        END LOOP;
        FOR MYROW3 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '1'
                                  AND T.RECUT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.STATUS = '2'
                                  AND T.COL_NO = '#COL_NO#'
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #RECUT_NUM2#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.RECUT_LENGTH = '#RECUT_LEN2#', T.RECUT_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW3.SEQ;
        END LOOP;
        FOR MYROW4 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #SAMPLE_NUM2#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.SAMPLE_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW4.SEQ;
        END LOOP;
      END IF;
    END IF;
  ELSE
    IF ('#COL_NO#' = '1') THEN
      INSERT INTO MIL_TESTING_RESULT_DETAIL
        (TEST_NUM1,
         RECUT_LEN1,
         RESULT_NO,
         LOT_NO,
         JUDGE_STOVE_NO,
         PLINE_CODE,
         START_TIME,
         END_TIME,
         COL_USER,
         COL_SHIFT,
         COL_GROUP,
         SCRAP_NUM1,
         QUALIFIED_NUM1,
         REINSPECTION_NUM1,
         REINSPECTION_QUALIFIED_NUM1,
         OFFLINE_NUM1,
         BACKLINE_NUM1,
         DETECTION_NUM1,
         SUSPECT_PRODUCT_NUM1,
         RECUT_NUM1,
         SAMPLE_NUM1,
         PRO_PLAN_ID,
         GX_PLAN_NO)
      VALUES
        ('#TEST_NUM1#',
         '#RECUT_LEN1#',
         '#RESULT_NO#',
         '#LOT_NO#',
         '#JUDGE_STOVE_NO#',
         '#PLINE_CODE#',
         SYSDATE,
         SYSDATE,
         '#COL_USER#',
         '#COL_SHIFT#',
         '#COL_GROUP#',
         '#SCRAP_NUM1#',
         '#QUALIFIED_NUM1#',
         '#REINSPECTION_NUM1#',
         '#REINSPECTION_QUALIFIED_NUM1#',
         '#OFFLINE_NUM1#',
         '#BACKLINE_NUM1#',
         '#DETECTION_NUM1#',
         '#SUSPECT_PRODUCT_NUM1#',
         '#RECUT_NUM1#',
         '#SAMPLE_NUM1#',
         '#PRO_PLAN_ID#',
         '#GX_PLAN_NO#');
      UPDATE MIL_MT_RESULT T
         SET T.DETECTION_NUM              = TO_NUMBER(T.DETECTION_NUM) +
                                            TO_NUMBER('#DETECTION_NUM1#'),
             T.SCRAP_NUM                  = TO_NUMBER(T.SCRAP_NUM) +
                                            TO_NUMBER('#SCRAP_NUM1#'),
             T.QUALIFIED_NUM              = TO_NUMBER(T.QUALIFIED_NUM) +
                                            TO_NUMBER('#QUALIFIED_NUM1#'),
             T.REINSPECTION_NUM           = TO_NUMBER(T.REINSPECTION_NUM) +
                                            TO_NUMBER('#REINSPECTION_NUM1#'),
             T.ALARM_NUM                  = TO_NUMBER(T.ALARM_NUM) +
                                            TO_NUMBER('#SUSPECT_PRODUCT_NUM1#'),
             T.RECUT_NUM                  = TO_NUMBER(T.RECUT_NUM) +
                                            TO_NUMBER('#RECUT_NUM1#'),
             T.QA_TON                     = TO_NUMBER(T.QA_TON) +
                                            TO_NUMBER('#QA_TON#'),
             T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) +
                                            TO_NUMBER('#REINSPECTION_QUALIFIED_NUM1#'),
             T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) +
                                            TO_NUMBER('#SAMPLE_NUM1#'),
             T.PRODUCT_STANDARDS          = '#PRODUCT_STANDARDS#',
             T.LO_SURFACE                 = '#LO_SURFACE#',
             T.LI_SURFACE                 = '#LI_SURFACE#',
             T.TO_SURFACE                 = '#TO_SURFACE#',
             T.TI_SURFACE                 = '#TI_SURFACE#',
             T.GROOVE_SHAPE               = '#GROOVE_SHAPE#',
             T.INSPECTION_STANDARD        = '#INSPECTION_STANDARD#',
             T.LONGITUDINAL_CURRENT1      = '#LONGITUDINAL_CURRENT1#',
             T.TRANSVERSE_CURRENT1        = '#TRANSVERSE_CURRENT1#',
             T.LONGITUDINAL_CURRENT2      = '#LONGITUDINAL_CURRENT2#',
             T.TRANSVERSE_CURRENT2        = '#TRANSVERSE_CURRENT2#',
             T.SPEED1                     = '#SPEED1#',
             T.SPEED2                     = '#SPEED2#',
             T.DETECTION_SPEED1           = '#DETECTION_SPEED1#',
             T.DETECTION_SPEED2           = '#DETECTION_SPEED2#',
             T.REMARK                     = '#REMARK#',
             T.REMARK1                    = '#REMARK1#',
             T.NOTCH_INFO                 = '#NOTCH_INFO#',
             T.NOTCH_LENGTH               = '#NOTCH_LENGTH#',
             T.NOTCH_WIDTH                = '#NOTCH_WIDTH#',
             T.NOTCH_DEPTH                = '#NOTCH_DEPTH#',
             T.NOTCH_FX                   = '#NOTCH_FX#',
             T.COVERAGE                   = '#COVERAGE#',
             T.SAMPLE_NO                  = '#SAMPLE_NO#',
             T.SIGNID                     = '#SIGNID#',
             T.SIGNID_GRADE               = '2',
             T.USERID1                    = '#USERID1#',
             T.USERID2                    = '#USERID2#',
             T.USERID_GRADE1              = '#USERID_GRADE1#',
             T.USERID_GRADE2              = '#USERID_GRADE2#',
               T.USERID1JD                    = '#USERID1JD#',
             T.USERID2JD                    = '#USERID2JD#',
             T.USERID_GRADE1JD              = '#USERID_GRADE1JD#',
             T.USERID_GRADE2JD              = '#USERID_GRADE2JD#',
             T.STANDARDS_NO               = '#STANDARDS_NO#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      FOR MYROW IN (SELECT SEQ
                      FROM (SELECT T.SEQ
                              FROM MIL_TESTING_RACK T
                             WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                               AND NVL(T.PRO_PLAN_ID, '/') =
                                   NVL('#PRO_PLAN_ID#', '/')
                               AND NVL(T.GX_PLAN_NO, '/') =
                                   NVL('#GX_PLAN_NO#', '/')
                               AND T.RESULT_NO = '#RESULT_NO#'
                               AND T.SUSPECT_FLAG = '1'
                               AND T.RETEST_NUM = '0'
                               AND T.OFFLINE_FLAG = '0'
                               AND T.COL_NO = '#COL_NO#'
                               AND T.COL_SHIFT IS NULL
                               AND T.COL_GROUP IS NULL
                             ORDER BY T.SEQ ASC)
                     WHERE ROWNUM <= #REINSPECTION_NUM1#) LOOP
        UPDATE MIL_TESTING_RACK T
           SET T.RETEST_NUM = '#TEST_NUM1#'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.SEQ = MYROW.SEQ;
      END LOOP;
      FOR MYROW1 IN (SELECT SEQ
                       FROM (SELECT T.SEQ
                               FROM MIL_TESTING_RACK T
                              WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                AND NVL(T.PRO_PLAN_ID, '/') =
                                    NVL('#PRO_PLAN_ID#', '/')
                                AND NVL(T.GX_PLAN_NO, '/') =
                                    NVL('#GX_PLAN_NO#', '/')
                                AND T.RESULT_NO = '#RESULT_NO#'
                                AND T.SUSPECT_FLAG = '1'
                                AND T.STATUS = '2'
                                AND T.RECUT_FLAG = '0'
                                AND T.OFFLINE_FLAG = '0'
                                AND T.COL_NO = '#COL_NO#'
                                AND T.COL_SHIFT IS NULL
                                AND T.COL_GROUP IS NULL
                              ORDER BY T.SEQ ASC)
                      WHERE ROWNUM <= #RECUT_NUM1#) LOOP
        UPDATE MIL_TESTING_RACK T
           SET T.RECUT_LENGTH = '#RECUT_LEN1#', T.RECUT_FLAG = '1'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.SEQ = MYROW1.SEQ;
      END LOOP;
      FOR MYROW4 IN (SELECT SEQ
                       FROM (SELECT T.SEQ
                               FROM MIL_TESTING_RACK T
                              WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                AND NVL(T.PRO_PLAN_ID, '/') =
                                    NVL('#PRO_PLAN_ID#', '/')
                                AND NVL(T.GX_PLAN_NO, '/') =
                                    NVL('#GX_PLAN_NO#', '/')
                                AND T.RESULT_NO = '#RESULT_NO#'
                                AND T.SUSPECT_FLAG = '0'
                                AND T.OFFLINE_FLAG = '0'
                                AND T.COL_SHIFT IS NULL
                                AND T.COL_GROUP IS NULL
                              ORDER BY T.SEQ ASC)
                      WHERE ROWNUM <= #SAMPLE_NUM1#) LOOP
        UPDATE MIL_TESTING_RACK T
           SET T.SAMPLE_FLAG = '1'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.SEQ = MYROW4.SEQ;
      END LOOP;
    ELSE
      INSERT INTO MIL_TESTING_RESULT_DETAIL
        (TEST_NUM2,
         RECUT_LEN2,
         RESULT_NO,
         LOT_NO,
         STOVE_NO,
         JUDGE_STOVE_NO,
         PLINE_CODE,
         START_TIME,
         END_TIME,
         COL_USER,
         COL_SHIFT,
         COL_GROUP,
         SCRAP_NUM2,
         QUALIFIED_NUM2,
         REINSPECTION_NUM2,
         REINSPECTION_QUALIFIED_NUM2,
         OFFLINE_NUM2,
         BACKLINE_NUM2,
         DETECTION_NUM2,
         SUSPECT_PRODUCT_NUM2,
         RECUT_NUM2,
         SAMPLE_NUM2,
         PRO_PLAN_ID,
         GX_PLAN_NO)
      VALUES
        ('#TEST_NUM2#',
         '#RECUT_LEN2#',
         '#RESULT_NO#',
         '#LOT_NO#',
         '#STOVE_NO#',
         '#JUDGE_STOVE_NO#',
         '#PLINE_CODE#',
         SYSDATE,
         SYSDATE,
         '#COL_USER#',
         '#COL_SHIFT#',
         '#COL_GROUP#',
         '#SCRAP_NUM2#',
         '#QUALIFIED_NUM2#',
         '#REINSPECTION_NUM2#',
         '#REINSPECTION_QUALIFIED_NUM2#',
         '#OFFLINE_NUM2#',
         '#BACKLINE_NUM2#',
         '#DETECTION_NUM2#',
         '#SUSPECT_PRODUCT_NUM2#',
         '#RECUT_NUM2#',
         '#SAMPLE_NUM2#',
         '#PRO_PLAN_ID#',
         '#GX_PLAN_NO#');
      UPDATE MIL_MT_RESULT T
         SET T.DETECTION_NUM              = TO_NUMBER(T.DETECTION_NUM) +
                                            TO_NUMBER('#DETECTION_NUM2#'),
             T.SCRAP_NUM                  = TO_NUMBER(T.SCRAP_NUM) +
                                            TO_NUMBER('#SCRAP_NUM2#'),
             T.QUALIFIED_NUM              = TO_NUMBER(T.QUALIFIED_NUM) +
                                            TO_NUMBER('#QUALIFIED_NUM2#'),
             T.REINSPECTION_NUM           = TO_NUMBER(T.REINSPECTION_NUM) +
                                            TO_NUMBER('#REINSPECTION_NUM2#'),
             T.ALARM_NUM                  = TO_NUMBER(T.ALARM_NUM) +
                                            TO_NUMBER('#SUSPECT_PRODUCT_NUM2#'),
             T.RECUT_NUM                  = TO_NUMBER(T.RECUT_NUM) +
                                            TO_NUMBER('#RECUT_NUM2#'),
             T.QA_TON                     = TO_NUMBER(T.QA_TON) +
                                            TO_NUMBER('#QA_TON#'),
             T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) +
                                            TO_NUMBER('#REINSPECTION_QUALIFIED_NUM2#'),
             T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) +
                                            TO_NUMBER('#SAMPLE_NUM2#'),
             T.PRODUCT_STANDARDS          = '#PRODUCT_STANDARDS#',
             T.LO_SURFACE                 = '#LO_SURFACE#',
             T.LI_SURFACE                 = '#LI_SURFACE#',
             T.TO_SURFACE                 = '#TO_SURFACE#',
             T.TI_SURFACE                 = '#TI_SURFACE#',
             T.GROOVE_SHAPE               = '#GROOVE_SHAPE#',
             T.INSPECTION_STANDARD        = '#INSPECTION_STANDARD#',
             T.LONGITUDINAL_CURRENT1      = '#LONGITUDINAL_CURRENT1#',
             T.TRANSVERSE_CURRENT1        = '#TRANSVERSE_CURRENT1#',
             T.LONGITUDINAL_CURRENT2      = '#LONGITUDINAL_CURRENT2#',
             T.TRANSVERSE_CURRENT2        = '#TRANSVERSE_CURRENT2#',
             T.SPEED1                     = '#SPEED1#',
             T.SPEED2                     = '#SPEED2#',
             T.DETECTION_SPEED1           = '#DETECTION_SPEED1#',
             T.DETECTION_SPEED2           = '#DETECTION_SPEED2#',
             T.REMARK                     = '#REMARK#',
             T.REMARK1                    = '#REMARK1#',
             T.NOTCH_INFO                 = '#NOTCH_INFO#',
             T.NOTCH_LENGTH               = '#NOTCH_LENGTH#',
             T.NOTCH_WIDTH                = '#NOTCH_WIDTH#',
             T.NOTCH_DEPTH                = '#NOTCH_DEPTH#',
             T.NOTCH_FX                   = '#NOTCH_FX#',
             T.COVERAGE                   = '#COVERAGE#',
             T.SAMPLE_NO                  = '#SAMPLE_NO#',
             T.SIGNID                     = '#SIGNID#',
             T.SIGNID_GRADE               = '2',
             T.USERID1                    = '#USERID1#',
             T.USERID2                    = '#USERID2#',
             T.USERID_GRADE1              = '#USERID_GRADE1#',
             T.USERID_GRADE2              = '#USERID_GRADE2#',
               T.USERID1JD                    = '#USERID1JD#',
             T.USERID2JD                    = '#USERID2JD#',
             T.USERID_GRADE1JD              = '#USERID_GRADE1JD#',
             T.USERID_GRADE2JD              = '#USERID_GRADE2JD#',
             T.STANDARDS_NO               = '#STANDARDS_NO#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      FOR MYROW IN (SELECT SEQ
                      FROM (SELECT T.SEQ
                              FROM MIL_TESTING_RACK T
                             WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                               AND NVL(T.PRO_PLAN_ID, '/') =
                                   NVL('#PRO_PLAN_ID#', '/')
                               AND NVL(T.GX_PLAN_NO, '/') =
                                   NVL('#GX_PLAN_NO#', '/')
                               AND T.RESULT_NO = '#RESULT_NO#'
                               AND T.SUSPECT_FLAG = '1'
                               AND T.RETEST_NUM = '0'
                               AND T.COL_NO = '#COL_NO#'
                               AND T.OFFLINE_FLAG = '0'
                               AND T.COL_SHIFT IS NULL
                               AND T.COL_GROUP IS NULL
                             ORDER BY T.SEQ ASC)
                     WHERE ROWNUM <= #REINSPECTION_NUM2#) LOOP
        UPDATE MIL_TESTING_RACK T
           SET T.RETEST_NUM = '#TEST_NUM2#'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.SEQ = MYROW.SEQ;
      END LOOP;
      FOR MYROW1 IN (SELECT SEQ
                       FROM (SELECT T.SEQ
                               FROM MIL_TESTING_RACK T
                              WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                AND NVL(T.PRO_PLAN_ID, '/') =
                                    NVL('#PRO_PLAN_ID#', '/')
                                AND NVL(T.GX_PLAN_NO, '/') =
                                    NVL('#GX_PLAN_NO#', '/')
                                AND T.RESULT_NO = '#RESULT_NO#'
                                AND T.SUSPECT_FLAG = '1'
                                AND T.RECUT_FLAG = '0'
                                AND T.OFFLINE_FLAG = '0'
                                AND T.STATUS = '2'
                                AND T.COL_NO = '#COL_NO#'
                                AND T.COL_SHIFT IS NULL
                                AND T.COL_GROUP IS NULL
                              ORDER BY T.SEQ ASC)
                      WHERE ROWNUM <= #RECUT_NUM2#) LOOP
        UPDATE MIL_TESTING_RACK T
           SET T.RECUT_LENGTH = '#RECUT_LEN2#', T.RECUT_FLAG = '1'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.SEQ = MYROW1.SEQ;
      END LOOP;
      FOR MYROW4 IN (SELECT SEQ
                       FROM (SELECT T.SEQ
                               FROM MIL_TESTING_RACK T
                              WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                AND NVL(T.PRO_PLAN_ID, '/') =
                                    NVL('#PRO_PLAN_ID#', '/')
                                AND NVL(T.GX_PLAN_NO, '/') =
                                    NVL('#GX_PLAN_NO#', '/')
                                AND T.RESULT_NO = '#RESULT_NO#'
                                AND T.SUSPECT_FLAG = '0'
                                AND T.OFFLINE_FLAG = '0'
                                AND T.COL_SHIFT IS NULL
                                AND T.COL_GROUP IS NULL
                              ORDER BY T.SEQ ASC)
                      WHERE ROWNUM <= #SAMPLE_NUM2#) LOOP
        UPDATE MIL_TESTING_RACK T
           SET T.SAMPLE_FLAG = '1'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.SEQ = MYROW4.SEQ;
      END LOOP;
    END IF;
  END IF;
END;
]]>
   </query>
   <query id = "EddyCurrentTestingResult.saveEtResult" desc = "保存涡流探伤实绩">
   <![CDATA[
   DECLARE
  V_COUNT                       MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := NULL;
  V_DETECTION_NUM1              MIL_TESTING_RESULT_DETAIL.DETECTION_NUM1%TYPE := NULL;
  V_SCRAP_NUM1                  MIL_TESTING_RESULT_DETAIL.SCRAP_NUM1%TYPE := NULL;
  V_QUALIFIED_NUM1              MIL_TESTING_RESULT_DETAIL.QUALIFIED_NUM1%TYPE := NULL;
  V_REINSPECTION_NUM1           MIL_TESTING_RESULT_DETAIL.REINSPECTION_NUM1%TYPE := NULL;
  V_SUSPECT_PRODUCT_NUM1        MIL_TESTING_RESULT_DETAIL.SUSPECT_PRODUCT_NUM1%TYPE := NULL;
  V_REINSPECTION_QUALIFIED_NUM1 MIL_TESTING_RESULT_DETAIL.REINSPECTION_QUALIFIED_NUM1%TYPE := NULL;
  V_SAMPLE_NUM1                 MIL_TESTING_RESULT_DETAIL.SAMPLE_NUM1%TYPE := NULL;
  V_DETECTION_NUM2              MIL_TESTING_RESULT_DETAIL.DETECTION_NUM2%TYPE := NULL;
  V_SCRAP_NUM2                  MIL_TESTING_RESULT_DETAIL.SCRAP_NUM2%TYPE := NULL;
  V_QUALIFIED_NUM2              MIL_TESTING_RESULT_DETAIL.QUALIFIED_NUM2%TYPE := NULL;
  V_REINSPECTION_NUM2           MIL_TESTING_RESULT_DETAIL.REINSPECTION_NUM2%TYPE := NULL;
  V_SUSPECT_PRODUCT_NUM2        MIL_TESTING_RESULT_DETAIL.SUSPECT_PRODUCT_NUM2%TYPE := NULL;
  V_REINSPECTION_QUALIFIED_NUM2 MIL_TESTING_RESULT_DETAIL.REINSPECTION_QUALIFIED_NUM2%TYPE := NULL;
  V_SAMPLE_NUM2                 MIL_TESTING_RESULT_DETAIL.SAMPLE_NUM2%TYPE := NULL;

  V_DETECTION_NUM3              MIL_TESTING_RESULT_DETAIL.DETECTION_NUM1%TYPE := NULL;
  V_SCRAP_NUM3                  MIL_TESTING_RESULT_DETAIL.SCRAP_NUM1%TYPE := NULL;
  V_QUALIFIED_NUM3              MIL_TESTING_RESULT_DETAIL.QUALIFIED_NUM1%TYPE := NULL;
  V_REINSPECTION_NUM3           MIL_TESTING_RESULT_DETAIL.REINSPECTION_NUM1%TYPE := NULL;
  V_SUSPECT_PRODUCT_NUM3        MIL_TESTING_RESULT_DETAIL.SUSPECT_PRODUCT_NUM1%TYPE := NULL;
  V_REINSPECTION_QUALIFIED_NUM3 MIL_TESTING_RESULT_DETAIL.REINSPECTION_QUALIFIED_NUM1%TYPE := NULL;
  V_SAMPLE_NUM3                 MIL_TESTING_RESULT_DETAIL.SAMPLE_NUM1%TYPE := NULL;

  V_RACKCOUNT     MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := NULL;
  V_QUALIFIED_NUM MIL_TESTING_RESULT_DETAIL_DES.REASON_NUMBER%TYPE := NULL;
BEGIN
  --查询实绩字表是否已存在实绩
  SELECT NVL(COUNT(1), 0)
    INTO V_COUNT
    FROM MIL_TESTING_RESULT_DETAIL T
   WHERE T.RESULT_NO = '#RESULT_NO#'
     AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
     AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
     AND T.COL_SHIFT = '#COL_SHIFT#'
     AND T.COL_GROUP = '#COL_GROUP#';
  SELECT T.QUALIFIED_NUM
    INTO V_QUALIFIED_NUM
    FROM MIL_ET_RESULT T
   WHERE T.RESULT_NO = '#RESULT_NO#'
     AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
     AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
     AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
  IF (V_COUNT > 0) THEN
    --存在看是哪个操作台
    IF ('#COL_NO#' = '1') THEN
      SELECT T.DETECTION_NUM1,
             T.SCRAP_NUM1,
             T.QUALIFIED_NUM1,
             T.REINSPECTION_NUM1,
             T.SUSPECT_PRODUCT_NUM1,
             T.REINSPECTION_QUALIFIED_NUM1,
             T.SAMPLE_NUM1
        INTO V_DETECTION_NUM1,
             V_SCRAP_NUM1,
             V_QUALIFIED_NUM1,
             V_REINSPECTION_NUM1,
             V_SUSPECT_PRODUCT_NUM1,
             V_REINSPECTION_QUALIFIED_NUM1,
             V_SAMPLE_NUM1
        FROM MIL_TESTING_RESULT_DETAIL T
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      --把该班次班组原支数在实绩主表减去
      IF (V_QUALIFIED_NUM > 0) THEN
        UPDATE MIL_ET_RESULT T
           SET T.DETECTION_NUM              = TO_NUMBER(T.DETECTION_NUM) -
                                              TO_NUMBER(V_DETECTION_NUM1),
               T.SCRAP_NUM                  = TO_NUMBER(T.SCRAP_NUM) -
                                              TO_NUMBER(V_SCRAP_NUM1),
               T.QUALIFIED_NUM              = TO_NUMBER(T.QUALIFIED_NUM) -
                                              TO_NUMBER(V_QUALIFIED_NUM1),
               T.REINSPECTION_NUM           = TO_NUMBER(T.REINSPECTION_NUM) -
                                              TO_NUMBER(V_REINSPECTION_NUM1),
               T.SUSPECT_PRODUCT_NUM        = TO_NUMBER(T.SUSPECT_PRODUCT_NUM) -
                                              TO_NUMBER(V_SUSPECT_PRODUCT_NUM1),
               T.QA_TON                     = TO_NUMBER(T.QA_TON) -
                                              TO_NUMBER(T.QA_TON /
                                                        QUALIFIED_NUM) *
                                              TO_NUMBER(V_QUALIFIED_NUM1),
               T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) -
                                              TO_NUMBER(V_REINSPECTION_QUALIFIED_NUM1),
               T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) -
                                              TO_NUMBER(V_SAMPLE_NUM1)
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      ELSIF (V_QUALIFIED_NUM = 0) THEN
        UPDATE MIL_ET_RESULT T
           SET T.DETECTION_NUM              = TO_NUMBER(T.DETECTION_NUM) -
                                              TO_NUMBER(V_DETECTION_NUM1),
               T.SCRAP_NUM                  = TO_NUMBER(T.SCRAP_NUM) -
                                              TO_NUMBER(V_SCRAP_NUM1),
               T.QUALIFIED_NUM              = TO_NUMBER(T.QUALIFIED_NUM) -
                                              TO_NUMBER(V_QUALIFIED_NUM1),
               T.REINSPECTION_NUM           = TO_NUMBER(T.REINSPECTION_NUM) -
                                              TO_NUMBER(V_REINSPECTION_NUM1),
               T.SUSPECT_PRODUCT_NUM        = TO_NUMBER(T.SUSPECT_PRODUCT_NUM) -
                                              TO_NUMBER(V_SUSPECT_PRODUCT_NUM1),
               T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) -
                                              TO_NUMBER(V_REINSPECTION_QUALIFIED_NUM1),
               T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) -
                                              TO_NUMBER(V_SAMPLE_NUM1)
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      END IF;
      --把实绩主表的支数增加
      UPDATE MIL_ET_RESULT T
         SET T.DETECTION_NUM       = TO_NUMBER(T.DETECTION_NUM) +
                                     TO_NUMBER('#DETECTION_NUM1#'),
             T.SCRAP_NUM           = TO_NUMBER(T.SCRAP_NUM) +
                                     TO_NUMBER('#SCRAP_NUM1#'),
             T.QUALIFIED_NUM       = TO_NUMBER(T.QUALIFIED_NUM) +
                                     TO_NUMBER('#QUALIFIED_NUM1#'),
             T.REINSPECTION_NUM    = TO_NUMBER(T.REINSPECTION_NUM) +
                                     TO_NUMBER('#REINSPECTION_NUM1#'),
             T.SUSPECT_PRODUCT_NUM = TO_NUMBER(T.SUSPECT_PRODUCT_NUM) +
                                     TO_NUMBER('#SUSPECT_PRODUCT_NUM1#'),
             
             T.QA_TON                     = TO_NUMBER(T.QA_TON) +
                                            TO_NUMBER('#QA_TON#'),
             T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) +
                                            TO_NUMBER('#REINSPECTION_QUALIFIED_NUM1#'),
             T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) +
                                            TO_NUMBER('#SAMPLE_NUM1#'),
             T.PRODUCT_STANDARDS          = '#PRODUCT_STANDARDS#',
             T.INSPECTION_STANDARD        = '#INSPECTION_STANDARD#',
             T.TESTING_METHOD             = '#TESTING_METHOD#',
             T.CALIBRATION_METHOD         = '#CALIBRATION_METHOD#',
             T.ARTIFICIAL_DEFECT_SHAPE    = '#ARTIFICIAL_DEFECT_SHAPE#',
             T.EXCITATION_FREQUENCY1      = '#EXCITATION_FREQUENCY1#',
             T.EXCITATION_FREQUENCY2      = '#EXCITATION_FREQUENCY2#',
             T.EXCITATION_FREQUENCY3      = '#EXCITATION_FREQUENCY3#',
             T.TESTING_SPEED1             = '#TESTING_SPEED1#',
             T.TESTING_SPEED2             = '#TESTING_SPEED2#',
             T.TESTING_SPEED3             = '#TESTING_SPEED3#',
             T.USERID                     = '#USERID#',
             T.SIGNID                     = '#SIGNID#',
             T.ACCEPTANCE_GRADE           = '#ACCEPTANCE_GRADE#',
             T.USERID1                    = '#USERID1#',
             T.USERID2                    = '#USERID2#',
             T.USERID_GRADE1              = '#USERID_GRADE1#',
             T.USERID_GRADE2              = '#USERID_GRADE2#',
              T.USERID1JD                    = '#USERID1JD#',
             T.USERID2JD                    = '#USERID2JD#',
             T.USERID_GRADE1JD              = '#USERID_GRADE1JD#',
             T.USERID_GRADE2JD              = '#USERID_GRADE2JD#',
             T.REMARK                     = '#REMARK#',
             T.NOTCH_INFO                 = '#NOTCH_INFO#',
             T.NOTCH_LENGTH               = '#NOTCH_LENGTH#',
             T.NOTCH_WIDTH                = '#NOTCH_WIDTH#',
             T.NOTCH_DEPTH                = '#NOTCH_DEPTH#',
             T.SAMPLE_NEWS                = '#SAMPLE_NEWS#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      --修改实绩子表
      UPDATE MIL_TESTING_RESULT_DETAIL T
         SET T.DETECTION_NUM1              = '#DETECTION_NUM1#',
             T.SCRAP_NUM1                  = '#SCRAP_NUM1#',
             T.QUALIFIED_NUM1              = '#QUALIFIED_NUM1#',
             T.REINSPECTION_NUM1           = '#REINSPECTION_NUM1#',
             T.REINSPECTION_QUALIFIED_NUM1 = '#REINSPECTION_QUALIFIED_NUM1#',
             T.SUSPECT_PRODUCT_NUM1        = '#SUSPECT_PRODUCT_NUM1#',
             T.SAMPLE_NUM1                 = '#SAMPLE_NUM1#',
             T.COL_USER                    = '#COL_USER#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      --处理1号台管号队列
      SELECT NVL(COUNT(1), 0)
        INTO V_RACKCOUNT
        FROM MIL_TESTING_RACK T
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT IS NULL
         AND T.COL_GROUP IS NULL;
      IF (V_RACKCOUNT > 0) THEN
        UPDATE MIL_TESTING_RACK T
           SET T.RETEST_NUM   = '0',
               T.RECUT_LENGTH = '',
               T.RECUT_FLAG   = '0',
               T.SAMPLE_FLAG  = '0'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.COL_SHIFT IS NULL
           AND T.COL_GROUP IS NULL;
        --留样支数
        FOR MYROW4 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.SUSPECT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #SAMPLE_NUM1#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.SAMPLE_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW4.SEQ;
        END LOOP;
      ELSE
        FOR MYROW5 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.SUSPECT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #SAMPLE_NUM1#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.SAMPLE_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW5.SEQ;
        END LOOP;
      END IF;
    ELSIF ('#COL_NO#' = '2') THEN
      --168二号操作台
      SELECT T.DETECTION_NUM2,
             T.SCRAP_NUM2,
             T.QUALIFIED_NUM2,
             T.REINSPECTION_NUM2,
             T.SUSPECT_PRODUCT_NUM2,
             T.REINSPECTION_QUALIFIED_NUM2,
             T.SAMPLE_NUM2
        INTO V_DETECTION_NUM2,
             V_SCRAP_NUM2,
             V_QUALIFIED_NUM2,
             V_REINSPECTION_NUM2,
             V_SUSPECT_PRODUCT_NUM2,
             V_REINSPECTION_QUALIFIED_NUM2,
             V_SAMPLE_NUM2
        FROM MIL_TESTING_RESULT_DETAIL T
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      IF (V_QUALIFIED_NUM > 0) THEN
        UPDATE MIL_ET_RESULT T
           SET T.DETECTION_NUM       = TO_NUMBER(T.DETECTION_NUM) -
                                       TO_NUMBER(V_DETECTION_NUM2),
               T.SCRAP_NUM           = TO_NUMBER(T.SCRAP_NUM) -
                                       TO_NUMBER(V_SCRAP_NUM2),
               T.QUALIFIED_NUM       = TO_NUMBER(T.QUALIFIED_NUM) -
                                       TO_NUMBER(V_QUALIFIED_NUM2),
               T.REINSPECTION_NUM    = TO_NUMBER(T.REINSPECTION_NUM) -
                                       TO_NUMBER(V_REINSPECTION_NUM2),
               T.SUSPECT_PRODUCT_NUM = TO_NUMBER(T.SUSPECT_PRODUCT_NUM) -
                                       TO_NUMBER(V_SUSPECT_PRODUCT_NUM2),
               
               T.QA_TON                     = TO_NUMBER(T.QA_TON) -
                                              TO_NUMBER(T.QA_TON /
                                                        QUALIFIED_NUM) *
                                              TO_NUMBER(V_QUALIFIED_NUM2),
               T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) -
                                              TO_NUMBER(V_REINSPECTION_QUALIFIED_NUM2),
               T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) -
                                              TO_NUMBER(V_SAMPLE_NUM2)
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      END IF;
      UPDATE MIL_ET_RESULT T
         SET T.DETECTION_NUM              = TO_NUMBER(T.DETECTION_NUM) +
                                            TO_NUMBER('#DETECTION_NUM2#'),
             T.SCRAP_NUM                  = TO_NUMBER(T.SCRAP_NUM) +
                                            TO_NUMBER('#SCRAP_NUM2#'),
             T.QUALIFIED_NUM              = TO_NUMBER(T.QUALIFIED_NUM) +
                                            TO_NUMBER('#QUALIFIED_NUM2#'),
             T.REINSPECTION_NUM           = TO_NUMBER(T.REINSPECTION_NUM) +
                                            TO_NUMBER('#REINSPECTION_NUM2#'),
             T.SUSPECT_PRODUCT_NUM        = TO_NUMBER(T.SUSPECT_PRODUCT_NUM) +
                                            TO_NUMBER('#SUSPECT_PRODUCT_NUM2#'),
             T.QA_TON                     = TO_NUMBER(T.QA_TON) +
                                            TO_NUMBER('#QA_TON#'),
             T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) +
                                            TO_NUMBER('#REINSPECTION_QUALIFIED_NUM2#'),
             T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) +
                                            TO_NUMBER('#SAMPLE_NUM2#'),
             T.PRODUCT_STANDARDS          = '#PRODUCT_STANDARDS#',
             T.INSPECTION_STANDARD        = '#INSPECTION_STANDARD#',
             T.TESTING_METHOD             = '#TESTING_METHOD#',
             T.CALIBRATION_METHOD         = '#CALIBRATION_METHOD#',
             T.ARTIFICIAL_DEFECT_SHAPE    = '#ARTIFICIAL_DEFECT_SHAPE#',
             T.EXCITATION_FREQUENCY1      = '#EXCITATION_FREQUENCY1#',
             T.EXCITATION_FREQUENCY2      = '#EXCITATION_FREQUENCY2#',
             T.EXCITATION_FREQUENCY3      = '#EXCITATION_FREQUENCY3#',
             T.TESTING_SPEED1             = '#TESTING_SPEED1#',
             T.TESTING_SPEED2             = '#TESTING_SPEED2#',
             T.TESTING_SPEED3             = '#TESTING_SPEED3#',
             T.USERID                     = '#USERID#',
             T.SIGNID                     = '#SIGNID#',
             T.ACCEPTANCE_GRADE           = '#ACCEPTANCE_GRADE#',
             T.USERID1                    = '#USERID1#',
             T.USERID2                    = '#USERID2#',
             T.USERID_GRADE1              = '#USERID_GRADE1#',
             T.USERID_GRADE2              = '#USERID_GRADE2#',
                T.USERID1JD                    = '#USERID1JD#',
             T.USERID2JD                    = '#USERID2JD#',
             T.USERID_GRADE1JD              = '#USERID_GRADE1JD#',
             T.USERID_GRADE2JD              = '#USERID_GRADE2JD#',
             T.REMARK                     = '#REMARK#',
             T.NOTCH_INFO                 = '#NOTCH_INFO#',
             T.NOTCH_LENGTH               = '#NOTCH_LENGTH#',
             T.NOTCH_WIDTH                = '#NOTCH_WIDTH#',
             T.NOTCH_DEPTH                = '#NOTCH_DEPTH#',
             T.SAMPLE_NEWS                = '#SAMPLE_NEWS#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
    
      UPDATE MIL_TESTING_RESULT_DETAIL T
         SET T.DETECTION_NUM2              = '#DETECTION_NUM2#',
             T.SCRAP_NUM2                  = '#SCRAP_NUM2#',
             T.QUALIFIED_NUM2              = '#QUALIFIED_NUM2#',
             T.REINSPECTION_NUM2           = '#REINSPECTION_NUM2#',
             T.REINSPECTION_QUALIFIED_NUM2 = '#REINSPECTION_QUALIFIED_NUM2#',
             T.SUSPECT_PRODUCT_NUM2        = '#SUSPECT_PRODUCT_NUM2#',
             T.SAMPLE_NUM2                 = '#SAMPLE_NUM2#',
             T.COL_USER                    = '#COL_USER#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      --处理二号台管号队列
      SELECT NVL(COUNT(1), 0)
        INTO V_RACKCOUNT
        FROM MIL_TESTING_RACK T
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      IF (V_RACKCOUNT > 0) THEN
        UPDATE MIL_TESTING_RACK T
           SET T.RETEST_NUM   = '0',
               T.RECUT_LENGTH = '',
               T.RECUT_FLAG   = '0',
               T.SAMPLE_FLAG  = '0'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.COL_SHIFT = '#COL_SHIFT#'
           AND T.COL_GROUP = '#COL_GROUP#';
        FOR MYROW4 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #SAMPLE_NUM2#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.SAMPLE_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW4.SEQ;
        END LOOP;
      ELSE
        FOR MYROW4 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #SAMPLE_NUM2#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.SAMPLE_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW4.SEQ;
        END LOOP;
      END IF;
    ELSE
      SELECT T.DETECTION_NUM3,
             T.SCRAP_NUM3,
             T.QUALIFIED_NUM3,
             T.REINSPECTION_NUM3,
             T.SUSPECT_PRODUCT_NUM3,
             T.REINSPECTION_QUALIFIED_NUM3,
             T.SAMPLE_NUM3
        INTO V_DETECTION_NUM3,
             V_SCRAP_NUM3,
             V_QUALIFIED_NUM3,
             V_REINSPECTION_NUM3,
             V_SUSPECT_PRODUCT_NUM3,
             V_REINSPECTION_QUALIFIED_NUM3,
             V_SAMPLE_NUM3
        FROM MIL_TESTING_RESULT_DETAIL T
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      IF (V_QUALIFIED_NUM > 0) THEN
        UPDATE MIL_ET_RESULT T
           SET T.DETECTION_NUM       = TO_NUMBER(T.DETECTION_NUM) -
                                       TO_NUMBER(V_DETECTION_NUM3),
               T.SCRAP_NUM           = TO_NUMBER(T.SCRAP_NUM) -
                                       TO_NUMBER(V_SCRAP_NUM3),
               T.QUALIFIED_NUM       = TO_NUMBER(T.QUALIFIED_NUM) -
                                       TO_NUMBER(V_QUALIFIED_NUM3),
               T.REINSPECTION_NUM    = TO_NUMBER(T.REINSPECTION_NUM) -
                                       TO_NUMBER(V_REINSPECTION_NUM3),
               T.SUSPECT_PRODUCT_NUM = TO_NUMBER(T.SUSPECT_PRODUCT_NUM) -
                                       TO_NUMBER(V_SUSPECT_PRODUCT_NUM3),
               
               T.QA_TON                     = TO_NUMBER(T.QA_TON) -
                                              TO_NUMBER(T.QA_TON /
                                                        QUALIFIED_NUM) *
                                              TO_NUMBER(V_QUALIFIED_NUM3),
               T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) -
                                              TO_NUMBER(V_REINSPECTION_QUALIFIED_NUM3),
               T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) -
                                              TO_NUMBER(V_SAMPLE_NUM3)
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      END IF;
      UPDATE MIL_ET_RESULT T
         SET T.DETECTION_NUM              = TO_NUMBER(T.DETECTION_NUM) +
                                            TO_NUMBER('#DETECTION_NUM3#'),
             T.SCRAP_NUM                  = TO_NUMBER(T.SCRAP_NUM) +
                                            TO_NUMBER('#SCRAP_NUM3#'),
             T.QUALIFIED_NUM              = TO_NUMBER(T.QUALIFIED_NUM) +
                                            TO_NUMBER('#QUALIFIED_NUM3#'),
             T.REINSPECTION_NUM           = TO_NUMBER(T.REINSPECTION_NUM) +
                                            TO_NUMBER('#REINSPECTION_NUM3#'),
             T.SUSPECT_PRODUCT_NUM        = TO_NUMBER(T.SUSPECT_PRODUCT_NUM) +
                                            TO_NUMBER('#SUSPECT_PRODUCT_NUM3#'),
             T.QA_TON                     = TO_NUMBER(T.QA_TON) +
                                            TO_NUMBER('#QA_TON#'),
             T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) +
                                            TO_NUMBER('#REINSPECTION_QUALIFIED_NUM3#'),
             T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) +
                                            TO_NUMBER('#SAMPLE_NUM3#'),
             T.PRODUCT_STANDARDS          = '#PRODUCT_STANDARDS#',
             T.INSPECTION_STANDARD        = '#INSPECTION_STANDARD#',
             T.TESTING_METHOD             = '#TESTING_METHOD#',
             T.CALIBRATION_METHOD         = '#CALIBRATION_METHOD#',
             T.ARTIFICIAL_DEFECT_SHAPE    = '#ARTIFICIAL_DEFECT_SHAPE#',
             T.EXCITATION_FREQUENCY1      = '#EXCITATION_FREQUENCY1#',
             T.EXCITATION_FREQUENCY2      = '#EXCITATION_FREQUENCY2#',
             T.EXCITATION_FREQUENCY3      = '#EXCITATION_FREQUENCY3#',
             T.TESTING_SPEED1             = '#TESTING_SPEED1#',
             T.TESTING_SPEED2             = '#TESTING_SPEED2#',
             T.TESTING_SPEED3             = '#TESTING_SPEED3#',
             T.USERID                     = '#USERID#',
             T.SIGNID                     = '#SIGNID#',
             T.ACCEPTANCE_GRADE           = '#ACCEPTANCE_GRADE#',
             T.USERID1                    = '#USERID1#',
             T.USERID2                    = '#USERID2#',
             T.USERID_GRADE1              = '#USERID_GRADE1#',
             T.USERID_GRADE2              = '#USERID_GRADE2#',
             T.USERID1JD                    = '#USERID1JD#',
             T.USERID2JD                    = '#USERID2JD#',
             T.USERID_GRADE1JD              = '#USERID_GRADE1JD#',
             T.USERID_GRADE2JD              = '#USERID_GRADE2JD#',
             T.REMARK                     = '#REMARK#',
             T.NOTCH_INFO                 = '#NOTCH_INFO#',
             T.NOTCH_LENGTH               = '#NOTCH_LENGTH#',
             T.NOTCH_WIDTH                = '#NOTCH_WIDTH#',
             T.NOTCH_DEPTH                = '#NOTCH_DEPTH#',
             T.SAMPLE_NEWS                = '#SAMPLE_NEWS#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
    
      UPDATE MIL_TESTING_RESULT_DETAIL T
         SET T.DETECTION_NUM3              = '#DETECTION_NUM3#',
             T.SCRAP_NUM3                  = '#SCRAP_NUM3#',
             T.QUALIFIED_NUM3              = '#QUALIFIED_NUM3#',
             T.REINSPECTION_NUM3           = '#REINSPECTION_NUM3#',
             T.REINSPECTION_QUALIFIED_NUM3 = '#REINSPECTION_QUALIFIED_NUM3#',
             T.SUSPECT_PRODUCT_NUM3        = '#SUSPECT_PRODUCT_NUM3#',
             T.SAMPLE_NUM3                 = '#SAMPLE_NUM3#',
             T.COL_USER                    = '#COL_USER#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      --处理三号台管号队列
      SELECT NVL(COUNT(1), 0)
        INTO V_RACKCOUNT
        FROM MIL_TESTING_RACK T
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
         AND T.COL_SHIFT = '#COL_SHIFT#'
         AND T.COL_GROUP = '#COL_GROUP#';
      IF (V_RACKCOUNT > 0) THEN
        UPDATE MIL_TESTING_RACK T
           SET T.RETEST_NUM   = '0',
               T.RECUT_LENGTH = '',
               T.RECUT_FLAG   = '0',
               T.SAMPLE_FLAG  = '0'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.COL_SHIFT = '#COL_SHIFT#'
           AND T.COL_GROUP = '#COL_GROUP#';
        FOR MYROW4 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #SAMPLE_NUM3#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.SAMPLE_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW4.SEQ;
        END LOOP;
      ELSE
        FOR MYROW4 IN (SELECT SEQ
                         FROM (SELECT T.SEQ
                                 FROM MIL_TESTING_RACK T
                                WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                  AND NVL(T.PRO_PLAN_ID, '/') =
                                      NVL('#PRO_PLAN_ID#', '/')
                                  AND NVL(T.GX_PLAN_NO, '/') =
                                      NVL('#GX_PLAN_NO#', '/')
                                  AND T.RESULT_NO = '#RESULT_NO#'
                                  AND T.SUSPECT_FLAG = '0'
                                  AND T.OFFLINE_FLAG = '0'
                                  AND T.COL_SHIFT IS NULL
                                  AND T.COL_GROUP IS NULL
                                ORDER BY T.SEQ ASC)
                        WHERE ROWNUM <= #SAMPLE_NUM3#) LOOP
          UPDATE MIL_TESTING_RACK T
             SET T.SAMPLE_FLAG = '1'
           WHERE T.RESULT_NO = '#RESULT_NO#'
             AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
             AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
             AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
             AND T.SEQ = MYROW4.SEQ;
        END LOOP;
      END IF;
    END IF;
  ELSE
    IF ('#COL_NO#' = '1') THEN
      INSERT INTO MIL_TESTING_RESULT_DETAIL
        (RESULT_NO,
         LOT_NO,
         JUDGE_STOVE_NO,
         PLINE_CODE,
         START_TIME,
         END_TIME,
         COL_USER,
         COL_SHIFT,
         COL_GROUP,
         SCRAP_NUM1,
         QUALIFIED_NUM1,
         REINSPECTION_NUM1,
         REINSPECTION_QUALIFIED_NUM1,
         OFFLINE_NUM1,
         BACKLINE_NUM1,
         DETECTION_NUM1,
         SUSPECT_PRODUCT_NUM1,
         SAMPLE_NUM1,
         PRO_PLAN_ID,
         GX_PLAN_NO)
      VALUES
        ('#RESULT_NO#',
         '#LOT_NO#',
         '#JUDGE_STOVE_NO#',
         '#PLINE_CODE#',
         SYSDATE,
         SYSDATE,
         '#COL_USER#',
         '#COL_SHIFT#',
         '#COL_GROUP#',
         '#SCRAP_NUM1#',
         '#QUALIFIED_NUM1#',
         '#REINSPECTION_NUM1#',
         '#REINSPECTION_QUALIFIED_NUM1#',
         '#OFFLINE_NUM1#',
         '#BACKLINE_NUM1#',
         '#DETECTION_NUM1#',
         '#SUSPECT_PRODUCT_NUM1#',
         '#SAMPLE_NUM1#',
         '#PRO_PLAN_ID#',
         '#GX_PLAN_NO#');
      UPDATE MIL_ET_RESULT T
         SET T.DETECTION_NUM       = TO_NUMBER(T.DETECTION_NUM) +
                                     TO_NUMBER('#DETECTION_NUM1#'),
             T.SCRAP_NUM           = TO_NUMBER(T.SCRAP_NUM) +
                                     TO_NUMBER('#SCRAP_NUM1#'),
             T.QUALIFIED_NUM       = TO_NUMBER(T.QUALIFIED_NUM) +
                                     TO_NUMBER('#QUALIFIED_NUM1#'),
             T.REINSPECTION_NUM    = TO_NUMBER(T.REINSPECTION_NUM) +
                                     TO_NUMBER('#REINSPECTION_NUM1#'),
             T.SUSPECT_PRODUCT_NUM = TO_NUMBER(T.SUSPECT_PRODUCT_NUM) +
                                     TO_NUMBER('#SUSPECT_PRODUCT_NUM1#'),
             
             T.QA_TON                     = TO_NUMBER(T.QA_TON) +
                                            TO_NUMBER('#QA_TON#'),
             T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) +
                                            TO_NUMBER('#REINSPECTION_QUALIFIED_NUM1#'),
             T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) +
                                            TO_NUMBER('#SAMPLE_NUM1#'),
             T.PRODUCT_STANDARDS          = '#PRODUCT_STANDARDS#',
             T.INSPECTION_STANDARD        = '#INSPECTION_STANDARD#',
             T.TESTING_METHOD             = '#TESTING_METHOD#',
             T.CALIBRATION_METHOD         = '#CALIBRATION_METHOD#',
             T.ARTIFICIAL_DEFECT_SHAPE    = '#ARTIFICIAL_DEFECT_SHAPE#',
             T.EXCITATION_FREQUENCY1      = '#EXCITATION_FREQUENCY1#',
             T.EXCITATION_FREQUENCY2      = '#EXCITATION_FREQUENCY2#',
             T.EXCITATION_FREQUENCY3      = '#EXCITATION_FREQUENCY3#',
             T.TESTING_SPEED1             = '#TESTING_SPEED1#',
             T.TESTING_SPEED2             = '#TESTING_SPEED2#',
             T.TESTING_SPEED3             = '#TESTING_SPEED3#',
             T.USERID                     = '#USERID#',
             T.SIGNID                     = '#SIGNID#',
             T.ACCEPTANCE_GRADE           = '#ACCEPTANCE_GRADE#',
             T.USERID1                    = '#USERID1#',
             T.USERID2                    = '#USERID2#',
             T.USERID_GRADE1              = '#USERID_GRADE1#',
             T.USERID_GRADE2              = '#USERID_GRADE2#',
              T.USERID1JD                    = '#USERID1JD#',
             T.USERID2JD                    = '#USERID2JD#',
             T.USERID_GRADE1JD              = '#USERID_GRADE1JD#',
             T.USERID_GRADE2JD              = '#USERID_GRADE2JD#',
             T.REMARK                     = '#REMARK#',
             T.NOTCH_INFO                 = '#NOTCH_INFO#',
             T.NOTCH_LENGTH               = '#NOTCH_LENGTH#',
             T.NOTCH_WIDTH                = '#NOTCH_WIDTH#',
             T.NOTCH_DEPTH                = '#NOTCH_DEPTH#',
             T.SAMPLE_NEWS                = '#SAMPLE_NEWS#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      FOR MYROW4 IN (SELECT SEQ
                       FROM (SELECT T.SEQ
                               FROM MIL_TESTING_RACK T
                              WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                AND NVL(T.PRO_PLAN_ID, '/') =
                                    NVL('#PRO_PLAN_ID#', '/')
                                AND NVL(T.GX_PLAN_NO, '/') =
                                    NVL('#GX_PLAN_NO#', '/')
                                AND T.RESULT_NO = '#RESULT_NO#'
                                AND T.SUSPECT_FLAG = '0'
                                AND T.OFFLINE_FLAG = '0'
                                AND T.COL_SHIFT IS NULL
                                AND T.COL_GROUP IS NULL
                              ORDER BY T.SEQ ASC)
                      WHERE ROWNUM <= #SAMPLE_NUM1#) LOOP
        UPDATE MIL_TESTING_RACK T
           SET T.SAMPLE_FLAG = '1'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.SEQ = MYROW4.SEQ;
      END LOOP;
    ELSIF ('#COL_NO#' = '2') THEN
      INSERT INTO MIL_TESTING_RESULT_DETAIL
        (RESULT_NO,
         LOT_NO,
         STOVE_NO,
         JUDGE_STOVE_NO,
         PLINE_CODE,
         START_TIME,
         END_TIME,
         COL_USER,
         COL_SHIFT,
         COL_GROUP,
         SCRAP_NUM2,
         QUALIFIED_NUM2,
         REINSPECTION_NUM2,
         REINSPECTION_QUALIFIED_NUM2,
         OFFLINE_NUM2,
         BACKLINE_NUM2,
         DETECTION_NUM2,
         SUSPECT_PRODUCT_NUM2,
         SAMPLE_NUM2,
         PRO_PLAN_ID,
         GX_PLAN_NO)
      VALUES
        ('#RESULT_NO#',
         '#LOT_NO#',
         '#STOVE_NO#',
         '#JUDGE_STOVE_NO#',
         '#PLINE_CODE#',
         SYSDATE,
         SYSDATE,
         '#COL_USER#',
         '#COL_SHIFT#',
         '#COL_GROUP#',
         '#SCRAP_NUM2#',
         '#QUALIFIED_NUM2#',
         '#REINSPECTION_NUM2#',
         '#REINSPECTION_QUALIFIED_NUM2#',
         '#OFFLINE_NUM2#',
         '#BACKLINE_NUM2#',
         '#DETECTION_NUM2#',
         '#SUSPECT_PRODUCT_NUM2#',
         '#SAMPLE_NUM2#',
         '#PRO_PLAN_ID#',
         '#GX_PLAN_NO#');
      UPDATE MIL_ET_RESULT T
         SET T.DETECTION_NUM              = TO_NUMBER(T.DETECTION_NUM) +
                                            TO_NUMBER('#DETECTION_NUM2#'),
             T.SCRAP_NUM                  = TO_NUMBER(T.SCRAP_NUM) +
                                            TO_NUMBER('#SCRAP_NUM2#'),
             T.QUALIFIED_NUM              = TO_NUMBER(T.QUALIFIED_NUM) +
                                            TO_NUMBER('#QUALIFIED_NUM2#'),
             T.REINSPECTION_NUM           = TO_NUMBER(T.REINSPECTION_NUM) +
                                            TO_NUMBER('#REINSPECTION_NUM2#'),
             T.SUSPECT_PRODUCT_NUM        = TO_NUMBER(T.SUSPECT_PRODUCT_NUM) +
                                            TO_NUMBER('#SUSPECT_PRODUCT_NUM2#'),
             T.QA_TON                     = TO_NUMBER(T.QA_TON) +
                                            TO_NUMBER('#QA_TON#'),
             T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) +
                                            TO_NUMBER('#REINSPECTION_QUALIFIED_NUM2#'),
             T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) +
                                            TO_NUMBER('#SAMPLE_NUM2#'),
             T.PRODUCT_STANDARDS          = '#PRODUCT_STANDARDS#',
             T.INSPECTION_STANDARD        = '#INSPECTION_STANDARD#',
             T.TESTING_METHOD             = '#TESTING_METHOD#',
             T.CALIBRATION_METHOD         = '#CALIBRATION_METHOD#',
             T.ARTIFICIAL_DEFECT_SHAPE    = '#ARTIFICIAL_DEFECT_SHAPE#',
             T.EXCITATION_FREQUENCY1      = '#EXCITATION_FREQUENCY1#',
             T.EXCITATION_FREQUENCY2      = '#EXCITATION_FREQUENCY2#',
             T.EXCITATION_FREQUENCY3      = '#EXCITATION_FREQUENCY3#',
             T.TESTING_SPEED1             = '#TESTING_SPEED1#',
             T.TESTING_SPEED2             = '#TESTING_SPEED2#',
             T.TESTING_SPEED3             = '#TESTING_SPEED3#',
             T.USERID                     = '#USERID#',
             T.SIGNID                     = '#SIGNID#',
             T.ACCEPTANCE_GRADE           = '#ACCEPTANCE_GRADE#',
             T.USERID1                    = '#USERID1#',
             T.USERID2                    = '#USERID2#',
             T.USERID_GRADE1              = '#USERID_GRADE1#',
             T.USERID_GRADE2              = '#USERID_GRADE2#',
                T.USERID1JD                   = '#USERID1JD#',
             T.USERID2JD                    = '#USERID2JD#',
             T.USERID_GRADE1JD              = '#USERID_GRADE1JD#',
             T.USERID_GRADE2JD              = '#USERID_GRADE2JD#',
             T.REMARK                     = '#REMARK#',
             T.NOTCH_INFO                 = '#NOTCH_INFO#',
             T.NOTCH_LENGTH               = '#NOTCH_LENGTH#',
             T.NOTCH_WIDTH                = '#NOTCH_WIDTH#',
             T.NOTCH_DEPTH                = '#NOTCH_DEPTH#',
             T.SAMPLE_NEWS                = '#SAMPLE_NEWS#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      FOR MYROW4 IN (SELECT SEQ
                       FROM (SELECT T.SEQ
                               FROM MIL_TESTING_RACK T
                              WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                AND NVL(T.PRO_PLAN_ID, '/') =
                                    NVL('#PRO_PLAN_ID#', '/')
                                AND NVL(T.GX_PLAN_NO, '/') =
                                    NVL('#GX_PLAN_NO#', '/')
                                AND T.RESULT_NO = '#RESULT_NO#'
                                AND T.SUSPECT_FLAG = '0'
                                AND T.OFFLINE_FLAG = '0'
                                AND T.COL_SHIFT IS NULL
                                AND T.COL_GROUP IS NULL
                              ORDER BY T.SEQ ASC)
                      WHERE ROWNUM <= #SAMPLE_NUM2#) LOOP
        UPDATE MIL_TESTING_RACK T
           SET T.SAMPLE_FLAG = '1'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.SEQ = MYROW4.SEQ;
      END LOOP;
    ELSE
      INSERT INTO MIL_TESTING_RESULT_DETAIL
        (RESULT_NO,
         LOT_NO,
         STOVE_NO,
         JUDGE_STOVE_NO,
         PLINE_CODE,
         START_TIME,
         END_TIME,
         COL_USER,
         COL_SHIFT,
         COL_GROUP,
         SCRAP_NUM3,
         QUALIFIED_NUM3,
         REINSPECTION_NUM3,
         REINSPECTION_QUALIFIED_NUM3,
         OFFLINE_NUM3,
         BACKLINE_NUM3,
         DETECTION_NUM3,
         SUSPECT_PRODUCT_NUM3,
         SAMPLE_NUM3,
         PRO_PLAN_ID,
         GX_PLAN_NO)
      VALUES
        ('#RESULT_NO#',
         '#LOT_NO#',
         '#STOVE_NO#',
         '#JUDGE_STOVE_NO#',
         '#PLINE_CODE#',
         SYSDATE,
         SYSDATE,
         '#COL_USER#',
         '#COL_SHIFT#',
         '#COL_GROUP#',
         '#SCRAP_NUM3#',
         '#QUALIFIED_NUM3#',
         '#REINSPECTION_NUM3#',
         '#REINSPECTION_QUALIFIED_NUM3#',
         '#OFFLINE_NUM3#',
         '#BACKLINE_NUM3#',
         '#DETECTION_NUM3#',
         '#SUSPECT_PRODUCT_NUM3#',
         '#SAMPLE_NUM3#',
         '#PRO_PLAN_ID#',
         '#GX_PLAN_NO#');
      UPDATE MIL_ET_RESULT T
         SET T.DETECTION_NUM              = TO_NUMBER(T.DETECTION_NUM) +
                                            TO_NUMBER('#DETECTION_NUM3#'),
             T.SCRAP_NUM                  = TO_NUMBER(T.SCRAP_NUM) +
                                            TO_NUMBER('#SCRAP_NUM3#'),
             T.QUALIFIED_NUM              = TO_NUMBER(T.QUALIFIED_NUM) +
                                            TO_NUMBER('#QUALIFIED_NUM3#'),
             T.REINSPECTION_NUM           = TO_NUMBER(T.REINSPECTION_NUM) +
                                            TO_NUMBER('#REINSPECTION_NUM3#'),
             T.SUSPECT_PRODUCT_NUM        = TO_NUMBER(T.SUSPECT_PRODUCT_NUM) +
                                            TO_NUMBER('#SUSPECT_PRODUCT_NUM3#'),
             T.QA_TON                     = TO_NUMBER(T.QA_TON) +
                                            TO_NUMBER('#QA_TON#'),
             T.REINSPECTION_QUALIFIED_NUM = TO_NUMBER(T.REINSPECTION_QUALIFIED_NUM) +
                                            TO_NUMBER('#REINSPECTION_QUALIFIED_NUM3#'),
             T.SAMPLE_NUM                 = TO_NUMBER(T.SAMPLE_NUM) +
                                            TO_NUMBER('#SAMPLE_NUM3#'),
             T.PRODUCT_STANDARDS          = '#PRODUCT_STANDARDS#',
             T.INSPECTION_STANDARD        = '#INSPECTION_STANDARD#',
             T.TESTING_METHOD             = '#TESTING_METHOD#',
             T.CALIBRATION_METHOD         = '#CALIBRATION_METHOD#',
             T.ARTIFICIAL_DEFECT_SHAPE    = '#ARTIFICIAL_DEFECT_SHAPE#',
             T.EXCITATION_FREQUENCY1      = '#EXCITATION_FREQUENCY1#',
             T.EXCITATION_FREQUENCY2      = '#EXCITATION_FREQUENCY2#',
             T.EXCITATION_FREQUENCY3      = '#EXCITATION_FREQUENCY3#',
             T.TESTING_SPEED1             = '#TESTING_SPEED1#',
             T.TESTING_SPEED2             = '#TESTING_SPEED2#',
             T.TESTING_SPEED3             = '#TESTING_SPEED3#',
             T.USERID                     = '#USERID#',
             T.SIGNID                     = '#SIGNID#',
             T.ACCEPTANCE_GRADE           = '#ACCEPTANCE_GRADE#',
             T.USERID1                    = '#USERID1#',
             T.USERID2                    = '#USERID2#',
             T.USERID_GRADE1              = '#USERID_GRADE1#',
             T.USERID_GRADE2              = '#USERID_GRADE2#',
                T.USERID1JD                    = '#USERID1JD#',
             T.USERID2JD                    = '#USERID2JD#',
             T.USERID_GRADE1JD              = '#USERID_GRADE1JD#',
             T.USERID_GRADE2JD              = '#USERID_GRADE2JD#',
             T.REMARK                     = '#REMARK#',
             T.NOTCH_INFO                 = '#NOTCH_INFO#',
             T.NOTCH_LENGTH               = '#NOTCH_LENGTH#',
             T.NOTCH_WIDTH                = '#NOTCH_WIDTH#',
             T.NOTCH_DEPTH                = '#NOTCH_DEPTH#',
             T.SAMPLE_NEWS                = '#SAMPLE_NEWS#'
       WHERE T.RESULT_NO = '#RESULT_NO#'
         AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
         AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
         AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/');
      FOR MYROW4 IN (SELECT SEQ
                       FROM (SELECT T.SEQ
                               FROM MIL_TESTING_RACK T
                              WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
                                AND NVL(T.PRO_PLAN_ID, '/') =
                                    NVL('#PRO_PLAN_ID#', '/')
                                AND NVL(T.GX_PLAN_NO, '/') =
                                    NVL('#GX_PLAN_NO#', '/')
                                AND T.RESULT_NO = '#RESULT_NO#'
                                AND T.SUSPECT_FLAG = '0'
                                AND T.OFFLINE_FLAG = '0'
                                AND T.COL_SHIFT IS NULL
                                AND T.COL_GROUP IS NULL
                              ORDER BY T.SEQ ASC)
                      WHERE ROWNUM <= #SAMPLE_NUM3#) LOOP
        UPDATE MIL_TESTING_RACK T
           SET T.SAMPLE_FLAG = '1'
         WHERE T.RESULT_NO = '#RESULT_NO#'
           AND T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#'
           AND NVL(T.PRO_PLAN_ID, '/') = NVL('#PRO_PLAN_ID#', '/')
           AND NVL(T.GX_PLAN_NO, '/') = NVL('#GX_PLAN_NO#', '/')
           AND T.SEQ = MYROW4.SEQ;
      END LOOP;
    END IF;
  END IF;
END;
]]>
   </query>
   <query id = "EddyCurrentTestingResult.doQueryAlarm" desc = "查询可疑支数(漏磁)">
  SELECT SUM(T.ALARM_NUM) ALARM_NUM, SUM(S.REASON_NUMBER) REASON_NUMBER
  FROM MIL_MT_RESULT T
  LEFT JOIN (SELECT JUDGE_STOVE_NO,
                    RESULT_NO,
                    REASON_FLAG,
                    NVL(SUM(REASON_NUMBER), 0) REASON_NUMBER
               FROM MIL_TESTING_RESULT_DETAIL_DES
              GROUP BY JUDGE_STOVE_NO, RESULT_NO, REASON_FLAG) S
    ON T.JUDGE_STOVE_NO = S.JUDGE_STOVE_NO
   AND T.RESULT_NO = S.RESULT_NO
 WHERE T.JUDGE_STOVE_NO = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
   AND S.REASON_FLAG = '可疑'
   </query>
   <query id = "EddyCurrentTestingResult.doQueryAlarm1" desc = "查询可疑支数(涡流)">
   SELECT SUM(T.SUSPECT_PRODUCT_NUM) ALARM_NUM,
       SUM(S.REASON_NUMBER) REASON_NUMBER
  FROM MIL_ET_RESULT T
  LEFT JOIN (SELECT JUDGE_STOVE_NO,
                    RESULT_NO,
                    REASON_FLAG,
                    NVL(SUM(REASON_NUMBER), 0) REASON_NUMBER
               FROM MIL_TESTING_RESULT_DETAIL_DES
              GROUP BY JUDGE_STOVE_NO, RESULT_NO, REASON_FLAG) S
    ON T.JUDGE_STOVE_NO = S.JUDGE_STOVE_NO
   AND T.RESULT_NO = S.RESULT_NO
 WHERE T.JUDGE_STOVE_NO = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
   AND S.REASON_FLAG = '可疑'
   </query>
   <query id = "EddyCurrentTestingResult.doQuerySCRAPNUM" desc = "查询剔除支数(漏磁)">
   SELECT SUM(T.SCRAP_NUM) SCRAP_NUM,
       SUM(S.REASON_NUMBER) REASON_NUMBER,
       SUM(P.ACT_COUNT) ACT_COUNT
  FROM MIL_MT_RESULT T
  LEFT JOIN (SELECT JUDGE_STOVE_NO,
                    RESULT_NO,
                    REASON_FLAG,
                    NVL(SUM(REASON_NUMBER), 0) REASON_NUMBER
               FROM MIL_TESTING_RESULT_DETAIL_DES
              GROUP BY JUDGE_STOVE_NO, RESULT_NO, REASON_FLAG) S
    ON T.JUDGE_STOVE_NO = S.JUDGE_STOVE_NO
   AND T.RESULT_NO = S.RESULT_NO
  LEFT JOIN (SELECT P.JUDGE_STOVE_NO, P.PLAN_ID, SUM(P.ACT_COUNT) ACT_COUNT
               FROM PORT_MIL_BATCH_SAMPLE_RESULT P
              WHERE P.STATUS = '2'
                AND P.OP_PROCESS = '10'
              GROUP BY P.JUDGE_STOVE_NO, P.PLAN_ID) P
    ON T.JUDGE_STOVE_NO = P.JUDGE_STOVE_NO
   AND T.RESULT_NO = P.PLAN_ID
 WHERE T.JUDGE_STOVE_NO = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
   AND S.REASON_FLAG = '剔除'
   </query>
   <query id = "EddyCurrentTestingResult.doQuerySCRAPNUM1" desc = "查询剔除支数(涡流)">
  SELECT SUM(T.SCRAP_NUM) SCRAP_NUM,
       SUM(S.REASON_NUMBER) REASON_NUMBER,
       SUM(P.ACT_COUNT) ACT_COUNT
  FROM MIL_ET_RESULT T
  LEFT JOIN (SELECT JUDGE_STOVE_NO,
                    RESULT_NO,
                    REASON_FLAG,
                    NVL(SUM(REASON_NUMBER), 0) REASON_NUMBER
               FROM MIL_TESTING_RESULT_DETAIL_DES
              GROUP BY JUDGE_STOVE_NO, RESULT_NO, REASON_FLAG) S
    ON T.JUDGE_STOVE_NO = S.JUDGE_STOVE_NO
   AND T.RESULT_NO = S.RESULT_NO
  LEFT JOIN (SELECT P.JUDGE_STOVE_NO, P.PLAN_ID, SUM(P.ACT_COUNT) ACT_COUNT
               FROM PORT_MIL_BATCH_SAMPLE_RESULT P
              WHERE P.STATUS = '2'
                AND P.OP_PROCESS = '10'
              GROUP BY P.JUDGE_STOVE_NO, P.PLAN_ID) P
    ON T.JUDGE_STOVE_NO = P.JUDGE_STOVE_NO
   AND T.RESULT_NO = P.PLAN_ID
 WHERE T.JUDGE_STOVE_NO = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
   AND S.REASON_FLAG = '剔除'
   </query>
   <query id = "EddyCurrentTestingResult.getMtResultNum" desc = "查询探伤总支数(MT)">
   SELECT (T.QUALIFIED_NUM + T.SCRAP_NUM + T.OFFLINE_NUM + T.SAMPLE_NUM +
       T.INSPECTIONED_OFFLINE_NUM) AS TOTALCOUNT
  FROM MIL_MT_RESULT T
 WHERE T.JUDGE_STOVE_NO = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
   </query>
   <query id = "EddyCurrentTestingResult.getMtResultNum1" desc = "查询探伤总支数(ET)">
   SELECT (T.QUALIFIED_NUM + T.SCRAP_NUM + T.OFFLINE_NUM + T.SAMPLE_NUM +
       T.INSPECTIONED_OFFLINE_NUM) AS TOTALCOUNT
  FROM MIL_ET_RESULT T
 WHERE T.JUDGE_STOVE_NO = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
   </query>
   <query id = "EddyCurrentTestingResult.doQuerySize" desc = "查询几何尺寸记录">
   <![CDATA[
   SELECT T.JUDGE_STOVE_NO
  FROM MIL_SIZE_CHECK_DEATIL T
 WHERE T.JUDGE_STOVE_NO LIKE  ? || '%'
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
   ]]>
   </query>
   <query id = "NodeBack.UpdateShift" desc = "回退清除班次班组">
   DECLARE
  V_SEQ MIL_TESTING_RACK.SEQ%TYPE := 0;
BEGIN
  SELECT NVL(MAX(T.SEQ),0)INTO V_SEQ FROM MIL_TESTING_RACK T WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#' AND T.RESULT_NO = '#RESULT_NO#' AND T.CHANGE_FLAG = '1';
  IF(V_SEQ = 0)THEN
  UPDATE MIL_TESTING_RACK T SET T.COL_SHIFT = '',T.COL_GROUP = '' WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#' AND T.RESULT_NO = '#RESULT_NO#';
  ELSE
  UPDATE MIL_TESTING_RACK T SET T.COL_SHIFT = '',T.COL_GROUP = '' WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#' AND T.RESULT_NO = '#RESULT_NO#' AND T.SEQ > V_SEQ;
  END IF;
END;
   </query>
   <query id = "EddyCurrentTestingResult.selectBackLineNum" desc = "查询是否存在返线支数">
   SELECT T.JUDGE_STOVE_NO
  FROM MIL_TESTING_RACK T
 WHERE T.RESULT_NO = ?
   AND T.JUDGE_STOVE_NO = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
   AND T.OFFLINE_FLAG = '2'
   </query>
   <query id = "EddyCurrentTestingResult.doQueryMtResult" desc = "查询部分实绩">
   SELECT T.DETECTION_NUM,
       T.ALARM_NUM,
       T.SCRAP_NUM,
       T.INSPECTIONED_OFFLINE_NUM,
       T.SAMPLE_NUM
  FROM MIL_MT_RESULT T
 WHERE T.RESULT_NO = ?
 AND T.JUDGE_STOVE_NO = ?
   </query>
   <query id = "EddyCurrentTestingResult.doQueryEtResult" desc = "查询部分实绩">
   SELECT T.DETECTION_NUM,
       T.SUSPECT_PRODUCT_NUM,
       T.SCRAP_NUM,
       T.INSPECTIONED_OFFLINE_NUM,
       T.SAMPLE_NUM
  FROM MIL_ET_RESULT T
 WHERE T.RESULT_NO = ?
   </query>
   <query id = "EddyCurrentTestingResult.doQueryTestedNum" desc = "查询已探下线支数">
   SELECT NVL(T.REASON_NUMBER, 0) REASON_NUMBER
  FROM MIL_TESTING_RESULT_DETAIL_DES T
 WHERE T.RESULT_NO = ?
   AND T.COL_SHIFT = ?
   AND T.COL_GROUP = ?
   AND T.COL_NO = ?
   AND T.REASON_FLAG = '下线'
   </query>
   <query id = "EddyCurrentTestingResult.doQueryResultStaus" desc = "查询结炉状态">
   <![CDATA[
   SELECT T.NODE_FUR_FLAG
  FROM #RESULT# T
 WHERE T.RESULT_NO = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.PLINE_CODE = ?
   AND T.PRO_PLAN_ID || '&' LIKE '%' || ? || '%'
   AND T.GX_PLAN_NO || '&' LIKE '%' || ? || '%'
   ]]>
   </query>
   <query id = "EddyCurrentTestingResult.doQueryOfflineNum" desc = "查询已探下线支数">
  SELECT T.REASON_NUMBER
  FROM MIL_TESTING_RESULT_DETAIL_DES T
 WHERE T.RESULT_NO = ?
   AND T.COL_SHIFT = ?
   AND T.COL_GROUP = ?
   AND T.COL_NO = ?
   AND T.REASON_FLAG = '下线'
   </query>
   <query id = "EddyCurrentTestingResult.doQuerySeq" desc = "查询进程管号队列">
   SELECT ROWNUM SEQ, T.ORDER_LENGTH
  FROM PORT_MIL_BATCH_SAMPLE_RESULT T
 WHERE T.PLAN_ID = ?
   AND T.JUDGE_STOVE_NO = ?
   AND T.STATUS = '0'
   ORDER BY T.MAT_NO ASC
   </query>
   <query id = "updateProcessTest.selectMilSlabSeqCount" desc = "查询已探下线支数">
   <![CDATA[
   SELECT NVL(SUM(T.REASON_NUMBER), 0) ACOUNT
  FROM MIL_TESTING_RESULT_DETAIL_DES T
 WHERE T.JUDGE_STOVE_NO = ?
   AND T.PRO_PLAN_ID  || '&' LIKE '%' || ? || '%'
   AND T.GX_PLAN_NO  || '&' LIKE '%' || ? || '%'
   AND T.REASON_FLAG = '下线'
   ]]>
   </query>
   <query id = "EddyCurrentTestingResult.selectMilPlanData" desc = "查询炉计划信息">
   <![CDATA[
	SELECT T.*
  FROM MIL_PLAN T
 WHERE T.JUDGE_STOVE_NO = ?
   AND T.PRO_PLAN_ID  || '&' LIKE '%' || ? || '%'
   AND T.GX_PLAN_NO  || '&' LIKE '%' || ? || '%'
   ]]>
	</query>
	<query id = "EddyCurrentTestingResult.selectMilOfflineGroup" desc = "查询是否有组炉">
	SELECT NVL(SUM(T.GROUP_NUM), 0)
  FROM MIL_OFFLINE_RESLUT T
 WHERE T.JUDGE_STOVE_NO = ?
   AND NVL(T.PRO_PLAN_ID, '/') = NVL(?, '/')
   AND NVL(T.GX_PLAN_NO, '/') = NVL(?, '/')
   AND T.OFFLINE_PRO = 'TS'
	</query>
	<query id = "EddyCurrentTestingResult.insertScrapSlab" desc = "插入废管">
	<![CDATA[
	DECLARE
  CURSOR OPOrder_Cursor IS
    SELECT ROWNUM SEQ, MAT_NO, PIPE_LENGTH, JUDGE_STOVE_NO
      from (SELECT T.SEQ, T.MAT_NO, T.PIPE_LENGTH, T.JUDGE_STOVE_NO
              FROM MIL_TESTING_RACK T
             WHERE T.JUDGE_STOVE_NO = ?
               AND T.PRO_PLAN_ID  || '&' LIKE '%' || ? || '%'
               AND T.GX_PLAN_NO  || '&' LIKE '%' || ? || '%'
               AND T.STATUS = '1'
             ORDER BY T.SEQ ASC);
  curOPOrder OPOrder_Cursor%RowType;
BEGIN
  open OPOrder_Cursor;
  LOOP
    fetch OPOrder_Cursor
      into curOPOrder;
    EXIT WHEN OPOrder_Cursor%NOTFOUND;
    insert into mil_slab_scrap
      (judge_stove_no,
       process_no,
       mat_no,
       pline_code,
       PRO_PLAN_ID,
       GX_PLAN_NO)
    values
      (curOPOrder.JUDGE_STOVE_NO, '10', curOPOrder.MAT_NO, ?, ?, ?);
  END LOOP;
  close OPOrder_Cursor;
END;
]]>
	</query>
	<query id = "EddyCurrentTestingResult.assignmentMatNo" desc = "赋值材料号到表检">
	<![CDATA[
	DECLARE
  CURSOR OPOrder_Cursor IS
    SELECT ROWNUM SEQ, MAT_NO, Order_Length
      from (SELECT T.SEQ, T.MAT_NO, T.Order_Length
              FROM PORT_MIL_BATCH_SAMPLE_RESULT T
             WHERE T.JUDGE_STOVE_NO = ?
               AND T.PRO_PLAN_ID  || '&' LIKE '%' || ? || '%'
               AND T.GX_PLAN_NO  || '&' LIKE '%' || ? || '%'
               AND (T.STATUS = '0' OR T.STATUS = '3' AND T.OP_PROCESS = '12')
             ORDER BY T.BATCH_NO DESC, T.IS_SAMPLE_PIPE, T.SEQ ASC);
  curOPOrder OPOrder_Cursor%RowType;
BEGIN
  open OPOrder_Cursor;
  LOOP
    fetch OPOrder_Cursor
      into curOPOrder;
    EXIT WHEN OPOrder_Cursor%NOTFOUND;
    UPDATE MIL_QA_RACK T
       SET T.MAT_NO      = curOPOrder.MAT_NO,
           T.PIPE_LENGTH = curOPOrder.Order_Length
     WHERE T.JUDGE_STOVE_NO = ?
       AND T.PRO_PLAN_ID  || '&' LIKE '%' || ? || '%'
       AND T.GX_PLAN_NO  || '&' LIKE '%' || ? || '%'
       AND T.SEQ = curOPOrder.SEQ;
  END LOOP;
  close OPOrder_Cursor;
END;
]]>
	</query>
	<query id = "EddyCurrentTestingResult.doQueryGrade" desc = "查询绑定操作者等级">
	SELECT T.USER_NAME, T.USERID_GRADE,T.USER_ID
  FROM MIL_SIGNATURE T
 WHERE T.COL_GROUP = ?
   AND T.PROCESS_NO = ?
   AND T.PLINE_CODE = ?
	</query>
	<query id = "EddyCurrentTestingResult.doQueryGrade2" desc = "查询绑定签发者">
	SELECT T.USER_NAME, T.USERID_GRADE,T.USER_ID
  FROM MIL_SIGNATURE T
 WHERE T.PROCESS_NO = ?
   AND T.PLINE_CODE = ?
   AND T.USERID_GRADE like '%2%'
	</query>
    <query id = "EddyCurrentTestingResult.doQueryGradejd" desc = "查询绑定监督者">
        SELECT T.USER_NAME, T.USERID_GRADE,T.USER_ID
        FROM MIL_SIGNATURE T
        WHERE T.PROCESS_NO = ?
        AND T.PLINE_CODE = ?
        AND T.USERID_GRADE like '%2%'
    </query>
	<query id = "EddyCurrentTestingResult.doQueryGrade1" desc = "查询操作者等级1">
	SELECT T.USERID_GRADE
  FROM MIL_SIGNATURE T
 WHERE T.USER_ID = ?
	</query>
	<query id = "EddyCurrentTestingResult.SelectPipeSizeLen" desc = "查询轧管规格/长度">
	SELECT T.* FROM MIL_PLAN T WHERE T.JUDGE_STOVE_NO = ?
	</query>
	<query id = "EddyCurrentTestingResult.SelectofflineDoc" desc = "离线单号">
	SELECT T.OFFLINE_DOC
  FROM MIL_OFFLINE_RESLUT T
 WHERE T.JUDGE_STOVE_NO = ?
   AND T.PRO_PLAN_ID = ?
   AND T.GX_PLAN_NO = ?
   AND T.OFFLINE_PRO = 'TS'
	</query>
</queryMap>