<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="理化标准">

	<query id="IMscPhyDao.getExaminePic" desc="查询已审批理化索引号">
         <![CDATA[
      SELECT P.PIC, P.MODEL_CODE
   FROM (SELECT T.PIC, NVL(T.MODEL_CODE, 'C001') MODEL_CODE
          FROM COM_MSC_STD_PIC T
         WHERE T.MSC = ?
           AND T.CODE_JG IS NULL
           AND T.VALIDFLAG = 3) P
 WHERE INSTR(P.MODEL_CODE, ?) > 0
    OR (P.MODEL_CODE = 'C001' AND NOT EXISTS
        (SELECT 1
           FROM (SELECT T.PIC, NVL(T.MODEL_CODE, 'C001') MODEL_CODE
                   FROM COM_MSC_STD_PIC T
                  WHERE T.MSC = ?
                    AND T.CODE_JG IS NULL
                    AND T.VALIDFLAG = 3) A
          WHERE INSTR(A.MODEL_CODE, ?) > 0))
 ORDER BY P.MODEL_CODE DESC
             ]]>
	</query>

	<query id="IMscPhyDao.getEValidPic" desc="查询有效理化索引号">
         <![CDATA[
      SELECT P.PIC, P.MODEL_CODE
   FROM (SELECT T.PIC, NVL(T.MODEL_CODE, 'C001') MODEL_CODE
          FROM COM_MSC_STD_PIC T
         WHERE T.MSC = ?
           AND T.CODE_JG IS NULL
           AND T.VALIDFLAG != 0) P
 WHERE INSTR(P.MODEL_CODE, ?) > 0
    OR (P.MODEL_CODE = 'C001' AND NOT EXISTS
        (SELECT 1
           FROM (SELECT T.PIC, NVL(T.MODEL_CODE, 'C001') MODEL_CODE
                   FROM COM_MSC_STD_PIC T
                  WHERE T.MSC = ?
                    AND T.CODE_JG IS NULL
                    AND T.VALIDFLAG != 0) A
          WHERE INSTR(A.MODEL_CODE, ?) > 0))
 ORDER BY P.MODEL_CODE DESC
             ]]>
	</query>

	<query id="IMscPhyDao.getPhyByPic" desc="查询交付理化标准">
         <![CDATA[
SELECT T.PIC,
       T.INDEX_SEQ,
       T.PHY_CODE_MAX,
       T.PHY_NAME_MAX,
       T.PHY_CODE_MIN,
       T.PHY_NAME_MIN,
       T.PHY_CODE,
       T.PHY_NAME,
       T.ITEM_CODE_F,
       T.ITEM_NAME_F,
       T.ITEM_CODE_W,
       T.ITEM_NAME_W,
       T.ITEM_CODE_S,
       T.ITEM_NAME_S,
       T.GROUP_SEQ,
       T.RESULT_COUNT,
       T.ISCHECK,
       T.ISJUDGE,
       T.ISQUOTE,
       T.PHY_TYPE,
       T.PHY_FORMULA,
       T.STDMIN_SIGN,
       T.STDMIN,
       T.STDMAX_SIGN,
       T.STDMAX,
       T.JUDGE_BASIS,
       T.DELIVERYSTATE,
       T.MODEL_CODE,
       T.MODEL_DESC,
       T.STDMEMO,
       T.SIZE_CODE2,
       T.SIZE_NAME2,
       T.SIZE_MIN_SIGN2,
       T.SIZE_MIN2,
       T.SIZE_MAX_SIGN2,
       T.SIZE_MAX2,
       T.SIZE_CODE,
       T.SIZE_NAME,
       T.SIZE_MIN_SIGN,
       T.SIZE_MIN,
       T.SIZE_MAX_SIGN,
       T.SIZE_MAX,
       T.SPEC_JG,
       T.SPEC_JG_DESC,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       T.VALIDFLAG,
       T.ADDCONDITION,
       T.ADDSTDCON_CODE,
       T.ADDSTD_MIN_SIGN,
       T.ADDSTD_MIN,
       T.ADDSTD_MAX_SIGN,
       T.ADDSTD_MAX,
       T.ADDPERCENT,
       T.STDMIN_SIGN2,
       T.STDMIN2,
       T.STDMAX_SIGN2,
       T.STDMAX2,
       T.STD_CHOOSE,
       T.GUID,
       T.BILLET_SAMPLE,
       T.FORMULA,
       T.MIN_F,
       T.MIN_F_SIGN,
       T.MAX_F,
       T.MAX_F_SIGN
  FROM COM_MSC_STD_PHY T
 WHERE T.PIC = ?
   AND T.VALIDFLAG = '1'
 ORDER BY T.PHY_CODE_MAX,
          T.PHY_CODE_MIN,
          T.PHY_CODE,
          T.ITEM_CODE_F,
          T.ITEM_CODE_S,
          T.ITEM_CODE_W
             ]]>
	</query>

	<query id="IMscPhyDao.savePhy" desc="保存质量设计理化标准">
         <![CDATA[
INSERT INTO SLM_ORD_DESIGN_STD_PIC
  (DESGIN_KEY,
   PIC,
   USE_CODE,
   USE_DESC,
   SPECL_FL,
   INDEX_SEQ,
   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,
   GROUP_SEQ,
   ISCHECK,
   ISQUOTE,
   RESULT_COUNT,
   ISJUDGE,
   PHY_TYPE,
   PHY_FORMULA,
   STDMIN_SIGN,
   STDMIN,
   STDMAX_SIGN,
   STDMAX,
   JUDGE_BASIS,
   DELIVERYSTATE,
   MODEL_CODE,
   MODEL_DESC,
   STDMEMO,
   SIZE_CODE,
   SIZE_NAME,
   SIZE_MIN_SIGN,
   SIZE_MIN,
   SIZE_MAX_SIGN,
   SIZE_MAX,
   SIZE_CODE2,
   SIZE_NAME2,
   SIZE_MIN_SIGN2,
   SIZE_MIN2,
   SIZE_MAX_SIGN2,
   SIZE_MAX2,
   SPEC_JG,
   SPEC_JG_DESC,
   ADDCONDITION,
   ADDSTDCON_CODE,
   ADDSTD_MIN_SIGN,
   ADDSTD_MIN,
   ADDSTD_MAX_SIGN,
   ADDSTD_MAX,
   ADDPERCENT,
   STDMIN_SIGN2,
   STDMIN2,
   STDMAX_SIGN2,
   STDMAX2,
   STD_CHOOSE,
   BILLET_SAMPLE,
   FORMULA,
   MIN_F,
   MIN_F_SIGN,
   MAX_F,
   MAX_F_SIGN)
VALUES
  ('#DESGIN_KEY#',
   '#PIC#',
   '#USE_CODE#',
   '#USE_DESC#',
   '#SPECL_FL#',
   '#INDEX_SEQ#',
   '#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#',
   '#GROUP_SEQ#',
   '#ISCHECK#',
   '#ISQUOTE#',
   '#RESULT_COUNT#',
   '#ISJUDGE#',
   '#PHY_TYPE#',
   '#PHY_FORMULA#',
   '#STDMIN_SIGN#',
   '#STDMIN#',
   '#STDMAX_SIGN#',
   '#STDMAX#',
   '#JUDGE_BASIS#',
   '#DELIVERYSTATE#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#STDMEMO#',
   '#SIZE_CODE#',
   '#SIZE_NAME#',
   '#SIZE_MIN_SIGN#',
   '#SIZE_MIN#',
   '#SIZE_MAX_SIGN#',
   '#SIZE_MAX#',
   '#SIZE_CODE2#',
   '#SIZE_NAME2#',
   '#SIZE_MIN_SIGN2#',
   '#SIZE_MIN2#',
   '#SIZE_MAX_SIGN2#',
   '#SIZE_MAX2#',
   '#SPEC_JG#',
   '#SPEC_JG_DESC#',
   '#ADDCONDITION#',
   '#ADDSTDCON_CODE#',
   '#ADDSTD_MIN_SIGN#',
   '#ADDSTD_MIN#',
   '#ADDSTD_MAX_SIGN#',
   '#ADDSTD_MAX#',
   '#ADDPERCENT#',
   '#STDMIN_SIGN2#',
   '#STDMIN2#',
   '#STDMAX_SIGN2#',
   '#STDMAX2#',
   '#STD_CHOOSE#',
   '#BILLET_SAMPLE#',
   '#FORMULA#',
   '#MIN_F#',
   '#MIN_F_SIGN#',
   '#MAX_F#',
   '#MAX_F_SIGN#')
             ]]>
	</query>


	<query id="IMscPhyDao.getPicSample" desc="查询质量设计取样要求">
         <![CDATA[
SELECT T1.PIC,
       T1.SIC,
       T1.PHY_CODE_MIN,
       T1.PHY_NAME_MIN,
       T2.STD_CODE,
       T2.STD_NAME,
       T2.RATE,
       T2.DESC_RATE,
       T2.DESC_COUNT,
       T2.POSITION,
       T2.DESC_POSITION,
       T2.MEMO,
       T2.MIN_D,
       T2.MAX_D,
       T2.MIN_H,
       T2.MAX_H,
       T2.MIN_D_SIGN,
       T2.MAX_D_SIGN,
       T2.MIN_H_SIGN,
       T2.MAX_H_SIGN,
       T2.SAMPLE_COUNT,
       T2.BATCH_CNT,
       T2.BATCH_UNIT,
       T1.SAMPLE_KEY,
       T1.SAMPLE_KEY_DESC,
       T1.ITEM_CODE_C,
       T1.ITEM_CODE_F,
       T1.ITEM_CODE_W,
       T1.STD_CODE_TEST,
       T1.STD_NAME_TEST
  FROM COM_MSC_PHY_SAMPLE T1, COM_BASE_SAMPLE T2
 WHERE T1.SIC = T2.SIC
   AND T1.PIC = {0}
   AND T1.PHY_CODE_MIN = {1}
   AND DECODE({2}, NULL, '1', T1.ITEM_CODE_F) = DECODE({2}, NULL, '1', {2})
   AND DECODE({2}, NULL, T1.ITEM_CODE_F, NULL) IS NULL
   AND DECODE({3}, NULL, '1', T1.ITEM_CODE_C) = DECODE({3}, NULL, '1', {3})
   AND DECODE({3}, NULL, T1.ITEM_CODE_C, NULL) IS NULL
   AND DECODE({4}, NULL, '1', T1.ITEM_CODE_W) = DECODE({4}, NULL, '1', {4})
   AND DECODE({4}, NULL, T1.ITEM_CODE_W, NULL) IS NULL
   AND T1.VALIDFLAG = 1
   AND T2.VALIDFLAG = 1
   AND (EXISTS (SELECT 1
                  FROM COM_BASE_SAMPLE_R_STD A
                 WHERE A.SIC = T2.SIC
                   AND A.VALIDFLAG = '1'
                   AND A.STD_CODE = {5}) OR NOT EXISTS
        (SELECT 1
           FROM COM_BASE_SAMPLE_R_STD A
          WHERE A.SIC = T2.SIC
            AND A.VALIDFLAG = '1'))
   AND (EXISTS (SELECT 1
                  FROM COM_BASE_SAMPLE_R_STEEL A
                 WHERE A.SIC = T2.SIC
                   AND A.VALIDFLAG = '1'
                   AND A.STEELCODE = {6}) OR NOT EXISTS
        (SELECT 1
           FROM COM_BASE_SAMPLE_R_STEEL A
          WHERE A.SIC = T2.SIC
            AND A.VALIDFLAG = '1'))
   AND (EXISTS (SELECT 1
                  FROM COM_BASE_SAMPLE_R_PRODUCT A
                 WHERE A.SIC = T2.SIC
                   AND A.PRODUCCODE = {7}) OR NOT EXISTS
        (SELECT 1 FROM COM_BASE_SAMPLE_R_PRODUCT A WHERE A.SIC = T2.SIC))
             ]]>
	</query>
	
	<query id="IMscPhyDao.getPicSpline" desc="查询质量设计试样要求">
         <![CDATA[
SELECT B.PHY_DIR,
       B.LENGTH,
       B.WIDTH,
       B.SAMPLE_STYLE,
       B.SIZE_DESC,
       C.MIN_D,
       C.MAX_D,
       C.MIN_H,
       C.MAX_H,
       C.MIN_D_SIGN,
       C.MIN_H_SIGN,
       C.MAX_D_SIGN,
       C.MAX_H_SIGN,
       C.FORMULA,
       C.MIN_F,
       C.MIN_F_SIGN,
       C.MAX_F,
       C.MAX_F_SIGN,
       A.EIC,
       A.SAMPLE_KEY,
       A.SAMPLE_KEY_DESC,
       A.ITEM_CODE_C,
       A.ITEM_CODE_F,
       A.ITEM_CODE_W,
       A.PIC,
       A.PHY_CODE_MIN
  FROM COM_MSC_PHY_SPLINE A,
       COM_BASE_SPLINE    B,
       COM_BASE_SPLINE_C  C,
       COM_MSC_PHY_SAMPLE F
 WHERE A.EIC = B.EIC
   AND A.PIC = '#PIC#'
   AND A.PHY_CODE_MIN = '#PHY_CODE_MIN#'
   AND DECODE('#ITEM_CODE_F#', NULL, '1', A.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_F#', NULL, A.ITEM_CODE_F, NULL) IS NULL
   AND DECODE('#ITEM_CODE_C#', NULL, '1', A.ITEM_CODE_C) =
       DECODE('#ITEM_CODE_C#', NULL, '1', '#ITEM_CODE_C#')
   AND DECODE('#ITEM_CODE_C#', NULL, A.ITEM_CODE_C, NULL) IS NULL
   AND DECODE('#ITEM_CODE_W#', NULL, '1', A.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_W#', NULL, A.ITEM_CODE_W, NULL) IS NULL
   AND A.VALIDFLAG = '1'
   AND B.VALIDFLAG = '1'
   AND F.PIC = A.PIC
   AND DECODE('#ITEM_CODE_F#', NULL, '1', F.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_F#', NULL, F.ITEM_CODE_F, NULL) IS NULL
   AND DECODE('#ITEM_CODE_C#', NULL, '1', F.ITEM_CODE_C) =
       DECODE('#ITEM_CODE_C#', NULL, '1', '#ITEM_CODE_C#')
   AND DECODE('#ITEM_CODE_C#', NULL, F.ITEM_CODE_C, NULL) IS NULL
   AND DECODE('#ITEM_CODE_W#', NULL, '1', F.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_W#', NULL, F.ITEM_CODE_W, NULL) IS NULL
   AND F.PHY_CODE_MIN = A.PHY_CODE_MIN
   AND C.EIC = B.EIC
   AND C.STD_CODE = '#STD_CODE#'
   AND C.VALIDFLAG = '1'
   AND EXISTS
 (SELECT 1
          FROM COM_BASE_SPLINE_R_STD E
         WHERE E.EIC = B.EIC
           AND E.STD_CODE = F.STD_CODE_TEST)
   AND (EXISTS (SELECT 1
                  FROM COM_BASE_SPLINE_C_R_PRODUCT D
                 WHERE D.TIC = C.TIC
                   AND D.VALIDFLAG = '1'
                   AND D.PRODUCCODE = '#PRODUCCODE#') OR NOT EXISTS
        (SELECT 1
           FROM COM_BASE_SPLINE_C_R_PRODUCT D
          WHERE D.TIC = C.TIC
            AND D.VALIDFLAG = '1'))
   AND (EXISTS (SELECT 1
                  FROM COM_BASE_SPLINE_C_R_STEEL E
                 WHERE E.TIC = C.TIC
                   AND E.VALIDFLAG = '1'
                   AND E.STEELCODE = '#STEELCODE#') OR NOT EXISTS
        (SELECT 1
           FROM COM_BASE_SPLINE_C_R_STEEL E
          WHERE E.TIC = C.TIC
            AND E.VALIDFLAG = '1'))
UNION ALL
SELECT B.PHY_DIR,
       B.LENGTH,
       B.WIDTH,
       B.SAMPLE_STYLE,
       B.SIZE_DESC,
       NULL              MIN_D,
       NULL              MAX_D,
       NULL              MIN_H,
       NULL              MAX_H,
       NULL              MIN_D_SIGN,
       NULL              MIN_H_SIGN,
       NULL              MAX_D_SIGN,
       NULL              MAX_H_SIGN,
       NULL FORMULA,
       NULL MIN_F,
       NULL MIN_F_SIGN,
       NULL MAX_F,
       NULL MAX_F_SIGN,
       A.EIC,
       A.SAMPLE_KEY,
       A.SAMPLE_KEY_DESC,
       A.ITEM_CODE_C,
       A.ITEM_CODE_F,
       A.ITEM_CODE_W,
       A.PIC,
       A.PHY_CODE_MIN
  FROM COM_MSC_PHY_SPLINE A, COM_BASE_SPLINE B, COM_MSC_PHY_SAMPLE F
 WHERE A.EIC = B.EIC
   AND A.PIC = '#PIC#'
   AND A.PHY_CODE_MIN = '#PHY_CODE_MIN#'
   AND DECODE('#ITEM_CODE_F#', NULL, '1', A.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_F#', NULL, A.ITEM_CODE_F, NULL) IS NULL
   AND DECODE('#ITEM_CODE_C#', NULL, '1', A.ITEM_CODE_C) =
       DECODE('#ITEM_CODE_C#', NULL, '1', '#ITEM_CODE_C#')
   AND DECODE('#ITEM_CODE_C#', NULL, A.ITEM_CODE_C, NULL) IS NULL
   AND DECODE('#ITEM_CODE_W#', NULL, '1', A.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_W#', NULL, A.ITEM_CODE_W, NULL) IS NULL
   AND A.VALIDFLAG = '1'
   AND B.VALIDFLAG = '1'
   AND F.PIC = A.PIC
   AND DECODE('#ITEM_CODE_F#', NULL, '1', F.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_F#', NULL, F.ITEM_CODE_F, NULL) IS NULL
   AND DECODE('#ITEM_CODE_C#', NULL, '1', F.ITEM_CODE_C) =
       DECODE('#ITEM_CODE_C#', NULL, '1', '#ITEM_CODE_C#')
   AND DECODE('#ITEM_CODE_C#', NULL, F.ITEM_CODE_C, NULL) IS NULL
   AND DECODE('#ITEM_CODE_W#', NULL, '1', F.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_W#', NULL, F.ITEM_CODE_W, NULL) IS NULL
   AND F.PHY_CODE_MIN = A.PHY_CODE_MIN
   AND NOT EXISTS (SELECT 1
          FROM COM_BASE_SPLINE_C C
         WHERE C.EIC = B.EIC
           AND C.VALIDFLAG = '1')
             ]]>
	</query>

	<query id="IMscPhyDao.savePicSample" desc="保存质量设计取样要求">
         <![CDATA[
       INSERT INTO SLM_ORD_DESIGN_STD_PIC_SMP(
        DESGIN_KEY,
        PIC,
        SIC,
        PHY_CODE_MIN,
        PHY_NAME_MIN,
        STD_CODE,
        STD_NAME,
        LENGTH,
        DESC_LENGTH,
        RATE,
        DESC_RATE,
        DESC_COUNT,
        POSITION,
        DESC_POSITION,
        SAMPLE_COUNT,
        MEMO,
        SAMPLE_STYLE,
        WIDTH,
        BATCH_CNT,
        BATCH_UNIT,
        EIC,
        PHY_DIR,
        SIZE_DESC,
        SAMPLE_KEY,
        SAMPLE_KEY_DESC,
        ITEM_CODE_F,
        ITEM_CODE_C,
        ITEM_CODE_W,
        STD_CODE_TEST,
        STD_NAME_TEST)
 VALUES( 
        '#DESGIN_KEY#',
        '#PIC#',
        '#SIC#',
        '#PHY_CODE_MIN#',
        '#PHY_NAME_MIN#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#LENGTH#',
        '#DESC_LENGTH#',
        '#RATE#',
        '#DESC_RATE#',
        '#DESC_COUNT#',
        '#POSITION#',
        '#DESC_POSITION#',
        '#SAMPLE_COUNT#',
        '#MEMO#',
        '#SAMPLE_STYLE#',
        '#WIDTH#',
        '#BATCH_CNT#',
        '#BATCH_UNIT#',
        '#EIC#',
        '#PHY_DIR#',
        '#SIZE_DESC#',
        '#SAMPLE_KEY#',
        '#SAMPLE_KEY_DESC#',
        '#ITEM_CODE_F#',
        '#ITEM_CODE_C#',
        '#ITEM_CODE_W#',
        '#STD_CODE_TEST#',
        '#STD_NAME_TEST#')
             ]]>
	</query>
	
	<query id="IMscPhyDao.savePicSpline" desc="保存质量设计取样要求">
         <![CDATA[
UPDATE SLM_ORD_DESIGN_STD_PIC_SMP T
   SET T.LENGTH       = '#LENGTH#',
       T.SAMPLE_STYLE = '#SAMPLE_STYLE#',
       T.WIDTH        = '#WIDTH#',
       T.EIC          = '#EIC#',
       T.PHY_DIR      = '#PHY_DIR#',
       T.SIZE_DESC    = '#SIZE_DESC#'
 WHERE T.DESGIN_KEY = '#DESGIN_KEY#'
   AND T.PIC = '#PIC#'
   AND T.PHY_CODE_MIN = '#PHY_CODE_MIN#'
   AND T.SAMPLE_KEY = '#SAMPLE_KEY#'
             ]]>
	</query>

	<query id="IMscPhyDao.updateDesignStd" desc="修改交付标准索引号">
         <![CDATA[
      UPDATE SLM_ORD_DESIGN_STD SET PIC = ? WHERE DESGIN_KEY = ?
             ]]>
	</query>

	<query id="IMscPhyDao.checkSmp" desc="验证取样要求">
         <![CDATA[
      SELECT T.PIC
  FROM SLM_ORD_DESIGN_STD_PIC_SMP T
 WHERE T.DESGIN_KEY = '#DESGIN_KEY#'
   AND T.PIC = '#PIC#'
   AND T.SIC = '#SIC#'
   AND T.PHY_CODE_MIN = '#PHY_CODE_MIN#'
   AND DECODE('#ITEM_CODE_F#', NULL, '1', T.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_F#', NULL, T.ITEM_CODE_F, NULL) IS NULL
   AND DECODE('#ITEM_CODE_C#', NULL, '1', T.ITEM_CODE_C) =
       DECODE('#ITEM_CODE_C#', NULL, '1', '#ITEM_CODE_C#')
   AND DECODE('#ITEM_CODE_C#', NULL, T.ITEM_CODE_C, NULL) IS NULL
   AND DECODE('#ITEM_CODE_W#', NULL, '1', T.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_W#', NULL, T.ITEM_CODE_W, NULL) IS NULL
             ]]>
	</query>

</queryMap> 