<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="同步检化验理化低倍数据到质量">
	<query id="SteerPhyDbToQcmLgPhyTask.getSteerPhyDb" desc="获取检化验理化低倍数据">
		<![CDATA[
SELECT *
  FROM STEER_PHYDB_AUDIT_RESULT T
 WHERE T.CX_FLAG = '0'
   AND ROWNUM <= 50
		]]>
	</query>
	
	<query id="SteerPhyDbToQcmLgPhyTask.DeleteQcmJhyLgPhy" desc="删除检化验理化低倍数据">
		<![CDATA[
DELETE FROM QCM_JHY_LG_PHYRESULT T
 WHERE T.SAMPLE_ID = '#SAMPLE_ID#'
   AND T.PHY_CODE = '#PHY_CODE#'
		]]>
	</query>
	
	<query id="SteerPhyDbToQcmLgPhyTask.insertQcmJhyLgPhy" desc="新增质量理化低倍表">
		<![CDATA[
INSERT INTO QCM_JHY_LG_PHYRESULT
  (SAMPLE_ID,
   SAMPLE_NO,
   INDEX_SEQ,
   LOT_NO,
   STOVE_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   SAMPLE_TYPE,
   CONSIGNER,
   PLINE_CODE,
   PHY_CODE_MAX,
   PHY_NAME_MAX,
   PHY_CODE_MIN,
   PHY_NAME_MIN,
   PHY_CODE,
   PHY_NAME,
   ITEM_CODE_F,
   ITEM_NAME_F,
   ITEM_CODE_W,
   ITEM_NAME_W,
   ITEM_CODE_S,
   ITEM_NAME_S,
   VALUE1,
   VALUE2,
   VALUE3,
   AVERAGE,
   CREATE_NAME,
   CREATE_TIME)
VALUES
  ('#SAMPLE_ID#',
   '#SAMPLE_NO#',
   (SELECT NVL(MAX(T.INDEX_SEQ), 0) + 1
      FROM QCM_JHY_LG_PHYRESULT T
     WHERE T.SAMPLE_ID = '#SAMPLE_ID#'
       AND T.SAMPLE_NO = '#SAMPLE_NO#'),
   '#LOT_NO#',
   '#STOVE_NO#',
   '#JUDGE_STOVE_NO#',
   '#BATCH_NO#',
   '#SAMPLE_TYPE#',
   '#CONSIGNER#',
   '#PLINE_CODE#',
   '#PHY_CODE_MAX#',
   '#PHY_NAME_MAX#',
   '#PHY_CODE_MIN#',
   '#PHY_NAME_MIN#',
   '#PHY_CODE#',
   '#PHY_NAME#',
   '#ITEM_CODE_F#',
   '#ITEM_NAME_F#',
   '#ITEM_CODE_W#',
   '#ITEM_NAME_W#',
   '#ITEM_CODE_S#',
   '#ITEM_NAME_S#',
   '#VALUE1#',
   '#VALUE2#',
   '#VALUE3#',
   '#AVERAGE#',
   '#CREATE_NAME#',
   SYSDATE)
		]]>
	</query>
	
	<query id="SteerPhyDbToQcmLgPhyTask.updateSteerPhyDb" desc="修改检化验理化低倍标志">
		<![CDATA[
UPDATE STEER_PHYDB_AUDIT_RESULT T
   SET T.CX_FLAG = '#CX_FLAG#'
 WHERE T.HEAT_NO = '#HEAT_NO#'
   AND T.CHANGE_HEAT_NO = '#CHANGE_HEAT_NO#'
   AND T.SAMPLE_NO = '#SAMPLE_NO#'
   AND T.PHY_CODE = '#PHY_CODE#'
		]]>
	</query>
</queryMap>