<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="轧管调度日志">
	<query id="FrmHttControlLog.doQueryPlan" desc="查询日志">
<![CDATA[
SELECT CONTROL_ID,
       TO_CHAR(TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_BEG,
       TO_CHAR(TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_END,
       PLINE_CODE,
       PLINE_NAME,
       RESULT_NO,
       DECODE(T.NODE_FLAG, '0', '未结炉', '1', '已结炉') NODE_FLAG,
       HEAT_PLAN_NO,
       LOT_NO,
       JUDGE_STOVE_NO,
       BATCH_NO,
       BATCH_GROUD_NO,
       CONTRACT_NO,
       CRAFT_FILE_NO,
       PRDCR_NO,
       PRODUCCODE,
       PRODUCNAME,
       GRADECODE,
       GRADENAME,
       STEELCODE,
       STEELNAME,
       MODEL_CODE,
       MODEL_DESC,
       STD_CODE,
       STD_NAME,
       STD_STYLE,
       STD_STYLE_DESC,
       ACT_DIMATER,
       ACT_HEIGHT,
       ACT_LEN,
       ACT_LEN_MIN,
       ACT_LEN_MAX,
       PRO_BC,
       PRO_BZ,
       NVL(T.QUALIFIED_NUM, 0) QUALIFIED_NUM,
       NVL(T.QUALIFIED_WT, 0) QUALIFIED_WT,
       NVL(T.SCRAP_NUM, 0) SCRAP_NUM,
       NVL(T.SCRAP_WT, 0) SCRAP_WT,
       DECODE(T.PRO_TYPE,
              '1',
              DECODE(PROCESS_CODE_C, 'B024', '仅探伤', '正常'),
              '2',
              '停机',
              '正常') PRO_TYPE,
       STOP_TYPE,
       (SELECT BASENAME FROM com_base_info WHERE BASECODE = T.STOP_REASON) STOP_REASON,
       TO_CHAR(T.USER_DATE, 'YYYY-MM-DD HH24:MI:SS') USER_DATE,
       USER_NAME,
       USER_ID,
       (SELECT BASENAME FROM com_base_info WHERE BASECODE = T.STOP_SMALL) STOP_SMALL,
       CONFIRM_TIME,
       CONFIRM_NAME,
       DECODE(T.CONFIRM_FLAG, '0', '未确认', '1', '已确认', '2', '已审核') CONFIRM_FLAG,
       BAL_YEAR_MONTH,
       PROC_DATE,
       MEMO,
       SPEC_CODE,
       SPEC_NAME,
       PROCESS_CODE_C,
       PROCESS_DESC_C,
       DECODE(STATION,
              '0',
              '热处理',
              '1',
              '探伤',
              '2',
              '测量点',
              '3',
              '车丝',
              '4',
              '水压') STATION,
       AUDIT_TIME,
       AUDIT_NAME
  FROM HTT_CONTROL_LOG T
 WHERE 1 = 1
   ]]>
	</query>

	<query id="FrmHttControlLog.doQueryPlanById" desc="查询日志">
		<![CDATA[
SELECT *
  FROM HTT_CONTROL_LOG T
  WHERE CONTROL_ID =?

   ]]>
	</query>

	<query id="FrmHttControlLog.doQueryPlan2" desc="查询日志">
		<![CDATA[
SELECT *
  FROM HTT_CONTROL_LOG T WHERE 1=1

   ]]>
	</query>

	<query id="FrmHttControlLog.doQueryShiftInfo" desc="查询日志">
		<![CDATA[
SELECT *
  FROM HTT_CONTROL_SHIFT
 WHERE PLINE_CODE = ?
   AND PRO_BC = ?
   ]]>
	</query>

	<query id="FrmHttControlLog.doQueryTotal" desc="查询汇总">
		<![CDATA[
SELECT TO_CHAR(TO_DATE(T.BAL_YEAR_MONTH,'YYYYMM'),'MM') || ' 月-' || (SELECT PLINE_NAME FROM COM_BASE_PLINE WHERE PLINE_CODE =T.PLINE_CODE)  TITLE,
       COUNT(DISTINCT JUDGE_STOVE_NO) STOVE_NUM,
       NVL(SUM(QUALIFIED_NUM),0) PRO_NUM,
       NVL(SUM(QUALIFIED_WT),0) PRO_WT,
       NVL(SUM(DECODE(T.PROCESS_CODE_C,
                      'B024',
                      0,
                      ROUND((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                           TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60))),
           0) TOTAL_TIME,
       NVL(SUM(DECODE(T.PRO_TYPE,
                      '1',
                      0,
                      ROUND((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                           TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60))),
           0) STOVE_STOP_TIME,
       NVL(SUM(D.STOP_TIME),0) STOP_TIME,
       NVL(SUM(D.STOP_NORMAL),0) STOP_NORMAL,
        NVL(SUM(D.STOP_ABNORMAL),0) STOP_ABNORMAL,

       NVL((SELECT SUM(ROUND((TO_DATE(B.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                           TO_DATE(B.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60) - CASE
                        WHEN B.LOGS_BEG < S.LOGS_BEG THEN
                         ROUND((TO_DATE(S.LOGS_BEG, 'YYYY-MM-DD HH24:MI') -
                              TO_DATE(B.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)
                        ELSE
                         0
                      END - CASE
                        WHEN B.LOGS_END > S.LOGS_END THEN
                         ROUND((TO_DATE(B.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                              TO_DATE(S.LOGS_END, 'YYYY-MM-DD HH24:MI')) * 24 * 60)
                        ELSE
                         0
                      END)
             FROM HTT_CONTROL_LOG S, HTT_CONTROL_LOG B
            WHERE 1 = 1
              AND B.PLINE_CODE = S.PLINE_CODE
              AND B.CONFIRM_FLAG = '1'
              AND S.CONFIRM_FLAG = '1'
              AND B.PROCESS_CODE_C = 'B024'
              AND S.PRO_TYPE = '2'
              AND B.BAL_YEAR_MONTH = T.BAL_YEAR_MONTH
              AND S.BAL_YEAR_MONTH = T.BAL_YEAR_MONTH
              AND B.PLINE_CODE = T.PLINE_CODE
              AND ((S.LOGS_BEG > B.LOGS_BEG AND S.LOGS_BEG < B.LOGS_END) OR
                  (S.LOGS_END > B.LOGS_BEG AND S.LOGS_END < B.LOGS_END) OR
                  (S.LOGS_BEG <= B.LOGS_BEG AND S.LOGS_END >= B.LOGS_END))),
           0) PRO_INCREMENT

  FROM HTT_CONTROL_LOG T
  LEFT JOIN (SELECT CONTROL_ID,
                    NVL(SUM(ROUND((TO_DATE(LOGS_END, 'YYYY-MM-DD HH24:MI') -
                                 TO_DATE(LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)),
                        0) STOP_TIME,
                    NVL(SUM(DECODE(STOP_TYPE,
                                   '600602',
                                   ROUND((TO_DATE(LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                        TO_DATE(LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                                          '702501',
                                   ROUND((TO_DATE(LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                        TO_DATE(LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                                   0)),
                        0) STOP_NORMAL,
                    NVL(SUM(DECODE(STOP_TYPE,
                                   '600603',
                                   ROUND((TO_DATE(LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                        TO_DATE(LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                                             '702502',
                                   ROUND((TO_DATE(LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                        TO_DATE(LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                                   0)),
                        0) STOP_ABNORMAL
               FROM HTT_CONTROL_LOG_DETAIL
              GROUP BY CONTROL_ID) D
    ON T.CONTROL_ID = D.CONTROL_ID
 WHERE T.BAL_YEAR_MONTH = ?
   AND T.PLINE_CODE = ?
   AND T.CONFIRM_FLAG = '1'
 GROUP BY T.PLINE_CODE, T.BAL_YEAR_MONTH
  UNION ALL
SELECT * FROM  (SELECT TO_CHAR(TO_DATE(T.PROC_DATE, 'YYYYMMDD'), 'DD') || ' 日'  TITLE,
       COUNT(DISTINCT JUDGE_STOVE_NO) STOVE_NUM,
       NVL(SUM(QUALIFIED_NUM), 0) PRO_NUM,
       NVL(SUM(QUALIFIED_WT), 0) PRO_WT,
       NVL(SUM(DECODE(T.PROCESS_CODE_C,
                      'B024',
                      0,
                      ROUND((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                           TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60))),
           0) TOTAL_TIME,
       NVL(SUM(DECODE(T.PRO_TYPE,
                      '1',
                      0,
                      ROUND((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                           TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60))),
           0) STOVE_STOP_TIME,
       NVL(SUM(D.STOP_TIME),0) STOP_TIME,
       NVL(SUM(D.STOP_NORMAL),0) STOP_NORMAL,
        NVL(SUM(D.STOP_ABNORMAL),0) STOP_ABNORMAL,

       NVL((SELECT SUM(ROUND((TO_DATE(B.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                           TO_DATE(B.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60) - CASE
                        WHEN B.LOGS_BEG < S.LOGS_BEG THEN
                         ROUND((TO_DATE(S.LOGS_BEG, 'YYYY-MM-DD HH24:MI') -
                              TO_DATE(B.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)
                        ELSE
                         0
                      END - CASE
                        WHEN B.LOGS_END > S.LOGS_END THEN
                         ROUND((TO_DATE(B.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                              TO_DATE(S.LOGS_END, 'YYYY-MM-DD HH24:MI')) * 24 * 60)
                        ELSE
                         0
                      END)
             FROM HTT_CONTROL_LOG S, HTT_CONTROL_LOG B
            WHERE 1 = 1
              AND B.PLINE_CODE = S.PLINE_CODE
              AND B.CONFIRM_FLAG = '1'
              AND S.CONFIRM_FLAG = '1'
              AND B.PROCESS_CODE_C = 'B024'
              AND S.PRO_TYPE = '2'
              AND B.BAL_YEAR_MONTH = T.BAL_YEAR_MONTH
              AND S.BAL_YEAR_MONTH = T.BAL_YEAR_MONTH
              AND B.PROC_DATE = T.PROC_DATE
              AND S.PROC_DATE = T.PROC_DATE
              AND B.PLINE_CODE = T.PLINE_CODE
              AND ((S.LOGS_BEG > B.LOGS_BEG AND S.LOGS_BEG < B.LOGS_END) OR
                  (S.LOGS_END > B.LOGS_BEG AND S.LOGS_END < B.LOGS_END) OR
                  (S.LOGS_BEG <= B.LOGS_BEG AND S.LOGS_END >= B.LOGS_END))),
           0) PRO_INCREMENT

  FROM HTT_CONTROL_LOG T
  LEFT JOIN (SELECT CONTROL_ID,
                    NVL(SUM(ROUND((TO_DATE(LOGS_END, 'YYYY-MM-DD HH24:MI') -
                                 TO_DATE(LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)),
                        0) STOP_TIME,
                    NVL(SUM(DECODE(STOP_TYPE,
                                   '600602',
                                   ROUND((TO_DATE(LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                        TO_DATE(LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                                    '702501',
                                     ROUND((TO_DATE(LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                        TO_DATE(LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                                   0)),
                        0) STOP_NORMAL,
                    NVL(SUM(DECODE(STOP_TYPE,
                                   '600603',
                                   ROUND((TO_DATE(LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                        TO_DATE(LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                                                  '702502',
                                   ROUND((TO_DATE(LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                        TO_DATE(LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                                   0)),
                        0) STOP_ABNORMAL
               FROM HTT_CONTROL_LOG_DETAIL
              GROUP BY CONTROL_ID) D
    ON T.CONTROL_ID = D.CONTROL_ID
 WHERE T.BAL_YEAR_MONTH = ?
   AND  T.PROC_DATE = DECODE(?,'',T.PROC_DATE, ?)
   AND T.PLINE_CODE = ?
   AND T.CONFIRM_FLAG = '1'
 GROUP BY T.PLINE_CODE,T.BAL_YEAR_MONTH, T.PROC_DATE
 ORDER BY T.PLINE_CODE,T.BAL_YEAR_MONTH, T.PROC_DATE)
 UNION ALL
 SELECT * FROM  (SELECT TO_CHAR(TO_DATE(T.PROC_DATE, 'YYYYMMDD'), 'DD') || ' 日' || DECODE(T.PRO_BC,'0','白班','1','早班','2','中班','3','晚班')  TITLE,
       COUNT(DISTINCT JUDGE_STOVE_NO) STOVE_NUM,
       NVL(SUM(QUALIFIED_NUM), 0) PRO_NUM,
       NVL(SUM(QUALIFIED_WT), 0) PRO_WT,
       NVL(SUM(DECODE(T.PROCESS_CODE_C,
                      'B024',
                      0,
                      ROUND((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                           TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60))),
           0) TOTAL_TIME,
       NVL(SUM(DECODE(T.PRO_TYPE,
                      '1',
                      0,
                      ROUND((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                           TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60))),
           0) STOVE_STOP_TIME,
       NVL(SUM(D.STOP_TIME),0) STOP_TIME,
       NVL(SUM(D.STOP_NORMAL),0) STOP_NORMAL,
        NVL(SUM(D.STOP_ABNORMAL),0) STOP_ABNORMAL,

       NVL((SELECT SUM(ROUND((TO_DATE(B.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                           TO_DATE(B.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60) - CASE
                        WHEN B.LOGS_BEG < S.LOGS_BEG THEN
                         ROUND((TO_DATE(S.LOGS_BEG, 'YYYY-MM-DD HH24:MI') -
                              TO_DATE(B.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)
                        ELSE
                         0
                      END - CASE
                        WHEN B.LOGS_END > S.LOGS_END THEN
                         ROUND((TO_DATE(B.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                              TO_DATE(S.LOGS_END, 'YYYY-MM-DD HH24:MI')) * 24 * 60)
                        ELSE
                         0
                      END)
             FROM HTT_CONTROL_LOG S, HTT_CONTROL_LOG B
            WHERE 1 = 1
              AND B.PLINE_CODE = S.PLINE_CODE
              AND B.CONFIRM_FLAG = '1'
              AND S.CONFIRM_FLAG = '1'
              AND B.PROCESS_CODE_C = 'B024'
              AND S.PRO_TYPE = '2'
              AND B.BAL_YEAR_MONTH = T.BAL_YEAR_MONTH
              AND S.BAL_YEAR_MONTH = T.BAL_YEAR_MONTH
              AND B.PROC_DATE = T.PROC_DATE
              AND S.PROC_DATE = T.PROC_DATE
              AND B.PRO_BC = T.PRO_BC
              AND S.PRO_BC = T.PRO_BC
              AND B.PLINE_CODE = T.PLINE_CODE
              AND ((S.LOGS_BEG > B.LOGS_BEG AND S.LOGS_BEG < B.LOGS_END) OR
                  (S.LOGS_END > B.LOGS_BEG AND S.LOGS_END < B.LOGS_END) OR
                  (S.LOGS_BEG <= B.LOGS_BEG AND S.LOGS_END >= B.LOGS_END))),
           0) PRO_INCREMENT

  FROM HTT_CONTROL_LOG T
  LEFT JOIN (SELECT CONTROL_ID,
                    NVL(SUM(ROUND((TO_DATE(LOGS_END, 'YYYY-MM-DD HH24:MI') -
                                 TO_DATE(LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)),
                        0) STOP_TIME,
                    NVL(SUM(DECODE(STOP_TYPE,
                                   '600602',
                                   ROUND((TO_DATE(LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                        TO_DATE(LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                                                '702501',
                                   ROUND((TO_DATE(LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                        TO_DATE(LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                                   0)),
                        0) STOP_NORMAL,
                    NVL(SUM(DECODE(STOP_TYPE,
                                   '600603',
                                   ROUND((TO_DATE(LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                        TO_DATE(LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                                                '702502',
                                   ROUND((TO_DATE(LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                        TO_DATE(LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                                   0)),
                        0) STOP_ABNORMAL
               FROM HTT_CONTROL_LOG_DETAIL
              GROUP BY CONTROL_ID) D
    ON T.CONTROL_ID = D.CONTROL_ID
 WHERE T.BAL_YEAR_MONTH = ?
   AND  T.PROC_DATE = DECODE(?,'','', ?)
   AND T.PLINE_CODE = ?
   AND T.CONFIRM_FLAG = '1'
 GROUP BY T.PLINE_CODE,T.BAL_YEAR_MONTH, T.PROC_DATE, T.PRO_BC
 ORDER BY T.PLINE_CODE,T.BAL_YEAR_MONTH, T.PROC_DATE,T.PRO_BC)
   ]]>
	</query>


	<query id="FrmHttControlLog.doQueryControlLogStopTotal" desc="查询日志">
		<![CDATA[
SELECT T.CONTROL_ID,
       TO_CHAR(TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_BEG,
       TO_CHAR(TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_END,
       T.PLINE_CODE,
       (SELECT PLINE_NAME
          FROM Com_Base_Pline
         WHERE PLINE_CODE = T.PLINE_CODE) PLINE_NAME,
       DECODE(T.PRO_BC,
              '0',
              '白班',
              '1',
              '早班',
              '2',
              '中班',
              '3',
              '晚班',
              '') PRO_BC,
       DECODE(T.PRO_BZ, '1', '甲', '2', '乙', '3', '丙', '4', '丁', '') PRO_BZ,
       (SELECT BASENAME FROM com_base_info WHERE BASECODE = T.STOP_TYPE) STOP_TYPE,
       (SELECT BASENAME FROM com_base_info WHERE BASECODE = T.STOP_REASON) STOP_REASON,
       (SELECT BASENAME FROM com_base_info WHERE BASECODE = T.STOP_SMALL) STOP_SMALL,
       T.MEMO,
       TO_CHAR(T.USER_DATE, 'YYYY-MM-DD HH24:MI:SS') USER_DATE,
       T.USER_NAME,
       T.USER_ID,
       T.CONFIRM_TIME,
       T.CONFIRM_NAME,
       DECODE(T.CONFIRM_FLAG, '0', '未确认', '1', '已确认', '2', '已审核') CONFIRM_FLAG,
       T.BAL_YEAR_MONTH,
       T.PROC_DATE,
       DECODE(T.STATION,
              '0',
              '热处理点',
              '1',
              '探伤点',
              '2',
              '测量点',
              '3',
              '车丝',
              '4',
              '水压') STATION,
       T.AUDIT_NAME,
       TO_CHAR(T.AUDIT_TIME, 'YYYY-MM-DD HH24:MI:SS') AUDIT_TIME
  FROM HTT_CONTROL_LOG T
 WHERE PRO_TYPE = '2'
   ]]>
	</query>

	<query id="FrmHttControlLog.doQueryControlLogProTotal" desc="查询日志">
		<![CDATA[
SELECT CONTROL_ID,
       TO_CHAR(TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_BEG,
       TO_CHAR(TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_END,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.RESULT_NO,
       DECODE(T.NODE_FLAG, '0', '未结炉', '1', '已结炉') NODE_FLAG,
       T.HEAT_PLAN_NO,
       T.LOT_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.CONTRACT_NO,
       T.CRAFT_FILE_NO,
       T.PRDCR_NO,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.STEELCODE,
       T.STEELNAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
       T.ACT_LEN,
       T.ACT_LEN_MIN,
       T.ACT_LEN_MAX,
       DECODE(T.PRO_BC,
              '0',
              '白班',
              '1',
              '早班',
              '2',
              '中班',
              '3',
              '晚班',
              '') PRO_BC,
       DECODE(T.PRO_BZ, '1', '甲', '2', '乙', '3', '丙', '4', '丁', '') PRO_BZ,
       NVL(T.QUALIFIED_NUM, 0) QUALIFIED_NUM,
       NVL(T.QUALIFIED_WT, 0) QUALIFIED_WT,
       NVL(T.SCRAP_NUM, 0) SCRAP_NUM,
       NVL(T.SCRAP_WT, 0) SCRAP_WT,
       DECODE(T.PRO_TYPE, '1', '正常', '2', '停机', '正常') PRO_TYPE,
       T.STOP_TYPE,
       (SELECT BASENAME FROM com_base_info WHERE BASECODE = T.STOP_REASON) STOP_REASON,
       TO_CHAR(T.USER_DATE, 'YYYY-MM-DD HH24:MI:SS') USER_DATE,
       T.USER_NAME,
       T.USER_ID,
       T.STOP_SMALL,
       T.CONFIRM_TIME,
       T.CONFIRM_NAME,
       DECODE(T.CONFIRM_FLAG, '0', '未确认', '1', '已确认', '2', '已审核') CONFIRM_FLAG,
       T.BAL_YEAR_MONTH,
       T.PROC_DATE,
       T.MEMO,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.PROCESS_CODE_C,
       T.PROCESS_DESC_C,
       L.HR_CAPCTY,
       DECODE(T.STATION,
              '0',
              '热处理点',
              '1',
              '探伤点',
              '2',
              '测量点',
              '3',
              '车丝',
              '4',
              '水压') STATION,
       T.AUDIT_NAME,
       TO_CHAR(T.AUDIT_TIME, 'YYYY-MM-DD HH24:MI:SS') AUDIT_TIME
  FROM HTT_CONTROL_LOG T
  LEFT JOIN PLN_ZY_RCL_M M
    ON M.HEAT_PLAN_NO = T.HEAT_PLAN_NO
  LEFT JOIN SLM_BASE_MATERIAL_F_PL L
    ON L.IN_MATERIAL_NO = M.INWL_ID
   AND L.OUT_MATERIAL_NO = M.OUTWL_ID
   AND L.PLINE_CODE = T.PLINE_CODE
 WHERE PRO_TYPE = '1'
   ]]>
	</query>

	<query id="FrmHttControlLog.doQueryControlLogProTotalG" desc="查询日志">
		<![CDATA[
SELECT CONTROL_ID,
       TO_CHAR(TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_BEG,
       TO_CHAR(TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_END,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.RESULT_NO,
       DECODE(T.NODE_FLAG, '0', '未结炉', '1', '已结炉') NODE_FLAG,
       T.HEAT_PLAN_NO,
       T.LOT_NO,
       T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO,
       T.CONTRACT_NO,
       T.CRAFT_FILE_NO,
       T.PRDCR_NO,
       T.PRODUCCODE,
       T.PRODUCNAME,
       T.GRADECODE,
       T.GRADENAME,
       T.STEELCODE,
       T.STEELNAME,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.STD_CODE,
       T.STD_NAME,
       T.STD_STYLE,
       T.STD_STYLE_DESC,
       T.ACT_DIMATER,
       T.ACT_HEIGHT,
       T.ACT_LEN,
       T.ACT_LEN_MIN,
       T.ACT_LEN_MAX,
       DECODE(T.PRO_BC,
              '0',
              '白班',
              '1',
              '早班',
              '2',
              '中班',
              '3',
              '晚班',
              '') PRO_BC,
       DECODE(T.PRO_BZ, '1', '甲', '2', '乙', '3', '丙', '4', '丁', '') PRO_BZ,
       NVL(T.QUALIFIED_NUM, 0) QUALIFIED_NUM,
       NVL(T.QUALIFIED_WT, 0) QUALIFIED_WT,
       NVL(T.SCRAP_NUM, 0) SCRAP_NUM,
       NVL(T.SCRAP_WT, 0) SCRAP_WT,
       DECODE(T.PRO_TYPE, '1', '正常', '2', '停机', '正常') PRO_TYPE,
       T.STOP_TYPE,
       (SELECT BASENAME FROM com_base_info WHERE BASECODE = T.STOP_REASON) STOP_REASON,
       TO_CHAR(T.USER_DATE, 'YYYY-MM-DD HH24:MI:SS') USER_DATE,
       T.USER_NAME,
       T.USER_ID,
       T.STOP_SMALL,
       T.CONFIRM_TIME,
       T.CONFIRM_NAME,
       DECODE(T.CONFIRM_FLAG, '0', '未确认', '1', '已确认', '2', '已审核') CONFIRM_FLAG,
       T.BAL_YEAR_MONTH,
       T.PROC_DATE,
       T.MEMO,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.PROCESS_CODE_C,
       T.PROCESS_DESC_C,
       L.HR_CAPCTY,
       DECODE(T.STATION,
              '0',
              '热处理点',
              '1',
              '探伤点',
              '2',
              '测量点',
              '3',
              '车丝',
              '4',
              '水压') STATION,
       T.AUDIT_NAME,
       TO_CHAR(T.AUDIT_TIME, 'YYYY-MM-DD HH24:MI:SS') AUDIT_TIME
  FROM HTT_CONTROL_LOG T
  LEFT JOIN PLN_ZY_JGX_M M
    ON M.HEAT_PLAN_NO = T.HEAT_PLAN_NO
  LEFT JOIN SLM_BASE_MATERIAL_K_PL L
    ON L.IN_MATERIAL_NO = M.INWL_ID
   AND L.OUT_MATERIAL_NO = M.OUTWL_ID
   AND L.PLINE_CODE = T.PLINE_CODE
 WHERE PRO_TYPE = '1'
   ]]>
	</query>

	<query id="FrmHttControlLog.doQueryControlHours" desc="查询日志">
		<![CDATA[
SELECT P.*, T1.*, DECODE(T1.PRODUCT_TIME,0,0, ROUND(T1.QUALIFIED_NUM/T1.PRODUCT_TIME * 60)) HR_RHYTHM
  FROM (SELECT T.PLINE_CODE, INWL_ID IN_MATERIAL_NO,
                        INWL_DESC IN_MATERIAL_DESC,
                        OUTWL_ID OUT_MATERIAL_NO,
                        OUTWL_DESC OUT_MATERIAL_DESC,
                        SUM(QUALIFIED_NUM) QUALIFIED_NUM,
                        SUM(QUALIFIED_WT) QUALIFIED_WT,
                        SUM(ROUND(DECODE(T.LOGS_END,
                                         NULL,
                                         0,
                                         TO_DATE(T.LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                         TO_DATE(T.LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60)) PRODUCT_TIME
          FROM HTT_CONTROL_LOG T, PLN_ZY_RCL_M M
         WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
           AND T.PRO_TYPE = '1'
           AND T.CONFIRM_FLAG = '1'
           #WHERE#
         GROUP BY T.PLINE_CODE,INWL_ID, INWL_DESC, OUTWL_ID, OUTWL_DESC) T1
  LEFT JOIN SLM_BASE_MATERIAL_F_PL P
    ON T1.IN_MATERIAL_NO = P.IN_MATERIAL_NO
   AND T1.OUT_MATERIAL_NO = P.OUT_MATERIAL_NO
   AND T1.PLINE_CODE = P.PLINE_CODE
   ORDER BY T1.PLINE_CODE, T1.IN_MATERIAL_NO,T1.OUT_MATERIAL_NO

   ]]>
	</query>



	<query id="FrmHttControlLog.doQueryControlHoursG" desc="查询日志">
		<![CDATA[
SELECT P.*, T1.*, DECODE(T1.PRODUCT_TIME,0,0, ROUND(T1.QUALIFIED_NUM/T1.PRODUCT_TIME * 60)) HR_RHYTHM
  FROM (SELECT T.PLINE_CODE, INWL_ID IN_MATERIAL_NO,
                        INWL_DESC IN_MATERIAL_DESC,
                        OUTWL_ID OUT_MATERIAL_NO,
                        OUTWL_DESC OUT_MATERIAL_DESC,
                        SUM(QUALIFIED_NUM) QUALIFIED_NUM,
                        SUM(QUALIFIED_WT) QUALIFIED_WT,
                        SUM(ROUND(DECODE(T.LOGS_END,
                                         NULL,
                                         0,
                                         TO_DATE(T.LOGS_END,
                                                 'YYYY-MM-DD HH24:MI') -
                                         TO_DATE(T.LOGS_BEG,
                                                 'YYYY-MM-DD HH24:MI')) * 24 * 60)) PRODUCT_TIME
          FROM HTT_CONTROL_LOG T, PLN_ZY_JGX_M M
         WHERE T.HEAT_PLAN_NO = M.HEAT_PLAN_NO
           AND T.PRO_TYPE = '1'
           AND T.CONFIRM_FLAG = '1'
           #WHERE#
         GROUP BY T.PLINE_CODE,INWL_ID, INWL_DESC, OUTWL_ID, OUTWL_DESC) T1
  LEFT JOIN SLM_BASE_MATERIAL_K_PL P
    ON T1.IN_MATERIAL_NO = P.IN_MATERIAL_NO
   AND T1.OUT_MATERIAL_NO = P.OUT_MATERIAL_NO
   AND T1.PLINE_CODE = P.PLINE_CODE
   ORDER BY T1.PLINE_CODE, T1.IN_MATERIAL_NO,T1.OUT_MATERIAL_NO

   ]]>
	</query>



	<query id="FrmHttControlLog.doQueryDetail" desc="查询日志">
		<![CDATA[
SELECT CONTROL_ID,
        CONTROL_SEQ,
       TO_CHAR(TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_BEG,
       TO_CHAR(TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_END,
       STOP_TYPE,
        STOP_SMALL,
       STOP_REASON,
        STATION_CODE,
        MEMO
  FROM HTT_CONTROL_LOG_DETAIL T
  WHERE CONTROL_ID=?
  ORDER BY CONTROL_SEQ

   ]]>
	</query>

	<query id="FrmHttControlLog.getConflictHttContorlLog" desc="查询日志">
		<![CDATA[
SELECT *
  FROM HTT_CONTROL_LOG
 WHERE PLINE_CODE = ?
   AND PRO_BC = ?
   AND PRO_TYPE = '1'
   AND PROC_DATE =?
   AND (TO_DATE(?, 'YYYYMMDDHH24MI') BETWEEN
       TO_DATE(LOGS_BEG, 'YYYY-MM-DD HH24:MI') AND
       TO_DATE(LOGS_END, 'YYYY-MM-DD HH24:MI') OR
       TO_DATE(?, 'YYYYMMDDHH24MI') BETWEEN
       TO_DATE(LOGS_BEG, 'YYYY-MM-DD HH24:MI') AND
       TO_DATE(LOGS_END, 'YYYY-MM-DD HH24:MI'))

   ]]>
	</query>


	<query id="FrmHttControlLog.doQueryDetail1" desc="查询日志">
		<![CDATA[
SELECT CONTROL_ID,
        CONTROL_SEQ,
       TO_CHAR(TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_BEG,
       TO_CHAR(TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_END,
       (SELECT BASENAME FROM com_base_info WHERE  BASECODE=T.STOP_TYPE ) STOP_TYPE,
       (SELECT BASENAME FROM com_base_info WHERE  BASECODE=T.STOP_SMALL )  STOP_SMALL,
       (SELECT BASENAME FROM com_base_info WHERE  BASECODE=T.STOP_REASON ) STOP_REASON,
        STATION_CODE,
        MEMO
  FROM HTT_CONTROL_LOG_DETAIL T
  WHERE CONTROL_ID=?
  ORDER BY CONTROL_SEQ

   ]]>
	</query>

	<query id="FrmHttControlLog.doQueryPlanPro" desc="生产详情">
<![CDATA[
SELECT T.CONTROL_ID,
       TO_CHAR(TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_BEG,
       TO_CHAR(TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_END,
       (SELECT B.PLINE_NAME
          FROM COM_BASE_PLINE B
         WHERE B.PLINE_CODE = T.PLINE_CODE) PLINE_CODE,
       T.JUDGE_STOVE_NO,
        T.LOT_NO,
       T.CONTRACT_NO,
       T.CRAFT_FILE_NO,
       T.PRDCR_NO,
       T.PRODUCNAME VARIETIES,
       T.SPEC_NAME PIPE_SIZE,
       T.MODEL_DESC BUCKLE_TYPE,
       T.STEELCODE,
       T.STEELNAME,
       T.GRADECODE,
       T.GRADENAME,
       DECODE(T.PRO_BC,'0','白班','1','早班','2','中班','3','晚班') PRO_BC,
       DECODE(T.PRO_BZ,'1','甲','2','乙','3','丙','4','丁') PRO_BZ,  
       NVL(T.QUALIFIED_NUM, 0) QUALIFIED_NUM,
       NVL(T.QUALIFIED_WT, 0) QUALIFIED_WT,
       NVL(T.SCRAP_NUM, 0) SCRAP_NUM,
       NVL(T.SCRAP_WT, 0) SCRAP_WT,
       DECODE(T.PRO_TYPE, '1', '正常', '2', '停机','正常') PRO_TYPE,
        (SELECT BASENAME FROM com_base_info WHERE  BASECODE=T.STOP_TYPE ) STOP_TYPE,
       (SELECT BASENAME FROM com_base_info WHERE  BASECODE=T.STOP_REASON ) STOP_REASON,
       TO_CHAR(T.USER_DATE, 'YYYY-MM-DD HH24:MI:SS') USER_DATE,
       T.USER_NAME,
       T.USER_ID,
        (SELECT BASENAME FROM com_base_info WHERE  BASECODE=T.STOP_SMALL ) STOP_SMALL,
       TO_CHAR(T.CONFIRM_TIME, 'YYYY-MM-DD HH24:MI:SS') CONFIRM_TIME,
       T.CONFIRM_NAME,
       DECODE(T.CONFIRM_FLAG, '0', '未确认', '1', '已确认') CONFIRM_FLAG,
       T.MEMO,
       T.BAL_YEAR_MONTH,
       T.PROC_DATE,
       DECODE(T.NODE_FLAG, '0', '未结炉', '1', '已结炉') NODE_FLAG,
       T.RESULT_NO,
       T.HEAT_PLAN_NO,
       T.BATCH_NO,
       T.BATCH_GROUD_NO
  FROM HTT_CONTROL_LOG T
 WHERE 1 = 1
   ]]>
	</query>
	<query id="FrmHttControlLog.doStopQuery" desc="查询日志停机记录">
<![CDATA[
SELECT CONTROL_ID,
       TO_CHAR(TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_BEG,
       TO_CHAR(TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_END,
       PLINE_CODE,
       PLINE_NAME,
       RESULT_NO,
            DECODE(T.NODE_FLAG, '0', '未结炉', '1', '已结炉') NODE_FLAG,
       HEAT_PLAN_NO,
       LOT_NO,
       JUDGE_STOVE_NO,
       BATCH_NO,
       BATCH_GROUD_NO,
       CONTRACT_NO,
       CRAFT_FILE_NO,
       PRDCR_NO,
       PRODUCCODE,
       PRODUCNAME,
       GRADECODE,
       GRADENAME,
       STEELCODE,
       STEELNAME,
       MODEL_CODE,
       MODEL_DESC,
       STD_CODE,
       STD_NAME,
       STD_STYLE,
       STD_STYLE_DESC,
       ACT_DIMATER,
       ACT_HEIGHT,
       ACT_LEN,
       ACT_LEN_MIN,
       ACT_LEN_MAX,
       PRO_BC,
       PRO_BZ,
       NVL(T.QUALIFIED_NUM, 0) QUALIFIED_NUM,
       NVL(T.QUALIFIED_WT, 0) QUALIFIED_WT,
       NVL(T.SCRAP_NUM, 0) SCRAP_NUM,
       NVL(T.SCRAP_WT, 0) SCRAP_WT,
       DECODE(T.PRO_TYPE, '1', '正常', '2', '停机','正常') PRO_TYPE,
       STOP_TYPE,
        (SELECT BASENAME FROM com_base_info WHERE  BASECODE=T.STOP_REASON ) STOP_REASON,
       TO_CHAR(T.USER_DATE, 'YYYY-MM-DD HH24:MI:SS') USER_DATE,
       USER_NAME,
       USER_ID,
       STOP_SMALL,
       CONFIRM_TIME,
       CONFIRM_NAME,
       DECODE(T.CONFIRM_FLAG, '0', '未确认', '1', '已确认') CONFIRM_FLAG,
       BAL_YEAR_MONTH,
       PROC_DATE,
       MEMO,
       SPEC_CODE,
       SPEC_NAME,
       PROCESS_CODE_C,
       PROCESS_DESC_C
  FROM HTT_CONTROL_LOG T
 WHERE 1 = 1
 AND T.PRO_TYPE='2'
   ]]>
	</query>
	<query id="FrmHttControlLog.addMilControlLog" desc="新增日志">
<![CDATA[ 
INSERT INTO HTT_CONTROL_LOG
  (LOGS_END,
   LOGS_BEG,
   USER_DATE,
   USER_NAME,
   PRO_TYPE,
   PRO_BC,
   PRO_BZ,
   PLINE_CODE,
   BAL_YEAR_MONTH,
   PROC_DATE,
   CONTROL_ID,
   STATION)
VALUES
  (TO_CHAR(TO_DATE(?, 'YYYY-MM-DD HH24:MI'), 'YYYYMMDDHH24MI'),
   TO_CHAR(TO_DATE(?, 'YYYY-MM-DD HH24:MI') - ? / 24 / 60, 'YYYYMMDDHH24MI'),
   TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
   ?,
   '2',
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?)
  ]]>
	</query>

	<query id="FrmHttControlLog.addMilControlLogDetail" desc="新增日志">
		<![CDATA[
INSERT INTO HTT_CONTROL_LOG_DETAIL
  (CONTROL_ID,LOGS_END, LOGS_BEG,CONTROL_SEQ)
VALUES
  (?,
 TO_CHAR(TO_DATE(?, 'YYYY-MM-DD HH24:MI'),'YYYYMMDDHH24MI'),
  TO_CHAR(TO_DATE(?, 'YYYY-MM-DD HH24:MI') - ?/24/60,'YYYYMMDDHH24MI'),
   (SELECT NVL(MAX(CONTROL_SEQ), 0) + 1
      FROM HTT_CONTROL_LOG_DETAIL
     WHERE CONTROL_ID = ?))

  ]]>
	</query>



	<query id="FrmHttControlLog.queryPlanJg" desc="查询是否存在要新增的记录">
<![CDATA[ 
SELECT COUNT(*) COUNTS
  FROM HTT_CONTROL_LOG T
 WHERE T.LOGS_BEG = ?
  ]]>
	</query>
	<query id="FrmHttControlLog.updateControlLog" desc="修改日志表记录">
<![CDATA[ 
UPDATE HTT_CONTROL_LOG
   SET LOGS_BEG       = ?,
       LOGS_END       = ?,
       MEMO           = ?,
       BAL_YEAR_MONTH = ?,
       Proc_Date      = ?,
       PRO_BC         = ?,
       STOP_TYPE      = ?,
       STOP_SMALL     = ?,
       STOP_REASON    = ?
 WHERE CONTROL_ID = ?
  ]]>
	</query>
	<query id="FrmHttControlLog.updateControlLog2" desc="修改日志表记录">
		<![CDATA[
UPDATE HTT_CONTROL_LOG
   SET LOGS_BEG = ?
 WHERE CONTROL_ID = ?
  ]]>
	</query>

	<query id="FrmHttControlLog.updateControlLogDown" desc="修改选中行下一条数据">
<![CDATA[ 
UPDATE HTT_CONTROL_LOG
   SET LOGS_BEG = ? 
 WHERE CONTROL_ID = ?
  ]]>
	</query>
	<query id="FrmHttControlLog.updateControlLogUp" desc="修改选中行上一条数据">
<![CDATA[ 
UPDATE HTT_CONTROL_LOG
   SET LOGS_END = ?
 WHERE CONTROL_ID = ?
  ]]>
	</query>
	<query id="FrmHttControlLog.queryStratTime" desc="查询修改上一行记录">
<![CDATA[ 
SELECT TO_CHAR(TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_BEG,
       TO_CHAR(TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_END,
       T.CONTROL_ID
  FROM HTT_CONTROL_LOG T
 WHERE T.LOGS_BEG <
       (SELECT T1.LOGS_BEG
          FROM HTT_CONTROL_LOG T1
         WHERE T1.CONTROL_ID = ?)
         AND T.PRO_BC=?
         AND T.PRO_BZ=?
 ORDER BY T.LOGS_BEG DESC
  ]]>
	</query>
	<query id="FrmHttControlLog.queryEndTime" desc="查询修改下一行记录">
<![CDATA[ 
SELECT TO_CHAR(TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_BEG,
       TO_CHAR(TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_END,
       T.CONTROL_ID
  FROM HTT_CONTROL_LOG T
 WHERE T.LOGS_BEG >
       (SELECT T1.LOGS_BEG
          FROM HTT_CONTROL_LOG T1
         WHERE T1.CONTROL_ID = ?)
         AND T.PRO_BC=?
         AND T.PRO_BZ=?
 ORDER BY T.LOGS_BEG ASC
  ]]>
	</query>
	<query id="FrmHttControlLog.queryTime" desc="查询修改下一行记录">
<![CDATA[ 
SELECT TO_CHAR(TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_BEG,
       TO_CHAR(TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_END,
       T.CONTROL_ID
  FROM HTT_CONTROL_LOG T
 WHERE T.CONTROL_ID = ?
  ]]>
	</query>
	<query id="FrmHttControlLog.getComBaseInfo" desc="停机分类">
<![CDATA[ 
SELECT T.BASECODE, T.BASENAME
  FROM COM_BASE_INFO T
 WHERE T.SORTCODE = ?
   AND T.VALIDFLAG = '1'
]]>
	</query>
	<query id="FrmHttControlLog.queryContfirm" desc="确认状态">
<![CDATA[ 
SELECT T.*,
         TO_CHAR(NVL(T1.HHEAT_ENTER_TIME, T2.COL_TIME), 'YYYYMMDDHH24MI') BEGIN_DATE,
         TO_CHAR(NVL(T1.HHEAT_OUT_TIME, T2.COL_END_TIME), 'YYYYMMDDHH24MI') END_DATE,
         (SELECT basename FROM com_base_info WHERE basecode='60070101') CAN_TIME

  FROM HTT_CONTROL_LOG T
  LEFT JOIN HTT_HHEAT_RESULT T1
    ON T1.RESULT_NO = T.RESULT_NO
  LEFT JOIN HTT_CRACK_DETECTION_ET T2
    ON T.RESULT_NO = T2.RESULT_NO
 WHERE T.CONTROL_ID = ?
]]>
	</query>

	<query id="FrmHttControlLog.queryContfirm2" desc="确认状态">
		<![CDATA[
SELECT basename FROM com_base_info WHERE basecode='60070201'

]]>
	</query>

	<query id="FrmHttControlLog.queryCountLoag" desc="查询选中行数据前是否有数据">
<![CDATA[ 
SELECT T.CONTROL_ID
  FROM HTT_CONTROL_LOG T
 WHERE T.CONFIRM_FLAG='0'
   AND (T.LOGS_BEG < ? OR (T.LOGS_BEG=? AND T.LOGS_END < ? ))
   AND T.PLINE_CODE = ?
   AND T.PRO_BC =?
 AND T.PROC_DATE = ?
   ORDER BY T.LOGS_BEG
]]>
	</query>
	<query id="FrmHttControlLog.queryCountLoag1" desc="查询选中行数据后是否有数据">
<![CDATA[ 
SELECT T.CONTROL_ID
  FROM HTT_CONTROL_LOG T
 WHERE T.CONFIRM_FLAG='1'
   AND (T.LOGS_BEG > ? OR (T.LOGS_BEG=? AND T.LOGS_END > ? ))
   AND T.PLINE_CODE = ?
   AND T.PRO_BC =?
   AND T.PRO_BZ = ?
   ORDER BY T.LOGS_BEG
]]>
	</query>

	<query id="FrmHttControlLog.queryCountLoag2" desc="查询选中行数据后是否有数据">
		<![CDATA[
SELECT T.CONTROL_ID
  FROM HTT_CONTROL_LOG T
 WHERE T.CONFIRM_FLAG='1'
   AND T.LOGS_BEG <= ?
   AND T.LOGS_END >= ?
   AND T.PLINE_CODE = ?
   AND T.PRO_BC =?
   ORDER BY T.LOGS_BEG
]]>
	</query>

	<query id="FrmHttControlLog.queryCountLoag3" desc="查询选中行数据后是否有数据">
		<![CDATA[
SELECT T.CONTROL_ID
  FROM HTT_CONTROL_LOG T
 WHERE T.CONFIRM_FLAG='1'
   AND T.PLINE_CODE = ?
   AND T.PRO_BC = ?
   AND T.PROC_DATE = ?
   ORDER BY T.LOGS_BEG
]]>
	</query>

	<query id="FrmHttControlLog.confirmMilControlLog" desc="修改确认标志">
<![CDATA[ 
DECLARE
  V_CONFIRM_FLAG HTT_CONTROL_LOG.CONFIRM_FLAG%type := ?;
  V_CONFIRM_NAME HTT_CONTROL_LOG.CONFIRM_NAME%type := ?;
  V_CONTROL_ID   HTT_CONTROL_LOG.CONTROL_ID%type := ?;
BEGIN
  IF (V_CONFIRM_FLAG = '1') THEN
    UPDATE HTT_CONTROL_LOG
       SET CONFIRM_FLAG = V_CONFIRM_FLAG,
           CONFIRM_NAME = V_CONFIRM_NAME,
           CONFIRM_TIME = SYSDATE
     WHERE CONTROL_ID = V_CONTROL_ID;
  ELSE
    UPDATE HTT_CONTROL_LOG
       SET CONFIRM_FLAG = V_CONFIRM_FLAG,
           AUDIT_NAME   = V_CONFIRM_NAME,
           AUDIT_TIME   = SYSDATE
     WHERE CONTROL_ID = V_CONTROL_ID;
  END IF;
END;
]]>
	</query>
	<query id="FrmHttControlLog.UpConfirmMilControlLog" desc="取消确认标志">
<![CDATA[ 
DECLARE
  V_CONFIRM_FLAG HTT_CONTROL_LOG.CONFIRM_FLAG%type := ?;
  V_CONTROL_ID   HTT_CONTROL_LOG.CONTROL_ID%type := ?;
BEGIN
  IF (V_CONFIRM_FLAG = '0') THEN
    UPDATE HTT_CONTROL_LOG
       SET CONFIRM_FLAG = V_CONFIRM_FLAG,
           CONFIRM_NAME = '',
           CONFIRM_TIME = TO_DATE('', 'YYYY-MM-DD HH24:MI:SS')
     WHERE CONTROL_ID = V_CONTROL_ID;
  ELSE
    UPDATE HTT_CONTROL_LOG
       SET CONFIRM_FLAG = V_CONFIRM_FLAG,
           AUDIT_NAME   = '',
           AUDIT_TIME   = TO_DATE('', 'YYYY-MM-DD HH24:MI:SS')
     WHERE CONTROL_ID = V_CONTROL_ID;
  END IF;
END;
]]>
	</query>
	<query id="FrmHttControlLog.DeleteControlLog" desc="删除停机记录">
<![CDATA[ 
DELETE HTT_CONTROL_LOG WHERE CONTROL_ID = ?
]]>
	</query>

	<query id="FrmHttControlLog.DeleteControlLogDetail" desc="删除停机记录">
		<![CDATA[
DELETE HTT_CONTROL_LOG_DETAIL WHERE CONTROL_ID = ?
]]>
	</query>

	<query id="FrmHttControlLog.OneKeyProcesMilControlLog" desc="一键处理新增轧管日志">
<![CDATA[ 
INSERT INTO HTT_CONTROL_LOG
  (LOGS_BEG, LOGS_END, USER_DATE, USER_NAME, PRO_BC,PRO_BZ,PLINE_CODE,PRO_TYPE,STOP_TYPE,STOP_SMALL,STOP_REASON)
VALUES
  (?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ?, ?,?,?,?,?,?,?)
  ]]>
	</query>
	<query id="FrmHttControlLog.doQueryActual" desc="统计当班生产实绩">
<![CDATA[ 
SELECT T2.JUDGE_STOVE_NO,
       T2.QUALIFIED_NUM,
       T2.QUALIFIED_WT,
       (SELECT round(NVL(((CASE
                          WHEN TRUNC(TO_DATE(?, 'YYYY-MM-DD')) =
                               TRUNC(SYSDATE) AND ? = GET_CurrentBC() THEN
                           SYSDATE
                          ELSE
                           TO_DATE(MAX(T.LOGS_END), 'YYYY-MM-DD HH24:MI')
                        END -
                        TO_DATE(MIN(T.LOGS_BEG), 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                   0)) YOUMINUTES
          FROM HTT_CONTROL_LOG T
         WHERE T.PROC_DATE = ?
           AND T.PRO_BC = ?
           AND T.PLINE_CODE = ?
           AND T.CONFIRM_FLAG = '1') YOUMINUTES,
       (SELECT round(NVL(SUM(((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                            TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)),
                   0)) MINUTES
          FROM HTT_CONTROL_LOG T
         WHERE T.PROC_DATE = ?
           AND T.PRO_BC = ?
           AND T.PLINE_CODE = ?
           AND T.CONFIRM_FLAG = '1'
           AND T.PRO_TYPE = '2'
           AND (T.STOP_TYPE <> '600603')) MINUTES,
       (SELECT round(NVL(SUM(((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                            TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)),
                   0)) ABSMINUTES
          FROM HTT_CONTROL_LOG T
         WHERE T.PROC_DATE = ?
           AND T.PRO_BC = ?
           AND T.PLINE_CODE = ?
           AND T.CONFIRM_FLAG = '1'
           AND T.PRO_TYPE = '2'
           AND T.STOP_TYPE = '600603') ABSMINUTES,
       (SELECT round(NVL(SUM(((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                            TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)),
                   0)) SUMMINUTES
          FROM HTT_CONTROL_LOG T
         WHERE T.PROC_DATE = ?
           AND T.PRO_BC = ?
           AND T.PLINE_CODE = ?
           AND T.CONFIRM_FLAG = '1'
           AND T.PRO_TYPE = '2') SUMMINUTES
  FROM (SELECT COUNT(1) JUDGE_STOVE_NO,
               NVL(SUM(T1.QUALIFIED_NUM), 0) QUALIFIED_NUM,
               NVL(SUM(T1.QUALIFIED_WT), 0) QUALIFIED_WT
          FROM (SELECT T.JUDGE_STOVE_NO,
                       NVL(SUM(T.QUALIFIED_NUM), 0) QUALIFIED_NUM,
                       NVL(SUM(T.QUALIFIED_WT), 0) QUALIFIED_WT
                  FROM HTT_CONTROL_LOG T
                 WHERE T.PROC_DATE = ?
                   AND T.PRO_BC = ?
                   AND T.PLINE_CODE = ?
                   AND T.CONFIRM_FLAG = '1'
                   AND T.PRO_TYPE = '1'
                 GROUP BY T.JUDGE_STOVE_NO) T1) T2
  ]]>
	</query>
	<query id="FrmHttControlLog.doQueryMonthActual" desc="统计月生产实绩">
<![CDATA[ 
SELECT T2.JUDGE_STOVE_NO,
       T2.QUALIFIED_NUM,
       T2.QUALIFIED_WT,
       (SELECT round(NVL(((CASE
                          WHEN ? = TO_CHAR(TRUNC(SYSDATE), 'YYYYMM') THEN
                           SYSDATE
                          ELSE
                           TO_DATE(MAX(T.LOGS_END), 'YYYY-MM-DD HH24:MI')
                        END -
                        TO_DATE(MIN(T.LOGS_BEG), 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                   0)) YOUMINUTES
          FROM HTT_CONTROL_LOG T
         WHERE T.BAL_YEAR_MONTH = ?
           AND T.PLINE_CODE = ?
           AND T.CONFIRM_FLAG = '1') YOUMINUTES,
       (SELECT round(NVL(SUM(((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                            TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)),
                   0)) MINUTES
          FROM HTT_CONTROL_LOG T
         WHERE T.BAL_YEAR_MONTH = ?
           AND T.PLINE_CODE = ?
           AND T.CONFIRM_FLAG = '1'
           AND T.PRO_TYPE = '2'
           AND (T.STOP_TYPE <>'600603')) MINUTES,
       (SELECT round(NVL(SUM(((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                            TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)),
                   0)) ABSMINUTES
          FROM HTT_CONTROL_LOG T
         WHERE T.BAL_YEAR_MONTH = ?
           AND T.PLINE_CODE = ?
           AND T.CONFIRM_FLAG = '1'
           AND T.PRO_TYPE = '2'
           AND T.STOP_TYPE = '600603') ABSMINUTES,
       (SELECT round(NVL(SUM(((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                            TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)),
                   0)) SUMMINUTES
          FROM HTT_CONTROL_LOG T
         WHERE T.BAL_YEAR_MONTH = ?
           AND T.PLINE_CODE = ?
           AND T.CONFIRM_FLAG = '1'
           AND T.PRO_TYPE = '2') SUMMINUTES
  FROM (SELECT COUNT(1) JUDGE_STOVE_NO,
               NVL(SUM(T1.QUALIFIED_NUM), 0) QUALIFIED_NUM,
               NVL(SUM(T1.QUALIFIED_WT), 0) QUALIFIED_WT
          FROM (SELECT T.JUDGE_STOVE_NO,
                       NVL(SUM(T.QUALIFIED_NUM), 0) QUALIFIED_NUM,
                       NVL(SUM(T.QUALIFIED_WT), 0) QUALIFIED_WT
                  FROM HTT_CONTROL_LOG T
                 WHERE T.BAL_YEAR_MONTH = ?
                   AND T.PLINE_CODE = ?
                   AND T.CONFIRM_FLAG = '1'
                   AND T.PRO_TYPE = '1'
                 GROUP BY T.JUDGE_STOVE_NO) T1) T2
  ]]>
	</query>
	<query id="FrmHttControlLog.doQueryDayActual" desc="统计日">
<![CDATA[ SELECT T2.JUDGE_STOVE_NO,
       T2.QUALIFIED_NUM,
       T2.QUALIFIED_WT,
       (SELECT round(NVL(((CASE
                          WHEN TRUNC(TO_DATE(?, 'YYYY-MM-DD')) =
                               TRUNC(SYSDATE) THEN
                           SYSDATE
                          ELSE
                           TO_DATE(MAX(T.LOGS_END), 'YYYY-MM-DD HH24:MI')
                        END -
                        TO_DATE(MIN(T.LOGS_BEG), 'YYYY-MM-DD HH24:MI')) * 24 * 60),
                   0)) YOUMINUTES
          FROM HTT_CONTROL_LOG T
         WHERE T.PROC_DATE = ?
           AND T.PLINE_CODE = ?
           AND T.CONFIRM_FLAG = '1') YOUMINUTES,
       (SELECT round(NVL(SUM(((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                            TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)),
                   0)) MINUTES
          FROM HTT_CONTROL_LOG T
         WHERE T.PROC_DATE = ?
           AND T.PLINE_CODE = ?
           AND T.CONFIRM_FLAG = '1'
           AND T.PRO_TYPE = '2'
           AND (T.STOP_TYPE <>'600603')) MINUTES,
       
       (SELECT round(NVL(SUM(((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                            TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)),
                   0)) ABSMINUTES
          FROM HTT_CONTROL_LOG T
         WHERE T.PROC_DATE = ?
           AND T.PLINE_CODE = ?
           AND T.CONFIRM_FLAG = '1'
           AND T.PRO_TYPE = '2'
           AND T.STOP_TYPE = '600603') ABSMINUTES,
       (SELECT round(NVL(SUM(((TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI') -
                            TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI')) * 24 * 60)),
                   0)) SUMMINUTES
          FROM HTT_CONTROL_LOG T
         WHERE T.PROC_DATE = ?
           AND T.PLINE_CODE = ?
           AND T.CONFIRM_FLAG = '1'
           AND T.PRO_TYPE = '2') SUMMINUTES
  FROM (SELECT COUNT(1) JUDGE_STOVE_NO,
               NVL(SUM(T1.QUALIFIED_NUM), 0) QUALIFIED_NUM,
               NVL(SUM(T1.QUALIFIED_WT), 0) QUALIFIED_WT
          FROM (SELECT T.JUDGE_STOVE_NO,
                       NVL(SUM(T.QUALIFIED_NUM), 0) QUALIFIED_NUM,
                       NVL(SUM(T.QUALIFIED_WT), 0) QUALIFIED_WT
                  FROM HTT_CONTROL_LOG T
                 WHERE T.PROC_DATE = ?
                   AND T.PLINE_CODE = ?
                   AND T.CONFIRM_FLAG = '1'
                   AND T.PRO_TYPE = '1'
                 GROUP BY T.JUDGE_STOVE_NO) T1) T2
  ]]>
	</query>
	<query id="FrmHttControlLog.OneKeyUpdateMilControlLog" desc="一键修改">
<![CDATA[
UPDATE HTT_CONTROL_LOG T SET T.LOGS_END = ? WHERE T.CONTROL_ID = ?
 ]]>
	</query>
	
	<query id = "FrmHttControlLog.UpdataPROCDATE" desc = "更新调度中的生产年月">
<![CDATA[
      	  UPDATE HTT_CONTROL_LOG T  
                     SET T.Proc_Date = CASE   
                   WHEN (substr(t.logs_beg,9,4)> '1200'   
                        AND substr(t.logs_beg,9,4)<= '2400') AND T.PRO_BC = '3'  THEN  TO_CHAR(TRUNC(to_date(t.logs_beg,'YYYY-MM-DD HH24:MI:SS'))+1,'YYYYMMDD')   
                   WHEN (substr(t.logs_beg,9,4) >='0000'   
                        AND substr(t.logs_beg,9,4)< '1200') AND T.PRO_BC = '3'  THEN TO_CHAR(TRUNC(to_date(t.logs_beg,'YYYY-MM-DD HH24:MI:SS')),'YYYYMMDD')   
                   ELSE TO_CHAR(TRUNC(to_date(t.logs_beg,'YYYY-MM-DD HH24:MI:SS')),'YYYYMMDD')END,   
                     T.Bal_Year_Month = CASE   
                   WHEN (substr(t.logs_beg,9,4)> '1200'  
                        AND substr(t.logs_beg,9,4)<= '2400') AND T.PRO_BC = '3'  THEN  TO_CHAR(TRUNC(to_date(t.logs_beg,'YYYY-MM-DD HH24:MI:SS'))+1,'YYYYMM')   
                   WHEN (substr(t.logs_beg,9,4) >='0000'  
                        AND substr(t.logs_beg,9,4)< '1200') AND T.PRO_BC = '3'  THEN TO_CHAR(TRUNC(to_date(t.logs_beg,'YYYY-MM-DD HH24:MI:SS')),'YYYYMM')   
             ELSE TO_CHAR(TRUNC(to_date(t.logs_beg,'YYYY-MM-DD HH24:MI:SS')),'YYYYMM')END  
             WHERE T.Proc_Date IS NULL		    
        ]]>
</query>
	<query id = "FrmHttControlLog.doMinutesQuery" desc = "查询调度生产运行停机时间">
<![CDATA[

]]>
</query>


	<query id = "FrmHttControlLog.QueryMaxID" desc = "">
		<![CDATA[
  SELECT ? ||
         LPAD(NVL(MAX(TO_NUMBER(SUBSTR(CONTROL_ID, LENGTH(CONTROL_ID) - 3))),
                  0) + 1,
              4,
              '0') CONTROL_ID
    FROM HTT_CONTROL_LOG
   WHERE CONTROL_ID LIKE ? || '____'
]]>
	</query>


	<query id = "FrmHttControlLog.AddControlDetail" desc = "">
		<![CDATA[
INSERT INTO HTT_CONTROL_LOG_DETAIL
  (CONTROL_ID,
   LOGS_BEG,
   LOGS_END,
   STOP_TYPE,
   STOP_REASON,
   STOP_SMALL,
   CONTROL_SEQ,
   STATION_CODE,
   MEMO)
VALUES
  ('#CONTROL_ID#',
   '#LOGS_BEG#',
   '#LOGS_END#',
   '#STOP_TYPE#',
   '#STOP_REASON#',
   '#STOP_SMALL#',
   '#CONTROL_SEQ#',
   '#STATION_CODE#',
   '#MEMO#')
]]>
	</query>


	<query id = "FrmHttControlLog.UpdateHours" desc = "">
		<![CDATA[
UPDATE SLM_BASE_MATERIAL_F_PL
   SET HR_CAPCTY = ROUND((NVL(HR_CAPCTY,0) * 5000 +
                   NVL(?, 0) * NVL(?, 0)) / (5000 + NVL(?, 0)))
 WHERE IN_MATERIAL_NO = ?
   AND OUT_MATERIAL_NO = ?
   AND PLINE_CODE = ?
]]>
	</query>

	<query id = "FrmHttControlLog.UpdateHoursG" desc = "">
		<![CDATA[
UPDATE SLM_BASE_MATERIAL_K_PL
   SET HR_CAPCTY = ROUND((NVL(HR_CAPCTY,0) * 5000 +
                   NVL(?, 0) * NVL(?, 0)) / (5000 + NVL(?, 0)))
 WHERE IN_MATERIAL_NO = ?
   AND OUT_MATERIAL_NO = ?
   AND PLINE_CODE = ?
]]>
	</query>
	<query id = "FrmHttControlLog.doQueryStop" desc = "调度停机查询">
		<![CDATA[
 SELECT T.CONTROL_ID,
       TO_CHAR(TO_DATE(T.LOGS_BEG, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_BEG,
       TO_CHAR(TO_DATE(T.LOGS_END, 'YYYY-MM-DD HH24:MI'),
               'YYYY-MM-DD HH24:MI') LOGS_END,
       PLINE_CODE,
       PLINE_NAME,
       RESULT_NO,
       DECODE(T.NODE_FLAG, '0', '未结炉', '1', '已结炉') NODE_FLAG,
       HEAT_PLAN_NO,
       LOT_NO,
       JUDGE_STOVE_NO,
       BATCH_NO,
       BATCH_GROUD_NO,
       CONTRACT_NO,
       CRAFT_FILE_NO,
       PRDCR_NO,
       PRODUCCODE,
       PRODUCNAME,
       GRADECODE,
       GRADENAME,
       STEELCODE,
       STEELNAME,
       MODEL_CODE,
       MODEL_DESC,
       STD_CODE,
       STD_NAME,
       STD_STYLE,
       STD_STYLE_DESC,
       ACT_DIMATER,
       ACT_HEIGHT,
       ACT_LEN,
       ACT_LEN_MIN,
       ACT_LEN_MAX,
       PRO_BC,
       PRO_BZ,
       DECODE(T.PRO_TYPE,
              '1',
              DECODE(PROCESS_CODE_C, 'B024', '仅探伤', '正常'),
              '2',
              '停机',
              '正常') PRO_TYPE,
       (SELECT BASENAME FROM com_base_info WHERE BASECODE = T.STOP_TYPE) STOP_TYPE,
       
       (SELECT BASENAME FROM com_base_info WHERE BASECODE = T.STOP_REASON) STOP_REASON,
       TO_CHAR(T.USER_DATE, 'YYYY-MM-DD HH24:MI:SS') USER_DATE,
       USER_NAME,
       USER_ID,
       (SELECT BASENAME FROM com_base_info WHERE BASECODE = T.STOP_SMALL) STOP_SMALL,
       CONFIRM_TIME,
       CONFIRM_NAME,
       DECODE(T.CONFIRM_FLAG, '0', '未确认', '1', '已确认', '2', '已审核') CONFIRM_FLAG,
       BAL_YEAR_MONTH,
       PROC_DATE,
       T.MEMO,
       SPEC_CODE,
       SPEC_NAME,
       PROCESS_CODE_C,
       PROCESS_DESC_C,
       DECODE(STATION,
              '0',
              '热处理',
              '1',
              '探伤',
              '2',
              '测量点',
              '3',
              '车丝',
              '4',
              '水压') STATION,
       AUDIT_TIME,
       AUDIT_NAME
  from HTT_CONTROL_LOG T
 WHERE T.PRO_TYPE = '2'
]]>
	</query>
	
		<query id="FrmHttControlLog.updateMilControlLogStop" desc="修改日志表记录">
<![CDATA[ 
UPDATE HTT_CONTROL_LOG T
   SET T.LOGS_BEG    = '#LOGS_BEG#',
       T.LOGS_END    = '#LOGS_END#',
       T.STOP_TYPE   = '#STOP_TYPE#',
       T.STOP_REASON = '#STOP_REASON#',
       T.STOP_SMALL  = '#STOP_SMALL#',
       T.MEMO        = '#MEMO#'
 WHERE T.CONTROL_ID = '#CONTROL_ID#'
  ]]>
	</query>
	
	<query id="FrmHttControlLog.qureyConfirmFlag" desc="查询录入时间是否调度已确认">
<![CDATA[ 
select COUNT(1) ACOUT
  from HTT_CONTROL_LOG t
 WHERE T.CONFIRM_FLAG > 0
   AND ((T.LOGS_BEG <= ? AND T.LOGS_END > ?) OR
       (T.LOGS_BEG < ? AND T.LOGS_END >= ?))
   AND T.PLINE_CODE = ?
   AND T.STATION = ?
  ]]>
	</query>

</queryMap>