<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "转移支队列">
<query id = "FrmTransfer.getBelongVaild" desc = "通过产线获取权限">
SELECT T.PLINE_CODE,T.PLINE_NAME FROM COM_BASE_PLINE T WHERE T.VALIDFLAG = '1'
</query>
<query id = "FrmTransfer.doQuery" desc = "查询支队列炉信息">
SELECT T.*
  FROM MIL_PLAN T,
       (SELECT T1.JUDGE_STOVE_NO,
               T1.PRO_PLAN_ID,
               T1.GX_PLAN_NO,
               T1.BAL_YEAR_MONTH
          FROM PORT_MIL_BATCH_SAMPLE_RESULT T1
         GROUP BY T1.JUDGE_STOVE_NO,
                  T1.PRO_PLAN_ID,
                  T1.GX_PLAN_NO,
                  T1.BAL_YEAR_MONTH) S
 WHERE NVL(T.PRO_PLAN_ID,'/') = NVL(S.PRO_PLAN_ID,'/')
   AND NVL(T.GX_PLAN_NO,'/') = NVL(S.GX_PLAN_NO,'/')
   AND T.JUDGE_STOVE_NO = S.JUDGE_STOVE_NO
   AND T.JUDGE_STOVE_NO = REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '') || '-01'
   AND T.BACK_PLAN_FLAG = '0'
</query>

<query id = "FrmTransfer.doQueryB" desc = "查询已转移炉信息">
SELECT T.*
  FROM MIL_PLAN T,
       (SELECT T1.JUDGE_STOVE_NO,
               T1.PRO_PLAN_ID,
               T1.GX_PLAN_NO,
               T1.BAL_YEAR_MONTH
          FROM MIL_BATCH_RESULT_HISTORY T1
         GROUP BY T1.JUDGE_STOVE_NO,
                  T1.PRO_PLAN_ID,
                  T1.GX_PLAN_NO,
                  T1.BAL_YEAR_MONTH) S
 WHERE NVL(T.PRO_PLAN_ID,'/') = NVL(S.PRO_PLAN_ID,'/')
   AND NVL(T.GX_PLAN_NO,'/') = NVL(S.GX_PLAN_NO,'/')
   AND T.JUDGE_STOVE_NO = S.JUDGE_STOVE_NO
   AND T.JUDGE_STOVE_NO = REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '') || '-01'
   AND T.BACK_PLAN_FLAG = '0'
