<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="统计采集点">
	<query id="PhysicalCollectionToJhyDbTask.getPipeCheckconsignPhyDetail" desc="获取未审核的委托明细信息">
		<![CDATA[
SELECT A.*,
       (SELECT MAX(FLAG)
          FROM PIPE_CHECKCONSIGN_DETAIL
         WHERE CHECK_NO = A.CHECK_NO
           AND SAMPLE_NO = A.SAMPLE_NO
           AND PHY_CODE_MAX = A.PHY_CODE_MAX) FLAG
  FROM PIPE_CHECKCONSIGN_PHYDETAIL A
 WHERE A.CHECK_NO = ?
   AND SAMPLE_NO = ?
		]]>
	</query>

	<query id="PhysicalCollectionToJhyDbTask.getPipeCheckconsignPhyRelation" desc="获取未审核的委托明细信息">
		<![CDATA[
SELECT *
  FROM PIPE_CHECKCONSIGN_PHYRELATION
 WHERE (PHY_CODE = ?
 OR (PHY_TYPE = ? AND   PHY_CODE='0000')
 OR (PHY_TYPE_C = ? AND PHY_TYPE='0000' AND  PHY_CODE ='0000'))
   AND VALUENAME = ?
   AND VALIDFLAG = '1'
		]]>
	</query>


	<query id="PhysicalCollectionToJhyDbTask.UpdateCheckConsignDetail" desc="修改检验委托明细信息">
		<![CDATA[
UPDATE PIPE_CHECKCONSIGN_DETAIL
   SET CHECK_TEMP = ?,
       (DEVICE_NO, DEVICE_NAME) =
       (SELECT D.DEVICE_ID, D.DEVICE_NAME || '(' || D.SPEC || ')'
  FROM BASE_CHECK_EQUIPMENT T
  LEFT JOIN RMDM_FIXEDASSETS_DETAIL D
    ON D.DEVICE_ID = T.DEVICE_ID
 WHERE EQUIPMENT_NAME = ?
   AND ROWNUM = 1),
       REMARK = ?,
       CHECK_CLASS = ?,
CHECK_SHIFT =?,
       CHECK_NAME = ?,
       CHECK_TIME = SYSDATE,
       SAMPLE_TYPE = ?,
       (FORMUAL_NO, FORMUAL_NAME) =
       (SELECT QUERY_ID,STD_ID FROM RMFM_STANDARDFILE_INFO WHERE STD_ID =? AND ROWNUM =1),
       FLAG = ?,
       ORIGINAL_AREA=?,
       HARDNESS_TYPE =?,
       SAMPLE_STYLE =?,
       PHY_DIR=?,
       STD_STEEL_VALUE=?,
       ACTUAL_VALUE =?,
       STD_STEEL_NO =?
 WHERE FLAG IN ('2', '3')
   AND PHY_CODE_MAX = ?
   AND SAMPLE_NO = ?
   AND CHECK_NO = ?
		]]>
	</query>


	<query id="PhysicalCollectionToJhyDbTask.UpdateCheckConsignPhyDetail" desc="修改检验委托过程结果">
		<![CDATA[
		    UPDATE PIPE_CHECKCONSIGN_PHYDETAIL
               SET VALUE1 = '#VALUE1#',
                   VALUE2 =  '#VALUE2#',
                   VALUE3 =  '#VALUE3#',
                   VALUE4 =  '#VALUE4#',
                   VALUE5 =  '#VALUE5#',
                   VALUE6 =  '#VALUE6#',
                   VALUE7 = '#VALUE7#',
                   VALUE8 = '#VALUE8#',
                   VALUE9 =  '#VALUE9#',
                   VALUE10 =  '#VALUE10#',
                   VALUE11 =  '#VALUE11#',
                   VALUE12 =  '#VALUE12#',
                   VALUE13 =  '#VALUE13#',
                   VALUE14 = '#VALUE14#',
                   VALUE15 =  '#VALUE15#',
                   AVERAGE_VALUE = '#AVERAGE_VALUE#',
                   REMARK= '#REMARK#',
                   PHY_CODE_DIR ='#PHY_CODE_DIR#',
                   PHY_NAME_DIR = '#PHY_NAME_DIR#'
             WHERE PHYDETAIL_ID = '#PHYDETAIL_ID#'
		]]>
	</query>

</queryMap>
