<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="加工通径实绩">
	<query id="FrmRemanenceResult.getQueryExpandResult" desc="查通径实绩">
        <![CDATA[
    SELECT
       *
  FROM MCH_REMANENCE_RESULT T
 WHERE T.HEAT_PLAN_NO = ? AND BATCH_NO =?
        ]]>
	</query>


	<query id="FrmRemanenceResult.queryResultNo" desc="查询实绩最大实绩编号">
		<![CDATA[
		  SELECT ? || TO_CHAR(SYSDATE, 'yyyyMMDD') ||
         LPAD(NVL(MAX(TO_NUMBER(SUBSTR(RESULT_NO, LENGTH(RESULT_NO) - 5))),
                  0) + 1,
              6,
              '0') RESULT_NO
    FROM  MCH_REMANENCE_RESULT
   WHERE RESULT_NO LIKE ? || TO_CHAR(SYSDATE, 'yyyyMMDD') || '______'
			]]>
	</query>

	<query id="FrmRemanenceResult.AddResult" desc="增加实绩">
		<![CDATA[
 INSERT INTO MCH_REMANENCE_RESULT(
        RESULT_NO,
        HEAT_PLAN_NO,
        BATCH_NO,
        PLINE_CODE,
        PLINE_NAME,
        PRO_USER,
        PRO_NUM,
        PRO_WT,
        PRO_SHIFT,
        PRO_GROUP,
        PRO_TIME,
        JUDGE_STOVE_NO,
        MEMO,
        RESPONSIBLE,
        REPORT_PATH,
        TEST_RECORD,
        POINT_MAX,
        AVERAGE_MAX)
 VALUES(
        '#RESULT_NO#',
        '#HEAT_PLAN_NO#',
        '#BATCH_NO#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#PRO_USER#',
        '#PRO_NUM#',
        '#PRO_WT#',
        '#PRO_SHIFT#',
        '#PRO_GROUP#',
         TO_DATE('#PRO_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
        '#JUDGE_STOVE_NO#',
        '#MEMO#',
        '#RESPONSIBLE#',
        '#REPORT_PATH#',
        '#TEST_RECORD#',
        '#POINT_MAX#',
        '#AVERAGE_MAX#')
			]]>
	</query>



	<query id="FrmRemanenceResult.AddDetailResult" desc="增加实绩">
		<![CDATA[
INSERT INTO MCH_REMANENCE_RESULT_D
  (RESULT_NO,
   HEAT_PLAN_NO,
   PLINE_CODE,
   PLINE_NAME,
   BATCH_NO,
   JUDGE_STOVE_NO,
   SEQ,
     MEASUREMENT,
        MAT_NO,
        MEASUREMENT_VALUE_A0,
        MEASUREMENT_VALUE_A90,
        MEASUREMENT_VALUE_A180,
        MEASUREMENT_VALUE_A270,
        MEASUREMENT_VALUE_AAVG,
        MEASUREMENT_VALUE_B0,
        MEASUREMENT_VALUE_B90,
        MEASUREMENT_VALUE_B180,
        MEASUREMENT_VALUE_B270,
        MEASUREMENT_VALUE_BAVG)
VALUES
  ('#RESULT_NO#',
   '#HEAT_PLAN_NO#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#BATCH_NO#',
   '#JUDGE_STOVE_NO#',
   ?,
   TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?)

			]]>
	</query>


	<query id="FrmRemanenceResult.UpdateResult" desc="修改实绩">
		<![CDATA[
			 UPDATE MCH_REMANENCE_RESULT T
			   SET
					T.PRO_SHIFT = '#PRO_SHIFT#',
					T.PRO_GROUP = '#PRO_GROUP#',
					T.PRO_USER = '#PRO_USER#',
					T.PRO_TIME = TO_DATE('#PRO_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
					T.MEMO = '#MEMO#',
					T.POINT_MAX = '#POINT_MAX#',
					T.TEST_RECORD = '#TEST_RECORD#',
					T.AVERAGE_MAX = '#AVERAGE_MAX#'
			 WHERE
					T.RESULT_NO = '#RESULT_NO#'
			]]>
	</query>


	<query id="FrmRemanenceResult.DeleteResult" desc="删除实绩">
		<![CDATA[
DELETE FROM MCH_REMANENCE_RESULT WHERE RESULT_NO =?

			]]>
	</query>

	<query id="FrmRemanenceResult.DeleteDetailResult" desc="删除实绩">
		<![CDATA[
DELETE FROM MCH_REMANENCE_RESULT_D WHERE RESULT_NO =?

			]]>
	</query>

	<query id="FrmRemanenceResult.QueryDetail" desc="">
		<![CDATA[
SELECT * FROM MCH_REMANENCE_RESULT_D T WHERE 1=1
        ]]>
	</query>

	<query id="FrmRemanenceResult.UpdatePath" desc="更新报告路径">
		<![CDATA[
UPDATE MCH_REMANENCE_RESULT SET REPORT_PATH = ? WHERE RESULT_NO =?
			]]>
	</query>

</queryMap>