<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="质保书探伤表">
	<query id="JdgQcmZbsDetectResult.insert" desc="探伤">
		<![CDATA[
 INSERT INTO QCM_ZBS_DETECT_RESULT(
        ZBS_ID,
        ZBS_SEQ,
        PROCESS_CODE,
        GROUP_SEQ,
        PHY_CODE,
        PHY_NAME,
        POSITION_CODE,
        POSITION_DESC,
        STD_DESC,
        LV_CODE,
        GROOVE_POS,
        GROOVE_DIR,
        LV_DESC,
        COVERAGE,
        RATE,
        DESC_RATE,
        DESC_VAL,
        DIC)
 VALUES( 
        '#ZBS_ID#',
        (SELECT NVL(MAX(A.ZBS_SEQ), 0) + 1
      FROM QCM_ZBS_DETECT_RESULT A
     WHERE A.ZBS_ID = '#ZBS_ID#'),
        '#PROCESS_CODE#',
        '#GROUP_SEQ#',
        '#PHY_CODE#',
        '#PHY_NAME#',
        '#POSITION_CODE#',
        '#POSITION_DESC#',
        '#STD_DESC#',
        '#LV_CODE#',
        '#GROOVE_POS#',
        '#GROOVE_DIR#',
        '#LV_DESC#',
        '#COVERAGE#',
        '#RATE#',
        '#DESC_RATE#',
        '#DESC_VAL#',
        '#DIC#')
		]]>
	</query>
	
	<query id="JdgQcmZbsDetectResult.delete" desc="删除探伤">
		<![CDATA[
 DELETE FROM QCM_ZBS_DETECT_RESULT WHERE ZBS_ID = {0}
		]]>
	</query>
	
	<query id="JdgQcmZbsDetectResult.update" desc="修改">
		<![CDATA[
 UPDATE QCM_ZBS_DETECT_RESULT T
   SET 
        T.PROCESS_CODE = '#PROCESS_CODE#',
        T.GROUP_SEQ = '#GROUP_SEQ#',
        T.PHY_CODE = '#PHY_CODE#',
        T.PHY_NAME = '#PHY_NAME#',
        T.POSITION_CODE = '#POSITION_CODE#',
        T.POSITION_DESC = '#POSITION_DESC#',
        T.STD_DESC = '#STD_DESC#',
        T.LV_CODE = '#LV_CODE#',
        T.GROOVE_POS = '#GROOVE_POS#',
        T.GROOVE_DIR = '#GROOVE_DIR#',
        T.LV_DESC = '#LV_DESC#',
        T.COVERAGE = '#COVERAGE#',
        T.RATE = '#RATE#',
        T.DESC_RATE = '#DESC_RATE#',
        T.DESC_VAL = '#DESC_VAL#'
 WHERE
T.ZBS_ID = '#ZBS_ID#'
AND T.ZBS_SEQ = '#ZBS_SEQ#'
		]]>
	</query>
	
	<query id="JdgQcmZbsDetectResult.getByZbsId" desc="通过ZBS_ID查询">
		<![CDATA[
SELECT T.ZBS_ID,
       T.ZBS_SEQ,
       T.PROCESS_CODE,
       A.PROCESS_DESC,
       T.GROUP_SEQ,
       T.PHY_CODE,
       T.PHY_NAME,
       T.POSITION_CODE,
       T.POSITION_DESC,
       T.STD_DESC,
       T.LV_CODE,
       T.GROOVE_POS,
       T.GROOVE_DIR,
       T.LV_DESC,
       T.COVERAGE,
       T.RATE,
       T.DESC_RATE,
       T.DESC_VAL,
       'False' CHK
  FROM QCM_ZBS_DETECT_RESULT T
  LEFT JOIN COM_BASE_PROCESS A
    ON A.PROCESS_CODE = T.PROCESS_CODE
  WHERE T.ZBS_ID = {0}
 ORDER BY T.ZBS_SEQ
		]]>
	</query>
</queryMap>