</query>
<query id = "FrmTransfer.transferPortMil" desc = "查询进程信息">
<![CDATA[
 SELECT AA.*,
       CASE AA.NODE_STATUS
         WHEN '10' THEN
          '锯切完成'
         WHEN '20' THEN
          '出炉'
         WHEN '30' THEN
          '穿孔完成'
         WHEN '40' THEN
          '连轧完成'
         WHEN '50' THEN
          '出再加热炉'
         WHEN '60' THEN
          '出定径'
         WHEN '70' THEN
          '分切完成'
         WHEN '80' THEN
          '矫直完成'
         WHEN '90' THEN
          '探伤完成'
         WHEN '96' THEN
          '质检完成'
         WHEN '99' THEN
          '下线'
       END NODE_STATUS1,
       CASE
         WHEN AA.NODE_STATUS < 20 THEN
          0
         ELSE
          AA.HGZ1 - AA.FPZ2
       END HGZ2,
       CASE
         WHEN AA.NODE_STATUS < 20 THEN
          0
         ELSE
          AA.HGD1 - AA.FPD2
       END HGD2,
       
       CASE
         WHEN AA.NODE_STATUS < 30 THEN
          0
         ELSE
          AA.HGZ1 - AA.FPZ2 - AA.FPZ3
       END HGZ3,
       CASE
         WHEN AA.NODE_STATUS < 30 THEN
          0
         ELSE
          AA.HGD1 - AA.FPD2 - AA.FPD3
       END HGD3,
       
       CASE
         WHEN AA.NODE_STATUS < 40 THEN
          0
         ELSE
          AA.HGZ1 - AA.FPZ2 - AA.FPZ3 - AA.FPZ4
       END HGZ4,
       CASE
         WHEN AA.NODE_STATUS < 40 THEN
          0
         ELSE
          AA.HGD1 - AA.FPD2 - AA.FPD3 - AA.FPD4
       END HGD4,
       
       CASE
         WHEN AA.NODE_STATUS < 50 THEN
          0
         ELSE
          AA.HGZ1 - AA.FPZ2 - AA.FPZ3 - AA.FPZ4 - AA.FPZ5
       END HGZ5,
       CASE
         WHEN AA.NODE_STATUS < 50 THEN
          0
         ELSE
          AA.HGD1 - AA.FPD2 - AA.FPD3 - AA.FPD4 - AA.FPD5
       END HGD5,
       
       CASE
         WHEN AA.NODE_STATUS < 60 THEN
          0
         ELSE
          AA.HGZ1 - AA.FPZ2 - AA.FPZ3 - AA.FPZ4 - AA.FPZ5 - AA.FPZ6
       END HGZ6,
       CASE
         WHEN AA.NODE_STATUS < 60 THEN
          0
         ELSE
          AA.HGD1 - AA.FPD2 - AA.FPD3 - AA.FPD4 - AA.FPD5 - AA.FPD6
       END HGD6,
       
       CASE
         WHEN AA.NODE_STATUS < 80 THEN
          0
         ELSE
          AA.HGZ7 - AA.FPZ9 - AA.XXZ9 - AA.ZLZ9
       END HGZ9,
       CASE
         WHEN AA.NODE_STATUS < 80 THEN
          0
         ELSE
          AA.HGD7 - AA.FPD9 - AA.XXD9 - AA.ZLD9
       END HGD9,
       
       CASE
         WHEN AA.NODE_STATUS < 90 THEN
          0
         ELSE
          AA.HGZ7 - AA.FPZ9 - AA.XXZ9 - AA.FPZ10 - AA.XXZ10 - AA.ZLZ10
       END HGZ10,
       CASE
         WHEN AA.NODE_STATUS < 90 THEN
          0
         ELSE
          AA.HGD7 - AA.FPD9 - AA.XXD9 - AA.FPD10 - AA.XXD10 - AA.ZLD10
       END HGD10,
       
       CASE
         WHEN AA.NODE_STATUS < 96 THEN
          0
         ELSE
          AA.HGZ7 - AA.FPZ9 - AA.XXZ9 - AA.FPZ10 - AA.XXZ10 - AA.FPZ11 -
          AA.XXZ11 - AA.ZLZ11
       END HGZ11,
       CASE
         WHEN AA.NODE_STATUS < 96 THEN
          0
         ELSE
          AA.HGD7 - AA.FPD9 - AA.XXD9 - AA.FPD10 - AA.XXD10 - AA.FPD11 -
          AA.XXD11 - AA.ZLD11
       END HGD11

  FROM (select REGEXP_REPLACE(T1.JUDGE_STOVE_NO, '-.*', '') JUDGE_STOVE_NO,
               T1.LOT_NO,
               T.PLINE_CODE,
               (SELECT A.PLINE_NAME
                  FROM COM_BASE_PLINE A
                 WHERE A.PLINE_CODE = T.PLINE_CODE) PLINE_CODE1,
               T1.CONTRACT_NO,
               MAX(T1.VARIETIES) VARIETIES,
               MAX(T1.STEELNAME) STEELNAME,
               MAX(T1.GRADENAME) GRADENAME,
               REPLACE(MAX(T1.PIPE_SIZE), '*', 'x') PIPE_SIZE,
               MAX(T1.BUCKLE_TYPE) BUCKLE_TYPE,
               MAX(T1.LENGTH_RANGE) LENGTH_RANGE,
               MAX(T1.ROLL_STANDRAD) ROLL_STANDRAD,
               MIN(T.START_TIME) START_TIME,
               --MAX(T1.NODE_STATUS) NODE_STATUS,
               MAX(T1.TARGET) TARGET,
               
               (SELECT MAX(NODE_STATUS) FROM MIL_PLAN WHERE ID = T1.ID) NODE_STATUS,
               
               (SELECT count(1)
                  from (SELECT B.JUDGE_STOVE_NO,
                               B.m_mat_no,
                               SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                          FROM PORT_MIL_BATCH_SAMPLE_RESULT B
                         WHERE B.IS_VALID = '1'
                           AND (TRIM(B.Op_Process) != '0' OR
                               B.Op_Process IS NULL)
                         group by B.m_mat_no, B.JUDGE_STOVE_NO) A
                 WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                 GROUP BY A.JUDGE_STOVE_NO) HGZ1,
               
               (SELECT SUM(A.ACT_THEORY_WEIGHT)
                  from (SELECT B.JUDGE_STOVE_NO,
                               B.m_mat_no,
                               SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                          FROM PORT_MIL_BATCH_SAMPLE_RESULT B
                         WHERE B.IS_VALID = '1'
                           AND (TRIM(B.Op_Process) != '0' OR
                               B.Op_Process IS NULL)
                         group by B.m_mat_no, B.JUDGE_STOVE_NO) A
                 WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                 GROUP BY A.JUDGE_STOVE_NO) HGD1,
               
               (select COUNT(1)
                  from (select B.JUDGE_STOVE_NO,
                               TRIM(B.OP_PROCESS) OP_PROCESS,
                               B.m_mat_no,
                               SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                          from PORT_MIL_BATCH_SAMPLE_RESULT B
                         WHERE B.IS_VALID = '1'
                           AND B.STATUS = '1'
                         group by B.JUDGE_STOVE_NO, B.m_mat_no, B.op_process) A
                 WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                   AND A.OP_PROCESS = '0') FPZ1,
               
               NVL((select SUM(A.ACT_THEORY_WEIGHT)
                     from (select B.JUDGE_STOVE_NO,
                                  TRIM(B.OP_PROCESS) OP_PROCESS,
                                  B.m_mat_no,
                                  SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                             from PORT_MIL_BATCH_SAMPLE_RESULT B
                            WHERE B.IS_VALID = '1'
                              AND B.STATUS = '1'
                            group by B.JUDGE_STOVE_NO,
                                     B.m_mat_no,
                                     B.op_process) A
                    WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                      AND A.OP_PROCESS = '0'),
                   0) FPD1,
               
               (select COUNT(1)
                  from (select B.JUDGE_STOVE_NO,
                               TRIM(B.OP_PROCESS) OP_PROCESS,
                               B.m_mat_no,
                               SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                          from PORT_MIL_BATCH_SAMPLE_RESULT B
                         WHERE B.IS_VALID = '1'
                           AND B.STATUS = '1'
                         group by B.JUDGE_STOVE_NO, B.m_mat_no, B.op_process) A
                 WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                   AND A.OP_PROCESS = '2') FPZ2,
               
               NVL((select SUM(A.ACT_THEORY_WEIGHT)
                     from (select B.JUDGE_STOVE_NO,
                                  TRIM(B.OP_PROCESS) OP_PROCESS,
                                  B.m_mat_no,
                                  SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                             from PORT_MIL_BATCH_SAMPLE_RESULT B
                            WHERE B.IS_VALID = '1'
                              AND B.STATUS = '1'
                            group by B.JUDGE_STOVE_NO,
                                     B.m_mat_no,
                                     B.op_process) A
                    WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                      AND A.OP_PROCESS = '2'),
                   0) FPD2,
               
               (select COUNT(1)
                  from (select B.JUDGE_STOVE_NO,
                               TRIM(B.OP_PROCESS) OP_PROCESS,
                               B.m_mat_no,
                               SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                          from PORT_MIL_BATCH_SAMPLE_RESULT B
                         WHERE B.IS_VALID = '1'
                           AND B.STATUS = '1'
                         group by B.JUDGE_STOVE_NO, B.m_mat_no, B.op_process) A
                 WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                   AND A.OP_PROCESS = '3') FPZ3,
               
               NVL((select SUM(A.ACT_THEORY_WEIGHT)
                     from (select B.JUDGE_STOVE_NO,
                                  TRIM(B.OP_PROCESS) OP_PROCESS,
                                  B.m_mat_no,
                                  SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                             from PORT_MIL_BATCH_SAMPLE_RESULT B
                            WHERE B.IS_VALID = '1'
                              AND B.STATUS = '1'
                            group by B.JUDGE_STOVE_NO,
                                     B.m_mat_no,
                                     B.op_process) A
                    WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                      AND A.OP_PROCESS = '3'),
                   0) FPD3,
               
               (select COUNT(1)
                  from (select B.JUDGE_STOVE_NO,
                               TRIM(B.OP_PROCESS) OP_PROCESS,
                               B.m_mat_no,
                               SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                          from PORT_MIL_BATCH_SAMPLE_RESULT B
                         WHERE B.IS_VALID = '1'
                           AND B.STATUS = '1'
                         group by B.JUDGE_STOVE_NO, B.m_mat_no, B.op_process) A
                 WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                   AND A.OP_PROCESS = '4') FPZ4,
               
               NVL((select SUM(A.ACT_THEORY_WEIGHT)
                     from (select B.JUDGE_STOVE_NO,
                                  TRIM(B.OP_PROCESS) OP_PROCESS,
                                  B.m_mat_no,
                                  SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                             from PORT_MIL_BATCH_SAMPLE_RESULT B
                            WHERE B.IS_VALID = '1'
                              AND B.STATUS = '1'
                            group by B.JUDGE_STOVE_NO,
                                     B.m_mat_no,
                                     B.op_process) A
                    WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                      AND A.OP_PROCESS = '4'),
                   0) FPD4,
               
               (select COUNT(1)
                  from (select B.JUDGE_STOVE_NO,
                               TRIM(B.OP_PROCESS) OP_PROCESS,
                               B.m_mat_no,
                               SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                          from PORT_MIL_BATCH_SAMPLE_RESULT B
                         WHERE 1 = 1
                           AND B.IS_VALID = '1'
                           AND B.STATUS = '1'
                         group by B.JUDGE_STOVE_NO, B.m_mat_no, B.op_process) A
                 WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                   AND A.OP_PROCESS = '5') FPZ5,
               
               NVL((select SUM(A.ACT_THEORY_WEIGHT)
                     from (select B.JUDGE_STOVE_NO,
                                  TRIM(B.OP_PROCESS) OP_PROCESS,
                                  B.m_mat_no,
                                  SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                             from PORT_MIL_BATCH_SAMPLE_RESULT B
                            WHERE B.IS_VALID = '1'
                              AND B.STATUS = '1'
                            group by B.JUDGE_STOVE_NO,
                                     B.m_mat_no,
                                     B.op_process) A
                    WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                      AND A.OP_PROCESS = '5'),
                   0) FPD5,
               
               (select COUNT(1)
                  from (select B.JUDGE_STOVE_NO,
                               TRIM(B.OP_PROCESS) OP_PROCESS,
                               B.m_mat_no,
                               SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                          from PORT_MIL_BATCH_SAMPLE_RESULT B
                         WHERE B.IS_VALID = '1'
                           AND B.STATUS = '1'
                         group by B.JUDGE_STOVE_NO, B.m_mat_no, B.op_process) A
                 WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                   AND A.OP_PROCESS = '6') FPZ6,
               
               NVL((select SUM(A.ACT_THEORY_WEIGHT)
                     from (select B.JUDGE_STOVE_NO,
                                  TRIM(B.OP_PROCESS) OP_PROCESS,
                                  B.m_mat_no,
                                  SUM(B.ACT_THEORY_WEIGHT) ACT_THEORY_WEIGHT
                             from PORT_MIL_BATCH_SAMPLE_RESULT B
                            WHERE B.IS_VALID = '1'
                              AND B.STATUS = '1'
                            group by B.JUDGE_STOVE_NO,
                                     B.m_mat_no,
                                     B.op_process) A
                    WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO
                      AND A.OP_PROCESS = '6'),
                   0) FPD6,
               
               (SELECT sum(A.act_count)
                  FROM PORT_MIL_BATCH_SAMPLE_RESULT A
                 WHERE A.IS_VALID = '1'
                   AND A.STATUS <> '1'
                                   AND (TRIM(A.OP_PROCESS) <> '7' OR
                                       A.OP_PROCESS IS NULL)
                   AND SUBSTR(A.JUDGE_STOVE_NO, -2) = '01'
                   AND A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO) HGZ7,
               
               (SELECT SUM(A.ACT_THEORY_WEIGHT)
                  FROM PORT_MIL_BATCH_SAMPLE_RESULT A
                 WHERE A.IS_VALID = '1'
                   AND A.STATUS <> '1'
                                   AND (TRIM(A.OP_PROCESS) <> '7' OR
                                       A.OP_PROCESS IS NULL)
                   AND SUBSTR(A.JUDGE_STOVE_NO, -2) = '01'
                   AND A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO) HGD7,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '2'
                      AND TRIM(A.OP_PROCESS) = '7'
                      AND A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO),
                   0) FPZ7,
               
               NVL((select SUM(A.ACT_THEORY_WEIGHT)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '2'
                      AND TRIM(A.OP_PROCESS) = '7'
                      AND A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO),
                   0) FPD7,
               
               NVL((select sum(1)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '2'
                      AND TRIM(A.OP_PROCESS) = '9'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) FPZ9,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '2'
                      AND TRIM(A.OP_PROCESS) = '9'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) FPD9,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '3'
                      AND TRIM(A.OP_PROCESS) = '9'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) XXZ9,
               
               NVL((select SUM(A.ACT_THEORY_WEIGHT)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '3'
                      AND TRIM(A.OP_PROCESS) = '9'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) XXD9,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS IN ('2', '5')
                      AND TRIM(A.OP_PROCESS) = '10'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) FPZ10,
               
               NVL((select SUM(A.ACT_THEORY_WEIGHT)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS IN ('2', '5')
                      AND TRIM(A.OP_PROCESS) = '10'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) FPD10,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '3'
                      AND TRIM(A.OP_PROCESS) = '10'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) XXZ10,
               
               NVL((select SUM(A.ACT_THEORY_WEIGHT)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '3'
                      AND TRIM(A.OP_PROCESS) = '10'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) XXD10,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '2'
                      AND TRIM(A.OP_PROCESS) = '11'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) FPZ11,
               
               NVL((select SUM(A.ACT_THEORY_WEIGHT)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '2'
                      AND TRIM(A.OP_PROCESS) = '11'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) FPD11,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '3'
                      AND TRIM(A.OP_PROCESS) = '11'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) XXZ11,
               
               NVL((select SUM(A.ACT_THEORY_WEIGHT)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '3'
                      AND TRIM(A.OP_PROCESS) = '11'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) XXD11,
               
               NVL((select sum(1)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.GROUP_FLAG = '1'
                      AND TRIM(A.OP_PROCESS) = '9'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) ZLZ9,
               
               NVL((select sum(A.ACT_THEORY_WEIGHT)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.GROUP_FLAG = '1'
                      AND TRIM(A.OP_PROCESS) = '9'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) ZLD9,
               
               NVL((select sum(1)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.GROUP_FLAG = '1'
                      AND TRIM(A.OP_PROCESS) = '10'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) ZLZ10,
               
               NVL((select sum(A.ACT_THEORY_WEIGHT)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.GROUP_FLAG = '1'
                      AND TRIM(A.OP_PROCESS) = '10'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) ZLD10,
               
               NVL((select sum(1)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.GROUP_FLAG = '1'
                      AND TRIM(A.OP_PROCESS) = '11'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) ZLZ11,
               
               NVL((select sum(A.ACT_THEORY_WEIGHT)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.GROUP_FLAG = '1'
                      AND TRIM(A.OP_PROCESS) = '11'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) ZLD11,
               
               (SELECT DECODE(B.DIRECTOR_QUANTITY,
                              0,
                              '',
                              TO_CHAR(NVL(B.QUALIFIED_BRANCH, 0) * 100 /
                                      B.DIRECTOR_QUANTITY,
                                      'FM990.00') || '%')
                  FROM mil_surface_result B
                 WHERE B.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO) qualifiedRate,
               
               SUM(B.FEED_NUM_PLAN) SLZ,
               SUM(B.MAT_TOTAL_HEIGHT - DECODE(B.CUT_TARGET,
                                       '返废',
                                       NVL(round(B.CUT_WEIGHT / B.FEED_NUM, 3), 0),
                                       --'回库',
                                       --NVL(round(B.CUT_WEIGHT / B.FEED_NUM, 3), 0),
                                       0)) SLD,
               SUM(B.FEED_NUM_PLAN * B.DB_NUM) * MAX(T1.SAW_NUM) YJZ,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '1'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) undeterminedNum,
               
               NVL((select sum(A.INPUT_WEIGHT)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '1'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) undeterminedD,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS IN ('2', '5')
                      AND A.OP_PROCESS <> '14'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) ScrapNum,
               
               NVL((select sum(A.ACT_THEORY_WEIGHT)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS IN ('2', '5')
                      AND A.OP_PROCESS <> '14'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) ScrapD,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '2'
                      AND A.OP_PROCESS = '14'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) FQY,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '6'
                      AND A.PLAN_ID = T.RESULT_NO
                      AND REGEXP_REPLACE(A.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) WWFPZ,
               
               NVL((SELECT NVL(SUM(T12.QUALIFIED_NUM), 0)
                     FROM MIL_INSTORE_RESULT T12
                    WHERE T12.RESULT_NO = T.RESULT_NO
                      AND REGEXP_REPLACE(T12.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')
                      AND T12.NODE_FUR_FLAG = '1'),
                   0) XXZ,
               
               NVL((SELECT NVL(SUM(T12.QUALIFIED_TONS), 0)
                     FROM MIL_INSTORE_RESULT T12
                    WHERE T12.RESULT_NO = T.RESULT_NO
                      AND REGEXP_REPLACE(T12.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')
                      AND T12.NODE_FUR_FLAG = '1'),
                   0) XXD,
               
               NVL((SELECT NVL(SUM(T12.QUALIFIED_NUM), 0)
                     FROM MIL_INSTORE_RESULT T12
                    WHERE T12.RESULT_NO = T.RESULT_NO
                      AND REGEXP_REPLACE(T12.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) HGZ12,
               
               NVL((SELECT NVL(SUM(T12.QUALIFIED_TONS), 0)
                     FROM MIL_INSTORE_RESULT T12
                    WHERE T12.RESULT_NO = T.RESULT_NO
                      AND REGEXP_REPLACE(T12.JUDGE_STOVE_NO, '-.*', '') =
                          REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) HGD12,
               
               0 HGM12,
               
               NVL((select SUM(Q.ACT_COUNT)
                     from QCM_ZG_JUGDE_APPLY Q
                    WHERE Q.VALIDFLAG = '20'
                      AND Q.APPLY_FLAG = '0'
                      AND Q.JUDGE_STOVE_NO = REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) PDZ,
               
               NVL((select DECODE(NVL(SUM(Q.ACT_WEIGHT), 0),
                                 0,
                                 SUM(Q.ACT_THEORY_WEIGHT),
                                 SUM(Q.ACT_WEIGHT))
                     from QCM_ZG_JUGDE_APPLY Q
                    WHERE Q.VALIDFLAG = '20'
                      AND Q.APPLY_FLAG = '0'
                      AND Q.JUDGE_STOVE_NO = REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) PDD,
               
               NVL((select SUM(Q.ACT_LEN)
                     from QCM_ZG_JUGDE_APPLY Q
                    WHERE 1 = 1
                      AND Q.VALIDFLAG = '20'
                      AND Q.APPLY_FLAG = '0'
                      AND Q.JUDGE_STOVE_NO = REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) PDM,
               
               NVL((select SUM(Q.ACT_COUNT)
                     from QCM_ZG_JUGDE_APPLY Q
                    WHERE Q.APPLY_FLAG = '0'
                      AND Q.JUDGE_STOVE_NO = REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) SPZ,
               
               NVL((select DECODE(NVL(SUM(Q.ACT_WEIGHT), 0),
                                 0,
                                 SUM(Q.ACT_THEORY_WEIGHT),
                                 SUM(Q.ACT_WEIGHT))
                     from QCM_ZG_JUGDE_APPLY Q
                    WHERE Q.APPLY_FLAG = '0'
                      AND Q.JUDGE_STOVE_NO = REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) SPD,
               
               NVL((select SUM(Q.ACT_LEN)
                     from QCM_ZG_JUGDE_APPLY Q
                    WHERE Q.APPLY_FLAG = '0'
                      AND Q.JUDGE_STOVE_NO = REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                   0) SPM,
               
               (NVL((select sum(A.act_count)
                      from PORT_MIL_BATCH_SAMPLE_RESULT A
                     WHERE A.IS_VALID = '1'
                       AND A.STATUS IN ('3', '4')
                       AND A.OP_PROCESS <> '12'
                       AND A.PLAN_ID = T.RESULT_NO),
                    0) + NVL((SELECT NVL(SUM(T12.OFFLINE_NUM), 0)
                                FROM MIL_INSTORE_RESULT T12
                               WHERE T12.RESULT_NO = T.RESULT_NO
                                 AND REGEXP_REPLACE(T12.JUDGE_STOVE_NO, '-.*', '') =
                                     REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')),
                              0)) LXZ,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.STATUS = '4'
                      AND A.GROUP_FLAG = '0'
                      AND A.PLAN_ID = T.RESULT_NO),
                   0) FXZ,
               
               NVL((select sum(A.act_count)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.GROUP_FLAG = '1'
                      AND TRIM(A.OP_PROCESS) <> '5'
                      AND A.PLAN_ID = T.RESULT_NO),
                   0) ZLZ,
               
               NVL((select sum(A.ACT_THEORY_WEIGHT)
                     from PORT_MIL_BATCH_SAMPLE_RESULT A
                    WHERE A.IS_VALID = '1'
                      AND A.GROUP_FLAG = '1'
                      AND TRIM(A.OP_PROCESS) <> '5'
                      AND A.PLAN_ID = T.RESULT_NO),
                   0) ZLD,
               
               (select MAX(A.BAL_YEAR_MONTH)
                  from PORT_MIL_BATCH_SAMPLE_RESULT A
                 WHERE A.PLAN_ID = T.RESULT_NO) BAL_YEAR_MONTH,
               
               TO_CHAR(NVL((select SUM(A.ACT_THEORY_WEIGHT)
                             from PORT_MIL_BATCH_SAMPLE_RESULT A
                            WHERE A.IS_VALID = '1'
                              AND A.STATUS <> '2'
                              AND A.STATUS <> '3'
                              AND A.STATUS <> '6'
                              AND A.JUDGE_STOVE_NO = T1.JUDGE_STOVE_NO),
                           0) / SUM(B.MAT_TOTAL_HEIGHT) * 100,
                       'FM990.00') || '%' RATE,
               
               SUM(B.MAT_TOTAL_HEIGHT) *
               (1 - NVL((select R.BURNNING_RATE
                           from MIL_FUR_RESULT R
                          WHERE R.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO) / 100,
                        0)) -
               DECODE(MAX(T1.CONTROL_THICKP),
                      0,
                      0,
                      (MAX(T1.CUT_HEAD_LENGTHP) + MAX(T1.CUT_TRAIL_LENGTHP)) / 1000 *
                      (0.02466 * MAX(T1.CONTROL_THICKP) / 1000 * 1.02 *
                      ((SUBSTR(MAX(T1.PIPE_SIZE),
                                1,
                                INSTR(MAX(T1.PIPE_SIZE), '*') - 1)) * (CASE
                        WHEN INSTR(MAX(T1.VARIETIES), '套管') > 0 THEN
                         1.005
                        WHEN INSTR(MAX(T1.VARIETIES), '油管') > 0 THEN
                         1.005
                        ELSE
                         1
                      END) - (MAX(T1.CONTROL_THICKP) / 1000 * 1.02)) *
                      SUM(B.FEED_NUM_PLAN * B.DB_NUM))) YJD,
               
               TO_CHAR(NVL((SELECT CASE
                                    WHEN SUM(M.ponder_gross_wt) > 0 THEN
                                     SUM(M.ponder_gross_wt)
                                    ELSE
                                     SUM(M.ACT_WEIGHT)
                                  END
                             FROM MAT_BC_M M
                            WHERE M.JUDGE_STOVE_NO =
                                  REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '')
                              AND M.LOT_NO = T1.LOT_NO
                              AND M.PLINE_CODE = T.PLINE_CODE),
                           0) * 100 / SUM(B.MAT_TOTAL_HEIGHT),
                       'FM990.00') || '%' RATE2
        
          from MIL_FEEDSAW_RESULT T, MIL_PLAN T1, MIL_FEED_PLAN B
         WHERE T.JUDGE_STOVE_NO = T1.JUDGE_STOVE_NO
           AND T.JUDGE_STOVE_NO = B.JUDGE_STOVE_NO 
           AND NVL(T1.PRO_PLAN_ID,'/') = NVL('#PRO_PLAN_ID#','/')
           AND NVL(T1.GX_PLAN_NO,'/') = NVL('#GX_PLAN_NO#','/')
           AND REGEXP_REPLACE(T1.JUDGE_STOVE_NO, '-.*', '') = '#JUDGE_STOVE_NO#'
           AND T1.LOT_NO = '#LOT_NO#'
         GROUP BY T1.JUDGE_STOVE_NO,
                  T1.LOT_NO,
                  T.PLINE_CODE,
                  T.JUDGE_STOVE_NO,
                  T.RESULT_NO,
                  T1.PRO_PLAN_ID,
                  t1.gx_plan_no,
                  T1.ID,
                  T1.CONTRACT_NO) AA
 ORDER BY AA.START_TIME ASC

]]>
</query>
<query id = "FrmTransfer.selectGroupJudge" desc = "查询所有新炉号">
SELECT T.NEW_HEAT_NO AS JUDGE_STOVE_NO
  FROM MIL_SLAB_SCRAP T
 WHERE REGEXP_REPLACE(T.JUDGE_STOVE_NO, '-.*', '') = '#JUDGE_STOVE_NO#'
 GROUP BY T.NEW_HEAT_NO
UNION ALL
SELECT T1.ZP_JUDGE_STOVE_NO AS JUDGE_STOVE_NO
  FROM MIL_FURNACES_RESLUT_DETIA T1
 WHERE REGEXP_REPLACE(T1.JUDGE_STOVE_NO, '-.*', '') = '#JUDGE_STOVE_NO#'
UNION ALL
SELECT T2.ZP_JUDGE_STOVE_NO AS JUDGE_STOVE_NO
  FROM MIL_OFFLINE_GROUP T2
 WHERE REGEXP_REPLACE(T2.OLD_ZP_JUDGE_STOVE_NO, '-.*', '') = '#JUDGE_STOVE_NO#'
</query>
<query id = "FrmTransfer.selectQcm" desc = "查询是否判定">
SELECT * FROM QCM_ZG_JUGDE_APPLY T WHERE T.JUDGE_STOVE_NO = ? AND T.VALIDFLAG = '20' AND T.IS_FLAG = '0'
AND T.IS_ALL_SCRAP IN('0','1')
</query>
<query id = "FrmTransfer.transferQueue" desc = "转移支队列">
 DECLARE
BEGIN
  FOR MYROW IN (SELECT T.MAT_NO
                  FROM PORT_MIL_BATCH_SAMPLE_RESULT T
                 WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#' || '-01') LOOP
    FOR MYROW1 IN (SELECT *
                     FROM PORT_MIL_BATCH_SAMPLE_RESULT S
                    WHERE S.MAT_NO = MYROW.MAT_NO) LOOP
      INSERT INTO MIL_BATCH_RESULT_HISTORY
        (PLAN_ID,
         LOT_NO,
         STOVE_NO,
         JUDGE_STOVE_NO,
         GROUP_NO,
         PLINE_CODE,
         BATCH_NO,
         SEQ,
         MAT_NO,
         IS_SAMPLE_PIPE,
         IS_VALID,
         REMARK,
         SAMPLE_PIPE_LEN,
         GET_SAMPLE_NAME,
         GET_SAMPLE_TIME,
         GET_SAMPLE_SHIFT,
         GET_SAMPLE_CLASS,
         ORDER_LENGTH,
         ACT_THEORY_WEIGHT,
         ACT_COUNT,
         CRATE_TIME,
         STATUS,
         M_MAT_NO,
         GROUP_FLAG,
         OP_PROCESS,
         BACK_PROCESS,
         M_M_MAT_NO,
         INSTORE_FLAG,
         REAL_BATCH_NO,
         RECUT_LENGTH,
         CUT_ACT_THEORY_WEIGHT,
         SAMPLE_PIPE_LEN_A,
         SAMPLE_PIPE_LEN_B,
         OFFLINE_TYPE,
         INPUT_WEIGHT,
         BAL_YEAR_MONTH,
         CHEM_RESULT_CODE,
         PHY_RESULT_CODE,
         RE_GET_SAMPLE_NAME,
         RE_GET_SAMPLE_TIME,
         RE_GET_SAMPLE_STATUS,
         OCUP_STAUS,
         OCUP_OP_PROCESS,
         PRO_PLAN_ID,
         GX_PLAN_NO,
         JUGDE_APPLY_CODE,
         TR_FLAG)
      VALUES
        (MYROW1.PLAN_ID,
         MYROW1.LOT_NO,
         MYROW1.STOVE_NO,
         MYROW1.JUDGE_STOVE_NO,
         MYROW1.GROUP_NO,
         MYROW1.PLINE_CODE,
         MYROW1.BATCH_NO,
         MYROW1.SEQ,
         MYROW1.MAT_NO,
         MYROW1.IS_SAMPLE_PIPE,
         MYROW1.IS_VALID,
         MYROW1.REMARK,
         MYROW1.SAMPLE_PIPE_LEN,
         MYROW1.GET_SAMPLE_NAME,
         TO_DATE(MYROW1.GET_SAMPLE_TIME, 'YYYY-MM-DD HH24:MI:SS'),
         MYROW1.GET_SAMPLE_SHIFT,
         MYROW1.GET_SAMPLE_CLASS,
         MYROW1.ORDER_LENGTH,
         MYROW1.ACT_THEORY_WEIGHT,
         MYROW1.ACT_COUNT,
         TO_DATE(MYROW1.CRATE_TIME, 'YYYY-MM-DD HH24:MI:SS'),
         MYROW1.STATUS,
         MYROW1.M_MAT_NO,
         MYROW1.GROUP_FLAG,
         MYROW1.OP_PROCESS,
         MYROW1.BACK_PROCESS,
         MYROW1.M_M_MAT_NO,
         MYROW1.INSTORE_FLAG,
         MYROW1.REAL_BATCH_NO,
         MYROW1.RECUT_LENGTH,
         MYROW1.CUT_ACT_THEORY_WEIGHT,
         MYROW1.SAMPLE_PIPE_LEN_A,
         MYROW1.SAMPLE_PIPE_LEN_B,
         MYROW1.OFFLINE_TYPE,
         MYROW1.INPUT_WEIGHT,
         MYROW1.BAL_YEAR_MONTH,
         MYROW1.CHEM_RESULT_CODE,
         MYROW1.PHY_RESULT_CODE,
         MYROW1.RE_GET_SAMPLE_NAME,
         TO_DATE(MYROW1.RE_GET_SAMPLE_TIME, 'YYYY-MM-DD HH24:MI:SS'),
         MYROW1.RE_GET_SAMPLE_STATUS,
         MYROW1.OCUP_STAUS,
         MYROW1.OCUP_OP_PROCESS,
         MYROW1.PRO_PLAN_ID,
         MYROW1.GX_PLAN_NO,
         MYROW1.JUGDE_APPLY_CODE,
         MYROW1.TR_FLAG);
    END LOOP;
  END LOOP;
END;
</query>
<query id = "FrmTransfer.cancelTransferQueue" desc = "撤销支队列转移">
DECLARE
BEGIN
  FOR MYROW IN (SELECT T.MAT_NO
                  FROM MIL_BATCH_RESULT_HISTORY T
                 WHERE T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#' || '-01') LOOP
    FOR MYROW1 IN (SELECT *
                     FROM MIL_BATCH_RESULT_HISTORY S
                    WHERE S.MAT_NO = MYROW.MAT_NO) LOOP
      INSERT INTO PORT_MIL_BATCH_SAMPLE_RESULT
        (PLAN_ID,
         LOT_NO,
         STOVE_NO,
         JUDGE_STOVE_NO,
         GROUP_NO,
         PLINE_CODE,
         BATCH_NO,
         SEQ,
         MAT_NO,
         IS_SAMPLE_PIPE,
         IS_VALID,
         REMARK,
         SAMPLE_PIPE_LEN,
         GET_SAMPLE_NAME,
         GET_SAMPLE_TIME,
         GET_SAMPLE_SHIFT,
         GET_SAMPLE_CLASS,
         ORDER_LENGTH,
         ACT_THEORY_WEIGHT,
         ACT_COUNT,
         CRATE_TIME,
         STATUS,
         M_MAT_NO,
         GROUP_FLAG,
         OP_PROCESS,
         BACK_PROCESS,
         M_M_MAT_NO,
         INSTORE_FLAG,
         REAL_BATCH_NO,
         RECUT_LENGTH,
         CUT_ACT_THEORY_WEIGHT,
         SAMPLE_PIPE_LEN_A,
         SAMPLE_PIPE_LEN_B,
         OFFLINE_TYPE,
         INPUT_WEIGHT,
         BAL_YEAR_MONTH,
         CHEM_RESULT_CODE,
         PHY_RESULT_CODE,
         RE_GET_SAMPLE_NAME,
         RE_GET_SAMPLE_TIME,
         RE_GET_SAMPLE_STATUS,
         OCUP_STAUS,
         OCUP_OP_PROCESS,
         PRO_PLAN_ID,
         GX_PLAN_NO,
         JUGDE_APPLY_CODE,
         TR_FLAG)
      VALUES
        (MYROW1.PLAN_ID,
         MYROW1.LOT_NO,
         MYROW1.STOVE_NO,
         MYROW1.JUDGE_STOVE_NO,
         MYROW1.GROUP_NO,
         MYROW1.PLINE_CODE,
         MYROW1.BATCH_NO,
         MYROW1.SEQ,
         MYROW1.MAT_NO,
         MYROW1.IS_SAMPLE_PIPE,
         MYROW1.IS_VALID,
         MYROW1.REMARK,
         MYROW1.SAMPLE_PIPE_LEN,
         MYROW1.GET_SAMPLE_NAME,
         TO_DATE(MYROW1.GET_SAMPLE_TIME, 'YYYY-MM-DD HH24:MI:SS'),
         MYROW1.GET_SAMPLE_SHIFT,
         MYROW1.GET_SAMPLE_CLASS,
         MYROW1.ORDER_LENGTH,
         MYROW1.ACT_THEORY_WEIGHT,
         MYROW1.ACT_COUNT,
         TO_DATE(MYROW1.CRATE_TIME, 'YYYY-MM-DD HH24:MI:SS'),
         MYROW1.STATUS,
         MYROW1.M_MAT_NO,
         MYROW1.GROUP_FLAG,
         MYROW1.OP_PROCESS,
         MYROW1.BACK_PROCESS,
         MYROW1.M_M_MAT_NO,
         MYROW1.INSTORE_FLAG,
         MYROW1.REAL_BATCH_NO,
         MYROW1.RECUT_LENGTH,
         MYROW1.CUT_ACT_THEORY_WEIGHT,
         MYROW1.SAMPLE_PIPE_LEN_A,
         MYROW1.SAMPLE_PIPE_LEN_B,
         MYROW1.OFFLINE_TYPE,
         MYROW1.INPUT_WEIGHT,
         MYROW1.BAL_YEAR_MONTH,
         MYROW1.CHEM_RESULT_CODE,
         MYROW1.PHY_RESULT_CODE,
         MYROW1.RE_GET_SAMPLE_NAME,
         TO_DATE(MYROW1.RE_GET_SAMPLE_TIME, 'YYYY-MM-DD HH24:MI:SS'),
         MYROW1.RE_GET_SAMPLE_STATUS,
         MYROW1.OCUP_STAUS,
         MYROW1.OCUP_OP_PROCESS,
         MYROW1.PRO_PLAN_ID,
         MYROW1.GX_PLAN_NO,
         MYROW1.JUGDE_APPLY_CODE,
         MYROW1.TR_FLAG);
    END LOOP;
  END LOOP;
END;
</query>
</queryMap>