<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="申请复取样表">
	<query id="JdgCheckConsignNoQualified.insert" desc="新增申请复取样表">
        <![CDATA[
INSERT INTO PIPE_CHECKCONSIGN_NOQUALIFIED
  (PHYDETAIL_ID,
   CHECK_NO,
   SAMPLE_NO,
   PHY_CODE_MAX,
   PHY_NAME_MAX,
   PHY_CODE_MIN,
   PHY_NAME_MIN,
   PHY_CODE,
   PHY_NAME,
   JF_QUALIFIED,
   NK_QUALIFIED,
   LOT_NO,
   JUDGE_STOVE_NO,
   BATCH_NO,
   IS_SAMPLE,
   PLINE_CODE,
   CREATE_NAME,
   CREATE_TIME,
   IS_REPEAT,
   IS_ORIGINAL,
   SAMPLE_COUNT,
   ITEM_CODE_F,
   ITEM_NAME_F,
   ITEM_CODE_W,
   ITEM_NAME_W,
   ITEM_CODE_S,
   ITEM_NAME_S)
VALUES
  (SYS_GUID(),
   {0},
   {1},
   {2},
   {3},
   {4},
   {5},
   {6},
   {7},
   {8},
   {9},
   {10},
   {11},
   {12},
   {13},
   {14},
   {15},
   SYSDATE,
   {16},
   {17},
   {18},
   {19},
   {20},
   {21},
   {22},
   {23},
   {24})
        ]]>
    </query>
    
    <query id="JdgCheckConsignNoQualified.getCount" desc="获取申请复取样数">
        <![CDATA[
SELECT COUNT(1) COUNT
  FROM PIPE_CHECKCONSIGN_NOQUALIFIED T
 WHERE T.CHECK_NO = {0}
   AND T.JUDGE_STOVE_NO = {1}
   AND T.IS_SAMPLE IN {2}
        ]]>
    </query>
    
    <query id="JdgCheckConsignNoQualified.deleteCheckNoQualified" desc="删除申请复取样">
        <![CDATA[
DELETE FROM PIPE_CHECKCONSIGN_NOQUALIFIED T
    WHERE T.CHECK_NO = {0}
      AND T.JUDGE_STOVE_NO = {1}
      AND T.BATCH_NO = {2}
      AND T.IS_SAMPLE = '0'
        ]]>
    </query>
    
    <query id="JdgCheckConsignNoQualified.getResampleData" desc="获取复取样数据">
        <![CDATA[
SELECT T.JUDGE_STOVE_NO,
       T.BATCH_NO,
       T.PHY_CODE_MAX,
       DECODE(MIN(T.IS_ORIGINAL), '1', 'True', 'False') IS_ORIGINAL,
       MIN(T.SAMPLE_COUNT) SAMPLE_COUNT,
       T.PHY_CODE,
       T.PHY_NAME
  FROM PIPE_CHECKCONSIGN_NOQUALIFIED T
 WHERE T.CHECK_NO = {0}
 GROUP BY T.PHY_CODE_MAX, T.PHY_CODE, T.PHY_NAME, T.JUDGE_STOVE_NO, T.BATCH_NO
        ]]>
    </query>
</queryMap>