<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="热处理实绩，分高温炉和低温炉">

	<query id="HeatTreatmentService.GetHeatTreatmentResultByID" desc="热处理高温炉实绩查询">
        <![CDATA[
          SELECT T.ZY_BATCH_ID,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       TO_CHAR(T.HHEAT_ENTER_TIME, 'YYYY-MM-DD HH24:MI:SS') HHEAT_ENTER_TIME,
       TO_CHAR(T.HHEAT_OUT_TIME, 'YYYY-MM-DD HH24:MI:SS') HHEAT_OUT_TIME,
       T.HHEAT_EXIT_TEMP,
       T.HHEAT_TAKT_TIME,
       T.HHEAT_CRUVE1,
       T.HHEAT_CRUVE2,
       T.HHEAT_CRUVE3,
       T.HHEAT_CRUVE4,
       T.HHEAT_CRUVE5,
       T.HHEAT_CRUVE6,
       T.HHEAT_AVG_TEMP1,
       T.HHEAT_AVG_TEMP2,
       T.HHEAT_AVG_TEMP3,
       T.HHEAT_AVG_TEMP4,
       T.HHEAT_AVG_TEMP5,
       T.HHEAT_AVG_TEMP6,
       T.PRO_NUM,
       T.PRO_WT,
       T.FAIL_NUM,
       T.FAIL_WT,
       T.OFFLINE_NUM,
       T.OFFLINE_WT,
       T.RE_NUM,
       T.RE_WT,
       T.COL_MODE,
       TO_CHAR(T.COL_TIME, 'YYYY-MM-DD HH24:MI:SS') COL_TIME,
       T.COL_USER,
       T.COL_SHIFT,
       T.COL_GROUP,
       T.PRODUCER,
       TO_CHAR(T.PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       T.PLINE_CODE,
       T.HEAT_PLAN_NO,
       T.RESULT_NO,
       T.PLINE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.UPDATE_NAME,
       DECODE(B.STATION_STATUS, '1', '生产中', '2', '生产完成') STATION_STATUS,
       T.PROCESS_SEQ,
       T.COOLING_TYPE,
       T.TOTAL_TIME,
       T.HTT_TECHNOLOGY,
       T.HTT_TYPE
 FROM HTT_HHEAT_RESULT T,HTT_COM_INFO B
 WHERE T.RESULT_NO = B.RESULT_NO
   AND T.HEAT_PLAN_NO = B.HEAT_PLAN_NO
 AND T.HEAT_PLAN_NO = ?
 ORDER BY T.COL_TIME DESC
        ]]>
	</query>

	<query id="HeatTreatmentService.GetHeatTreatmentResult" desc="热处理高温炉实绩查询">
		<![CDATA[
          SELECT *
 FROM HTT_HHEAT_RESULT
        ]]>
	</query>

		<query id="HeatTreatmentService.getQueryExpandResultStuts" desc="查询相同炉计划ID下高温炉状态">
		<![CDATA[
SELECT B.STATION_STATUS 
  FROM htt_hheat_result T INNER JOIN htt_COM_INFO B ON T.RESULT_NO=B.RESULT_NO
 WHERE T.HEAT_PLAN_NO = ? AND T.PLINE_CODE =?
			]]>
	</query>
	<query id="HeatTreatmentService.getQueryExpandResult1" desc="查询高温炉合格支数的和">
        <![CDATA[
   SELECT NVL(SUM(T.PRO_NUM), 0) PRO_NUM FROM HTT_HHEAT_RESULT T
   WHERE T.HEAT_PLAN_NO = ?
        ]]>
	</query>

	<query id="HeatTreatmentService.getHHeatOKCountByProcessSeq" desc="查询高温炉合格支数的和">
		<![CDATA[
   SELECT (SELECT NVL(SUM(ACT_COUNT), 0)
          FROM PORT_HTT_BATCH_SAMPLE_RESULT
         WHERE HEAT_PLAN_NO = ?
           AND ((NVL(PROCESS_SEQ, 1) = ? AND  (MAT_STATUS = '00' OR OP_PROCESS>= ?)) OR
               NVL(PROCESS_SEQ, 1) > ?)) -
       (SELECT NVL(SUM(PRO_NUM), 0)
          FROM HTT_HHEAT_RESULT
         WHERE HEAT_PLAN_NO =?
           AND NVL(PROCESS_SEQ, 1) = ?) COUNT
  FROM DUAL
        ]]>
	</query>

	<query id="HeatTreatmentService.getLHeatOKCountByProcessSeq" desc="查询低温炉合格支数的和">
	<![CDATA[
   SELECT (SELECT NVL(SUM(ACT_COUNT), 0)
          FROM PORT_HTT_BATCH_SAMPLE_RESULT
         WHERE HEAT_PLAN_NO = ?
           AND ((NVL(PROCESS_SEQ, 1) = ? AND (MAT_STATUS = '00' OR OP_PROCESS>= ?)) OR
               NVL(PROCESS_SEQ, 1) > ?)) -
       (SELECT NVL(SUM(PRO_NUM), 0)
          FROM HTT_LHEAT_RESULT
         WHERE HEAT_PLAN_NO =?
           AND NVL(PROCESS_SEQ, 1) = ?) COUNT
  FROM DUAL
        ]]>
</query>



	<query id="HeatTreatmentService.getQuenchingOKCountByProcessSeq" desc="查询高温炉合格支数的和">
		<![CDATA[
   SELECT (SELECT NVL(SUM(ACT_COUNT), 0)
          FROM PORT_HTT_BATCH_SAMPLE_RESULT
         WHERE HEAT_PLAN_NO = ?
           AND ((NVL(PROCESS_SEQ, 1) = ? AND (MAT_STATUS = '00' OR OP_PROCESS>= ?)) OR
               NVL(PROCESS_SEQ, 1) > ?)) -
       (SELECT NVL(SUM(PASS_NUM), 0)
          FROM HTT_QUENCHING_RESULT
         WHERE HEAT_PLAN_NO =?
           AND NVL(PROCESS_SEQ, 1) = ?) COUNT
  FROM DUAL
        ]]>
	</query>

	<query id="HeatTreatmentService.getQueryExpandResult3" desc="查询低温炉合格支数的和">
        <![CDATA[
   SELECT NVL(SUM(T.PRO_NUM), 0) PRO_NUM FROM HTT_LHEAT_RESULT T
   WHERE T.HEAT_PLAN_NO = ?
        ]]>
	</query>
		<query id="HeatTreatmentService.getQueryExpandResult2" desc="查询淬火合格支数的和">
        <![CDATA[
   SELECT NVL(SUM(T.PASS_NUM), 0) PASS_NUM FROM HTT_QUENCHING_RESULT T
   WHERE T.HEAT_PLAN_NO = ?
        ]]>
	</query>
		<query id="HeatTreatmentService.getQueryExpandResultStuts1" desc="查询相同炉计划ID下淬火状态">
		<![CDATA[
SELECT B.STATION_STATUS 
  FROM htt_quenching_result T INNER JOIN htt_COM_INFO B ON T.RESULT_NO=B.RESULT_NO
 WHERE T.HEAT_PLAN_NO = ? AND T.PLINE_CODE =?
			]]>
	</query>
	<query id="HeatTreatmentService.getQueryExpandResultStuts2" desc="查询相同炉计划ID下低温炉状态">
		<![CDATA[
SELECT B.STATION_STATUS 
  FROM htt_lheat_result T INNER JOIN htt_COM_INFO B ON T.RESULT_NO=B.RESULT_NO
 WHERE T.HEAT_PLAN_NO = ? AND T.PLINE_CODE =?
			]]>
	</query>
	<query id="HeatTreatmentService.GetLowHeatTreatmentResultByID"
		desc="热处理低温炉实绩查询">
        <![CDATA[ 
         SELECT 
       T.RESULT_NO,
       T.ZY_BATCH_ID,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       TO_CHAR(T.LHEAT_ENTER_TIME, 'YYYY-MM-DD HH24:MI:SS') LHEAT_ENTER_TIME,
       TO_CHAR(T.LHEAT_OUT_TIME, 'YYYY-MM-DD HH24:MI:SS') LHEAT_OUT_TIME,
       T.LHEAT_EXIT_TEMP,
       T.LHEAT_TAKT_TIME,
       T.LHEAT_CRUVE1,
       T.LHEAT_CRUVE2,
       T.LHEAT_CRUVE3,
       T.LHEAT_CRUVE4,
       T.LHEAT_CRUVE5,
       T.LHEAT_CRUVE6,
       T.LHEAT_CRUVE7,
       T.LHEAT_CRUVE8,
       T.LHEAT_CRUVE9,
       T.LHEAT_AVG_TEMP1,
       T.LHEAT_AVG_TEMP2,
       T.LHEAT_AVG_TEMP3,
       T.LHEAT_AVG_TEMP4,
       T.LHEAT_AVG_TEMP5,
       T.LHEAT_AVG_TEMP6,
       T.LHEAT_AVG_TEMP7,
       T.LHEAT_AVG_TEMP8,
       T.LHEAT_AVG_TEMP9,
       T.PRO_NUM,
       T.PRO_WT,
       T.FAIL_NUM,
       T.FAIL_WT,
       T.OFFLINE_NUM,
       T.OFFLINE_WT,
       T.RE_NUM,
       T.RE_WT,
       T.COL_MODE,
       TO_CHAR(T.COL_TIME, 'YYYY-MM-DD HH24:MI:SS') COL_TIME,
       T.COL_USER,
       T.COL_SHIFT,
       T.COL_GROUP,
       T.PRODUCER,
       TO_CHAR(T.PRODUCER_TIME, 'YYYY-MM-DD HH24:MI:SS') PRODUCER_TIME,
       T.PLINE_CODE,
       T.HEAT_PLAN_NO,
       T.PLINE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.UPDATE_NAME,
       DECODE(B.STATION_STATUS, '1', '生产中', '2', '生产完成') STATION_STATUS,
       T.PROCESS_SEQ,
       T.TOTAL_TIME,
        T.LOW_TEMP,
       T.COOLING_TYPE,
       T.HTT_TECHNOLOGY,
       T.HTT_TYPE
 FROM HTT_LHEAT_RESULT T,HTT_COM_INFO B
 WHERE T.RESULT_NO = B.RESULT_NO
   AND T.HEAT_PLAN_NO = B.HEAT_PLAN_NO
 AND T.HEAT_PLAN_NO = ?
 ORDER BY T.COL_TIME DESC
          ]]>
	</query>

	<query id="HeatTreatmentService.getQuechResultID"
		   desc="热处理低温炉实绩查询">
		<![CDATA[
          SELECT
       T.RESULT_NO,
       T.HEAT_PLAN_NO,
       T.ZY_BATCH_ID,
       T.PROD_INDEX,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.QUENCH_WAY,
       T.TRAFFIC,
       T.LENGTH_TIME,
       T.PASS_NUM,
       TO_CHAR(T.COL_TIME, 'YYYY-MM-DD HH24:MI:SS') COL_TIME,
       T.COL_USER,
       T.COL_SHIFT,
       T.COL_GROUP,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.UPDATE_NAME,
       T.COL_MODE,
       T.PRO_YEAR_MONTH_DAY,
       T.BAL_YEAR_MONTH,
       T.PROCESS_SEQ,
       T.FAIL_NUM,
       T.FAIL_WT,
       T.PRO_NUM,
       T.PRO_WT,
       T.MODEL,
       T.NEI_GPS,
       T.NEI_TIME,
       T.NEI_PSI,
       T.WAI_GPS,
       T.WAI_TIME,
       T.WAI_PSI,
       T.DELAYED,
       T.BEFORE_TEMPERATURE,
       T.AFTER_TEMPERATURE,
       T.MEDIUM_TEMPERATURE,
       T.PEMARK
 FROM HTT_QUENCHING_RESULT T
 WHERE
T.RESULT_NO = ?
          ]]>
	</query>
	<query id="HeatTreatmentService.GetLowHeatTreatmentResult"
		   desc="热处理低温炉实绩查询">
		<![CDATA[
         SELECT *
 FROM HTT_LHEAT_RESULT T
          ]]>
	</query>
	<query id="HeatTreatmentService.updateQuechResultByID"
		   desc="热处理淬火池实绩查询">
		<![CDATA[
       UPDATE HTT_QUENCHING_RESULT T
   SET
        T.MODEL = '#MODEL#',
        T.NEI_GPS = '#NEI_GPS#',
        T.NEI_TIME = '#NEI_TIME#',
        T.NEI_PSI = '#NEI_PSI#',
        T.WAI_GPS = '#WAI_GPS#',
        T.WAI_TIME = '#WAI_TIME#',
        T.WAI_PSI = '#WAI_PSI#',
        T.DELAYED = '#DELAYED#',
        T.BEFORE_TEMPERATURE = '#BEFORE_TEMPERATURE#',
        T.AFTER_TEMPERATURE = '#AFTER_TEMPERATURE#',
        T.MEDIUM_TEMPERATURE = '#MEDIUM_TEMPERATURE#',
        T.PEMARK = '#PEMARK#'
 WHERE
T.RESULT_NO = '#RESULT_NO#'
          ]]>
	</query>
	<query id="HeatTreatmentService.GetQuechtHeatTreatmentResultByID"
					   desc="热处理淬火池实绩查询">
	<![CDATA[
         SELECT
       T.RESULT_NO,
       T.HEAT_PLAN_NO,
       T.ZY_BATCH_ID,
       T.PRO_PLAN_ID,
       T.GX_PLAN_NO,
       T.QUENCH_WAY,
       T.TRAFFIC,
       T.LENGTH_TIME,
       T.PASS_NUM,
       TO_CHAR(T.COL_TIME, 'YYYY-MM-DD HH24:MI:SS') COL_TIME,
       T.COL_USER,
       T.COL_SHIFT,
       T.COL_GROUP,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.UPDATE_NAME,
       T.PLINE_CODE,
       T.PLINE_NAME,
       DECODE(B.STATION_STATUS, '1', '生产中', '2', '生产完成') STATION_STATUS,
          T.PRO_NUM,
       T.PRO_WT,
       T.FAIL_NUM,
       T.FAIL_WT,
       T.PROCESS_SEQ
 FROM HTT_QUENCHING_RESULT T,HTT_COM_INFO B
 WHERE T.RESULT_NO = B.RESULT_NO
   AND T.HEAT_PLAN_NO = B.HEAT_PLAN_NO
 AND T.HEAT_PLAN_NO = ?
 ORDER BY T.COL_TIME DESC
          ]]>
</query>

	<query id="HeatTreatmentService.GetQuechtHeatTreatmentResult"
		   desc="热处理淬火池实绩查询">
		<![CDATA[
         SELECT *
 FROM HTT_QUENCHING_RESULT T
          ]]>
	</query>

	<query id="HeatTreatmentService.AddHHeatResult" desc="新增高温炉实绩">
        <![CDATA[
INSERT INTO HTT_HHEAT_RESULT
  (RESULT_NO,
   ZY_BATCH_ID,
   PRO_PLAN_ID,
   GX_PLAN_NO,
   HHEAT_ENTER_TIME,
   HHEAT_OUT_TIME,
   HHEAT_EXIT_TEMP,
   HHEAT_TAKT_TIME,
   HHEAT_AVG_TEMP1,
   HHEAT_AVG_TEMP2,
   HHEAT_AVG_TEMP3,
   HHEAT_AVG_TEMP4,
   HHEAT_AVG_TEMP5,
   HHEAT_AVG_TEMP6,
   PRO_NUM,
   PRO_WT,
   FAIL_NUM,
   FAIL_WT,
   OFFLINE_NUM,
   OFFLINE_WT,
   RE_NUM,
   RE_WT,
   COL_MODE,
   COL_TIME,
   COL_USER,
   COL_SHIFT,
   COL_GROUP,
   PRODUCER,
   PRODUCER_TIME,
   PLINE_CODE,
   HEAT_PLAN_NO,
   PLINE_NAME,
   CREATE_TIME,
   PROCESS_SEQ,TOTAL_TIME,COOLING_TYPE,HTT_TECHNOLOGY,HTT_TYPE)
VALUES
  (?,
   ?,
   ?,
   ?,
   TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
   TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   (SELECT SUM(DEF_FILL_WT) FROM HTT_WASTE_RESULT WHERE RESULT_NO = ? ),
   ?,
   ?,
   ?,
   ?,
   ?,
   TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
   ?,
   ?,
   ?,
   ?,
   TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
   ?,
   ?,
   ?,
   TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
   ?,?,?,?,?)
        ]]>
	</query>
	<query id="HeatTreatmentService.doQuery" desc="查询工序点">
        <![CDATA[    
SELECT T.BASECODE,T.BASENAME
  FROM COM_BASE_INFO T
 WHERE T.SORTCODE = ?
   AND T.VALIDFLAG = '1'
   AND T.BASENAME IN ('高温炉', '淬火','低温炉')
        ]]>
	</query>
	<query id="HeatTreatmentService.queryExpandNUM" desc="查询管号队列里合格的材料号">
		<![CDATA[
	SELECT T1.MAT_NO
  FROM (SELECT T.MAT_NO
          FROM PORT_HTT_BATCH_SAMPLE_RESULT T
         WHERE T.MAT_STATUS = '00'
           AND T.IS_SAMPLE_PIPE='0'
           AND T.HEAT_PLAN_NO = ?
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM<?
			]]>
	</query>

	<query id="HeatTreatmentService.queryExpandNUMWithProcessSeq" desc="查询管号队列里合格的材料号">
		<![CDATA[
	SELECT T1.MAT_NO
  FROM (SELECT T.MAT_NO
          FROM PORT_HTT_BATCH_SAMPLE_RESULT T
         WHERE T.MAT_STATUS = '00'
           AND T.IS_SAMPLE_PIPE='0'
           AND T.HEAT_PLAN_NO = ?
           AND T.PROCESS_SEQ = ?
         ORDER BY T.MAT_NO ASC) T1
 WHERE ROWNUM<?
			]]>
	</query>
	
	<query id="HeatTreatmentService.UpdatePath" desc="修改队列表工艺路径">
		<![CDATA[
UPDATE PORT_HTT_BATCH_SAMPLE_RESULT T
   SET T.PRC_TECHNOLOGY_PATH = SUBSTR(T.PRC_TECHNOLOGY_PATH, 1,2) || ? ||
                               SUBSTR(T.PRC_TECHNOLOGY_PATH,4, LENGTH(T.PRC_TECHNOLOGY_PATH))
 WHERE T.HEAT_PLAN_NO = ?
 AND PROCESS_SEQ = (SELECT real_process_seq FROM pln_zy_rcl_m WHERE heat_plan_no = t.heat_plan_no)
 AND MAT_STATUS='00'
			]]>
	</query>	
	<query id="HeatTreatmentService.UpdatePath1" desc="修改队列表工艺路径">
		<![CDATA[
UPDATE PORT_HTT_BATCH_SAMPLE_RESULT T
   SET T.PRC_TECHNOLOGY_PATH = SUBSTR(T.PRC_TECHNOLOGY_PATH, 1,4) || ? ||
                               SUBSTR(T.PRC_TECHNOLOGY_PATH,6, LENGTH(T.PRC_TECHNOLOGY_PATH))
 WHERE T.HEAT_PLAN_NO = ?
 AND PROCESS_SEQ = (SELECT real_process_seq FROM pln_zy_rcl_m WHERE heat_plan_no = t.heat_plan_no)
 AND MAT_STATUS='00'
			]]>
	</query>	
	<query id="HeatTreatmentService.UpdatePath2" desc="修改队列表工艺路径">
		<![CDATA[
UPDATE PORT_HTT_BATCH_SAMPLE_RESULT T
   SET T.PRC_TECHNOLOGY_PATH = SUBSTR(T.PRC_TECHNOLOGY_PATH, 1,6) || ? ||
                               SUBSTR(T.PRC_TECHNOLOGY_PATH,8, LENGTH(T.PRC_TECHNOLOGY_PATH))
 WHERE T.HEAT_PLAN_NO = ?
 AND PROCESS_SEQ = (SELECT real_process_seq FROM pln_zy_rcl_m WHERE heat_plan_no = t.heat_plan_no)
 AND MAT_STATUS='00'
			]]>
	</query>	
	<query id="HeatTreatmentService.qureyGxComInfo" desc="查询工序是否是结炉状态">
		<![CDATA[
SELECT DISTINCT STATION_STATUS
  FROM HTT_COM_INFO
 WHERE HEAT_PLAN_NO = ?
   AND PLINE_CODE = ?
   AND STATION_CODE = ?
    AND PRO_NUM > 0
			]]>
	</query>

	<query id="HeatTreatmentService.qureyGxComInfoNew" desc="查询工序是否是结炉状态">
		<![CDATA[
SELECT  MAX(STATION_STATUS) STATION_STATUS,  MAX(STATION_CODE) STATION_CODE
  FROM HTT_COM_INFO
 WHERE HEAT_PLAN_NO = ?
   AND (STATION_CODE = ? OR STATION_CODE =? OR STATION_CODE =?)
   AND PROCESS_SEQ =?
    AND PRO_NUM > 0
			]]>
	</query>
	
	<query id="HeatTreatmentService.qureyIsConfirm" desc="查询调度是否确认">
		<![CDATA[
select count(1) acout from HTT_CONTROL_LOG t WHERE T.CONFIRM_FLAG <> '0' AND T.RESULT_NO = ?
			]]>
	</query>

	<query id="HeatTreatmentService.qureyGxComInfoNew1" desc="查询工序是否是结炉状态">
		<![CDATA[
SELECT  MAX(STATION_STATUS) STATION_STATUS,  MAX(STATION_CODE) STATION_CODE
  FROM HTT_COM_INFO
 WHERE HEAT_PLAN_NO = ?
 AND PROCESS_SEQ =?
 AND PRO_NUM > 0
			]]>
	</query>

	<query id="HeatTreatmentService.queryExpandFailNUM" desc="查询管号队列废品数量">
		<![CDATA[
		SELECT NVL(SUM(T.ACT_COUNT),0) ACT_COUNT
  FROM PORT_HTT_BATCH_SAMPLE_RESULT T
 WHERE T.MAT_STATUS = '10'
   AND T.HEAT_PLAN_NO = ?
   AND T.OP_PROCESS = ?
		
			]]>
	</query>
		<query id="HeatTreatmentService.queryExpandNUM2" desc="查询废品材料信息">
		<![CDATA[
	SELECT T1.MAT_NO
  FROM (SELECT T.MAT_NO
          FROM PORT_HTT_BATCH_SAMPLE_RESULT T
         WHERE T.MAT_STATUS = '10'
           AND T.HEAT_PLAN_NO = ?
             AND T.OP_PROCESS=?
         ORDER BY T.MAT_NO DESC) T1
 WHERE ROWNUM<?
			]]>
	</query>

	<query id="HeatTreatmentService.queryExpandNUM3" desc="查询废品材料信息">
		<![CDATA[
	SELECT T1.MAT_NO
  FROM (SELECT T.MAT_NO
          FROM PORT_HTT_BATCH_SAMPLE_RESULT T
         WHERE T.MAT_STATUS = '10'
           AND T.HEAT_PLAN_NO = ?
             AND T.OP_PROCESS=?
             AND T.PROCESS_SEQ =?
         ORDER BY T.MAT_NO DESC) T1
 WHERE ROWNUM<?
			]]>
	</query>

	<query id="HeatTreatmentService.queryExpandFailNUM4" desc="查询管号队列废品数量">
		<![CDATA[
		SELECT NVL(SUM(T.ACT_COUNT),0) ACT_COUNT
  FROM PORT_HTT_BATCH_SAMPLE_RESULT T
 WHERE T.MAT_STATUS = '10'
   AND T.HEAT_PLAN_NO = ?
   AND T.OP_PROCESS = ?
   AND PROCESS_SEQ =?

			]]>
	</query>
	
	<query id="HeatTreatmentService.queryExpandFailNUM1" desc="查询工序废品数量">
		<![CDATA[
		SELECT NVL(SUM(T.FAIL_NUM),0) FAIL_NUM FROM HTT_HHEAT_RESULT T
WHERE  T.HEAT_PLAN_NO=? 
			]]>
	</query>
	<query id="HeatTreatmentService.queryExpandFailNUM2" desc="查询工序废品数量">
		<![CDATA[
		SELECT NVL(SUM(T.FAIL_NUM),0) FAIL_NUM FROM HTT_QUENCHING_RESULT T
WHERE  T.HEAT_PLAN_NO=? 
			]]>
	</query>
	<query id="HeatTreatmentService.queryExpandFailNUM3" desc="查询工序废品数量">
		<![CDATA[
		SELECT NVL(SUM(T.FAIL_NUM),0) FAIL_NUM FROM HTT_LHEAT_RESULT T
WHERE  T.HEAT_PLAN_NO=? 
			]]>
	</query>
	<query id="HeatTreatmentService.AddComInfoResult1" desc="修改材料状态和工序编码">
		<![CDATA[
UPDATE PORT_HTT_BATCH_SAMPLE_RESULT T SET T.MAT_STATUS=?,T.OP_PROCESS=?
WHERE T.HEAT_PLAN_NO=? AND PROCESS_SEQ = (SELECT real_process_seq FROM pln_zy_rcl_m WHERE heat_plan_no = t.heat_plan_no) AND T.MAT_NO=?
			]]>
	</query>

	<query id="HeatTreatmentService.UpdateProcessSeq" desc="更新管号队列循环次数">
		<![CDATA[
UPDATE PORT_HTT_BATCH_SAMPLE_RESULT T SET PROCESS_SEQ=?
WHERE T.HEAT_PLAN_NO=? AND PROCESS_SEQ = (SELECT real_process_seq FROM pln_zy_rcl_m WHERE heat_plan_no = t.heat_plan_no) AND T.MAT_NO=?
			]]>
	</query>
	
	<query id="HeatTreatmentService.AddLHeatResult" desc="新增低温炉实绩">
        <![CDATA[
        INSERT INTO HTT_LHEAT_RESULT (RESULT_NO, ZY_BATCH_ID, PRO_PLAN_ID, 
GX_PLAN_NO, LHEAT_ENTER_TIME, LHEAT_OUT_TIME, LHEAT_EXIT_TEMP, LHEAT_TAKT_TIME, 
LHEAT_AVG_TEMP1, LHEAT_AVG_TEMP2, LHEAT_AVG_TEMP3, LHEAT_AVG_TEMP4, 
LHEAT_AVG_TEMP5, LHEAT_AVG_TEMP6, LHEAT_AVG_TEMP7, LHEAT_AVG_TEMP8, 
LHEAT_AVG_TEMP9, PRO_NUM, PRO_WT, FAIL_NUM, FAIL_WT, OFFLINE_NUM, OFFLINE_WT, 
RE_NUM, RE_WT, COL_MODE, COL_TIME, COL_USER, COL_SHIFT, COL_GROUP, PRODUCER, 
PRODUCER_TIME, PLINE_CODE, HEAT_PLAN_NO, PLINE_NAME, CREATE_TIME,PROCESS_SEQ,TOTAL_TIME,LOW_TEMP,COOLING_TYPE,HTT_TECHNOLOGY,HTT_TYPE) VALUES (?, ?,
 ?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), 
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, (SELECT SUM(DEF_FILL_WT) FROM HTT_WASTE_RESULT WHERE RESULT_NO = ? ), ?, ?, ?, ?, ?,
TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), ?, ?, ?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'), 
?, ?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),?,?,?,?,?,?)
        ]]>
	</query>
	<query id="HeatTreatmentService.AddQuechtResult" desc=" 新增淬火炉记录">
        <![CDATA[
        INSERT INTO HTT_QUENCHING_RESULT (RESULT_NO, HEAT_PLAN_NO, ZY_BATCH_ID, 
 PRO_PLAN_ID, GX_PLAN_NO, QUENCH_WAY, TRAFFIC, LENGTH_TIME, 
PASS_NUM, COL_TIME, COL_USER, COL_SHIFT, COL_GROUP, CREATE_TIME, PLINE_CODE, 
PLINE_NAME,PROCESS_SEQ,PRO_NUM, PRO_WT, FAIL_NUM, FAIL_WT) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
?, ?, ?, TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'), ?, ?,?,?, ?, ?, (SELECT SUM(DEF_FILL_WT) FROM HTT_WASTE_RESULT WHERE RESULT_NO = ? ))
            ]]>
	</query>
	<query id="HeatTreatmentService.updateHightResult" desc="修改高温炉实绩">
		<![CDATA[
		UPDATE HTT_HHEAT_RESULT T
   SET T.HHEAT_ENTER_TIME = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.HHEAT_OUT_TIME   = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.HHEAT_EXIT_TEMP  = ?,
       T.HHEAT_TAKT_TIME  = ?,
       T.HHEAT_AVG_TEMP1  = ?,
       T.HHEAT_AVG_TEMP2  = ?,
       T.HHEAT_AVG_TEMP3  = ?,
       T.HHEAT_AVG_TEMP4  = ?,
       T.HHEAT_AVG_TEMP5  = ?,
       T.HHEAT_AVG_TEMP6  = ?,
       T.PRO_NUM          = ?,
       T.PRO_WT           = ?,
       T.FAIL_NUM         = ?,
       T.FAIL_WT          = ?,
       T.OFFLINE_NUM      = ?,
       T.OFFLINE_WT       = ?,
       T.RE_NUM           = ?,
       T.RE_WT = ?,
       T.COL_TIME         = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.COL_SHIFT        = ?,
       T.COL_GROUP        = ?,
       T.PRODUCER         = ?,
       T.PRODUCER_TIME    = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.UPDATE_TIME      = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       T.UPDATE_NAME      = ?
 WHERE T.RESULT_NO = ?
			 
		]]>
	</query>
	<query id="HeatTreatmentService.updateLowResult" desc="修改低温炉实绩">
		<![CDATA[
			UPDATE HTT_LHEAT_RESULT
   SET LHEAT_ENTER_TIME = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       LHEAT_OUT_TIME   = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       LHEAT_EXIT_TEMP  = ?,
       LHEAT_TAKT_TIME  = ?,
       LHEAT_AVG_TEMP1  = ?,
       LHEAT_AVG_TEMP2  = ?,
       LHEAT_AVG_TEMP3  = ?,
       LHEAT_AVG_TEMP4  = ?,
       LHEAT_AVG_TEMP5  = ?,
       LHEAT_AVG_TEMP6  = ?,
       LHEAT_AVG_TEMP7  = ?,
       LHEAT_AVG_TEMP8  = ?,
       LHEAT_AVG_TEMP9  = ?,
       PRO_NUM          = ?,
       PRO_WT           = ?,
       FAIL_NUM         = ?,
       FAIL_WT          = ?,
       OFFLINE_NUM      = ?,
       OFFLINE_WT       = ?,
       RE_NUM           = ?,
       RE_WT            = ?,
       COL_TIME         = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       COL_SHIFT        = ?,
       COL_GROUP        = ?,
       PRODUCER         = ?,
       PRODUCER_TIME    = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       UPDATE_TIME      = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       UPDATE_NAME      = ?
 WHERE RESULT_NO = ?
		]]>
	</query>
	<query id="HeatTreatmentService.updateQuechtResult" desc="修改淬火炉实绩">
		<![CDATA[
		UPDATE HTT_QUENCHING_RESULT
   SET QUENCH_WAY  = ?,
       TRAFFIC     = ?,
       LENGTH_TIME = ?,
         PRO_NUM          = ?,
       PRO_WT           = ?,
       FAIL_NUM         = ?,
       FAIL_WT          = ?,
       COL_TIME    = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),    
       COL_SHIFT = ?,
       COL_GROUP = ?,    
       UPDATE_TIME = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       UPDATE_NAME = ?
 WHERE RESULT_NO = ?	
		]]>
	</query>
	<query id="HeatTreatmentService.queryHightMaxResultNo" desc="查询最大高温炉实绩编号">
		<![CDATA[
  SELECT ? ||
         LPAD(NVL(MAX(TO_NUMBER(SUBSTR(RESULT_NO, LENGTH(RESULT_NO) - 5))),
                  0) + 1,
              6,
              '0') RESULT_NO
    FROM HTT_HHEAT_RESULT
   WHERE RESULT_NO LIKE ? || '______'
			]]>
	</query>
	<query id="HeatTreatmentService.queryQuechtsMaxResultNo" desc="查询最大淬火炉实绩编号">
		<![CDATA[
  SELECT ? ||
         LPAD(NVL(MAX(TO_NUMBER(SUBSTR(RESULT_NO, LENGTH(RESULT_NO) - 5))),
                  0) + 1,
              6,
              '0') RESULT_NO
    FROM HTT_QUENCHING_RESULT
   WHERE RESULT_NO LIKE ? || '______'
			]]>
	</query>
	<query id="HeatTreatmentService.queryLowMaxResultNo" desc="查询最大冷矫实绩编号">
		<![CDATA[
	  SELECT ? ||
         LPAD(NVL(MAX(TO_NUMBER(SUBSTR(RESULT_NO, LENGTH(RESULT_NO) - 5))),
                  0) + 1,
              6,
              '0') RESULT_NO
    FROM HTT_LHEAT_RESULT
   WHERE RESULT_NO LIKE ? || '______'

			]]>
	</query>
	<query id="HeatTreatmentService.deleteHightResult" desc="删除高温炉实绩">
		<![CDATA[
		DELETE HTT_HHEAT_RESULT WHERE RESULT_NO = ?
			]]>
	</query>
	<query id="HeatTreatmentService.deleteLowResult" desc="删除低温炉记录">
		<![CDATA[
		DELETE HTT_LHEAT_RESULT WHERE RESULT_NO = ?
			]]>
	</query>
	<query id="HeatTreatmentService.deleteQuechtResult" desc="删除淬火记录">
		<![CDATA[
		DELETE HTT_QUENCHING_RESULT WHERE RESULT_NO = ?
			]]>
	</query>

	<query id="HeatTreatmentService.addHttControlLog" desc="增加调度日志">
		<![CDATA[
		INSERT INTO HTT_CONTROL_LOG
  (LOGS_BEG,
   LOGS_END,
   PLINE_CODE,
   PLINE_NAME,
   RESULT_NO,
   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,
   QUALIFIED_NUM,
   QUALIFIED_WT,
   SCRAP_NUM,
   SCRAP_WT,
   PRO_TYPE,
   USER_DATE,
   USER_NAME,
   USER_ID,
   CONFIRM_TIME,
   CONFIRM_NAME,
   CONFIRM_FLAG,
   BAL_YEAR_MONTH,
   PROC_DATE,
   MEMO,
   SPEC_CODE,
   SPEC_NAME,
   PROCESS_CODE_C,
   PROCESS_DESC_C,
   STATION)

  SELECT ?,
         ?,
         NVL(PLINE_CODE_W, PLINE_CODE),
         NVL(PLINE_NAME_W, PLINE_NAME),
         ?,
         '0',
         HEAT_PLAN_NO,
         ZY_BATCH_ID,
         JUDGE_STOVE_NO,
         '',
         '',
         ORDER_NO || '/' || ORDER_SEQ,
         CRAFT_FILE_NO,
         PRDCR_NO,
         PRODUCCODE,
         PRODUCNAME,
         GRADECODE,
         GRADENAME,
         STEELCODE,
         STEELNAME,
         MODEL_CODE,
         MODEL_DESC,
         STD_CODE,
         STD_NAME,
         STD_STYLE,
         STD_STYLE_DESC,
         OUTDIAMETER,
         WALLTHICK,
         '',
         LENGTHMIN,
         LENGTHMAX,
         ?,
         ?,
         ?,
         ?,
         '',
         '',
         '1',
         TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
         ?,
         '',
         '',
         '',
         '0',
         ?,
         ?,
         '',
         SPEC_CODE,
         SPEC_NAME,
         PROCESS_CODE_C,
         PROCESS_DESC_C,
         ?
    FROM PLN_ZY_RCL_M
   WHERE HEAT_PLAN_NO = ?

			]]>
	</query>

	<query id="HeatTreatmentService.deleteHttControlLog" desc="">
		<![CDATA[
		DELETE HTT_CONTROL_LOG WHERE RESULT_NO = ?
			]]>
	</query>

	<query id="HeatTreatmentService.UpdateHttControlLog1" desc="">
		<![CDATA[
UPDATE HTT_CONTROL_LOG
   SET LOGS_END = DECODE(LOGS_END,NULL, ?,LOGS_END)
 WHERE HEAT_PLAN_NO = ?
	   ]]>
	</query>


	<query id="HeatTreatmentService.UpdateHttControlLog2" desc="">
		<![CDATA[
UPDATE HTT_CONTROL_LOG
   SET  NODE_FLAG  = ?
 WHERE HEAT_PLAN_NO = ?
	   ]]>
	</query>

	<query id="HeatTreatmentService.GetStatus" desc="">
		<![CDATA[
SELECT (SELECT BASENAME
          FROM COM_BASE_INFO
         WHERE BASECODE = GET_SHIPPED_STATE(T.DESGIN_KEY, ?, 'B')) STATUS
  FROM CRAFT_ORD_DESIGN T, PLN_SALEORD E
 WHERE E.ORD_LN_PK = T.ORD_LN_PK
   AND E.ORD_LN_DLY_PK =?
   AND T.CRAFT_SEQ = ?
	   ]]>
	</query>
	
	<query id="HeatTreatmentService.UpdateHHeatResult" desc="修改高温炉实绩">
		<![CDATA[
UPDATE HTT_HHEAT_RESULT T
   SET T.HHEAT_EXIT_TEMP = '#HHEAT_EXIT_TEMP#',
       T.HHEAT_TAKT_TIME = '#HHEAT_TAKT_TIME#',
       T.TOTAL_TIME      = '#TOTAL_TIME#',
       T.COOLING_TYPE    = '#COOLING_TYPE#',
       T.HTT_TECHNOLOGY  = '#HTT_TECHNOLOGY#',
       T.HTT_TYPE        = '#HTT_TYPE#'
 WHERE T.RESULT_NO = '#RESULT_NO#'
	   ]]>
	</query>
	
	<query id="HeatTreatmentService.UpdateLHeatResult" desc="修改低温炉记录">
		<![CDATA[
UPDATE HTT_LHEAT_RESULT T
   SET T.LHEAT_EXIT_TEMP = '#LHEAT_EXIT_TEMP#',
       T.LHEAT_TAKT_TIME = '#LHEAT_TAKT_TIME#',
       T.TOTAL_TIME      = '#TOTAL_TIME#',
       T.LOW_TEMP        = '#LOW_TEMP#',
       T.COOLING_TYPE    = '#COOLING_TYPE#',
       T.HTT_TECHNOLOGY  = '#HTT_TECHNOLOGY#',
       T.HTT_TYPE        = '#HTT_TYPE#'
 WHERE T.RESULT_NO = '#RESULT_NO#'
	   ]]>
	</query>
	
	<query id="HeatTreatmentService.getHHeatEnterTimeOK"
		   desc="高温炉时间不重叠">
		<![CDATA[
          SELECT *
   FROM HTT_HHEAT_RESULT T
  WHERE (T.HHEAT_ENTER_TIME < TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS') AND
        T.HHEAT_OUT_TIME > TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'))
     OR (T.HHEAT_ENTER_TIME < TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS') AND
        T.HHEAT_OUT_TIME > TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'))
          ]]>
	</query>

</queryMap>