<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="产品技术特殊要求">
	
	<query id="CoreOrderSpecialInfo.UpdateAskAddStatus" desc="附加要求状态">
         <![CDATA[
             UPDATE SLM_ORDER_ADD_ASK SET ADD_ASK_STATUS=? WHERE ADD_ASK_NO=?
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAskItmeCount" desc="查询客户附加要求项目数量">
         <![CDATA[
             SELECT ADD_ASK_NO,count(ASK_ITME) FROM SLM_ORDER_ADD_ASK A WHERE A.CUSTOMER_NO = ? group by ADD_ASK_NO order by ADD_ASK_NO
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAskItmeOrder" desc="查询客户附加要求">
         <![CDATA[
             SELECT ADD_ASK_NO,ASK_ITME,ASK_SUB_ITME,ASK_SUB_ITME_VAL,ADD_ASK_STATUS  FROM SLM_ORDER_ADD_ASK  WHERE ADD_ASK_NO = ?
         ]]>
	</query>	
  
    <query id="CoreOrderSpecialInfo.queryAskItmeOrderMax" desc="附加要求">
         <![CDATA[
                 SELECT MAX(ADD_ASK_NO)  FROM SLM_ORDER_ADD_ASK  WHERE CUSTOMER_NO = ? AND PSC = ?
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryUnionAsk" desc="查询附加要求数据">
         <![CDATA[
SELECT T.ASK_SUB_ITME_DESC,
        T.ASK_SUB_ITME_VAL,
        T.ASK_SUB_ITME_VAL_DESC,
        T.PIC,
        T.STD_CODE,
        T.STD_NAME,
        T.ASK_ITME,
        T.ASK_ITME_DESC,
        T.ASK_SUB_ITME,
        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.MEMO,
        'S' ADD_ASK_STATUS,
        '标准项' ADD_ASK_TYPE
   FROM COM_BASE_ADDITIONAL T
  WHERE T.STD_CODE = '#STD_CODE#'
    AND T.VALIDFLAG = '1'
ORDER BY ASK_ITME_DESC, ASK_SUB_ITME_DESC
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryOtherStdAsk" desc="查询与特殊附加要求不一样的标准附加要求">
         <![CDATA[
SELECT T.ASK_SUB_ITME_DESC,
       T.ASK_SUB_ITME_VAL,
       T.ASK_SUB_ITME_VAL_DESC,
       T.PIC,
       T.STD_CODE,
       T.STD_NAME,
       T.ASK_ITME,
       T.ASK_ITME_DESC,
       T.ASK_SUB_ITME,
       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.MEMO,
       'S' ADD_ASK_STATUS,
       '标准项' ADD_ASK_TYPE,
       'True' IS_OTHER
  FROM COM_BASE_ADDITIONAL T
 WHERE T.STD_CODE = '#STD_CODE#'
   AND T.VALIDFLAG = '1'
   AND NOT EXISTS (SELECT 1
          FROM SLM_ORDER_ADD_ASK A
         WHERE A.ADD_ASK_NO = '#ADD_ASK_NO#'
           AND A.VALIDFLAG = '1'
           AND A.ASK_ITME = T.ASK_ITME
           AND A.ASK_SUB_ITME = T.ASK_SUB_ITME)
 ORDER BY ASK_ITME_DESC, ASK_SUB_ITME_DESC
         ]]>
	</query>

	<query id="CoreOrderSpecialInfo.queryUnionOrderAsk" desc="查询附加要求数据">
         <![CDATA[
		SELECT T.PSC,
       T.PSC_DESC,
       T.ADD_ASK_STATUS,
       T.VALIDFLAG,
       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.ADD_ASK_NO,
       T.ASK_ITME,
       T.ASK_ITME_DESC,
       T.ASK_SUB_ITME,
       T.ASK_SUB_ITME_DESC,
       T.ASK_SUB_ITME_VAL_DESC ASK_SUB_ITME_VAL1,
       T.ASK_SUB_ITME_VAL_DESC ASK_SUB_ITME_VAL_DESC1,
       T.ASK_ITME ASK_ITME_OLD,
       T. ASK_SUB_ITME ASK_SUB_ITME_OLD,
       DECODE(T.PIC, NULL, '', '存在附加要求文件') PIC1,
       T.CUSTOMER_NO,
       T.CUSTOMER_NM,
       DECODE(T.ADD_ASK_TYPE, '0', '标准项', '1', '修改项', '2', '新增项') ADD_ASK_TYPE
  FROM SLM_ORDER_ADD_ASK T
 WHERE T.ADD_ASK_NO = '#ADD_ASK_NO#'
   AND T.VALIDFLAG = '1'
   ORDER BY T.ASK_ITME_DESC, T.ASK_SUB_ITME_DESC
         ]]>
	</query>

    <query id="CoreOrderSpecialInfo.queryMsc" desc="查询冶金规范码">
         <![CDATA[
SELECT M.MSC || ',' || (SELECT T1.MSC
                          FROM COM_PSC_R_MSC T, COM_MSC T1
                         WHERE PSC = ?
                           AND T.MSC = T1.MSC
                           AND TRIM(MSC_SEQ) IS NULL
                           AND T1.VALIDFLAG != 'D') MSC,
       M.MSC_SEQ,
       M.MSC_DESC,
       M.USE_CODE,
       M.USE_DESC,
       PM.PSC,
       PM.CUST_ALPHA_NO,
       A.PRODUC_TYPE,
       B.MEMO
  FROM COM_MSC M
  LEFT JOIN COM_BASE_STD_ALPHA B
    ON B.ALPHA_CODE = M.USE_CODE,
 (SELECT MSC, PSC, CUST_ALPHA_NO FROM COM_PSC_R_MSC WHERE PSC = ?) PM
  LEFT JOIN COM_PSC A
    ON PM.PSC = A.PSC
 WHERE M.MSC = PM.MSC
   AND M.VALIDFLAG <> 'D'
   AND (M.USER_COUNT = -1 OR M.USER_COUNT > 0)
 ORDER BY M.MSC
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryPSCMSCModel" desc="查询MSC扣型">
         <![CDATA[
             SELECT MODEL_CODE
                             FROM COM_MSC_STD_PROCESS
                            WHERE MSC = ?
                              AND PSC = ? 
                              AND VALIDFLAG = '3'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryMscAlphaStdPro" desc="查询客户加工标准">
         <![CDATA[ 
				SELECT pm.station_code, pm.station_desc, pm.process_cdoe, pm.process_desc,
				       pm.process_cdoe_c, pm.process_desc_c, pm.value_text, pm.value_num,
				       pm.value_memo, pm.group_seq, ' ' model_code
				  FROM slm_cust_alpha_process pm
				 WHERE cust_alpha_no = ?
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryMscStdPro" desc="查询加工标准">
         <![CDATA[
             SELECT PM.STATION_CODE, PM.STATION_DESC, PM.PROCESS_CDOE,
			        PM.PROCESS_DESC, PM.PROCESS_CDOE_C, PM.PROCESS_DESC_C, PM.VALUE_TEXT,
			        PM.VALUE_NUM, PM.VALUE_MEMO, PM.GROUP_SEQ, PC.MODEL_CODE,
			       (SELECT MAX(VALUE_TEXT)
			          FROM SLM_CUST_ALPHA_PROCESS
			         WHERE CUST_ALPHA_NO = ?) ALPHA_VALUE_TEXT,
			       (SELECT MAX(VALUE_NUM)
			          FROM SLM_CUST_ALPHA_PROCESS
			         WHERE CUST_ALPHA_NO = ?) ALPHA_VALUE_NUM,
			       (SELECT MAX(VALUE_MEMO)
			          FROM SLM_CUST_ALPHA_PROCESS
			         WHERE CUST_ALPHA_NO = ?) ALPHA_VALUE_MEMO,
                   (SELECT MAX(CUST_ALPHA_NO)
                      FROM SLM_CUST_ALPHA_PROCESS
                     WHERE CUST_ALPHA_NO = ?) CUST_ALPHA_NO,
                     (SELECT MAX(GIC)
                      FROM SLM_CUST_ALPHA_PROCESS
                     WHERE CUST_ALPHA_NO = ?) GIC,
                     (SELECT MAX(XH)
                      FROM SLM_CUST_ALPHA_PROCESS
                     WHERE CUST_ALPHA_NO = ?) XH 
			  FROM COM_MSC_STD_PROCESS_C PM
			       JOIN
			       (SELECT GIC, PSC, MSC, STDSTYLE, PROCESS_CDOE, PROCESS_DESC,
			               STD_CODE_NK, STD_NAME_NK, MODEL_CODE, MODEL_DESC, PRODUC_HEAD,
			               CODE_JG
			          FROM COM_MSC_STD_PROCESS
			         WHERE MSC = ? AND PSC = ? AND MODEL_CODE = ? AND VALIDFLAG = '3') PC
			       ON PM.GIC = PC.GIC
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAlpha" desc="查询客户Alpha">
         <![CDATA[
SELECT U.CUST_ALPHA_NO,
       U.CHEM_ALPHA_NO,
       A.CUST_ALPHA_STS
  FROM SLM_CUST_ALPHA_USE U, SLM_CUST_ALPHA A
 WHERE U.CHEM_ALPHA_NO = ?
   AND DECODE(?, NULL, '1', U.CUST_ALPHA_NO) = DECODE(?, NULL, '1', ?)
   AND A.CUST_ALPHA_NO = U.CUST_ALPHA_NO
   AND DECODE(?, NULL, '1', A.CUST_ALPHA_STS) <> DECODE(?, NULL, '2', ?)
   AND A.VALIDFLAG = '1'
         ]]>
	</query>
	<query id="CoreOrderSpecialInfo.queryStationCode" desc="查询加工标准工序点">
         <![CDATA[
             SELECT station_code, station_desc, station_type, station_id, process_code,
			        process_desc, process_code_c, process_desc_c, COST, choose,
			        return_result, send_checkplan, monitor_lv, monitor_lv2, create_name,
			        create_time, update_name, update_time, delete_name, delete_time,
			        validflag, memo
			  FROM com_base_station
			 WHERE station_type = '403208' AND process_code = 'G'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryStationCodeId" desc="查询加工标准工序点">
         <![CDATA[
             SELECT station_code, station_desc, station_type, station_id, process_code,
			        process_desc, process_code_c, process_desc_c, COST, choose,
			        return_result, send_checkplan, monitor_lv, monitor_lv2, create_name,
			        create_time, update_name, update_time, delete_name, delete_time,
			        validflag, memo
			  FROM com_base_station
			 WHERE station_type = '403208' AND process_code = 'G' AND station_desc = ?
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAskAddCode" desc="查询客户附加要求">
         <![CDATA[
SELECT A.ADD_ASK_NO, ADD_ASK_NO || '+' || MAX(A.CUSTOMER_NM) CUSTOMER_NM
  FROM SLM_ORDER_ADD_ASK A
 WHERE A.CUSTOMER_NO = ?
 AND DECODE(?, NULL, '1', A.ADD_ASK_NO) = DECODE(?, NULL, '1', ?)
 AND A.VALIDFLAG = '1'
 GROUP BY A.ADD_ASK_NO
 ORDER BY A.ADD_ASK_NO
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryBaseAskAddCode" desc="查询二大规范附加要求">
         <![CDATA[
SELECT T.STD_CODE, T.STD_NAME
  FROM COM_PSC T
 WHERE T.STD_CODE = ?
 AND T.VALIDFLAG = '1'
 GROUP BY T.STD_CODE, T.STD_NAME
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAlphaState" desc="查询客户Alpha状态">
         <![CDATA[
             SELECT A.CUST_ALPHA_STS FROM SLM_CUST_ALPHA A WHERE A.CUST_ALPHA_NO = ?
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryCICALL" desc="根据PSC查询所有成分标准">
         <![CDATA[  
			SELECT   p.msc, NVL (p.cic, q.cic) cic,
			         NVL (p.index_seq, q.index_seq) index_seq,
			         NVL (p.chem_code, q.chem_code) AS chem_code,
			         NVL (p.chem_name, q.chem_name) AS chem_name,
			         NVL (p.chem_type, q.chem_type) AS chem_tpype,
			         NVL (p.chem_formula, q.chem_formula) AS chem_formula, p.ischeck,
			         p.isjudge, p.isquote, p.complex_type, p.stdmin_sign, p.stdmin,
			         p.stdmax_sign, p.stdmax, p.stdtarget, p.model_code, p.model_desc,
			         p.stdmemo, p.ele_code, p.ele_name, p.ele_min_sign, p.ele_min,
			         p.ele_max_sign, p.ele_max, p.size_code2, p.size_name2,
			         p.size_min_sign2, p.size_min2, p.size_max_sign2, p.size_max2,
			         p.size_code, p.size_name, p.size_min_sign, p.size_min,
			         p.size_max_sign, p.size_max, p.spec_jg, p.spec_jg_desc, p.rep_code,
			         p.rep_name, p.rep_min_sign, p.rep_min, p.rep_max_sign, p.rep_max,
			         p.rep_val, q.stdmin_sign AS stdmin_sign1, q.stdmin AS stdmin1,
			         q.stdmax_sign AS stdmax_sign1, q.stdmax AS stdmax1
			    FROM (SELECT a.cic, a.index_seq, a.chem_code, a.chem_name, a.chem_type,
			                 a.chem_formula, a.ischeck, a.isjudge, a.isquote,
			                 a.complex_type, a.stdmin_sign, a.stdmin, a.stdmax_sign,
			                 a.stdmax, a.stdtarget, a.model_code, a.model_desc, a.stdmemo,
			                 a.ele_code, a.ele_name, a.ele_min_sign, a.ele_min,
			                 a.ele_max_sign, a.ele_max, a.size_code2, a.size_name2,
			                 a.size_min_sign2, a.size_min2, a.size_max_sign2, a.size_max2,
			                 a.size_code, size_name, a.size_min_sign, a.size_min,
			                 a.size_max_sign, a.size_max, a.spec_jg, a.spec_jg_desc,
			                 a.rep_code, a.rep_name, a.rep_min_sign, a.rep_min,
			                 a.rep_max_sign, a.rep_max, a.rep_val, b.msc
			            FROM com_msc_std_chem a JOIN com_msc_std_cic b ON a.cic = b.cic
			           WHERE b.psc = ? AND a.validflag = 1) p
			         FULL JOIN
			         (SELECT a.cust_alpha_no, a.cic, a.index_seq, a.chem_code,
			                 a.chem_name, a.chem_type, a.chem_formula, a.stdmin_sign,
			                 a.stdmin, a.stdmax_sign, a.stdmax
			            FROM slm_cust_alpha_chem a
			           WHERE a.cust_alpha_no = ? AND a.validflag = 1) q ON p.chem_code = q.chem_code
			ORDER BY TO_NUMBER (SUBSTR (chem_code, 2, 3))
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryPICALL" desc="根据PSC查询所有材质标准">
         <![CDATA[ 
			SELECT p.msc, NVL (p.pic, q.pic) pic, NVL (p.index_seq,
			                                           q.index_seq) index_seq,
			       NVL (p.phy_code_max, q.phy_code_max) phy_code_max,
			       NVL (p.phy_name_max, q.phy_name_max) phy_name_max,
			       NVL (p.phy_code_min, q.phy_code_min) phy_code_min,
			       NVL (p.phy_name_min, q.phy_name_min) phy_name_min,
			       NVL (p.phy_code, q.phy_code) phy_code,
			       NVL (p.phy_name, q.phy_name) phy_name,
			       NVL (p.item_code_f, q.item_code_f) item_code_f,
			       NVL (p.item_name_f, q.item_name_f) item_name_f,
			       NVL (p.item_code_w, q.item_code_w) item_code_w,
			       NVL (p.item_name_w, q.item_name_w) item_name_w,
			       NVL (p.item_code_s, q.item_code_s) item_code_s,
			       NVL (p.item_name_s, q.item_name_s) item_name_s, p.group_seq,
			       p.result_count, p.ischeck, p.isjudge, p.isquote, p.phy_type,
			       p.phy_formula, p.stdmin_sign, p.stdmin, p.stdmax_sign, p.stdmax,
			       p.judge_basis, p.deliverystate, p.model_code, p.model_desc, p.stdmemo,
			       p.size_code2, p.size_name2, p.size_min_sign2, p.size_min2,
			       p.size_max_sign2, p.size_max2, p.size_code, p.size_name,
			       p.size_min_sign, p.size_min, p.size_max_sign, p.size_max, p.spec_jg,
			       p.spec_jg_desc, p.addcondition, p.addstdcon_code, p.addstd_min_sign,
			       p.addstd_min, p.addstd_max_sign, p.addstd_max, p.addpercent,
			       q.stdmin_sign AS stdmin_sign1, q.stdmin AS stdmin1,
			       q.stdmax_sign AS stdmax_sign1, q.stdmax AS stdmax1
			  FROM (SELECT a.pic, a.index_seq, a.phy_code_max, a.phy_name_max,
			               a.phy_code_min, a.phy_name_min, a.phy_code, a.phy_name,
			               ( A.ITEM_CODE_F || ',' ||  A.ITEM_CODE_W  || ',' || A.ITEM_CODE_S) item_code_f,
			                a.item_name_f, 
			                ( A.ITEM_CODE_F || ',' ||  A.ITEM_CODE_W  || ',' || A.ITEM_CODE_S)  item_code_w, 
			                a.item_name_w,
			               ( A.ITEM_CODE_F || ',' ||  A.ITEM_CODE_W  || ',' || A.ITEM_CODE_S)  item_code_s, 
			               a.item_name_s, a.group_seq, a.result_count,
			               a.ischeck, a.isjudge, a.isquote, a.phy_type, a.phy_formula,
			               a.stdmin_sign, a.stdmin, a.stdmax_sign, a.stdmax,
			               a.judge_basis, a.deliverystate, a.model_code, a.model_desc,
			               a.stdmemo, a.size_code2, a.size_name2, a.size_min_sign2,
			               a.size_min2, a.size_max_sign2, a.size_max2, a.size_code,
			               a.size_name, a.size_min_sign, a.size_min, a.size_max_sign,
			               a.size_max, a.spec_jg, a.spec_jg_desc, a.addcondition,
			               a.addstdcon_code, a.addstd_min_sign, a.addstd_min,
			               a.addstd_max_sign, a.addstd_max, a.addpercent, b.msc
			          FROM com_msc_std_phy a JOIN com_msc_std_pic b ON a.pic = b.pic
			         WHERE b.psc = ? AND a.validflag = 1) p
			       FULL JOIN
			       (SELECT cust_alpha_no, pic, index_seq, phy_code_max, phy_name_max,
			               phy_code_min, phy_name_min, phy_code, phy_name, 
			               ( A.ITEM_CODE_F || ',' ||  A.ITEM_CODE_W  || ',' || A.ITEM_CODE_S)  item_code_f,
			               item_name_f,
			                ( A.ITEM_CODE_F || ',' ||  A.ITEM_CODE_W  || ',' || A.ITEM_CODE_S)  item_code_w,
			                 item_name_w, 
			                 ( A.ITEM_CODE_F || ',' ||  A.ITEM_CODE_W  || ',' || A.ITEM_CODE_S)  item_code_s,
			               item_name_s, stdmin_sign, stdmin, stdmax_sign, stdmax
			          FROM slm_cust_alpha_phy a
			         WHERE a.cust_alpha_no = '' AND a.validflag = 1) q
			       ON p.phy_code_max = q.phy_code_max
			     AND p.phy_code_min = q.phy_code_min
			     AND p.phy_code = q.phy_code
			     AND p.item_code_f = q.item_code_f
			     AND p.item_code_w = q.item_code_w
			     AND p.item_code_s = q.item_code_s
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.querySICALL" desc="根据PSC查询所有公差标准">
         <![CDATA[ 
			SELECT p.msc, NVL (p.sic, q.sic) sic, NVL (p.index_seq,
			                                           q.index_seq) index_seq,
			       NVL (p.bias_code, q.bias_code) bias_code,
			       NVL (p.bias_name, q.bias_name) bias_name, p.lv, p.bias_code_z,
			       p.bias_name_z, p.zmin_sign, p.zmin, p.zmax_sign, p.zmax, p.bias_code_c,
			       p.bias_name_c, p.cmin_sign, p.cmin, p.cmax_sign, p.cmax, p.bias_code_s,
			       p.bias_name_s, p.smin_sign, p.smin, p.smax_sign, p.smax, p.ischeck,
			       p.std_min_val, p.std_max_val, p.std_min_in, p.std_max_in,
			       p.std_min_percent, p.std_max_percent, p.std_min_formula,
			       p.std_max_formula,
			       DECODE (p.std_min_formula_v,
			               '1', 'true',
			               'false'
			              ) AS std_min_formula_v,
			       DECODE (p.std_max_formula_v,
			               '1', 'true',
			               'false'
			              ) AS std_max_formula_v, p.stdmemo,
			       q.std_min_val AS std_min_val1, q.std_max_val AS std_max_val1,
			       q.std_min_percent AS std_min_percent1,
			       q.std_max_percent AS std_max_percent1,
			       DECODE (q.std_min_formula_v,
			               '1', 'true',
			               'false'
			              ) AS std_min_formula_v1,
			       DECODE (q.std_max_formula_v,
			               '1', 'true',
			               'false'
			              ) AS std_max_formula_v1
			  FROM (SELECT a.sic, a.index_seq, a.bias_code, a.bias_name, a.lv,
			               a.bias_code_z, a.bias_name_z, a.zmin_sign, a.zmin, a.zmax_sign,
			               a.zmax, a.bias_code_c, a.bias_name_c, a.cmin_sign, a.cmin,
			               a.cmax_sign, a.cmax, a.bias_code_s, a.bias_name_s, a.smin_sign,
			               a.smin, a.smax_sign, a.smax, a.ischeck, a.std_min_val,
			               a.std_max_val, a.std_min_in, a.std_max_in, a.std_min_percent,
			               a.std_max_percent, a.std_min_formula, a.std_max_formula,
			               a.std_min_formula_v, a.std_max_formula_v, a.stdmemo, b.msc
			          FROM com_msc_std_spec_c a JOIN com_msc_std_spec b ON a.sic = b.sic
			         WHERE b.psc = ? AND a.validflag = 1) p
			       FULL JOIN
			       (SELECT a.cust_alpha_no, a.sic, a.index_seq, a.bias_code, a.bias_name,
			               a.std_min_val, a.std_max_val, a.std_min_percent,
			               a.std_max_percent, a.std_min_formula_v, a.std_max_formula_v
			          FROM slm_cust_alpha_spec a
			         WHERE a.cust_alpha_no = ? AND a.validflag = 1) q
			       ON p.bias_code = q.bias_code
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryDICALL" desc="根据PSC查询所有探伤标准">
         <![CDATA[
            select p.msc,nvl(p.xh, q.xh) as xh,
			       nvl(p.dic, q.dic) as dic,
			       nvl(p.phy_code, q.phy_code) as phy_code,
			       nvl(p.phy_name, q.phy_name) as phy_name,
			       p.position_code,
			       p.position_desc,
			       p.std_desc,
			       p.lv_code,
			       p.groove_pos,
			       p.groove_dir,
			       p.lv_desc,
			       p.coverage,
			       p.memo,
			       p.rate,
			       p.desc_rate,
			       p.desc_val,
			       p.group_seq,
			       q.position_code as position_code1,
			       q.position_desc as position_desc1,
			       q.std_desc as std_desc1,
			       q.lv_code as lv_code1,
			       q.lv_desc as lv_desc1,
			       q.coverage as coverage1 　
			  from (select a.dic,
			               a.xh,
			               a.phy_code,
			               a.phy_name,
			               a.position_code,
			               a.position_desc,
			               a.std_desc,
			               a.lv_code,
			               a.groove_pos,
			               a.groove_dir,
			               a.lv_desc,
			               a.coverage,
			               a.memo,
			               a.rate,
			               a.desc_rate,
			               a.desc_val,
			               a.group_seq,
                           b.msc
			          from com_msc_std_detection_c a
			          join com_msc_std_detection b
			            on a.dic = b.dic
			         where b.psc = ?
			           and a.validflag = 1) p
			  full join (select a.cust_alpha_no,
			                    a.dic,
			                    a.xh,
			                    a.phy_code,
			                    a.phy_name,
			                    a.position_code,
			                    a.position_desc,
			                    a.std_desc,
			                    a.lv_code,
			                    a.lv_desc,
			                    a.coverage
			               from slm_cust_alpha_detection a
			              where a.cust_alpha_no = ?
			                and a.validflag = 1) q
			    on p.phy_code = q.phy_code
         ]]>
	</query>

	<query id="CoreOrderSpecialInfo.queryWICALL" desc="根据PSC查询所有水压标准">
         <![CDATA[ 
			SELECT NVL (p.wic, q.wic) wic, NVL (p.xh, q.xh) index_seq, p.pressure_y,
			       p.pressure, p.formula, p.save_time, p.memo, p.get_maxvalue,
			       p.get_minvalue, q.pressure_y AS pressure_y1, q.pressure AS pressure1,
			       q.save_time AS save_time1
			  FROM (SELECT a.wic, a.xh, a.pressure_y, a.pressure, a.formula, a.save_time,
			               a.memo, a.get_maxvalue, a.get_minvalue
			          FROM com_msc_std_water_c a JOIN com_msc_std_water b ON a.wic = b.wic
			         WHERE b.psc = ? AND a.validflag = 1) p
			       FULL JOIN
			       (SELECT cust_alpha_no, wic, index_seq xh, pressure_y, pressure, save_time
			          FROM slm_cust_alpha_water a
			         WHERE a.cust_alpha_no = ? AND a.validflag = 1) q ON p.xh = q.xh 
         ]]>
	</query>

	<query id="CoreOrderSpecialInfo.queryPROALL" desc="根据PSC查询所有加工标准">
         <![CDATA[
            SELECT pm.station_code, pm.station_desc, pm.process_cdoe, pm.process_desc,
			       pm.process_cdoe_c, pm.process_desc_c, pm.value_text, pm.value_num,
			       pm.value_memo, pm.group_seq, pc.model_code,
			       (SELECT value_text
			          FROM slm_cust_alpha_process
			         WHERE cust_alpha_no = ?) alpha_value_text,
			       (SELECT value_num
			          FROM slm_cust_alpha_process
			         WHERE cust_alpha_no = ?) alpha_value_num,
			       (SELECT value_memo
			          FROM slm_cust_alpha_process
			         WHERE cust_alpha_no = ?) alpha_value_memo,
			       (SELECT cust_alpha_no
			          FROM slm_cust_alpha_process
			         WHERE cust_alpha_no = ?) cust_alpha_no,
			       (SELECT gic
			          FROM slm_cust_alpha_process
			         WHERE cust_alpha_no = ?) gic, (SELECT xh
			                                          FROM slm_cust_alpha_process
			                                         WHERE cust_alpha_no = ?) xh
			  FROM com_msc_std_process_c pm
			       JOIN
			       (SELECT gic, psc, msc, stdstyle, process_cdoe, process_desc,
			               std_code_nk, std_name_nk, model_code, model_desc, produc_head,
			               code_jg
			          FROM com_msc_std_process
			         WHERE psc = ? AND validflag = '3') pc ON pm.gic = pc.gic
         ]]>
	</query>
 
	<query id="CoreOrderSpecialInfo.queryCic4" desc="查询质量成分标准">
         <![CDATA[
        SELECT A.CIC,
               A.INDEX_SEQ,
               A.CHEM_CODE,
               A.CHEM_NAME,
               A.CHEM_TYPE,
               A.CHEM_FORMULA,
               DECODE(A.ISCHECK, '1', 'True', 'False') ISCHECK,
               DECODE(A.ISJUDGE, '1', 'True', 'False') ISJUDGE,
               DECODE(A.ISQUOTE, '1', 'True', 'False') ISQUOTE,
               DECODE(A.COMPLEX_TYPE, '1', 'True', 'False') COMPLEX_TYPE,
               A.STDMIN_SIGN,
               A.STDMIN,
               A.STDMAX_SIGN,
               A.STDMAX,
               A.STDTARGET,
               A.MODEL_CODE,
               A.MODEL_DESC,
               A.STDMEMO,
               A.ELE_CODE,
               A.ELE_NAME,
               A.ELE_MIN_SIGN,
               A.ELE_MIN,
               A.ELE_MAX_SIGN,
               A.ELE_MAX,
               A.SIZE_CODE2,
               A.SIZE_NAME2,
               A.SIZE_MIN_SIGN2,
               A.SIZE_MIN2,
               A.SIZE_MAX_SIGN2,
               A.SIZE_MAX2,
               A.SIZE_CODE,
               A.SIZE_NAME,
               A.SIZE_MIN_SIGN,
               A.SIZE_MIN,
               A.SIZE_MAX_SIGN,
               A.SIZE_MAX,
               A.SPEC_JG,
               A.SPEC_JG_DESC,
               A.REP_CODE,
               A.REP_NAME,
               A.REP_MIN_SIGN,
               A.REP_MIN,
               A.REP_MAX_SIGN,
               A.REP_MAX,
               A.REP_VAL,
               '' STDMIN_SIGN1,
               '' STDMIN1,
               '' STDMAX_SIGN1,
               '' STDMAX1,
               '' STDMEMO1,
               A.VALIDFLAG
          FROM COM_MSC_STD_CHEM A
         WHERE A.CIC = '#CIC#'
         AND A.VALIDFLAG <> '0'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryCic1" desc="查询质量成分标准">
         <![CDATA[
SELECT T.CIC VALUE
  FROM COM_MSC_STD_CHEM T, COM_MSC_STD_CIC A
 WHERE A.MSC = '#MSC#'
   AND T.CIC = A.CIC
   AND T.VALIDFLAG <> 0
   AND A.VALIDFLAG <> 0
   AND (INSTR(A.MODEL_CODE, '#MODEL_CODE#') > 0 OR
       INSTR(A.MODEL_CODE, '#MODEL_CODE#') IS NULL OR
       INSTR(A.MODEL_CODE, 'C001') > 0)
   AND REGEXP_LIKE(NVL(T.SIZE_MIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND DECODE('#SPEC_JG#', NULL, '1', T.SPEC_JG) =
       DECODE('#SPEC_JG#', NULL, '1', '#SPEC_JG#')
   AND ('#DIMATER#' IS NULL OR
       (T.SIZE_NAME NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) =
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.SIZE_NAME2 NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN2 = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) =
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN2 = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN2 = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
ORDER BY T.CIC
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryCic2" desc="查询质量成分标准">
         <![CDATA[
SELECT T.CIC VALUE
  FROM COM_MSC_STD_CHEM T, COM_MSC_STD_CIC A
 WHERE A.MSC = '#MSC#'
   AND T.CIC = A.CIC
   AND T.VALIDFLAG <> 0
   AND A.VALIDFLAG <> 0
   AND (INSTR(T.MODEL_CODE, '#MODEL_CODE#') > 0 OR
       INSTR(T.MODEL_CODE, '#MODEL_CODE#') IS NULL OR
       INSTR(T.MODEL_CODE, 'C001') > 0)
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryCic3" desc="查询质量成分标准">
         <![CDATA[
SELECT T.CIC VALUE
  FROM COM_MSC_STD_CHEM T, COM_MSC_STD_CIC A
 WHERE A.MSC = '#MSC#'
   AND T.CIC = A.CIC
   AND T.VALIDFLAG <> 0
   AND A.VALIDFLAG <> 0
   AND REGEXP_LIKE(NVL(T.SIZE_MIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.SIZE_NAME NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) =
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.SIZE_NAME2 NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN2 = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) =
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN2 = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN2 = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAlphaCic" desc="查询销售成分标准">
         <![CDATA[
SELECT A.CIC,
        A.INDEX_SEQ,
        A.CHEM_CODE,
        A.CHEM_NAME,
        A.CHEM_TYPE,
        A.CHEM_FORMULA,
        DECODE(A.ISCHECK, '1', 'True', 'False') ISCHECK,
        DECODE(A.ISJUDGE, '1', 'True', 'False') ISJUDGE,
        DECODE(A.ISQUOTE, '1', 'True', 'False') ISQUOTE,
        DECODE(A.COMPLEX_TYPE, '1', 'True', 'False') COMPLEX_TYPE,
        A.STDTARGET,
        A.MODEL_CODE,
        A.MODEL_DESC,
        A.STDMEMO,
        A.ELE_CODE,
        A.ELE_NAME,
        A.ELE_MIN_SIGN,
        A.ELE_MIN,
        A.ELE_MAX_SIGN,
        A.ELE_MAX,
        A.SIZE_CODE2,
        A.SIZE_NAME2,
        A.SIZE_MIN_SIGN2,
        A.SIZE_MIN2,
        A.SIZE_MAX_SIGN2,
        A.SIZE_MAX2,
        A.SIZE_CODE,
        A.SIZE_NAME,
        A.SIZE_MIN_SIGN,
        A.SIZE_MIN,
        A.SIZE_MAX_SIGN,
        A.SIZE_MAX,
        A.SPEC_JG,
        A.SPEC_JG_DESC,
        A.REP_CODE,
        A.REP_NAME,
        A.REP_MIN_SIGN,
        A.REP_MIN,
        A.REP_MAX_SIGN,
        A.REP_MAX,
        A.REP_VAL,
        A.STDMIN_SIGN STDMIN_SIGN1,
        A.STDMIN STDMIN1,
        A.STDMAX_SIGN STDMAX_SIGN1,
        A.STDMAX STDMAX1,
        A.STDMEMO STDMEMO1,
        A.CUST_ALPHA_NO,
        A.VALIDFLAG
   FROM SLM_CUST_ALPHA_CHEM A
 WHERE A.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
 AND A.VALIDFLAG = '1'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryPic4" desc="查询质量材质标准">
         <![CDATA[
SELECT A.PIC,
       A.INDEX_SEQ,
       A.PHY_CODE_MAX,
       A.PHY_NAME_MAX,
       A.PHY_CODE_MIN,
       A.PHY_NAME_MIN,
       A.PHY_CODE,
       A.PHY_NAME,
       A.ITEM_CODE_F,
       A.ITEM_NAME_F,
       A.ITEM_CODE_S,
       A.ITEM_NAME_S,
       A.ITEM_CODE_W,
       A.ITEM_NAME_W,
       A.GROUP_SEQ,
       A.RESULT_COUNT,
       DECODE(A.ISCHECK, '1', 'True', 'False') ISCHECK,
       DECODE(A.ISJUDGE, '1', 'True', 'False') ISJUDGE,
       DECODE(A.ISQUOTE, '1', 'True', 'False') ISQUOTE,
       DECODE(A.PHY_TYPE, '1', 'True', 'False') PHY_TYPE,
       A.PHY_FORMULA,
       A.STDMIN_SIGN,
       A.STDMIN,
       A.STDMAX_SIGN,
       A.STDMAX,
       DECODE(A.JUDGE_BASIS,
              'A',
              '最小值',
              'B',
              '最大值',
              'C',
              '平均值',
              'D',
              '逐项值判') JUDGE_BASIS_DESC,
       A.JUDGE_BASIS,
       A.DELIVERYSTATE,
       C.BASENAME DELIVERYSTATE_DESC,
       A.MODEL_CODE,
       A.MODEL_DESC,
       A.STDMEMO,
       A.SIZE_CODE2,
       A.SIZE_NAME2,
       A.SIZE_MIN_SIGN2,
       A.SIZE_MIN2,
       A.SIZE_MAX_SIGN2,
       A.SIZE_MAX2,
       A.SIZE_CODE,
       A.SIZE_NAME,
       A.SIZE_MIN_SIGN,
       A.SIZE_MIN,
       A.SIZE_MAX_SIGN,
       A.SIZE_MAX,
       A.SPEC_JG,
       A.SPEC_JG_DESC,
       E.BASENAME STD_CHOOSE_DESC,
       A.STD_CHOOSE,
       A.STDMIN_SIGN2,
       A.STDMIN2,
       A.STDMAX_SIGN2,
       A.STDMAX2,
       A.ADDCONDITION,
       DECODE(A.ADDCONDITION, '1', '符合标准时', '0', '不符合标准时') ADDCONDITION_DESC,
       A.ADDSTDCON_CODE,
       D.BASENAME ADDSTDCON_DESC,
       A.ADDSTD_MIN_SIGN,
       A.ADDSTD_MIN,
       A.ADDSTD_MAX_SIGN,
       A.ADDSTD_MAX,
       A.ADDPERCENT,
       NULL STDMIN_SIGN1,
       NULL STDMIN1,
       NULL STDMAX_SIGN1,
       NULL STDMAX1,
       NULL STDMEMO1,
       A.VALIDFLAG,
       A.GUID
  FROM COM_MSC_STD_PHY A
  LEFT JOIN COM_BASE_INFO C
    ON A.DELIVERYSTATE = C.BASECODE
  LEFT JOIN COM_BASE_INFO D
    ON D.BASECODE = A.ADDSTDCON_CODE
  LEFT JOIN COM_BASE_INFO E
    ON E.BASECODE = A.STD_CHOOSE
 WHERE A.VALIDFLAG = '1'
   AND A.PIC = '#PIC#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryPic1" desc="查询质量材质标准">
         <![CDATA[
SELECT A.PIC VALUE
  FROM COM_MSC_STD_PHY A, COM_MSC_STD_PIC B
 WHERE A.PIC = B.PIC
   AND A.VALIDFLAG = '1'
   AND B.VALIDFLAG IN ('1', '2', '3')
   AND B.MSC = '#MSC#'
   AND B.CODE_JG IS NULL
   AND (INSTR(B.MODEL_CODE, '#MODEL_CODE#') > 0 OR
       INSTR(B.MODEL_CODE, '#MODEL_CODE#') IS NULL OR
       INSTR(B.MODEL_CODE, 'C001') > 0)
   AND REGEXP_LIKE(NVL(A.SIZE_MIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(A.SIZE_MAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(A.SIZE_MIN2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(A.SIZE_MAX2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND DECODE('#SPEC_JG#', NULL, '1', A.SPEC_JG) =
       DECODE('#SPEC_JG#', NULL, '1', '#SPEC_JG#')
   AND ('#DIMATER#' IS NULL OR
       (A.SIZE_NAME NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN A.SIZE_MIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MIN) =
                 TO_NUMBER(DECODE(A.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SIZE_MIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MIN) <
                 TO_NUMBER(DECODE(A.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SIZE_MIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MIN) <=
                 TO_NUMBER(DECODE(A.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN A.SIZE_MAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MAX) >
                 TO_NUMBER(DECODE(A.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SIZE_MAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MAX) >=
                 TO_NUMBER(DECODE(A.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (A.SIZE_NAME2 NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN A.SIZE_MIN_SIGN2 = '=' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MIN2) =
                 TO_NUMBER(DECODE(A.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SIZE_MIN_SIGN2 = '>' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MIN2) <
                 TO_NUMBER(DECODE(A.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SIZE_MIN_SIGN2 = '>=' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MIN2) <=
                 TO_NUMBER(DECODE(A.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN A.SIZE_MAX_SIGN2 = '<' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MAX2) >
                 TO_NUMBER(DECODE(A.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SIZE_MAX_SIGN2 = '<=' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MAX2) >=
                 TO_NUMBER(DECODE(A.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
ORDER BY A.PIC
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryPic2" desc="查询质量材质标准">
         <![CDATA[
SELECT A.PIC VALUE
  FROM COM_MSC_STD_PHY A, COM_MSC_STD_PIC B
 WHERE A.PIC = B.PIC
   AND A.VALIDFLAG = '1'
   AND B.VALIDFLAG IN ('1', '2', '3')
   AND B.MSC = '#MSC#'
   AND B.CODE_JG IS NULL
   AND (INSTR(B.MODEL_CODE, '#MODEL_CODE#') > 0 OR
       INSTR(B.MODEL_CODE, '#MODEL_CODE#') IS NULL OR
       INSTR(B.MODEL_CODE, 'C001') > 0)
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryPic3" desc="查询质量材质标准">
         <![CDATA[
SELECT A.PIC VALUE
  FROM COM_MSC_STD_PHY A, COM_MSC_STD_PIC B
 WHERE A.PIC = B.PIC
   AND A.VALIDFLAG = '1'
   AND B.VALIDFLAG IN ('1', '2', '3')
   AND B.MSC = '#MSC#'
   AND B.CODE_JG IS NULL
   AND REGEXP_LIKE(NVL(T.SIZE_MIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (A.SIZE_NAME NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN A.SIZE_MIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MIN) =
                 TO_NUMBER(DECODE(A.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SIZE_MIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MIN) <
                 TO_NUMBER(DECODE(A.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SIZE_MIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MIN) <=
                 TO_NUMBER(DECODE(A.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN A.SIZE_MAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MAX) >
                 TO_NUMBER(DECODE(A.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SIZE_MAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MAX) >=
                 TO_NUMBER(DECODE(A.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (A.SIZE_NAME2 NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN A.SIZE_MIN_SIGN2 = '=' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MIN2) =
                 TO_NUMBER(DECODE(A.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SIZE_MIN_SIGN2 = '>' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MIN2) <
                 TO_NUMBER(DECODE(A.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SIZE_MIN_SIGN2 = '>=' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MIN2) <=
                 TO_NUMBER(DECODE(A.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN A.SIZE_MAX_SIGN2 = '<' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MAX2) >
                 TO_NUMBER(DECODE(A.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SIZE_MAX_SIGN2 = '<=' THEN
          CASE
            WHEN TO_NUMBER(A.SIZE_MAX2) >=
                 TO_NUMBER(DECODE(A.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAlphaPic" desc="查询销售材质标准">
         <![CDATA[
SELECT A.PIC,
       A.INDEX_SEQ,
       A.PHY_CODE_MAX,
       A.PHY_NAME_MAX,
       A.PHY_CODE_MIN,
       A.PHY_NAME_MIN,
       A.PHY_CODE,
       A.PHY_NAME,
       A.ITEM_CODE_F,
       A.ITEM_NAME_F,
       A.ITEM_CODE_S,
       A.ITEM_NAME_S,
       A.ITEM_CODE_W,
       A.ITEM_NAME_W,
       A.GROUP_SEQ,
       A.RESULT_COUNT,
       DECODE(A.ISCHECK, '1', 'True', 'False') ISCHECK,
       DECODE(A.ISJUDGE, '1', 'True', 'False') ISJUDGE,
       DECODE(A.ISQUOTE, '1', 'True', 'False') ISQUOTE,
       DECODE(A.PHY_TYPE, '1', 'True', 'False') PHY_TYPE,
       A.PHY_FORMULA,
       A.JUDGE_BASIS,
       A.DELIVERYSTATE,
       A.MODEL_CODE,
       A.MODEL_DESC,
       A.STDMEMO,
       A.SIZE_CODE2,
       A.SIZE_NAME2,
       A.SIZE_MIN_SIGN2,
       A.SIZE_MIN2,
       A.SIZE_MAX_SIGN2,
       A.SIZE_MAX2,
       A.SIZE_CODE,
       A.SIZE_NAME,
       A.SIZE_MIN_SIGN,
       A.SIZE_MIN,
       A.SIZE_MAX_SIGN,
       A.SIZE_MAX,
       A.SPEC_JG,
       A.SPEC_JG_DESC,
       A.ADDCONDITION,
       DECODE(A.ADDCONDITION, '0', '不符合标准时', '1', '符合标准时') ADDCONDITION_DESC,
       A.ADDSTDCON_CODE,
       B.BASENAME ADDSTDCON_DESC,
       A.ADDSTD_MIN_SIGN,
       A.ADDSTD_MIN,
       A.ADDSTD_MAX_SIGN,
       A.ADDSTD_MAX,
       A.ADDPERCENT,
       A.STDMIN_SIGN AS STDMIN_SIGN1,
       A.STDMIN AS STDMIN1,
       A.STDMAX_SIGN AS STDMAX_SIGN1,
       A.STDMAX AS STDMAX1,
       A.STDMEMO STDMEMO1,
       A.CUST_ALPHA_NO,
       A.VALIDFLAG,
       A.GUID
  FROM SLM_CUST_ALPHA_PHY A
  LEFT JOIN COM_BASE_INFO B
    ON A.ADDSTDCON_CODE = B.BASECODE
 WHERE A.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND A.VALIDFLAG = '1'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.querySic4" desc="查询质量公差标准">
         <![CDATA[
SELECT A.SIC,
       A.INDEX_SEQ,
       A.BIAS_CODE,
       A.BIAS_NAME,
       C.BASENAME LV_DESC,
       A.LV,
       A.BIAS_CODE_Z,
       A.BIAS_NAME_Z,
       A.ZMIN_SIGN,
       A.ZMIN,
       A.ZMAX_SIGN,
       A.ZMAX,
       A.BIAS_CODE_C,
       A.BIAS_NAME_C,
       A.CMIN_SIGN,
       A.CMIN,
       A.CMAX_SIGN,
       A.CMAX,
       A.BIAS_CODE_S,
       A.BIAS_NAME_S,
       A.SMIN_SIGN,
       A.SMIN,
       A.SMAX_SIGN,
       A.SMAX,
       DECODE(A.ISCHECK, '1', 'True', 'False') ISCHECK,
       A.STD_MIN_VAL,
       A.STD_MAX_VAL,
       A.STD_MIN_IN,
       A.STD_MAX_IN,
       A.STD_MIN_PERCENT,
       A.STD_MAX_PERCENT,
       A.STD_MIN_FORMULA,
       A.STD_MAX_FORMULA,
       DECODE(A.STD_MIN_FORMULA_V, '1', 'True', 'False') AS STD_MIN_FORMULA_V,
       DECODE(A.STD_MAX_FORMULA_V, '1', 'True', 'False') AS STD_MAX_FORMULA_V,
       A.STDMEMO,
       '' AS STD_MIN_VAL1,
       '' STD_MAX_VAL1,
       '' STD_MIN_PERCENT1,
       '' STD_MAX_PERCENT1,
       '' STD_MEMO1,
       'False' STD_MIN_FORMULA_V1,
       'False' STD_MAX_FORMULA_V1,
       A.VALIDFLAG
  FROM COM_MSC_STD_SPEC_C A
  LEFT JOIN COM_BASE_INFO C
    ON A.LV = C.BASECODE
 WHERE A.VALIDFLAG = '1'
   AND A.SIC = '#SIC#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.querySic1" desc="查询质量公差标准">
         <![CDATA[
SELECT A.SIC VALUE
  FROM COM_MSC_STD_SPEC_C A, COM_MSC_STD_SPEC B
 WHERE B.MSC = '#MSC#'
   AND A.SIC = B.SIC
   AND B.VALIDFLAG <> '0'
   AND A.VALIDFLAG <> '0'
   AND B.CODE_JG IS NULL
   AND (INSTR(B.MODEL_CODE, '#MODEL_CODE#') > 0 OR
       INSTR(B.MODEL_CODE, '#MODEL_CODE#') IS NULL OR
       INSTR(B.MODEL_CODE, 'C001') > 0)
   AND REGEXP_LIKE(NVL(A.ZMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(A.ZMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(A.CMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(A.CMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(A.SMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(A.SMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (A.BIAS_NAME_Z NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN A.ZMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(A.ZMIN) =
                 TO_NUMBER(DECODE(A.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.ZMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(A.ZMIN) <
                 TO_NUMBER(DECODE(A.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.ZMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(A.ZMIN) <=
                 TO_NUMBER(DECODE(A.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN A.ZMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(A.ZMAX) >
                 TO_NUMBER(DECODE(A.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.ZMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(A.ZMAX) >=
                 TO_NUMBER(DECODE(A.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (A.BIAS_NAME_C NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN A.CMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(A.CMIN) =
                 TO_NUMBER(DECODE(A.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.CMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(A.CMIN) <
                 TO_NUMBER(DECODE(A.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.CMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(A.CMIN) <=
                 TO_NUMBER(DECODE(A.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN A.CMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(A.CMAX) >
                 TO_NUMBER(DECODE(A.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.CMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(A.CMAX) >=
                 TO_NUMBER(DECODE(A.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1)
       
       AND
       (A.BIAS_NAME_S NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN A.SMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(A.SMIN) =
                 TO_NUMBER(DECODE(A.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(A.SMIN) <
                 TO_NUMBER(DECODE(A.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(A.SMIN) <=
                 TO_NUMBER(DECODE(A.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN A.SMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(A.SMAX) >
                 TO_NUMBER(DECODE(A.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(A.SMAX) >=
                 TO_NUMBER(DECODE(A.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
ORDER BY A.SIC
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.querySic2" desc="查询质量公差标准">
         <![CDATA[
SELECT A.SIC VALUE
  FROM COM_MSC_STD_SPEC_C A, COM_MSC_STD_SPEC B
 WHERE B.MSC = '#MSC#'
   AND A.SIC = B.SIC
   AND B.VALIDFLAG <> '0'
   AND A.VALIDFLAG <> '0'
   AND B.CODE_JG IS NULL
   AND (INSTR(B.MODEL_CODE, '#MODEL_CODE#') > 0 OR
       INSTR(B.MODEL_CODE, '#MODEL_CODE#') IS NULL OR
       INSTR(B.MODEL_CODE, 'C001') > 0)
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.querySic3" desc="查询质量公差标准">
         <![CDATA[
SELECT A.SIC VALUE
  FROM COM_MSC_STD_SPEC_C A, COM_MSC_STD_SPEC B
 WHERE B.MSC = '#MSC#'
   AND A.SIC = B.SIC
   AND B.VALIDFLAG <> '0'
   AND A.VALIDFLAG <> '0'
   AND B.CODE_JG IS NULL
   AND REGEXP_LIKE(NVL(T.ZMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.ZMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.CMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.CMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (A.BIAS_NAME_Z NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN A.ZMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(A.ZMIN) =
                 TO_NUMBER(DECODE(A.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.ZMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(A.ZMIN) <
                 TO_NUMBER(DECODE(A.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.ZMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(A.ZMIN) <=
                 TO_NUMBER(DECODE(A.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN A.ZMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(A.ZMAX) >
                 TO_NUMBER(DECODE(A.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.ZMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(A.ZMAX) >=
                 TO_NUMBER(DECODE(A.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (A.BIAS_NAME_C NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN A.CMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(A.CMIN) =
                 TO_NUMBER(DECODE(A.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.CMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(A.CMIN) <
                 TO_NUMBER(DECODE(A.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.CMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(A.CMIN) <=
                 TO_NUMBER(DECODE(A.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN A.CMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(A.CMAX) >
                 TO_NUMBER(DECODE(A.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.CMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(A.CMAX) >=
                 TO_NUMBER(DECODE(A.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1)
       
       AND
       (A.BIAS_NAME_S NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN A.SMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(A.SMIN) =
                 TO_NUMBER(DECODE(A.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(A.SMIN) <
                 TO_NUMBER(DECODE(A.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(A.SMIN) <=
                 TO_NUMBER(DECODE(A.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN A.SMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(A.SMAX) >
                 TO_NUMBER(DECODE(A.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN A.SMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(A.SMAX) >=
                 TO_NUMBER(DECODE(A.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAlphaSic" desc="查询销售公差标准">
         <![CDATA[
SELECT A.SIC,
       A.INDEX_SEQ,
       A.BIAS_CODE,
       A.BIAS_NAME,
       A.LV,
       A.BIAS_CODE_Z,
       A.BIAS_NAME_Z,
       A.ZMIN_SIGN,
       A.ZMIN,
       A.ZMAX_SIGN,
       A.ZMAX,
       A.BIAS_CODE_C,
       A.BIAS_NAME_C,
       A.CMIN_SIGN,
       A.CMIN,
       A.CMAX_SIGN,
       A.CMAX,
       A.BIAS_CODE_S,
       A.BIAS_NAME_S,
       A.SMIN_SIGN,
       A.SMIN,
       A.SMAX_SIGN,
       A.SMAX,
       DECODE(A.ISCHECK, '1', 'True', 'False') ISCHECK,
       A.STD_MIN_IN,
       A.STD_MAX_IN,
       A.STD_MIN_FORMULA,
       A.STD_MAX_FORMULA,
       A.STDMEMO,
       A.STD_MIN_VAL AS STD_MIN_VAL1,
       A.STD_MAX_VAL AS STD_MAX_VAL1,
       A.STD_MIN_PERCENT AS STD_MIN_PERCENT1,
       A.STD_MAX_PERCENT AS STD_MAX_PERCENT1,
       DECODE(A.STD_MIN_FORMULA_V, '1', 'true', 'false') AS STD_MIN_FORMULA_V1,
       DECODE(A.STD_MAX_FORMULA_V, '1', 'true', 'false') AS STD_MAX_FORMULA_V1,
       A.STDMEMO STDMEMO1,
       A.CUST_ALPHA_NO,
       A.VALIDFLAG
  FROM SLM_CUST_ALPHA_SPEC A
 WHERE A.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND A.VALIDFLAG = '1'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryDic4" desc="查询质量探伤标准">
         <![CDATA[
SELECT A.XH,
       A.DIC,
       A.PHY_CODE,
       A.PHY_NAME,
       A.POSITION_CODE,
       A.POSITION_DESC,
       DECODE(C.BASENAME, NULL, A.STD_DESC, C.BASENAME) STD_DESC,
       A.LV_CODE,
       A.GROOVE_POS,
       A.GROOVE_DIR,
       A.LV_DESC,
       A.COVERAGE,
       A.MEMO,
       A.RATE,
       A.DESC_RATE,
       A.DESC_VAL,
       A.GROUP_SEQ,
       A.MIN_D,
       A.MAX_D,
       A.MIN_H,
       A.MAX_H,
       '' POSITION_CODE1,
       '' POSITION_DESC1,
       '' STD_DESC1,
       '' LV_CODE1,
       '' LV_DESC1,
       '' COVERAGE1,
       '' MEMO1,
       A.VALIDFLAG
  FROM COM_MSC_STD_DETECTION_C A
  LEFT JOIN COM_BASE_INFO C
    ON C.BASECODE = A.STD_DESC
 WHERE A.VALIDFLAG = '1'
   AND A.DIC = '#DIC#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryDic1" desc="查询质量探伤标准">
         <![CDATA[
SELECT B.DIC VALUE
  FROM COM_MSC_STD_DETECTION_C A, COM_MSC_STD_DETECTION B
 WHERE B.MSC = '#MSC#'
   AND A.DIC = B.DIC
   AND B.VALIDFLAG <> '0'
   AND A.VALIDFLAG <> '0'
   AND (INSTR(B.MODEL_CODE, '#MODEL_CODE#') > 0 OR
       INSTR(B.MODEL_CODE, '#MODEL_CODE#') IS NULL OR
       INSTR(B.MODEL_CODE, 'C001') > 0)
   AND ('#DIMATER#' IS NULL OR
       DECODE(A.MIN_D, NULL, 1, TO_NUMBER(A.MIN_D)) <=
       DECODE(A.MIN_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
       DECODE(A.MAX_D, NULL, 1, TO_NUMBER(A.MAX_D)) >=
       DECODE(A.MAX_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
       DECODE(A.MIN_H, NULL, 1, TO_NUMBER(A.MIN_H)) <=
       DECODE(A.MIN_H, NULL, 1, TO_NUMBER('#HEIGHT#')) AND
       DECODE(A.MAX_H, NULL, 1, TO_NUMBER(A.MAX_H)) >=
       DECODE(A.MAX_H, NULL, 1, TO_NUMBER('#HEIGHT#')))
ORDER BY B.DIC
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryDic2" desc="查询质量探伤标准">
         <![CDATA[
SELECT B.DIC VALUE
  FROM COM_MSC_STD_DETECTION_C A, COM_MSC_STD_DETECTION B
 WHERE B.MSC = '#MSC#'
   AND A.DIC = B.DIC
   AND B.VALIDFLAG <> '0'
   AND A.VALIDFLAG <> '0'
   AND (INSTR(B.MODEL_CODE, '#MODEL_CODE#') > 0 OR
       INSTR(B.MODEL_CODE, '#MODEL_CODE#') IS NULL OR
       INSTR(B.MODEL_CODE, 'C001') > 0)
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryDic3" desc="查询质量探伤标准">
         <![CDATA[
SELECT B.DIC VALUE
  FROM COM_MSC_STD_DETECTION_C A, COM_MSC_STD_DETECTION B
 WHERE B.MSC = '#MSC#'
   AND A.DIC = B.DIC
   AND B.VALIDFLAG <> '0'
   AND A.VALIDFLAG <> '0'
   AND ('#DIMATER#' IS NULL OR
       DECODE(A.MIN_D, NULL, 1, TO_NUMBER(A.MIN_D)) <=
       DECODE(A.MIN_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
       DECODE(A.MAX_D, NULL, 1, TO_NUMBER(A.MAX_D)) >=
       DECODE(A.MAX_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
       DECODE(A.MIN_H, NULL, 1, TO_NUMBER(A.MIN_H)) <=
       DECODE(A.MIN_H, NULL, 1, TO_NUMBER('#HEIGHT#')) AND
       DECODE(A.MAX_H, NULL, 1, TO_NUMBER(A.MAX_H)) >=
       DECODE(A.MAX_H, NULL, 1, TO_NUMBER('#HEIGHT#')))
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAlphaDic" desc="查询销售探伤标准">
         <![CDATA[
SELECT A.XH,
       A.DIC,
       A.PHY_CODE,
       A.PHY_NAME,
       A.GROOVE_POS GROOVE_POS1,
       A.GROOVE_DIR GROOVE_DIR1,
       A.MEMO,
       A.RATE RATE1,
       A.DESC_RATE DESC_RATE1,
       A.DESC_VAL DESC_VAL1,
       A.GROUP_SEQ,
       A.POSITION_CODE AS POSITION_CODE1,
       A.POSITION_DESC AS POSITION_DESC1,
       A.STD_DESC      AS STD_CODE1,
       A2.BASENAME STD_DESC1,
       A.LV_CODE       AS LV_CODE1,
       A.LV_DESC       AS LV_DESC1,
       A.COVERAGE      AS COVERAGE1,
       A.MEMO MEMO1,
       A.CUST_ALPHA_NO,
       A.VALIDFLAG,
       A.MIN_D,
       A.MAX_D,
       A.MIN_H,
       A.MAX_H
  FROM SLM_CUST_ALPHA_DETECTION A
  LEFT JOIN COM_BASE_INFO A2
  ON A2.BASECODE = A.STD_DESC
 WHERE A.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND A.VALIDFLAG = '1'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryWic4" desc="查询质量水压标准">
         <![CDATA[
SELECT A.WIC,
       A.XH INDEX_SEQ,
       A.PRESSURE_Y,
       A.PRESSURE,
       A.FORMULA,
       A.SAVE_TIME,
       A.MEMO,
       DECODE(A.GET_MAXVALUE, '1', 'True', 'False') GET_MAXVALUE,
       DECODE(A.GET_MINVALUE, '1', 'True', 'False') GET_MINVALUE,
       '' PRESSURE_Y1,
       '' PRESSURE1,
       '' SAVE_TIME1,
       '' FORMULA1,
       A.VALIDFLAG,
       B.MIN_D,
       B.MAX_D,
       B.MIN_H,
       B.MAX_H
  FROM COM_MSC_STD_WATER_C A, COM_MSC_STD_WATER B
 WHERE A.VALIDFLAG = '1'
   AND A.WIC = '#WIC#'
   AND B.WIC = A.WIC
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryWic1" desc="查询质量水压标准">
         <![CDATA[
SELECT A.WIC VALUE
  FROM COM_MSC_STD_WATER_C A, COM_MSC_STD_WATER B
 WHERE B.MSC = '#MSC#'
   AND A.WIC = B.WIC
   AND B.VALIDFLAG <> '0'
   AND A.VALIDFLAG <> '0'
   AND (INSTR(B.MODEL_CODE, '#MODEL_CODE#') > 0 OR
       INSTR(B.MODEL_CODE, '#MODEL_CODE#') IS NULL OR
       INSTR(B.MODEL_CODE, 'C001') > 0)
   AND DECODE('#SPEC_JG#', NULL, '1', B.SPEC_JG) =
       DECODE('#SPEC_JG#', NULL, '1', '#SPEC_JG#')
   AND ('#DIMATER#' IS NULL OR
       DECODE(B.MIN_D, NULL, 1, TO_NUMBER(B.MIN_D)) <=
       DECODE(B.MIN_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
       DECODE(B.MAX_D, NULL, 1, TO_NUMBER(B.MAX_D)) >=
       DECODE(B.MAX_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
       DECODE(B.MIN_H, NULL, 1, TO_NUMBER(B.MIN_H)) <=
       DECODE(B.MIN_H, NULL, 1, TO_NUMBER('#HEIGHT#')) AND
       DECODE(B.MAX_H, NULL, 1, TO_NUMBER(B.MAX_H)) >=
       DECODE(B.MAX_H, NULL, 1, TO_NUMBER('#HEIGHT#')))
 ORDER BY A.WIC
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryWic2" desc="查询质量水压标准">
         <![CDATA[
SELECT A.WIC VALUE
  FROM COM_MSC_STD_WATER_C A, COM_MSC_STD_WATER B
 WHERE B.MSC = '#MSC#'
   AND A.WIC = B.WIC
   AND B.VALIDFLAG <> '0'
   AND A.VALIDFLAG <> '0'
   AND (INSTR(B.MODEL_CODE, '#MODEL_CODE#') > 0 OR
       INSTR(B.MODEL_CODE, '#MODEL_CODE#') IS NULL OR
       INSTR(B.MODEL_CODE, 'C001') > 0)
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryWic3" desc="查询质量水压标准">
         <![CDATA[
SELECT A.WIC VALUE
  FROM COM_MSC_STD_WATER_C A, COM_MSC_STD_WATER B
 WHERE B.MSC = '#MSC#'
   AND A.WIC = B.WIC
   AND B.VALIDFLAG <> '0'
   AND A.VALIDFLAG <> '0'
   AND ('#DIMATER#' IS NULL OR
       DECODE(B.MIN_D, NULL, 1, TO_NUMBER(B.MIN_D)) <=
       DECODE(B.MIN_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
       DECODE(B.MAX_D, NULL, 1, TO_NUMBER(B.MAX_D)) >=
       DECODE(B.MAX_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
       DECODE(B.MIN_H, NULL, 1, TO_NUMBER(B.MIN_H)) <=
       DECODE(B.MIN_H, NULL, 1, TO_NUMBER('#HEIGHT#')) AND
       DECODE(B.MAX_H, NULL, 1, TO_NUMBER(B.MAX_H)) >=
       DECODE(B.MAX_H, NULL, 1, TO_NUMBER('#HEIGHT#')))
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAlphaWic" desc="查询销售水压标准">
         <![CDATA[
SELECT A.WIC,
       A.INDEX_SEQ,
       DECODE(A.GET_MAXVALUE, '1', 'True', 'False') GET_MAXVALUE,
       DECODE(A.GET_MINVALUE, '1', 'True', 'False') GET_MINVALUE,
       A.PRESSURE_Y   AS PRESSURE_Y1,
       A.PRESSURE     AS PRESSURE1,
       A.SAVE_TIME    AS SAVE_TIME1,
       A.FORMULA FORMULA1,
       A.CUST_ALPHA_NO,
       A.VALIDFLAG,
       '' MIN_D,
       '' MAX_D,
       '' MIN_H,
       '' MAX_H
  FROM SLM_CUST_ALPHA_WATER A
 WHERE A.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND A.VALIDFLAG = '1'
         ]]>
	</query>
	
	
	<query id="CoreOrderSpecialInfo.queryGic4" desc="查询质量加工要求">
         <![CDATA[
SELECT A.GIC,
       A.XH INDEX_SEQ,
       A.STATION_CODE,
       A.STATION_DESC,
       A.PROCESS_CDOE,
       A.PROCESS_DESC,
       A.PROCESS_CDOE_C,
       A.PROCESS_DESC_C,
       A.VALUE_TEXT,
       A.VALUE_NUM,
       A.VALUE_MEMO,
       '' ALPHA_VALUE_TEXT,
       '' ALPHA_VALUE_NUM,
       '' ALPHA_VALUE_MEMO,
       A.VALIDFLAG
  FROM COM_MSC_STD_PROCESS_C A
 WHERE A.VALIDFLAG = '1'
   AND A.GIC = '#GIC#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryGic1" desc="查询质量加工要求">
         <![CDATA[
SELECT A.GIC VALUE
  FROM COM_MSC_STD_PROCESS_C A, COM_MSC_STD_PROCESS B
 WHERE B.MSC = '#MSC#'
   AND B.GIC = A.GIC
   AND B.VALIDFLAG <> '0'
   AND A.VALIDFLAG <> '0'
   AND (INSTR(B.MODEL_CODE, '#MODEL_CODE#') > 0 OR
       INSTR(B.MODEL_CODE, '#MODEL_CODE#') IS NULL OR
       INSTR(B.MODEL_CODE, 'C001') > 0)
 ORDER BY A.GIC
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAlphaGic" desc="查询销售水压标准">
         <![CDATA[
SELECT A.GIC,
       A.XH,
       A.STATION_CODE,
       A.STATION_DESC,
       A.PROCESS_CDOE,
       A.PROCESS_DESC,
       A.PROCESS_CDOE_C,
       A.PROCESS_DESC_C,
       A.VALUE_TEXT     AS ALPHA_VALUE_TEXT,
       A.VALUE_NUM      AS ALPHA_VALUE_NUM,
       A.VALUE_MEMO     AS ALPHA_VALUE_MEMO,
       A.CUST_ALPHA_NO,
       A.VALIDFLAG
  FROM SLM_CUST_ALPHA_PROCESS A
 WHERE A.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND A.VALIDFLAG = '1'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAskAdd" desc="查询质量附加要求">
         <![CDATA[
            SELECT A.STD_CODE,
       A.STD_NAME,
       A.ASK_ITME,
       A.ASK_ITME_DESC,
       A.ASK_SUB_ITME,
       A.MEMO,
       A.ASK_SUB_ITME_DESC,
       A.ASK_SUB_ITME_VAL,
       A.ASK_SUB_ITME_VAL_DESC,
       A.PIC
  FROM COM_BASE_ADDITIONAL A
 WHERE A.STD_CODE = (SELECT B.STD_CODE
                       FROM COM_BASE_STD B
                       JOIN COM_MSC C
                         ON B.STD_CODE = C.STD_CODE
                      WHERE C.MSC = ?)
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAlphaAskAdd" desc="查询销售附加要求">
         <![CDATA[
             SELECT NVL(P.ASK_ITME, Q.ASK_ITME) AS ASK_ITME,
       NVL(P.ASK_ITME_DESC, Q.ASK_ITME_DESC) AS ASK_ITME_DESC,
       NVL(P.ASK_SUB_ITME, Q.ASK_SUB_ITME) AS ASK_SUB_ITME,
       NVL(P.ASK_SUB_ITME_DESC, Q.ASK_SUB_ITME_DESC) AS ASK_SUB_ITME_DESC,
       P.ASK_SUB_ITME_VAL,
       P.ASK_SUB_ITME_VAL_DESC,
       P.PIC,
       Q.ASK_SUB_ITME_VAL AS ASK_SUB_ITME_VAL1,
       Q.ASK_SUB_ITME_VAL_DESC AS ASK_SUB_ITME_VAL_DESC1,
       Q.PIC AS PIC1,
       q.ADD_ASK_NO
  FROM (SELECT A.ASK_ITME,
               A.ASK_ITME_DESC,
               A.ASK_SUB_ITME,
               A.ASK_SUB_ITME_DESC,
               A.ASK_SUB_ITME_VAL,
               A.ASK_SUB_ITME_VAL_DESC,
               A.PIC
          FROM COM_BASE_ADDITIONAL A
         WHERE A.STD_CODE = (SELECT B.STD_CODE
                               FROM COM_BASE_STD B
                               JOIN COM_MSC C
                                 ON B.STD_CODE = C.STD_CODE
                              WHERE C.MSC = ?)
           and a.validflag = 1) P
  FULL JOIN (SELECT A.ADD_ASK_NO,
                    A.ASK_ITME,
                    A.ASK_ITME_DESC,
                    A.ASK_SUB_ITME,
                    A.ASK_SUB_ITME_DESC,
                    A.ASK_SUB_ITME_VAL,
                    A.ASK_SUB_ITME_VAL_DESC,
                    A.PIC
               FROM SLM_ORDER_ADD_ASK A
              WHERE A.ADD_ASK_NO = ?
                and a.validflag = 1) Q
    ON P.ASK_ITME = Q.ASK_ITME
   AND P. ASK_SUB_ITME = Q.ASK_SUB_ITME
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.addAlphaChem" desc="增加销售成分标准">
         <![CDATA[            
		INSERT INTO SLM_CUST_ALPHA_CHEM
  (COMPLEX_TYPE,
   STDMIN_SIGN,
   STDMIN,
   STDMAX_SIGN,
   STDMAX,
   STDTARGET,
   MODEL_CODE,
   MODEL_DESC,
   STDMEMO,
   ELE_CODE,
   ELE_NAME,
   ELE_MIN_SIGN,
   ELE_MIN,
   ELE_MAX_SIGN,
   ELE_MAX,
   SIZE_CODE2,
   SIZE_NAME2,
   SIZE_MIN_SIGN2,
   SIZE_MIN2,
   SIZE_MAX_SIGN2,
   SIZE_MAX2,
   SIZE_CODE,
   SIZE_NAME,
   SIZE_MIN_SIGN,
   SIZE_MIN,
   SIZE_MAX_SIGN,
   SIZE_MAX,
   SPEC_JG,
   SPEC_JG_DESC,
   CREATE_NAME,
   CREATE_TIME,
   REP_CODE,
   REP_NAME,
   REP_MIN_SIGN,
   REP_MIN,
   REP_MAX_SIGN,
   REP_MAX,
   REP_VAL,
   CUST_ALPHA_NO,
   CIC,
   INDEX_SEQ,
   CHEM_CODE,
   CHEM_NAME,
   CHEM_TYPE,
   CHEM_FORMULA,
   ISCHECK,
   ISJUDGE,
   ISQUOTE)
VALUES
  ('#COMPLEX_TYPE#',
   '#STDMIN_SIGN#',
   '#STDMIN#',
   '#STDMAX_SIGN#',
   '#STDMAX#',
   '#STDTARGET#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#STDMEMO#',
   '#ELE_CODE#',
   '#ELE_NAME#',
   '#ELE_MIN_SIGN#',
   '#ELE_MIN#',
   '#ELE_MAX_SIGN#',
   '#ELE_MAX#',
   '#SIZE_CODE2#',
   '#SIZE_NAME2#',
   '#SIZE_MIN_SIGN2#',
   '#SIZE_MIN2#',
   '#SIZE_MAX_SIGN2#',
   '#SIZE_MAX2#',
   '#SIZE_CODE#',
   '#SIZE_NAME#',
   '#SIZE_MIN_SIGN#',
   '#SIZE_MIN#',
   '#SIZE_MAX_SIGN#',
   '#SIZE_MAX#',
   '#SPEC_JG#',
   '#SPEC_JG_DESC#',
   '#CREATE_NAME#',
   SYSDATE,
   '#REP_CODE#',
   '#REP_NAME#',
   '#REP_MIN_SIGN#',
   '#REP_MIN#',
   '#REP_MAX_SIGN#',
   '#REP_MAX#',
   '#REP_VAL#',
   '#CUST_ALPHA_NO#',
   '#CIC#',
   NVL((SELECT MAX(INDEX_SEQ) + 1
                FROM SLM_CUST_ALPHA_CHEM A
               WHERE A.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'),
              1),
   '#CHEM_CODE#',
   '#CHEM_NAME#',
   '#CHEM_TYPE#',
   '#CHEM_FORMULA#',
   '#ISCHECK#',
   '#ISJUDGE#',
   '#ISQUOTE#')
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.updateAlphaChem" desc="修改销售成分标准">
         <![CDATA[
      update slm_cust_alpha_chem
   set chem_code    = '#CHEM_CODE#',
       chem_name    = '#CHEM_NAME#',
       chem_type    = '#CHEM_TYPE#',
       chem_formula = '#CHEM_FORMULA#',
       stdmin_sign  = '#STDMIN_SIGN#',
       stdmin       = '#STDMIN#',
       stdmax_sign  = '#STDMAX_SIGN#',
       stdmax       = '#STDMAX#',
       update_name  = '#UPDATE_NAME#',
       update_time  = sysdate,
       stdmemo = '#STDMEMO#'
 where cust_alpha_no = '#CUST_ALPHA_NO#'
   and index_seq = '#INDEX_SEQ#'
   and cic = '#CIC#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.addAlphaPhy" desc="增加销售理化标准">
         <![CDATA[    
INSERT INTO SLM_CUST_ALPHA_PHY
  (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,
   CREATE_NAME,
   CREATE_TIME,
   ADDCONDITION,
   ADDSTDCON_CODE,
   ADDSTD_MIN_SIGN,
   ADDSTD_MIN,
   ADDSTD_MAX_SIGN,
   ADDSTD_MAX,
   ADDPERCENT,
   STDMIN_SIGN2,
   STDMIN2,
   STDMAX_SIGN2,
   STDMAX2,
   STD_CHOOSE,
   CUST_ALPHA_NO,
   PIC,
   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,
   RESULT_COUNT,
   ISCHECK,
   ISQUOTE,
   ISJUDGE,
   PHY_TYPE,
   PHY_FORMULA,
   STDMIN_SIGN,
   STDMIN,
   STDMAX_SIGN,
   STDMAX,
   JUDGE_BASIS,
   DELIVERYSTATE,
   MODEL_CODE,
   MODEL_DESC,
   STDMEMO,
   GUID)
VALUES
  ('#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#',
   '#CREATE_NAME#',
   SYSDATE,
   '#ADDCONDITION#',
   '#ADDSTDCON_CODE#',
   '#ADDSTD_MIN_SIGN#',
   '#ADDSTD_MIN#',
   '#ADDSTD_MAX_SIGN#',
   '#ADDSTD_MAX#',
   '#ADDPERCENT#',
   '#STDMIN_SIGN2#',
   '#STDMIN2#',
   '#STDMAX_SIGN2#',
   '#STDMAX2#',
   '#STD_CHOOSE#',
   '#CUST_ALPHA_NO#',
   '#PIC#',
   NVL((SELECT MAX(INDEX_SEQ) + 1
         FROM SLM_CUST_ALPHA_PHY A
        WHERE A.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'),
       1),
   '#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#',
   '#RESULT_COUNT#',
   '#ISCHECK#',
   '#ISQUOTE#',
   '#ISJUDGE#',
   '#PHY_TYPE#',
   '#PHY_FORMULA#',
   '#STDMIN_SIGN#',
   '#STDMIN#',
   '#STDMAX_SIGN#',
   '#STDMAX#',
   '#JUDGE_BASIS#',
   '#DELIVERYSTATE#',
   '#MODEL_CODE#',
   '#MODEL_DESC#',
   '#STDMEMO#',
   '#GUID#')
         ]]>
	</query>
	
		<query id="CoreOrderSpecialInfo.updateAlphaPhy" desc="修改销售理化标准">
         <![CDATA[
         update slm_cust_alpha_phy
   set phy_code_max = '#PHY_CODE_MAX#',
       phy_name_max = '#PHY_NAME_MAX#',
       phy_code_min = '#PHY_CODE_MIN#',
       phy_name_min = '#PHY_NAME_MIN#',
       phy_code     = '#PHY_CODE#',
       phy_name     = '#PHY_NAME#',
       item_code_f  = '#ITEM_CODE_F#',
       item_name_f  = '#ITEM_NAME_F#',
       item_code_w  = '#ITEM_CODE_W#',
       item_name_w  = '#ITEM_NAME_W#',
       item_code_s  = '#ITEM_CODE_S#',
       item_name_s  = '#ITEM_NAME_S#',
       stdmin_sign  = '#STDMIN_SIGN#',
       stdmin       = '#STDMIN#',
       stdmax_sign  = '#STDMAX_SIGN#',
       stdmax       = '#STDMAX#',
       update_name  = UPDATE_NAME,
       update_time  = sysdate,
       guid = '#GUID#',
       STDMEMO = '#STDMEMO#'
 where cust_alpha_no = '#CUST_ALPHA_NO#'
   and pic = '#PIC#'
   and index_seq = '#INDEX_SEQ#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.addAlphaSpec" desc="增加销售公差标准">
         <![CDATA[
                INSERT INTO SLM_CUST_ALPHA_SPEC
  (CUST_ALPHA_NO,
   SIC,
   INDEX_SEQ,
   BIAS_CODE,
   BIAS_NAME,
   LV,
   BIAS_CODE_Z,
   BIAS_NAME_Z,
   ZMIN_SIGN,
   ZMIN,
   ZMAX_SIGN,
   ZMAX,
   BIAS_CODE_C,
   BIAS_NAME_C,
   CMIN_SIGN,
   CMIN,
   CMAX_SIGN,
   CMAX,
   BIAS_CODE_S,
   BIAS_NAME_S,
   SMIN_SIGN,
   SMIN,
   SMAX_SIGN,
   SMAX,
   ISCHECK,
   STD_MIN_VAL,
   STD_MAX_VAL,
   STD_MIN_IN,
   STD_MAX_IN,
   STD_MIN_PERCENT,
   STD_MAX_PERCENT,
   STD_MIN_FORMULA,
   STD_MAX_FORMULA,
   STD_MIN_FORMULA_V,
   STD_MAX_FORMULA_V,
   STDMEMO,
   CREATE_NAME,
   CREATE_TIME)
VALUES
  ('#CUST_ALPHA_NO#',
   '#SIC#',
   NVL((SELECT MAX(INDEX_SEQ) + 1
         FROM SLM_CUST_ALPHA_SPEC A
        WHERE A.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'),
       1),
   '#BIAS_CODE#',
   '#BIAS_NAME#',
   '#LV#',
   '#BIAS_CODE_Z#',
   '#BIAS_NAME_Z#',
   '#ZMIN_SIGN#',
   '#ZMIN#',
   '#ZMAX_SIGN#',
   '#ZMAX#',
   '#BIAS_CODE_C#',
   '#BIAS_NAME_C#',
   '#CMIN_SIGN#',
   '#CMIN#',
   '#CMAX_SIGN#',
   '#CMAX#',
   '#BIAS_CODE_S#',
   '#BIAS_NAME_S#',
   '#SMIN_SIGN#',
   '#SMIN#',
   '#SMAX_SIGN#',
   '#SMAX#',
   '#ISCHECK#',
   '#STD_MIN_VAL#',
   '#STD_MAX_VAL#',
   '#STD_MIN_IN#',
   '#STD_MAX_IN#',
   '#STD_MIN_PERCENT#',
   '#STD_MAX_PERCENT#',
   '#STD_MIN_FORMULA#',
   '#STD_MAX_FORMULA#',
   '#STD_MIN_FORMULA_V#',
   '#STD_MAX_FORMULA_V#',
   '#STDMEMO#',
   '#CREATE_NAME#',
   SYSDATE)

         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.updateAlphaSpec" desc="修改销售公差标准">
         <![CDATA[
 UPDATE SLM_CUST_ALPHA_SPEC
   SET BIAS_CODE         = '#BIAS_CODE#',
       BIAS_NAME         = '#BIAS_NAME#',
       STD_MIN_VAL       = '#STD_MIN_VAL#',
       STD_MAX_VAL       = '#STD_MAX_VAL#',
       STD_MIN_PERCENT   = '#STD_MIN_PERCENT#',
       STD_MAX_PERCENT   = '#STD_MAX_PERCENT#',
       STD_MIN_FORMULA_V = '#STD_MIN_FORMULA_V#',
       STD_MAX_FORMULA_V = '#STD_MAX_FORMULA_V#',
       UPDATE_NAME       = '#UPDATE_NAME#',
       UPDATE_TIME       = SYSDATE,
       STDMEMO = '#STDMEMO#'
 WHERE CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND SIC = '#SIC#'
   AND INDEX_SEQ = '#INDEX_SEQ#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.addAlphaDetection" desc="增加销售探伤标准">
         <![CDATA[
        INSERT INTO SLM_CUST_ALPHA_DETECTION
  (CUST_ALPHA_NO,
   DIC,
   XH,
   PHY_CODE,
   PHY_NAME,
   POSITION_CODE,
   POSITION_DESC,
   STD_DESC,
   LV_CODE,
   LV_DESC,
   GROOVE_POS,
   GROOVE_DIR,
   COVERAGE,
   RATE,
   DESC_RATE,
   DESC_VAL,
   GROUP_SEQ,
   MEMO,
   CREATE_NAME,
   CREATE_TIME,
   MIN_D,
   MAX_D,
   MIN_H,
   MAX_H)
VALUES
  ('#CUST_ALPHA_NO#',
   '#DIC#',
   NVL((SELECT MAX(XH) + 1
         FROM SLM_CUST_ALPHA_DETECTION A
        WHERE A.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'),
       1),
   '#PHY_CODE#',
   '#PHY_NAME#',
   '#POSITION_CODE#',
   '#POSITION_DESC#',
   '#STD_DESC#',
   '#LV_CODE#',
   '#LV_DESC#',
   '#GROOVE_POS#',
   '#GROOVE_DIR#',
   '#COVERAGE#',
   '#RATE#',
   '#DESC_RATE#',
   '#DESC_VAL#',
   '#GROUP_SEQ#',
   '#MEMO#',
   '#CREATE_NAME#',
   SYSDATE,
   '#MIN_D#',
   '#MAX_D#',
   '#MIN_H#',
   '#MAX_H#')

         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.updateAlphaDetetion" desc="修改销售探伤标准">
         <![CDATA[
UPDATE SLM_CUST_ALPHA_DETECTION
   SET PHY_CODE      = '#PHY_CODE#',
       PHY_NAME      = '#PHY_NAME#',
       POSITION_CODE = '#POSITION_CODE#',
       POSITION_DESC = '#POSITION_DESC#',
       STD_DESC      = '#STD_DESC#',
       LV_CODE       = '#LV_CODE#',
       LV_DESC       = '#LV_DESC#',
       COVERAGE      = '#COVERAGE#',
       GROOVE_POS    = '#GROOVE_POS#',
       GROOVE_DIR    = '#GROOVE_DIR#',
       RATE          = '#RATE#',
       DESC_RATE     = '#DESC_RATE#',
       DESC_VAL      = '#DESC_VAL#',
       UPDATE_NAME   = '#UPDATE_NAME#',
       UPDATE_TIME   = SYSDATE,
       MEMO = '#MEMO#'
 WHERE CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND DIC = '#DIC#'
   AND XH = '#XH#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.addAlphaWater" desc="增加销售水压标准">
         <![CDATA[
 INSERT INTO SLM_CUST_ALPHA_WATER
  (CUST_ALPHA_NO,
   WIC,
   INDEX_SEQ,
   PRESSURE_Y,
   PRESSURE,
   FORMULA,
   SAVE_TIME,
   GET_MAXVALUE,
   GET_MINVALUE,
   CREATE_NAME,
   CREATE_TIME)
VALUES
  ('#CUST_ALPHA_NO#',
   '#WIC#',
   NVL((SELECT MAX(INDEX_SEQ) + 1
         FROM SLM_CUST_ALPHA_WATER A
        WHERE A.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'),
       1),
   '#PRESSURE_Y#',
   '#PRESSURE#',
   '#FORMULA#',
   '#SAVE_TIME#',
   '#GET_MAXVALUE#',
   '#GET_MINVALUE#',
   '#CREATE_NAME#',
   SYSDATE)

         ]]>
	</query>
	
		<query id="CoreOrderSpecialInfo.updateAlphaWater" desc="修改销售水压标准">
         <![CDATA[
UPDATE SLM_CUST_ALPHA_WATER
   SET PRESSURE_Y  = '#PRESSURE_Y#',
       PRESSURE    = '#PRESSURE#',
       FORMULA     = '#FORMULA#',
       SAVE_TIME   = '#SAVE_TIME#',
       UPDATE_NAME = '#UPDATE_NAME#',
       UPDATE_TIME = SYSDATE
 WHERE CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND WIC = '#WIC#'
   AND INDEX_SEQ = '#INDEX_SEQ#'
         ]]>
	</query>
	 
	<query id="CoreOrderSpecialInfo.getADDASK" desc="获取客户编码">
         <![CDATA[
	      SELECT ? || NVL(LPAD(substr(MAX(A.ADD_ASK_NO),11,6)+1,6,'0'),'000001') FROM SLM_ORDER_ADD_ASK A WHERE A.CUSTOMER_NO = ?
	     ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.addAlphaAskAdd" desc="增加销售附加要求">
         <![CDATA[
 DECLARE
  P_MAX_ASK_ITEM_NO SLM_BASE_ADD_ASK.ASK_ITEM_NO%TYPE;
  P_COUNT           NUMBER(5);
  P_BSE_ADD_ASK_COUNT NUMBER(5);
BEGIN
SELECT COUNT(1) INTO P_BSE_ADD_ASK_COUNT
  FROM SLM_BASE_ADD_ASK T
 WHERE T.ASK_P_ITEM_NO = '#ASK_SUB_ITME#'
   AND T.ASK_ITEM_DESC = '#ASK_SUB_ITME_VAL_DESC#';

  IF P_BSE_ADD_ASK_COUNT = 0 THEN
    SELECT NVL(MAX(T.ASK_ITEM_NO), '#ASK_SUB_ITME#' || '000') + 1
      INTO P_MAX_ASK_ITEM_NO
      FROM SLM_BASE_ADD_ASK T
     WHERE T.ASK_P_ITEM_NO = '#ASK_SUB_ITME#';
    INSERT INTO SLM_BASE_ADD_ASK
      (PIC,
       ASK_P_ITEM_NO,
       VALIDFLAG,
       CREATE_NAME,
       CREATE_TIME,
       ASK_ITEM_NO,
       ASK_ITEM_DESC)
    VALUES
      ('#PIC#',
       '#ASK_SUB_ITME#',
       '1',
       '#CREATE_NAME#',
       SYSDATE,
       P_MAX_ASK_ITEM_NO,
       '#ASK_SUB_ITME_VAL_DESC#');
  ELSE
    SELECT T.ASK_ITEM_NO INTO P_MAX_ASK_ITEM_NO
  FROM SLM_BASE_ADD_ASK T
 WHERE T.ASK_P_ITEM_NO = '#ASK_SUB_ITME#'
   AND T.ASK_ITEM_DESC = '#ASK_SUB_ITME_VAL_DESC#';
  END IF;

  /*SELECT COUNT(1)
    INTO P_COUNT
    FROM SLM_ORDER_ADD_ASK T
   WHERE T.ADD_ASK_NO = '#ADD_ASK_NO#'
     AND T.ASK_ITME = '#ASK_ITME_OLD#'
     AND T.ASK_SUB_ITME = '#ASK_SUB_ITME_OLD#';
  IF P_COUNT = 0 THEN*/
    INSERT INTO SLM_ORDER_ADD_ASK
      (ADD_ASK_NO,
       ASK_ITME,
       ASK_ITME_DESC,
       ASK_SUB_ITME,
       ASK_SUB_ITME_DESC,
       ASK_SUB_ITME_VAL,
       ASK_SUB_ITME_VAL_DESC,
       PIC,
       CUSTOMER_NO,
       CUSTOMER_NM,
       PSC,
       PSC_DESC,
       VALIDFLAG,
       CREATE_NAME,
       CREATE_TIME,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME,
       ADD_ASK_STATUS)
    VALUES
      ('#MAX_ADD_ASK_NO#',
       '#ASK_ITME#',
       '#ASK_ITME_DESC#',
       '#ASK_SUB_ITME#',
       '#ASK_SUB_ITME_DESC#',
       P_MAX_ASK_ITEM_NO,
       '#ASK_SUB_ITME_VAL_DESC#',
       '#PIC#',
       '#CUSTOMER_NO#',
       '#CUSTOMER_NM#',
       '#PSC#',
       '#PSC_DESC#',
       DEFAULT,
       '#CREATE_NAME#',
       SYSDATE,
       '',
       NULL,
       '',
       NULL,
       '#ADD_ASK_STATUS#');
/*  ELSE
    UPDATE SLM_ORDER_ADD_ASK
       SET ASK_ITME              = '#ASK_ITME#',
           ASK_ITME_DESC         = '#ASK_ITME_DESC#',
           ASK_SUB_ITME          = '#ASK_SUB_ITME#',
           ASK_SUB_ITME_DESC     = '#ASK_SUB_ITME_DESC#',
           ASK_SUB_ITME_VAL      = P_MAX_ASK_ITEM_NO,
           ASK_SUB_ITME_VAL_DESC = '#ASK_SUB_ITME_VAL_DESC#',
           PIC                   = '#PIC#',
           UPDATE_NAME           = '#UPDATE_NAME#',
           UPDATE_TIME           = SYSDATE
     WHERE ADD_ASK_NO = '#ADD_ASK_NO#'
       AND ASK_ITME = '#ASK_ITME_OLD#'
       AND ASK_SUB_ITME = '#ASK_SUB_ITME_OLD#'
       AND ADD_ASK_STATUS IN ('W', 'F');
  END IF;*/
END;
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getBaseAddAskCnt" desc="查询基础附加要求数目">
         <![CDATA[
SELECT COUNT(1) COUNT, MAX(T.ASK_ITEM_NO) MAX_VALUE
  FROM SLM_BASE_ADD_ASK T
 WHERE T.ASK_P_ITEM_NO = '#ASK_SUB_ITME#'
   AND T.ASK_ITEM_DESC = '#ASK_SUB_ITME_VAL_DESC#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMaxAskItemNo" desc="查询最大的附加要求码">
         <![CDATA[
SELECT TO_CHAR(NVL(MAX(T.ASK_ITEM_NO), '#ASK_SUB_ITME#' || '00000000') + 1)
      MAX_VALUE
      FROM SLM_BASE_ADD_ASK T
     WHERE T.ASK_P_ITEM_NO = '#ASK_SUB_ITME#'
     AND LENGTH(T.ASK_ITEM_NO) = 16
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.insertBaseAddAsk" desc="新增基础附加要求">
         <![CDATA[
INSERT INTO SLM_BASE_ADD_ASK
      (PIC,
       ASK_P_ITEM_NO,
       VALIDFLAG,
       CREATE_NAME,
       CREATE_TIME,
       ASK_ITEM_NO,
       ASK_ITEM_DESC)
    VALUES
      ('#PIC#',
       '#ASK_SUB_ITME#',
       '1',
       '#CREATE_NAME#',
       SYSDATE,
       '#ASK_ITEM_NO#',
       '#ASK_SUB_ITME_VAL_DESC#')
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.insertOrderAddAsk" desc="增加销售附加要求">
         <![CDATA[
INSERT INTO SLM_ORDER_ADD_ASK
      (ADD_ASK_NO,
       ASK_ITME,
       ASK_ITME_DESC,
       ASK_SUB_ITME,
       ASK_SUB_ITME_DESC,
       ASK_SUB_ITME_VAL,
       ASK_SUB_ITME_VAL_DESC,
       PIC,
       CUSTOMER_NO,
       CUSTOMER_NM,
       PSC,
       PSC_DESC,
       VALIDFLAG,
       CREATE_NAME,
       CREATE_TIME,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME,
       ADD_ASK_STATUS,
       ADD_ASK_TYPE)
    VALUES
      ('#ADD_ASK_NO#',
       '#ASK_ITME#',
       '#ASK_ITME_DESC#',
       '#ASK_SUB_ITME#',
       '#ASK_SUB_ITME_DESC#',
       '#ASK_SUB_ITME_VAL#',
       '#ASK_SUB_ITME_VAL_DESC#',
       '#PIC#',
       '#CUSTOMER_NO#',
       '#CUSTOMER_NM#',
       '#PSC#',
       '#PSC_DESC#',
       DEFAULT,
       '#CREATE_NAME#',
       SYSDATE,
       '',
       NULL,
       '',
       NULL,
       '#ADD_ASK_STATUS#',
       '#ADD_ASK_TYPE#')
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.updateOrderAddAsk" desc="修改销售附加要求">
         <![CDATA[
UPDATE SLM_ORDER_ADD_ASK T
   SET ADD_ASK_TYPE          = '#ADD_ASK_TYPE#',
       ASK_ITME              = '#ASK_ITME#',
       ASK_ITME_DESC         = '#ASK_ITME_DESC#',
       ASK_SUB_ITME          = '#ASK_SUB_ITME#',
       ASK_SUB_ITME_DESC     = '#ASK_SUB_ITME_DESC#',
       ASK_SUB_ITME_VAL      = '#ASK_SUB_ITME_VAL#',
       ASK_SUB_ITME_VAL_DESC = '#ASK_SUB_ITME_VAL_DESC#',
       PIC                   = '#PIC#',
       CUSTOMER_NO           = '#CUSTOMER_NO#',
       CUSTOMER_NM           = '#CUSTOMER_NM#',
       PSC                   = '#PSC#',
       PSC_DESC              = '#PSC_DESC#',
       ADD_ASK_STATUS        = '#ADD_ASK_STATUS#',
       VALIDFLAG             = '#VALIDFLAG#',
       UPDATE_NAME           = '#UPDATE_NAME#',
       UPDATE_TIME           = SYSDATE
 WHERE T.ADD_ASK_NO = '#ADD_ASK_NO#'
 AND T.ASK_ITME = '#ASK_ITME#'
 AND T.ASK_SUB_ITME = '#ASK_SUB_ITME#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.addAlphaAskAddRow" desc="增加销售附加要求5.22">
         <![CDATA[
             INSERT INTO SLM_ORDER_ADD_ASK
  (ADD_ASK_NO,
   ASK_ITME,
   ASK_ITME_DESC,
   ASK_SUB_ITME,
   ASK_SUB_ITME_DESC,
   ASK_SUB_ITME_VAL,
   ASK_SUB_ITME_VAL_DESC,
   PIC,
   CUSTOMER_NO,
   CUSTOMER_NM,
   PSC,
   PSC_DESC,
   VALIDFLAG,
   CREATE_NAME,
   CREATE_TIME,
   UPDATE_NAME,
   UPDATE_TIME,
   DELETE_NAME,
   DELETE_TIME)
VALUES
  ((SELECT MAX (a.add_ask_no) FROM slm_order_add_ask a WHERE a.customer_no = ? and ADD_ASK_STATUS IN ('W','F')),
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   ?,
   DEFAULT,
   ?,
   SYSDATE,
   '',
   NULL,
   '',
   NULL)
         ]]>
	</query>
	
	
	
	<query id="CoreOrderSpecialInfo.addCustAlpha" desc="增加客户Alpha">
         <![CDATA[
             INSERT INTO SLM_CUST_ALPHA
  (CUST_ALPHA_NO,
   CUST_ALPHA_DESC,
   CUST_ALPHA_STS,
   VALIDFLAG,
   CREATE_NAME,
   CREATE_TIME,
   UPDATE_NAME,
   UPDATE_TIME,
   DELETE_NAME,
   DELETE_TIME)
VALUES
  ('#CUST_ALPHA_NO#', '#CUST_ALPHA_DESC#', 'W', DEFAULT, '#CREATE_NAME#', SYSDATE, '', NULL, '', NULL)
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.addCustAlphaUse" desc="增加客户编码和最终客户关系">
         <![CDATA[
             INSERT INTO SLM_CUST_ALPHA_USE
  (CUST_ALPHA_NO,
   CHEM_ALPHA_NO,
   VALIDFLAG,
   CREATE_NAME,
   CREATE_TIME,
   UPDATE_NAME,
   UPDATE_TIME,
   DELETE_NAME,
   DELETE_TIME)
VALUES
  ('#CUST_ALPHA_NO#', '#CHEM_ALPHA_NO#', DEFAULT, '#CREATE_NAME#', SYSDATE, NULL, NULL, NULL, NULL)
         ]]>
	</query>

<query id="CoreOrderSpecialInfo.addCustAlphaProCess" desc="增加客户加工标准">
         <![CDATA[  
		INSERT INTO SLM_CUST_ALPHA_PROCESS
  (CUST_ALPHA_NO,
   GIC,
   XH,
   STATION_CODE,
   STATION_DESC,
   PROCESS_CDOE,
   PROCESS_DESC,
   PROCESS_CDOE_C,
   PROCESS_DESC_C,
   VALUE_TEXT,
   VALUE_NUM,
   VALUE_MEMO,
   GROUP_SEQ,
   CREATE_NAME,
   CREATE_TIME)
VALUES
  ('#CUST_ALPHA_NO#',
   (SELECT DECODE(MAX(GIC),
                  '',
                  '#CUST_ALPHA_NO#' || '001',
                  '#CUST_ALPHA_NO#' || LPAD(SUBSTR(MAX(GIC), 14) + 1, 3, '0'))
      FROM SLM_CUST_ALPHA_PROCESS
     WHERE GIC LIKE '#CUST_ALPHA_NO#' || '%'),
   (SELECT DECODE(MAX(XH), '', '1', MAX(XH) + 1)
      FROM SLM_CUST_ALPHA_PROCESS
     WHERE CUST_ALPHA_NO = '#CUST_ALPHA_NO#'),
   '#STATION_CODE#',
   '#STATION_DESC#',
   '#PROCESS_CDOE#',
   '#PROCESS_DESC#',
   '#PROCESS_CDOE_C#',
   '#PROCESS_DESC_C#',
   '#VALUE_TEXT#',
   '#VALUE_NUM#',
   '#VALUE_MEMO#',
   '#GROUP_SEQ#',
   '#CREATE_NAME#',
   SYSDATE)

         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.updateCustAlphaProCess" desc="修改客户加工标准">
         <![CDATA[ 
UPDATE SLM_CUST_ALPHA_PROCESS
   SET STATION_CODE   = '#STATION_CODE#',
       STATION_DESC   = '#STATION_DESC#',
       PROCESS_CDOE   = '#PROCESS_CDOE#',
       PROCESS_DESC   = '#PROCESS_DESC#',
       PROCESS_CDOE_C = '#PROCESS_CDOE_C#',
       PROCESS_DESC_C = '#PROCESS_DESC_C#',
       VALUE_TEXT     = '#VALUE_TEXT#',
       VALUE_NUM      = '#VALUE_NUM#',
       VALUE_MEMO     = '#VALUE_MEMO#',
       GROUP_SEQ      = '#GROUP_SEQ#',
       UPDATE_NAME    = '#UPDATE_NAME#',
       UPDATE_TIME    = sysdate
 WHERE CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND GIC = '#GIC#'
   AND XH = '#XH#'

         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMaxCustAlpha" desc="查询最大客户编码">
         <![CDATA[
          SELECT B.CUST_ALPHA_NO
            FROM SLM_CUST_ALPHA B
           WHERE B.CUST_ALPHA_NO =
                                  (SELECT MAX(A.CUST_ALPHA_NO) CUST_ALPHA_NO
                                     FROM SLM_CUST_ALPHA A
                                    WHERE SUBSTR(A.CUST_ALPHA_NO, 1, 10) like ?||'%')
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getAlphaWaterMaxIndex" desc="查询销售水压标准最大序号">
         <![CDATA[
   SELECT INDEX_SEQ
  FROM SLM_CUST_ALPHA_WATER
 WHERE INDEX_SEQ = (SELECT MAX(A.INDEX_SEQ) INDEX_SEQ
                      FROM SLM_CUST_ALPHA_WATER A
                     WHERE A.CUST_ALPHA_NO = ?) and CUST_ALPHA_NO = ?
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.updateAlphaAddAsk" desc="修改销售附加要求">
         <![CDATA[
DECLARE
P_MAX_ASK_ITEM_NO SLM_BASE_ADD_ASK.ASK_ITEM_NO%TYPE;
BEGIN
IF '#ASK_SUB_ITME_VAL#' = '#ASK_SUB_ITME_VAL_DESC#' THEN
    SELECT NVL(MAX(T.ASK_ITEM_NO), 0) + 1
      INTO P_MAX_ASK_ITEM_NO
      FROM SLM_BASE_ADD_ASK T
     WHERE T.ASK_P_ITEM_NO = '#ASK_SUB_ITME#';
    INSERT INTO SLM_BASE_ADD_ASK
      (PIC,
       ASK_P_ITEM_NO,
       VALIDFLAG,
       CREATE_NAME,
       CREATE_TIME,
       ASK_ITEM_NO,
       ASK_ITEM_DESC)
    VALUES
      ('#PIC#',
       '#ASK_SUB_ITME#',
       '1',
       '#CREATE_NAME#',
       SYSDATE,
       P_MAX_ASK_ITEM_NO,
       '#ASK_SUB_ITME_VAL_DESC#');
  ELSE
    P_MAX_ASK_ITEM_NO := '#ASK_SUB_ITME_VAL#';
  END IF;
UPDATE SLM_ORDER_ADD_ASK
		  SET 
		      ASK_ITME              = '#ASK_ITME#',
		      ASK_ITME_DESC         = '#ASK_ITME_DESC#',
		      ASK_SUB_ITME          = '#ASK_SUB_ITME#',
		      ASK_SUB_ITME_DESC     = 'ASK_SUB_ITME_DESC',
		      ASK_SUB_ITME_VAL      = P_MAX_ASK_ITEM_NO,
		      ASK_SUB_ITME_VAL_DESC = '#ASK_SUB_ITME_VAL_DESC#',
		      PIC                   = '#PIC#',
		      UPDATE_NAME           = '#UPDATE_NAME#',
		      UPDATE_TIME           = SYSDATE
		WHERE ADD_ASK_NO = '#ADD_ASK_NO#' AND ASK_ITME = '#ASK_ITME#' AND ADD_ASK_STATUS IN ('W','F') ;
END;
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.checkAlphaNoPass" desc="验证Alpha编码是否通过审批">
         <![CDATA[
            SELECT 1
  FROM SLM_CUST_ALPHA A
 WHERE A.CUST_ALPHA_NO = ?
   AND A.CUST_ALPHA_STS = 'S'
   AND A.VALIDFLAG = 1
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getDesc" desc="获取编码对应的描述">
         <![CDATA[
           SELECT T.CUSTOMER_NM, '用户' FROM SLM_BASE_CUSTOMER T WHERE T.CUSTOMER_NO = '#CUSTOMER_NO#'
			UNION ALL
			SELECT A.PSC_DESC, '产品' FROM COM_PSC A WHERE A.PSC = '#PSC#'
			UNION ALL
			SELECT B.MODEL_DESC, '扣型' FROM COM_BASE_MODEL B WHERE B.MODEL_CODE = '#MODEL_CODE#'
         ]]>
	</query>
	
	
	<query id="CoreOrderSpecialInfo.getStdCode" desc="获取标准代码">
         <![CDATA[
           SELECT T.STD_CODE, 'PSC', T.STD_NAME
			  FROM COM_PSC T
			 WHERE T.PSC = '#PSC#'
			UNION ALL
			SELECT A.CUSTOMER_NM, 'USER', ''
			  FROM SLM_BASE_CUSTOMER A
			 WHERE A.CUSTOMER_NO = '#CUSTOMER_NO#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getAddAskState" desc="获取附加要求状态">
         <![CDATA[
           SELECT T.ADD_ASK_STATUS, T.REVIEW_F_RS FROM SLM_ORDER_ADD_ASK T WHERE T.ADD_ASK_NO = '#ADD_ASK_NO#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.isExistAddAsk" desc="是否存在附加要求">
         <![CDATA[
           SELECT COUNT(1)
  FROM SLM_ORDER_ADD_ASK T
 WHERE T.ADD_ASK_NO = '#ADD_ASK_NO#'
   AND T.ASK_ITME = '#ASK_ITME#'
   AND T.ASK_SUB_ITME = '#ASK_SUB_ITME#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.insertBaseAdditional" desc="新增附加要求（标准）">
         <![CDATA[
             INSERT INTO COM_BASE_ADDITIONAL(
        ASK_SUB_ITME_DESC,
        ASK_SUB_ITME_VAL,
        ASK_SUB_ITME_VAL_DESC,
        PIC,
        STD_CODE,
        STD_NAME,
        ASK_ITME,
        ASK_ITME_DESC,
        ASK_SUB_ITME,
        CREATE_NAME,
        CREATE_TIME,
        VALIDFLAG,
        MEMO)
 VALUES( 
        '#ASK_SUB_ITME_DESC#',
        '#ASK_SUB_ITME_VAL#',
        '#ASK_SUB_ITME_VAL_DESC#',
        '#PIC#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#ASK_ITME#',
        '#ASK_ITME_DESC#',
        '#ASK_SUB_ITME#',
        '#CREATE_NAME#',
        SYSDATE,
        '1',
        '#MEMO#')
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.updateOrderAddAskState" desc="修改销售评审状态">
         <![CDATA[
             UPDATE SLM_ORDER_ADD_ASK T
			   SET T.ADD_ASK_STATUS = '#ADD_ASK_STATUS#',
			       T.UPDATE_NAME    = '#UPDATE_NAME#',
			       T.UPDATE_TIME    = SYSDATE,
			       T.REVIEW_F_RS    = '#REVIEW_F_RS#'
			 WHERE T.ADD_ASK_NO = '#ADD_ASK_NO#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.insertDesignAddAskSts" desc="新增质量设计附加要求评审状态">
         <![CDATA[
INSERT INTO SLM_ORD_DESIGN_ADD_ASK_STS(ORD_LN_PK, STATE) VALUES({0}, {1})
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.deleteDesignAddAskSts" desc="删除质量设计附加要求评审状态">
         <![CDATA[
DELETE FROM SLM_ORD_DESIGN_ADD_ASK_STS T WHERE T.ORD_LN_PK = {0}
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getAddAdditionalCount" desc="获取标准附加要求数目">
         <![CDATA[
             SELECT COUNT(1) COUNT
		        FROM COM_BASE_ADDITIONAL T
		       WHERE T.STD_CODE = '#STD_CODE#'
		         AND T.ASK_ITME = '#ASK_ITME#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.updateAddAdditional" desc="修改标准附加要求">
         <![CDATA[
              UPDATE COM_BASE_ADDITIONAL
			   SET 
			        ASK_SUB_ITME_DESC = '#ASK_SUB_ITME_DESC#',
			        ASK_SUB_ITME_VAL = '#ASK_SUB_ITME_VAL#',
			        ASK_SUB_ITME_VAL_DESC = '#ASK_SUB_ITME_VAL_DESC#',
			        PIC = '#PIC#',
			        STD_CODE = '#STD_CODE#',
			        STD_NAME = '#STD_NAME#',
			        ASK_ITME = '#ASK_ITME#',
			        ASK_ITME_DESC = '#ASK_ITME_DESC#',
			        ASK_SUB_ITME = '#ASK_SUB_ITME#',
			        UPDATE_NAME = '#UPDATE_NAME#',
			        UPDATE_TIME = SYSDATE,
			        VALIDFLAG = '1',
			        MEMO = '#MEMO#'
			 WHERE
			 STD_CODE = '#STD_CODE#'
			 AND ASK_SUB_ITME_VAL = '#ASK_SUB_ITME_VAL#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.updateCustAlphaState" desc="修改客户要求主表状态">
         <![CDATA[
              UPDATE SLM_CUST_ALPHA
			   SET 
			   	    CUST_ALPHA_STS = '#CUST_ALPHA_STS#',
			        VALIDFLAG = '1',
			        UPDATE_NAME = '#UPDATE_NAME#',
			        UPDATE_TIME = SYSDATE
			 WHERE
			 CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
         ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryUnitCodeByPsc" desc="查询PSC表科室">
		<![CDATA[
		SELECT T.UNIT_CODE, T.DEPARTMENT_CODE FROM COM_PSC T WHERE T.PSC = '#PSC#'
		 ]]>
	</query>
	
		<query id="CoreOrderSpecialInfo.queryMscRow" desc="查询冶金规范码">
		<![CDATA[
SELECT T.USE_CODE, T.USE_DESC FROM COM_MSC T WHERE T.MSC = '#MSC#'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.insertAlphaRCust" desc="新增用途码与客户关系">
		<![CDATA[
INSERT INTO COM_BASE_STD_R_CUST
  (STD_CODE, STD_NAME, CUST_CODE, CUST_NAME, CREATE_NAME, CREATE_TIME)
VALUES
  ('#STD_CODE#',
   '#STD_NAME#',
   '#CUST_CODE#',
   '#CUST_NAME#',
   '#CREATE_NAME#',
   SYSDATE)
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.queryAlphaRCustCnt" desc="查询途码与客户关系数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_BASE_STD_R_CUST A, COM_MSC B
 WHERE B.MSC = '#MSC#'
   AND A.STD_CODE = B.USE_CODE
   AND A.CUST_CODE = '#CUST_CODE#'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getCustChem" desc="查询临时成分的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_CHEM T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO2#'
   AND DECODE('#CUST_ALPHA_NO#', NULL, '1', T.CUST_ALPHA_NO) <> DECODE('#CUST_ALPHA_NO#', NULL, '2', '#CUST_ALPHA_NO#')
   AND DECODE('#CHEM_CODE#', NULL, '1', T.CHEM_CODE) =
       DECODE('#CHEM_CODE#', NULL, '1', '#CHEM_CODE#')
   AND DECODE('#CHEM_FORMULA#', NULL, '1', T.CHEM_FORMULA) =
       DECODE('#CHEM_FORMULA#', NULL, '1', '#CHEM_FORMULA#')
   AND DECODE('#STDMIN_SIGN#', NULL, '1', T.STDMIN_SIGN) =
       DECODE('#STDMIN_SIGN#', NULL, '1', '#STDMIN_SIGN#')
   AND DECODE('#STDMIN#', NULL, '1', T.STDMIN) =
       DECODE('#STDMIN#', NULL, '1', '#STDMIN#')
   AND DECODE('#STDMAX_SIGN#', NULL, '1', T.STDMAX_SIGN) =
       DECODE('#STDMAX_SIGN#', NULL, '1', '#STDMAX_SIGN#')
   AND DECODE('#STDMAX#', NULL, '1', T.STDMAX) =
       DECODE('#STDMAX#', NULL, '1', '#STDMAX#')
       AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscChem2" desc="查询Msc成分的数目（是否完全一致）">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_CHEM T
 WHERE T.CIC = '#CIC#'
   AND DECODE('#CHEM_CODE#', NULL, '1', T.CHEM_CODE) =
       DECODE('#CHEM_CODE#', NULL, '1', '#CHEM_CODE#')
   AND DECODE('#STDMIN_SIGN#', NULL, '1', T.STDMIN_SIGN) =
       DECODE('#STDMIN_SIGN#', NULL, '1', '#STDMIN_SIGN#')
   AND DECODE('#STDMIN#', NULL, '1', T.STDMIN) =
       DECODE('#STDMIN#', NULL, '1', '#STDMIN#')
   AND DECODE('#STDMAX_SIGN#', NULL, '1', T.STDMAX_SIGN) =
       DECODE('#STDMAX_SIGN#', NULL, '1', '#STDMAX_SIGN#')
   AND DECODE('#STDMAX#', NULL, '1', T.STDMAX) =
       DECODE('#STDMAX#', NULL, '1', '#STDMAX#')
   AND T.VALIDFLAG = '1'
   AND DECODE('#SPEC_JG#', NULL, '1', T.SPEC_JG) =
       DECODE('#SPEC_JG#', NULL, '1', '#SPEC_JG#')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.SIZE_NAME NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) =
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.SIZE_NAME2 NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN2 = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) =
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN2 = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN2 = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscChem3" desc="查询Msc成分的数目（排除扣型是否完全一致）">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_CHEM T
 WHERE T.CIC = '#CIC#'
   AND DECODE('#CHEM_CODE#', NULL, '1', T.CHEM_CODE) =
       DECODE('#CHEM_CODE#', NULL, '1', '#CHEM_CODE#')
   AND DECODE('#STDMIN_SIGN#', NULL, '1', T.STDMIN_SIGN) =
       DECODE('#STDMIN_SIGN#', NULL, '1', '#STDMIN_SIGN#')
   AND DECODE('#STDMIN#', NULL, '1', T.STDMIN) =
       DECODE('#STDMIN#', NULL, '1', '#STDMIN#')
   AND DECODE('#STDMAX_SIGN#', NULL, '1', T.STDMAX_SIGN) =
       DECODE('#STDMAX_SIGN#', NULL, '1', '#STDMAX_SIGN#')
   AND DECODE('#STDMAX#', NULL, '1', T.STDMAX) =
       DECODE('#STDMAX#', NULL, '1', '#STDMAX#')
   AND T.VALIDFLAG = '1'
   AND REGEXP_LIKE(NVL(T.SIZE_MIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.SIZE_NAME NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) =
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.SIZE_NAME2 NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN2 = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) =
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN2 = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN2 = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscChem1" desc="查询Msc成分的数目(项目是否一致)">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_CHEM T
 WHERE T.CIC = '#CIC#'
   AND DECODE('#CHEM_CODE#', NULL, '1', T.CHEM_CODE) =
       DECODE('#CHEM_CODE#', NULL, '1', '#CHEM_CODE#')
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscChem4" desc="查询Msc成分的数目（排除值）">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_CHEM T, COM_MSC_STD_CIC A
 WHERE T.CIC = '#CIC#'
   AND T.CIC = A.CIC
   AND A.VALIDFLAG <> 0
   AND (INSTR(A.MODEL_CODE, '#MODEL_CODE#') > 0 OR INSTR(A.MODEL_CODE, '#MODEL_CODE#') IS NULL
        OR INSTR(A.MODEL_CODE, 'C001') > 0)
   AND DECODE('#CHEM_CODE#', NULL, '1', T.CHEM_CODE) =
       DECODE('#CHEM_CODE#', NULL, '1', '#CHEM_CODE#')
   AND T.VALIDFLAG = '1'
   AND REGEXP_LIKE(NVL(T.SIZE_MIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.SIZE_NAME NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) =
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.SIZE_NAME2 NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN2 = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) =
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN2 = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN2 = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscChem5" desc="查询Msc成分的数目（包含扣型）">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_CHEM T, COM_MSC_STD_CIC A
 WHERE T.CIC = '#CIC#'
   AND A.CIC = T.CIC
   AND (INSTR(A.MODEL_CODE, '#MODEL_CODE#') > 0 OR INSTR(A.MODEL_CODE, '#MODEL_CODE#') IS NULL
        OR INSTR(A.MODEL_CODE, 'C001') > 0)
   AND A.VALIDFLAG <> '0'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscChem6" desc="查询Msc成分的数目（包含扣型）">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_CHEM T
 WHERE T.CIC = '#CIC#'
   AND DECODE('#CHEM_CODE#', NULL, '1', T.CHEM_CODE) =
       DECODE('#CHEM_CODE#', NULL, '1', '#CHEM_CODE#')
   AND DECODE('#SPEC_JG#', NULL, '1', T.SPEC_JG) =
       DECODE('#SPEC_JG#', NULL, '1', '#SPEC_JG#')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.SIZE_NAME NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) =
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.SIZE_NAME2 NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN2 = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) =
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN2 = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN2 = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getCustPhy" desc="查询临时理化的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_PHY T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO2#'
   AND DECODE('#CUST_ALPHA_NO#', NULL, '1', T.CUST_ALPHA_NO) <> DECODE('#CUST_ALPHA_NO#', NULL, '2', '#CUST_ALPHA_NO#')
   AND DECODE('#PHY_CODE_MAX#', NULL, '1', T.PHY_CODE_MAX) =
       DECODE('#PHY_CODE_MAX#', NULL, '1', '#PHY_CODE_MAX#')
   AND DECODE('#PHY_CODE_MIN#', NULL, '1', T.PHY_CODE_MIN) =
       DECODE('#PHY_CODE_MIN#', NULL, '1', '#PHY_CODE_MIN#')
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#ITEM_CODE_F#', NULL, '1', T.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_W#', NULL, '1', T.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_S#', NULL, '1', T.ITEM_CODE_S) =
       DECODE('#ITEM_CODE_S#', NULL, '1', '#ITEM_CODE_S#')
   AND DECODE('#STDMIN_SIGN#', NULL, '1', T.STDMIN_SIGN) =
       DECODE('#STDMIN_SIGN#', NULL, '1', '#STDMIN_SIGN#')
   AND DECODE('#STDMIN#', NULL, '1', T.STDMIN) =
       DECODE('#STDMIN#', NULL, '1', '#STDMIN#')
   AND DECODE('#STDMAX_SIGN#', NULL, '1', T.STDMAX_SIGN) =
       DECODE('#STDMAX_SIGN#', NULL, '1', '#STDMAX_SIGN#')
   AND DECODE('#STDMAX#', NULL, '1', T.STDMAX) =
       DECODE('#STDMAX#', NULL, '1', '#STDMAX#')
   AND NVL(T.STD_CHOOSE, '&') = NVL('#STD_CHOOSE#', '&')
   AND NVL(T.STDMIN_SIGN2, '&') = NVL('#STDMIN_SIGN2#', '&')
   AND NVL(T.STDMIN2, '&') = NVL('#STDMIN2#', '&')
   AND NVL(T.STDMAX_SIGN2, '&') = NVL('#STDMAX_SIGN2#', '&')
   AND NVL(T.STDMAX2, '&') = NVL('#STDMAX2#', '&')
   AND NVL(T.ADDCONDITION, '&') = NVL('#ADDCONDITION#', '&')
   AND NVL(T.ADDSTDCON_CODE, '&') = NVL('#ADDSTDCON_CODE#', '&')
   AND NVL(T.ADDSTD_MIN_SIGN, '&') = NVL('#ADDSTD_MIN_SIGN#', '&')
   AND NVL(T.ADDSTD_MIN, '&') = NVL('#ADDSTD_MIN#', '&')
   AND NVL(T.ADDSTD_MAX_SIGN, '&') = NVL('#ADDSTD_MAX_SIGN#', '&')
   AND NVL(T.ADDSTD_MAX, '&') = NVL('#ADDSTD_MAX#', '&')
   AND NVL(T.ADDPERCENT, '-999') = NVL('#ADDPERCENT#', '-999')
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscPhy2" desc="查询Msc理化的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_PHY T
 WHERE T.PIC = '#PIC#'
   AND DECODE('#PHY_CODE_MAX#', NULL, '1', T.PHY_CODE_MAX) =
       DECODE('#PHY_CODE_MAX#', NULL, '1', '#PHY_CODE_MAX#')
   AND DECODE('#PHY_CODE_MIN#', NULL, '1', T.PHY_CODE_MIN) =
       DECODE('#PHY_CODE_MIN#', NULL, '1', '#PHY_CODE_MIN#')
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#ITEM_CODE_F#', NULL, '1', T.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_W#', NULL, '1', T.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_S#', NULL, '1', T.ITEM_CODE_S) =
       DECODE('#ITEM_CODE_S#', NULL, '1', '#ITEM_CODE_S#')
   AND DECODE('#STDMIN_SIGN#', NULL, '1', T.STDMIN_SIGN) =
       DECODE('#STDMIN_SIGN#', NULL, '1', '#STDMIN_SIGN#')
   AND DECODE('#STDMIN#', NULL, '1', T.STDMIN) =
       DECODE('#STDMIN#', NULL, '1', '#STDMIN#')
   AND DECODE('#STDMAX_SIGN#', NULL, '1', T.STDMAX_SIGN) =
       DECODE('#STDMAX_SIGN#', NULL, '1', '#STDMAX_SIGN#')
   AND DECODE('#STDMAX#', NULL, '1', T.STDMAX) =
       DECODE('#STDMAX#', NULL, '1', '#STDMAX#')
   AND NVL(T.STD_CHOOSE, '&') = NVL('#STD_CHOOSE#', '&')
   AND NVL(T.STDMIN_SIGN2, '&') = NVL('#STDMIN_SIGN2#', '&')
   AND NVL(T.STDMIN2, '&') = NVL('#STDMIN2#', '&')
   AND NVL(T.STDMAX_SIGN2, '&') = NVL('#STDMAX_SIGN2#', '&')
   AND NVL(T.STDMAX2, '&') = NVL('#STDMAX2#', '&')
   AND NVL(T.ADDCONDITION, '&') = NVL('#ADDCONDITION#', '&')
   AND NVL(T.ADDSTDCON_CODE, '&') = NVL('#ADDSTDCON_CODE#', '&')
   AND NVL(T.ADDSTD_MIN_SIGN, '&') = NVL('#ADDSTD_MIN_SIGN#', '&')
   AND NVL(T.ADDSTD_MIN, '&') = NVL('#ADDSTD_MIN#', '&')
   AND NVL(T.ADDSTD_MAX_SIGN, '&') = NVL('#ADDSTD_MAX_SIGN#', '&')
   AND NVL(T.ADDSTD_MAX, '&') = NVL('#ADDSTD_MAX#', '&')
   AND NVL(T.ADDPERCENT, '-999') = NVL('#ADDPERCENT#', '-999')
   AND T.VALIDFLAG = '1'
   AND DECODE('#SPEC_JG#', NULL, '1', T.SPEC_JG) =
       DECODE('#SPEC_JG#', NULL, '1', '#SPEC_JG#')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.SIZE_NAME NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) =
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.SIZE_NAME2 NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN2 = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) =
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN2 = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN2 = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscPhy3" desc="查询Msc理化的数目(排除扣型)">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_PHY T
 WHERE T.PIC = '#PIC#'
   AND DECODE('#PHY_CODE_MAX#', NULL, '1', T.PHY_CODE_MAX) =
       DECODE('#PHY_CODE_MAX#', NULL, '1', '#PHY_CODE_MAX#')
   AND DECODE('#PHY_CODE_MIN#', NULL, '1', T.PHY_CODE_MIN) =
       DECODE('#PHY_CODE_MIN#', NULL, '1', '#PHY_CODE_MIN#')
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#ITEM_CODE_F#', NULL, '1', T.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_W#', NULL, '1', T.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_S#', NULL, '1', T.ITEM_CODE_S) =
       DECODE('#ITEM_CODE_S#', NULL, '1', '#ITEM_CODE_S#')
   AND DECODE('#STDMIN_SIGN#', NULL, '1', T.STDMIN_SIGN) =
       DECODE('#STDMIN_SIGN#', NULL, '1', '#STDMIN_SIGN#')
   AND DECODE('#STDMIN#', NULL, '1', T.STDMIN) =
       DECODE('#STDMIN#', NULL, '1', '#STDMIN#')
   AND DECODE('#STDMAX_SIGN#', NULL, '1', T.STDMAX_SIGN) =
       DECODE('#STDMAX_SIGN#', NULL, '1', '#STDMAX_SIGN#')
   AND DECODE('#STDMAX#', NULL, '1', T.STDMAX) =
       DECODE('#STDMAX#', NULL, '1', '#STDMAX#')
   AND T.VALIDFLAG = '1'
   AND REGEXP_LIKE(NVL(T.SIZE_MIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.SIZE_NAME NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) =
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.SIZE_NAME2 NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN2 = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) =
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN2 = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN2 = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscPhy1" desc="查询Msc理化的数目(验证项目是否一致)">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_PHY T
 WHERE T.PIC = '#PIC#'
   AND DECODE('#PHY_CODE_MAX#', NULL, '1', T.PHY_CODE_MAX) =
       DECODE('#PHY_CODE_MAX#', NULL, '1', '#PHY_CODE_MAX#')
   AND DECODE('#PHY_CODE_MIN#', NULL, '1', T.PHY_CODE_MIN) =
       DECODE('#PHY_CODE_MIN#', NULL, '1', '#PHY_CODE_MIN#')
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#ITEM_CODE_F#', NULL, '1', T.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_W#', NULL, '1', T.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_S#', NULL, '1', T.ITEM_CODE_S) =
       DECODE('#ITEM_CODE_S#', NULL, '1', '#ITEM_CODE_S#')
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscPhy4" desc="查询Msc理化的数目(不包含值)">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_PHY T, COM_MSC_STD_PIC A
 WHERE T.PIC = '#PIC#'
   AND T.PIC = A.PIC
   AND A.VALIDFLAG <> 0
   AND (INSTR(A.MODEL_CODE, '#MODEL_CODE#') > 0 OR INSTR(A.MODEL_CODE, '#MODEL_CODE#') IS NULL
        OR INSTR(A.MODEL_CODE, 'C001') > 0)
   AND DECODE('#PHY_CODE_MAX#', NULL, '1', T.PHY_CODE_MAX) =
       DECODE('#PHY_CODE_MAX#', NULL, '1', '#PHY_CODE_MAX#')
   AND DECODE('#PHY_CODE_MIN#', NULL, '1', T.PHY_CODE_MIN) =
       DECODE('#PHY_CODE_MIN#', NULL, '1', '#PHY_CODE_MIN#')
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#ITEM_CODE_F#', NULL, '1', T.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_W#', NULL, '1', T.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_S#', NULL, '1', T.ITEM_CODE_S) =
       DECODE('#ITEM_CODE_S#', NULL, '1', '#ITEM_CODE_S#')
   AND T.VALIDFLAG = '1'
   AND REGEXP_LIKE(NVL(T.SIZE_MIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.SIZE_NAME NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) =
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.SIZE_NAME2 NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN2 = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) =
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN2 = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN2 = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscPhy5" desc="查询Msc理化的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_PHY T, COM_MSC_STD_PIC A
 WHERE T.PIC = '#PIC#'
   AND A.PIC = T.PIC
   AND (INSTR(A.MODEL_CODE, '#MODEL_CODE#') > 0 OR INSTR(A.MODEL_CODE, '#MODEL_CODE#') IS NULL
        OR INSTR(A.MODEL_CODE, 'C001') > 0)
   AND A.VALIDFLAG <> 0
   AND DECODE('#PHY_CODE_MAX#', NULL, '1', T.PHY_CODE_MAX) =
       DECODE('#PHY_CODE_MAX#', NULL, '1', '#PHY_CODE_MAX#')
   AND DECODE('#PHY_CODE_MIN#', NULL, '1', T.PHY_CODE_MIN) =
       DECODE('#PHY_CODE_MIN#', NULL, '1', '#PHY_CODE_MIN#')
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#ITEM_CODE_F#', NULL, '1', T.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_W#', NULL, '1', T.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_S#', NULL, '1', T.ITEM_CODE_S) =
       DECODE('#ITEM_CODE_S#', NULL, '1', '#ITEM_CODE_S#')
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscPhy6" desc="查询Msc理化的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_PHY T
 WHERE T.PIC = '#PIC#'
   AND DECODE('#PHY_CODE_MAX#', NULL, '1', T.PHY_CODE_MAX) =
       DECODE('#PHY_CODE_MAX#', NULL, '1', '#PHY_CODE_MAX#')
   AND DECODE('#PHY_CODE_MIN#', NULL, '1', T.PHY_CODE_MIN) =
       DECODE('#PHY_CODE_MIN#', NULL, '1', '#PHY_CODE_MIN#')
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#ITEM_CODE_F#', NULL, '1', T.ITEM_CODE_F) =
       DECODE('#ITEM_CODE_F#', NULL, '1', '#ITEM_CODE_F#')
   AND DECODE('#ITEM_CODE_W#', NULL, '1', T.ITEM_CODE_W) =
       DECODE('#ITEM_CODE_W#', NULL, '1', '#ITEM_CODE_W#')
   AND DECODE('#ITEM_CODE_S#', NULL, '1', T.ITEM_CODE_S) =
       DECODE('#ITEM_CODE_S#', NULL, '1', '#ITEM_CODE_S#')
   AND T.VALIDFLAG = '1'
   AND DECODE('#SPEC_JG#', NULL, '1', T.SPEC_JG) =
       DECODE('#SPEC_JG#', NULL, '1', '#SPEC_JG#')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MIN2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SIZE_MAX2, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.SIZE_NAME NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) =
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.SIZE_NAME2 NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SIZE_MIN_SIGN2 = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) =
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MIN_SIGN2 = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MIN2) <=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SIZE_MAX_SIGN2 = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SIZE_MAX_SIGN2 = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SIZE_MAX2) >=
                 TO_NUMBER(DECODE(T.SIZE_NAME2,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getCustSpec" desc="查询临时公差的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_SPEC T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO2#'
   AND DECODE('#CUST_ALPHA_NO#', NULL, '1', T.CUST_ALPHA_NO) <> DECODE('#CUST_ALPHA_NO#', NULL, '2', '#CUST_ALPHA_NO#')
   AND DECODE('#BIAS_CODE#', NULL, '1', T.BIAS_CODE) =
       DECODE('#BIAS_CODE#', NULL, '1', '#BIAS_CODE#')
   AND DECODE('#STD_MIN_VAL#', NULL, 1, TO_NUMBER(T.STD_MIN_VAL)) =
       DECODE('#STD_MIN_VAL#', NULL, 1, TO_NUMBER('#STD_MIN_VAL#'))
   AND DECODE('#STD_MAX_VAL#', NULL, 1, TO_NUMBER(T.STD_MAX_VAL)) =
       DECODE('#STD_MAX_VAL#', NULL, 1, TO_NUMBER('#STD_MAX_VAL#'))
   AND DECODE('#STD_MIN_PERCENT#', NULL, 1, TO_NUMBER(T.STD_MIN_PERCENT)) =
       DECODE('#STD_MIN_PERCENT#', NULL, 1, TO_NUMBER('#STD_MIN_PERCENT#'))
   AND DECODE('#STD_MAX_PERCENT#', NULL, 1, TO_NUMBER(T.STD_MAX_PERCENT)) =
       DECODE('#STD_MAX_PERCENT#', NULL, 1, TO_NUMBER('#STD_MAX_PERCENT#'))
   AND DECODE('#STD_MIN_FORMULA_V#', NULL, '1', T.STD_MIN_FORMULA_V) =
       DECODE('#STD_MIN_FORMULA_V#', NULL, '1', '#STD_MIN_FORMULA_V#')
   AND DECODE('#STD_MAX_FORMULA_V#', NULL, '1', T.STD_MAX_FORMULA_V) =
       DECODE('#STD_MAX_FORMULA_V#', NULL, '1', '#STD_MAX_FORMULA_V#')
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscSpec2" desc="查询Msc公差的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_SPEC_C T
 WHERE T.SIC = '#SIC#'
   AND DECODE('#BIAS_CODE#', NULL, '1', T.BIAS_CODE) =
       DECODE('#BIAS_CODE#', NULL, '1', '#BIAS_CODE#')
   AND DECODE('#STD_MIN_VAL#', NULL, 1, TO_NUMBER(T.STD_MIN_VAL)) =
       DECODE('#STD_MIN_VAL#', NULL, 1, TO_NUMBER('#STD_MIN_VAL#'))
   AND DECODE('#STD_MAX_VAL#', NULL, 1, TO_NUMBER(T.STD_MAX_VAL)) =
       DECODE('#STD_MAX_VAL#', NULL, 1, TO_NUMBER('#STD_MAX_VAL#'))
   AND DECODE('#STD_MIN_PERCENT#', NULL, 1, TO_NUMBER(T.STD_MIN_PERCENT)) =
       DECODE('#STD_MIN_PERCENT#', NULL, 1, TO_NUMBER('#STD_MIN_PERCENT#'))
   AND DECODE('#STD_MAX_PERCENT#', NULL, 1, TO_NUMBER(T.STD_MAX_PERCENT)) =
       DECODE('#STD_MAX_PERCENT#', NULL, 1, TO_NUMBER('#STD_MAX_PERCENT#'))
   AND DECODE('#STD_MIN_FORMULA_V#', NULL, '1', T.STD_MIN_FORMULA_V) =
       DECODE('#STD_MIN_FORMULA_V#', NULL, '1', '#STD_MIN_FORMULA_V#')
   AND DECODE('#STD_MAX_FORMULA_V#', NULL, '1', T.STD_MAX_FORMULA_V) =
       DECODE('#STD_MAX_FORMULA_V#', NULL, '1', '#STD_MAX_FORMULA_V#')
   AND T.VALIDFLAG = '1'
   AND REGEXP_LIKE(NVL(T.ZMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.ZMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.CMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.CMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.BIAS_NAME_Z NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.ZMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.ZMIN) =
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.ZMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.ZMIN) <
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.ZMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.ZMIN) <=
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.ZMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.ZMAX) >
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.ZMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.ZMAX) >=
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.BIAS_NAME_C NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.CMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.CMIN) =
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.CMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.CMIN) <
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.CMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.CMIN) <=
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.CMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.CMAX) >
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.CMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.CMAX) >=
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1)
       
       AND
       (T.BIAS_NAME_S NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SMIN) =
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SMIN) <
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SMIN) <=
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SMAX) >
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SMAX) >=
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscSpec3" desc="查询Msc公差的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_SPEC_C T
 WHERE T.SIC = '#SIC#'
   AND DECODE('#BIAS_CODE#', NULL, '1', T.BIAS_CODE) =
       DECODE('#BIAS_CODE#', NULL, '1', '#BIAS_CODE#')
   AND DECODE('#STD_MIN_VAL#', NULL, '1', T.STD_MIN_VAL) =
       DECODE('#STD_MIN_VAL#', NULL, '1', '#STD_MIN_VAL#')
   AND DECODE('#STD_MAX_VAL#', NULL, '1', T.STD_MAX_VAL) =
       DECODE('#STD_MAX_VAL#', NULL, '1', '#STD_MAX_VAL#')
   AND DECODE('#STD_MIN_PERCENT#', NULL, '1', T.STD_MIN_PERCENT) =
       DECODE('#STD_MIN_PERCENT#', NULL, '1', '#STD_MIN_PERCENT#')
   AND DECODE('#STD_MAX_PERCENT#', NULL, '1', T.STD_MAX_PERCENT) =
       DECODE('#STD_MAX_PERCENT#', NULL, '1', '#STD_MAX_PERCENT#')
   AND DECODE('#STD_MIN_FORMULA_V#', NULL, '1', T.STD_MIN_FORMULA_V) =
       DECODE('#STD_MIN_FORMULA_V#', NULL, '1', '#STD_MIN_FORMULA_V#')
   AND DECODE('#STD_MAX_FORMULA_V#', NULL, '1', T.STD_MAX_FORMULA_V) =
       DECODE('#STD_MAX_FORMULA_V#', NULL, '1', '#STD_MAX_FORMULA_V#')
   AND T.VALIDFLAG = '1'
   AND REGEXP_LIKE(NVL(T.ZMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.ZMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.CMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.CMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.BIAS_NAME_Z NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.ZMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.ZMIN) =
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.ZMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.ZMIN) <
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.ZMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.ZMIN) <=
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.ZMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.ZMAX) >
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.ZMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.ZMAX) >=
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.BIAS_NAME_C NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.CMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.CMIN) =
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.CMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.CMIN) <
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.CMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.CMIN) <=
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.CMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.CMAX) >
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.CMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.CMAX) >=
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1)
       
       AND
       (T.BIAS_NAME_S NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SMIN) =
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SMIN) <
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SMIN) <=
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SMAX) >
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SMAX) >=
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscSpec1" desc="查询Msc公差的数目(验证项目是否一致)">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_SPEC_C T
 WHERE T.SIC = '#SIC#'
   AND DECODE('#BIAS_CODE#', NULL, '1', T.BIAS_CODE) =
       DECODE('#BIAS_CODE#', NULL, '1', '#BIAS_CODE#')
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscSpec4" desc="查询Msc公差的数目（排除值）">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_SPEC_C T, COM_MSC_STD_SPEC A
 WHERE T.SIC = '#SIC#'
   AND A.SIC = T.SIC
   AND A.VALIDFLAG <> 0
   AND (INSTR(A.MODEL_CODE, '#MODEL_CODE#') > 0 OR INSTR(A.MODEL_CODE, '#MODEL_CODE#') IS NULL
        OR INSTR(A.MODEL_CODE, 'C001') > 0)
   AND DECODE('#BIAS_CODE#', NULL, '1', T.BIAS_CODE) =
       DECODE('#BIAS_CODE#', NULL, '1', '#BIAS_CODE#')
   AND T.VALIDFLAG = '1'
   AND REGEXP_LIKE(NVL(T.ZMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.ZMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.CMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.CMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.BIAS_NAME_Z NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.ZMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.ZMIN) =
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.ZMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.ZMIN) <
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.ZMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.ZMIN) <=
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.ZMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.ZMAX) >
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.ZMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.ZMAX) >=
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.BIAS_NAME_C NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.CMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.CMIN) =
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.CMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.CMIN) <
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.CMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.CMIN) <=
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.CMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.CMAX) >
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.CMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.CMAX) >=
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1)
       
       AND
       (T.BIAS_NAME_S NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SMIN) =
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SMIN) <
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SMIN) <=
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SMAX) >
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SMAX) >=
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscSpec5" desc="查询Msc公差的数目（排除值）">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_SPEC_C T, COM_MSC_STD_SPEC A
 WHERE T.SIC = '#SIC#'
   AND A.SIC = T.SIC
   AND A.VALIDFLAG <> 0
   AND (INSTR(A.MODEL_CODE, '#MODEL_CODE#') > 0 OR INSTR(A.MODEL_CODE, '#MODEL_CODE#') IS NULL
        OR INSTR(A.MODEL_CODE, 'C001') > 0)
   AND DECODE('#BIAS_CODE#', NULL, '1', T.BIAS_CODE) =
       DECODE('#BIAS_CODE#', NULL, '1', '#BIAS_CODE#')
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscSpec6" desc="查询Msc公差的数目（排除Model）">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_SPEC_C T
 WHERE T.SIC = '#SIC#'
   AND DECODE('#BIAS_CODE#', NULL, '1', T.BIAS_CODE) =
       DECODE('#BIAS_CODE#', NULL, '1', '#BIAS_CODE#')
   AND T.VALIDFLAG = '1'
   AND REGEXP_LIKE(NVL(T.ZMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.ZMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.CMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.CMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SMIN, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND REGEXP_LIKE(NVL(T.SMAX, 1), '(^[ -]?\d{0,}\.?\d{0,}$)')
   AND ('#DIMATER#' IS NULL OR
       (T.BIAS_NAME_Z NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.ZMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.ZMIN) =
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.ZMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.ZMIN) <
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.ZMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.ZMIN) <=
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.ZMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.ZMAX) >
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.ZMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.ZMAX) >=
                 TO_NUMBER(DECODE(T.BIAS_NAME_Z,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1) AND
       (T.BIAS_NAME_C NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.CMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.CMIN) =
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.CMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.CMIN) <
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.CMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.CMIN) <=
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.CMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.CMAX) >
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.CMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.CMAX) >=
                 TO_NUMBER(DECODE(T.BIAS_NAME_C,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1)
       
       AND
       (T.BIAS_NAME_S NOT IN ('外径', '壁厚', '径壁比', '壁径比', '内径') OR CASE
         WHEN T.SMIN_SIGN = '=' THEN
          CASE
            WHEN TO_NUMBER(T.SMIN) =
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SMIN_SIGN = '>' THEN
          CASE
            WHEN TO_NUMBER(T.SMIN) <
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SMIN_SIGN = '>=' THEN
          CASE
            WHEN TO_NUMBER(T.SMIN) <=
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1 AND CASE
         WHEN T.SMAX_SIGN = '<' THEN
          CASE
            WHEN TO_NUMBER(T.SMAX) >
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         WHEN T.SMAX_SIGN = '<=' THEN
          CASE
            WHEN TO_NUMBER(T.SMAX) >=
                 TO_NUMBER(DECODE(T.BIAS_NAME_S,
                                  '外径',
                                  '#DIMATER#',
                                  '壁厚',
                                  '#HEIGHT#',
                                  '径壁比',
                                  '#DIMATER/HEIGHT#',
                                  '壁径比',
                                  '#HEIGHT/DIMATER#',
                                  '内径',
                                  '#DIMATER-HEIGHT#')) THEN
             1
            ELSE
             2
          END
         ELSE
          1
       END = 1))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getCustDetection" desc="查询临时探伤的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_DETECTION T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO2#'
   AND DECODE('#CUST_ALPHA_NO#', NULL, '1', T.CUST_ALPHA_NO) <> DECODE('#CUST_ALPHA_NO#', NULL, '2', '#CUST_ALPHA_NO#')
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#POSITION_CODE#', NULL, '1', T.POSITION_CODE) =
       DECODE('#POSITION_CODE#', NULL, '1', '#POSITION_CODE#')
   AND DECODE('#STD_DESC#', NULL, '1', T.STD_DESC) =
       DECODE('#STD_DESC#', NULL, '1', '#STD_DESC#')
   AND DECODE('#LV_CODE#', NULL, '1', T.LV_CODE) =
       DECODE('#LV_CODE#', NULL, '1', '#LV_CODE#')
   AND DECODE('#COVERAGE#', NULL, 1, TO_NUMBER(T.COVERAGE)) =
       DECODE('#COVERAGE#', NULL, 1, TO_NUMBER('#COVERAGE#'))
   AND DECODE('#GROOVE_DIR#', NULL, '1', T.GROOVE_DIR) =
       DECODE('#GROOVE_DIR#', NULL, '1', '#GROOVE_DIR#')
   AND DECODE('#GROOVE_POS#', NULL, '1', T.GROOVE_POS) =
       DECODE('#GROOVE_POS#', NULL, '1', '#GROOVE_POS#')
   AND DECODE('#RATE#', NULL, '1', T.RATE) =
       DECODE('#RATE#', NULL, '1', '#RATE#')
   AND DECODE('#DESC_VAL#', NULL, 1, TO_NUMBER(T.DESC_VAL)) =
       DECODE('#DESC_VAL#', NULL, 1, TO_NUMBER('#DESC_VAL#'))
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscDetection2" desc="查询Msc探伤的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_DETECTION_C T
 WHERE T.DIC = '#DIC#'
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#POSITION_CODE#', NULL, '1', T.POSITION_CODE) =
       DECODE('#POSITION_CODE#', NULL, '1', '#POSITION_CODE#')
   AND DECODE('#STD_DESC#', NULL, '1', T.STD_DESC) =
       DECODE('#STD_DESC#', NULL, '1', '#STD_DESC#')
   AND DECODE('#LV_CODE#', NULL, '1', T.LV_CODE) =
       DECODE('#LV_CODE#', NULL, '1', '#LV_CODE#')
   AND DECODE('#COVERAGE#', NULL, 1, TO_NUMBER(T.COVERAGE)) =
       DECODE('#COVERAGE#', NULL, 1, TO_NUMBER('#COVERAGE#'))
   AND DECODE('#GROOVE_DIR#', NULL, '1', T.GROOVE_DIR) =
       DECODE('#GROOVE_DIR#', NULL, '1', '#GROOVE_DIR#')
   AND DECODE('#GROOVE_POS#', NULL, '1', T.GROOVE_POS) =
       DECODE('#GROOVE_POS#', NULL, '1', '#GROOVE_POS#')
   AND DECODE('#RATE#', NULL, '1', T.RATE) =
       DECODE('#RATE#', NULL, '1', '#RATE#')
   AND DECODE('#DESC_VAL#', NULL, 1, TO_NUMBER(T.DESC_VAL)) =
       DECODE('#DESC_VAL#', NULL, 1, TO_NUMBER('#DESC_VAL#'))
   AND ('#DIMATER#' IS NULL OR
          DECODE(T.MIN_D, NULL, 1, TO_NUMBER(T.MIN_D)) <=
          DECODE(T.MIN_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
          DECODE(T.MAX_D, NULL, 1, TO_NUMBER(T.MAX_D)) >=
          DECODE(T.MAX_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
          DECODE(T.MIN_H, NULL, 1, TO_NUMBER(T.MIN_H)) <=
          DECODE(T.MIN_H, NULL, 1, TO_NUMBER('#HEIGHT#')) AND
          DECODE(T.MAX_H, NULL, 1, TO_NUMBER(T.MAX_H)) >=
          DECODE(T.MAX_H, NULL, 1, TO_NUMBER('#HEIGHT#')))
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscDetection3" desc="查询Msc探伤的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_DETECTION_C T
 WHERE T.DIC = '#DIC#'
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#POSITION_CODE#', NULL, '1', T.POSITION_CODE) =
       DECODE('#POSITION_CODE#', NULL, '1', '#POSITION_CODE#')
   AND DECODE('#STD_DESC#', NULL, '1', T.STD_DESC) =
       DECODE('#STD_DESC#', NULL, '1', '#STD_DESC#')
   AND DECODE('#LV_CODE#', NULL, '1', T.LV_CODE) =
       DECODE('#LV_CODE#', NULL, '1', '#LV_CODE#')
   AND DECODE('#COVERAGE#', NULL, '1', T.COVERAGE) =
       DECODE('#COVERAGE#', NULL, '1', '#COVERAGE#')
   AND DECODE('#GROOVE_DIR#', NULL, '1', T.GROOVE_DIR) =
       DECODE('#GROOVE_DIR#', NULL, '1', '#GROOVE_DIR#')
   AND DECODE('#GROOVE_POS#', NULL, '1', T.GROOVE_POS) =
       DECODE('#GROOVE_POS#', NULL, '1', '#GROOVE_POS#')
   AND DECODE('#RATE#', NULL, '1', T.RATE) =
       DECODE('#RATE#', NULL, '1', '#RATE#')
   AND DECODE('#DESC_VAL#', NULL, '1', T.DESC_VAL) =
       DECODE('#DESC_VAL#', NULL, '1', '#DESC_VAL#')
   AND ('#DIMATER#' IS NULL OR
          DECODE(T.MIN_D, NULL, 1, TO_NUMBER(T.MIN_D)) <=
          DECODE(T.MIN_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
          DECODE(T.MAX_D, NULL, 1, TO_NUMBER(T.MAX_D)) >=
          DECODE(T.MAX_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
          DECODE(T.MIN_H, NULL, 1, TO_NUMBER(T.MIN_H)) <=
          DECODE(T.MIN_H, NULL, 1, TO_NUMBER('#HEIGHT#')) AND
          DECODE(T.MAX_H, NULL, 1, TO_NUMBER(T.MAX_H)) >=
          DECODE(T.MAX_H, NULL, 1, TO_NUMBER('#HEIGHT#')))
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscDetection1" desc="查询Msc探伤的数目(验证项目是否一致)">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_DETECTION_C T
 WHERE T.DIC = '#DIC#'
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#POSITION_CODE#', NULL, '1', T.POSITION_CODE) =
       DECODE('#POSITION_CODE#', NULL, '1', '#POSITION_CODE#')
   AND DECODE('#STD_DESC#', NULL, '1', T.STD_DESC) =
       DECODE('#STD_DESC#', NULL, '1', '#STD_DESC#')
   AND DECODE('#LV_CODE#', NULL, '1', T.LV_CODE) =
       DECODE('#LV_CODE#', NULL, '1', '#LV_CODE#')
   AND DECODE('#COVERAGE#', NULL, 1, TO_NUMBER(T.COVERAGE)) =
       DECODE('#COVERAGE#', NULL, 1, TO_NUMBER('#COVERAGE#'))
   AND DECODE('#GROOVE_DIR#', NULL, '1', T.GROOVE_DIR) =
       DECODE('#GROOVE_DIR#', NULL, '1', '#GROOVE_DIR#')
   AND DECODE('#GROOVE_POS#', NULL, '1', T.GROOVE_POS) =
       DECODE('#GROOVE_POS#', NULL, '1', '#GROOVE_POS#')
   AND DECODE('#RATE#', NULL, '1', T.RATE) =
       DECODE('#RATE#', NULL, '1', '#RATE#')
   AND DECODE('#DESC_VAL#', NULL, 1, TO_NUMBER(T.DESC_VAL)) =
       DECODE('#DESC_VAL#', NULL, 1, TO_NUMBER('#DESC_VAL#'))
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscDetection4" desc="查询Msc探伤的数目(不带值)">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_DETECTION_C T, COM_MSC_STD_DETECTION A
 WHERE T.DIC = '#DIC#'
   AND A.DIC = T.DIC
   AND A.VALIDFLAG <> 0
   AND (INSTR(A.MODEL_CODE, '#MODEL_CODE#') > 0 OR INSTR(A.MODEL_CODE, '#MODEL_CODE#') IS NULL
        OR INSTR(A.MODEL_CODE, 'C001') > 0)
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#POSITION_CODE#', NULL, '1', T.POSITION_CODE) =
       DECODE('#POSITION_CODE#', NULL, '1', '#POSITION_CODE#')
   AND DECODE('#STD_DESC#', NULL, '1', T.STD_DESC) =
       DECODE('#STD_DESC#', NULL, '1', '#STD_DESC#')
   AND DECODE('#LV_CODE#', NULL, '1', T.LV_CODE) =
       DECODE('#LV_CODE#', NULL, '1', '#LV_CODE#')
   AND DECODE('#COVERAGE#', NULL, '1', T.COVERAGE) =
       DECODE('#COVERAGE#', NULL, '1', '#COVERAGE#')
   AND DECODE('#GROOVE_DIR#', NULL, '1', T.GROOVE_DIR) =
       DECODE('#GROOVE_DIR#', NULL, '1', '#GROOVE_DIR#')
   AND DECODE('#GROOVE_POS#', NULL, '1', T.GROOVE_POS) =
       DECODE('#GROOVE_POS#', NULL, '1', '#GROOVE_POS#')
   AND DECODE('#RATE#', NULL, '1', T.RATE) =
       DECODE('#RATE#', NULL, '1', '#RATE#')
   AND DECODE('#DESC_VAL#', NULL, '1', T.DESC_VAL) =
       DECODE('#DESC_VAL#', NULL, '1', '#DESC_VAL#')
   AND T.VALIDFLAG = '1'
   AND ('#DIMATER#' IS NULL OR
          DECODE(T.MIN_D, NULL, 1, TO_NUMBER(T.MIN_D)) <=
          DECODE(T.MIN_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
          DECODE(T.MAX_D, NULL, 1, TO_NUMBER(T.MAX_D)) >=
          DECODE(T.MAX_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
          DECODE(T.MIN_H, NULL, 1, TO_NUMBER(T.MIN_H)) <=
          DECODE(T.MIN_H, NULL, 1, TO_NUMBER('#HEIGHT#')) AND
          DECODE(T.MAX_H, NULL, 1, TO_NUMBER(T.MAX_H)) >=
          DECODE(T.MAX_H, NULL, 1, TO_NUMBER('#HEIGHT#')))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscDetection5" desc="查询Msc探伤的数目(带规格)">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_DETECTION_C T, COM_MSC_STD_DETECTION A
 WHERE T.DIC = '#DIC#'
   AND A.DIC = T.DIC
   AND (INSTR(A.MODEL_CODE, '#MODEL_CODE#') > 0 OR INSTR(A.MODEL_CODE, '#MODEL_CODE#') IS NULL
        OR INSTR(A.MODEL_CODE, 'C001') > 0)
   AND A.VALIDFLAG <> 0
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#POSITION_CODE#', NULL, '1', T.POSITION_CODE) =
       DECODE('#POSITION_CODE#', NULL, '1', '#POSITION_CODE#')
   AND DECODE('#STD_DESC#', NULL, '1', T.STD_DESC) =
       DECODE('#STD_DESC#', NULL, '1', '#STD_DESC#')
   AND DECODE('#LV_CODE#', NULL, '1', T.LV_CODE) =
       DECODE('#LV_CODE#', NULL, '1', '#LV_CODE#')
   AND DECODE('#COVERAGE#', NULL, '1', T.COVERAGE) =
       DECODE('#COVERAGE#', NULL, '1', '#COVERAGE#')
   AND DECODE('#GROOVE_DIR#', NULL, '1', T.GROOVE_DIR) =
       DECODE('#GROOVE_DIR#', NULL, '1', '#GROOVE_DIR#')
   AND DECODE('#GROOVE_POS#', NULL, '1', T.GROOVE_POS) =
       DECODE('#GROOVE_POS#', NULL, '1', '#GROOVE_POS#')
   AND DECODE('#RATE#', NULL, '1', T.RATE) =
       DECODE('#RATE#', NULL, '1', '#RATE#')
   AND DECODE('#DESC_VAL#', NULL, '1', T.DESC_VAL) =
       DECODE('#DESC_VAL#', NULL, '1', '#DESC_VAL#')
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscDetection6" desc="查询Msc探伤的数目(带规格)">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_DETECTION_C T
 WHERE T.DIC = '#DIC#'
   AND DECODE('#PHY_CODE#', NULL, '1', T.PHY_CODE) =
       DECODE('#PHY_CODE#', NULL, '1', '#PHY_CODE#')
   AND DECODE('#POSITION_CODE#', NULL, '1', T.POSITION_CODE) =
       DECODE('#POSITION_CODE#', NULL, '1', '#POSITION_CODE#')
   AND DECODE('#STD_DESC#', NULL, '1', T.STD_DESC) =
       DECODE('#STD_DESC#', NULL, '1', '#STD_DESC#')
   AND DECODE('#LV_CODE#', NULL, '1', T.LV_CODE) =
       DECODE('#LV_CODE#', NULL, '1', '#LV_CODE#')
   AND DECODE('#COVERAGE#', NULL, '1', T.COVERAGE) =
       DECODE('#COVERAGE#', NULL, '1', '#COVERAGE#')
   AND DECODE('#GROOVE_DIR#', NULL, '1', T.GROOVE_DIR) =
       DECODE('#GROOVE_DIR#', NULL, '1', '#GROOVE_DIR#')
   AND DECODE('#GROOVE_POS#', NULL, '1', T.GROOVE_POS) =
       DECODE('#GROOVE_POS#', NULL, '1', '#GROOVE_POS#')
   AND DECODE('#RATE#', NULL, '1', T.RATE) =
       DECODE('#RATE#', NULL, '1', '#RATE#')
   AND DECODE('#DESC_VAL#', NULL, '1', T.DESC_VAL) =
       DECODE('#DESC_VAL#', NULL, '1', '#DESC_VAL#')
   AND T.VALIDFLAG = '1'
   AND ('#DIMATER#' IS NULL OR
          DECODE(T.MIN_D, NULL, 1, TO_NUMBER(T.MIN_D)) <=
          DECODE(T.MIN_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
          DECODE(T.MAX_D, NULL, 1, TO_NUMBER(T.MAX_D)) >=
          DECODE(T.MAX_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
          DECODE(T.MIN_H, NULL, 1, TO_NUMBER(T.MIN_H)) <=
          DECODE(T.MIN_H, NULL, 1, TO_NUMBER('#HEIGHT#')) AND
          DECODE(T.MAX_H, NULL, 1, TO_NUMBER(T.MAX_H)) >=
          DECODE(T.MAX_H, NULL, 1, TO_NUMBER('#HEIGHT#')))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getCustWater" desc="查询临时水压的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_WATER T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO2#'
   AND DECODE('#CUST_ALPHA_NO#', NULL, '1', T.CUST_ALPHA_NO) <> DECODE('#CUST_ALPHA_NO#', NULL, '2', '#CUST_ALPHA_NO#')
   AND DECODE('#PRESSURE_Y#', NULL, '1', T.PRESSURE_Y) =
       DECODE('#PRESSURE_Y#', NULL, '1', '#PRESSURE_Y#')
   AND DECODE('#PRESSURE#', NULL, '1', T.PRESSURE) =
       DECODE('#PRESSURE#', NULL, '1', '#PRESSURE#')
   AND DECODE('#SAVE_TIME#', NULL, '1', T.SAVE_TIME) =
       DECODE('#SAVE_TIME#', NULL, '1', '#SAVE_TIME#')
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscWater1" desc="查询Msc水压的数目">
		<![CDATA[
 SELECT COUNT(1) COUNT
   FROM COM_MSC_STD_WATER_C T, COM_MSC_STD_WATER A
  WHERE T.WIC = '#WIC#'
    AND A.WIC = T.WIC
    AND A.VALIDFLAG <> '0'
    AND DECODE('#PRESSURE_Y#', NULL, '1', T.PRESSURE_Y) =
        DECODE('#PRESSURE_Y#', NULL, '1', '#PRESSURE_Y#')
    AND DECODE('#PRESSURE#', NULL, '1', T.PRESSURE) =
        DECODE('#PRESSURE#', NULL, '1', '#PRESSURE#')
    AND DECODE('#SAVE_TIME#', NULL, '1', T.SAVE_TIME) =
        DECODE('#SAVE_TIME#', NULL, '1', '#SAVE_TIME#')
    AND T.VALIDFLAG = '1'
    AND DECODE('#SPEC_JG#', NULL, '1', A.SPEC_JG) =
       DECODE('#SPEC_JG#', NULL, '1', '#SPEC_JG#')
    AND ('#DIMATER#' IS NULL OR
            DECODE(A.MIN_D, NULL, 1, TO_NUMBER(A.MIN_D)) <=
            DECODE(A.MIN_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
            DECODE(A.MAX_D, NULL, 1, TO_NUMBER(A.MAX_D)) >=
            DECODE(A.MAX_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
            DECODE(A.MIN_H, NULL, 1, TO_NUMBER(A.MIN_H)) <=
            DECODE(A.MIN_H, NULL, 1, TO_NUMBER('#HEIGHT#')) AND
            DECODE(A.MAX_H, NULL, 1, TO_NUMBER(A.MAX_H)) >=
            DECODE(A.MAX_H, NULL, 1, TO_NUMBER('#HEIGHT#')))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscWater2" desc="查询Msc水压的数目">
		<![CDATA[
 SELECT COUNT(1) COUNT
   FROM COM_MSC_STD_WATER_C T, COM_MSC_STD_WATER A
  WHERE T.WIC = '#WIC#'
    AND DECODE('#PRESSURE_Y#', NULL, '1', T.PRESSURE_Y) =
        DECODE('#PRESSURE_Y#', NULL, '1', '#PRESSURE_Y#')
    AND DECODE('#PRESSURE#', NULL, '1', T.PRESSURE) =
        DECODE('#PRESSURE#', NULL, '1', '#PRESSURE#')
    AND DECODE('#SAVE_TIME#', NULL, '1', T.SAVE_TIME) =
        DECODE('#SAVE_TIME#', NULL, '1', '#SAVE_TIME#')
    AND T.VALIDFLAG = '1'
    AND A.WIC = T.WIC
    AND A.VALIDFLAG <> 0
    AND ('#DIMATER#' IS NULL OR
            DECODE(A.MIN_D, NULL, 1, TO_NUMBER(A.MIN_D)) <=
            DECODE(A.MIN_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
            DECODE(A.MAX_D, NULL, 1, TO_NUMBER(A.MAX_D)) >=
            DECODE(A.MAX_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
            DECODE(A.MIN_H, NULL, 1, TO_NUMBER(A.MIN_H)) <=
            DECODE(A.MIN_H, NULL, 1, TO_NUMBER('#HEIGHT#')) AND
            DECODE(A.MAX_H, NULL, 1, TO_NUMBER(A.MAX_H)) >=
            DECODE(A.MAX_H, NULL, 1, TO_NUMBER('#HEIGHT#')))
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscWater3" desc="查询Msc水压的数目(包含扣型)">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_WATER A
 WHERE A.WIC = '#WIC#'
   AND DECODE('#SPEC_JG#', NULL, '1', A.SPEC_JG) =
       DECODE('#SPEC_JG#', NULL, '1', '#SPEC_JG#')
   AND ('#DIMATER#' IS NULL OR
       DECODE(A.MIN_D, NULL, 1, TO_NUMBER(A.MIN_D)) <=
       DECODE(A.MIN_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
       DECODE(A.MAX_D, NULL, 1, TO_NUMBER(A.MAX_D)) >=
       DECODE(A.MAX_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
       DECODE(A.MIN_H, NULL, 1, TO_NUMBER(A.MIN_H)) <=
       DECODE(A.MIN_H, NULL, 1, TO_NUMBER('#HEIGHT#')) AND
       DECODE(A.MAX_H, NULL, 1, TO_NUMBER(A.MAX_H)) >=
       DECODE(A.MAX_H, NULL, 1, TO_NUMBER('#HEIGHT#')))
   AND A.VALIDFLAG <> 0
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscWaterWithNoValue" desc="查询Msc水压的数目(不带值)">
		<![CDATA[
 SELECT COUNT(1) COUNT
   FROM COM_MSC_STD_WATER_C T, COM_MSC_STD_WATER A
  WHERE T.WIC = '#WIC#'
     AND ('#DIMATER#' IS NULL OR
            DECODE(A.MIN_D, NULL, 1, TO_NUMBER(A.MIN_D)) <=
            DECODE(A.MIN_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
            DECODE(A.MAX_D, NULL, 1, TO_NUMBER(A.MAX_D)) >=
            DECODE(A.MAX_D, NULL, 1, TO_NUMBER('#DIMATER#')) AND
            DECODE(A.MIN_H, NULL, 1, TO_NUMBER(A.MIN_H)) <=
            DECODE(A.MIN_H, NULL, 1, TO_NUMBER('#HEIGHT#')) AND
            DECODE(A.MAX_H, NULL, 1, TO_NUMBER(A.MAX_H)) >=
            DECODE(A.MAX_H, NULL, 1, TO_NUMBER('#HEIGHT#')))
    AND T.VALIDFLAG = '1'
    AND T.WIC = A.WIC
    AND A.VALIDFLAG <> 0
    AND (INSTR(A.MODEL_CODE, '#MODEL_CODE#') > 0 OR INSTR(A.MODEL_CODE, '#MODEL_CODE#') IS NULL
         OR INSTR(A.MODEL_DESC, '/') > 0)
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getCustProcess" desc="查询临时加工的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_PROCESS T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO2#'
   AND DECODE('#CUST_ALPHA_NO#', NULL, '1', T.CUST_ALPHA_NO) <> DECODE('#CUST_ALPHA_NO#', NULL, '2', '#CUST_ALPHA_NO#')
   AND DECODE('#STATION_CODE#', NULL, '1', T.STATION_CODE) =
       DECODE('#STATION_CODE#', NULL, '1', '#STATION_CODE#')
   AND DECODE('#PROCESS_CDOE#', NULL, '1', T.PROCESS_CDOE) =
       DECODE('#PROCESS_CDOE#', NULL, '1', '#PROCESS_CDOE#')
   AND DECODE('#VALUE_TEXT#', NULL, '1', T.VALUE_TEXT) =
       DECODE('#VALUE_TEXT#', NULL, '1', '#VALUE_TEXT#')
   AND DECODE('#VALUE_NUM#', NULL, '1', T.VALUE_NUM) =
       DECODE('#VALUE_NUM#', NULL, '1', '#VALUE_NUM#')
   AND DECODE('#VALUE_MEMO#', NULL, '1', T.VALUE_MEMO) =
       DECODE('#VALUE_MEMO#', NULL, '1', '#VALUE_MEMO#')
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscProcess1" desc="查询Msc加工的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_PROCESS_C T
 WHERE T.GIC = '#GIC#'
   AND DECODE('#STATION_CODE#', NULL, '1', T.STATION_CODE) =
       DECODE('#STATION_CODE#', NULL, '1', '#STATION_CODE#')
   AND DECODE('#PROCESS_CDOE#', NULL, '1', T.PROCESS_CDOE) =
       DECODE('#PROCESS_CDOE#', NULL, '1', '#PROCESS_CDOE#')
   AND DECODE('#VALUE_TEXT#', NULL, '1', T.VALUE_TEXT) =
       DECODE('#VALUE_TEXT#', NULL, '1', '#VALUE_TEXT#')
   AND DECODE('#VALUE_NUM#', NULL, '1', T.VALUE_NUM) =
       DECODE('#VALUE_NUM#', NULL, '1', '#VALUE_NUM#')
   AND DECODE('#VALUE_MEMO#', NULL, '1', T.VALUE_MEMO) =
       DECODE('#VALUE_MEMO#', NULL, '1', '#VALUE_MEMO#')
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscProcess2" desc="查询Msc加工的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_PROCESS_C T
 WHERE T.GIC = '#GIC#'
   AND DECODE('#STATION_CODE#', NULL, '1', T.STATION_CODE) =
       DECODE('#STATION_CODE#', NULL, '1', '#STATION_CODE#')
   AND DECODE('#PROCESS_CDOE#', NULL, '1', T.PROCESS_CDOE) =
       DECODE('#PROCESS_CDOE#', NULL, '1', '#PROCESS_CDOE#')
   AND DECODE('#VALUE_TEXT#', NULL, '1', T.VALUE_TEXT) =
       DECODE('#VALUE_TEXT#', NULL, '1', '#VALUE_TEXT#')
   AND DECODE('#VALUE_NUM#', NULL, '1', T.VALUE_NUM) =
       DECODE('#VALUE_NUM#', NULL, '1', '#VALUE_NUM#')
   AND DECODE('#VALUE_MEMO#', NULL, '1', T.VALUE_MEMO) =
       DECODE('#VALUE_MEMO#', NULL, '1', '#VALUE_MEMO#')
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscProcess3" desc="查询Msc加工的数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_MSC_STD_PROCESS A
  WHERE A.VALIDFLAG <> 0
  AND A.GIC = '#GIC#'
  AND (INSTR(A.MODEL_CODE, '#MODEL_CODE#') > 0 OR INSTR(A.MODEL_CODE, '#MODEL_CODE#') IS NULL
       OR INSTR(A.MODEL_CODE, 'C001') > 0)
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getCustAlphaNos" desc="通过客户码查询客户alpha编码">
		<![CDATA[
SELECT VALUE, SUM(COUNT) COUNT
  FROM (SELECT T.CUST_ALPHA_NO VALUE, COUNT(1) COUNT
          FROM SLM_CUST_ALPHA_USE T, SLM_CUST_ALPHA_CHEM A, SLM_CUST_ALPHA B
         WHERE T.CHEM_ALPHA_NO = '#CHEM_ALPHA_NO#'
           AND T.VALIDFLAG = '1'
           AND A.CUST_ALPHA_NO = T.CUST_ALPHA_NO
           AND A.VALIDFLAG = '1'
           AND B.CUST_ALPHA_NO = T.CUST_ALPHA_NO
           AND B.CUST_ALPHA_STS <> 'S'
           AND B.VALIDFLAG = '1'
         GROUP BY T.CUST_ALPHA_NO
        UNION ALL
        SELECT T.CUST_ALPHA_NO VALUE, COUNT(1) COUNT
          FROM SLM_CUST_ALPHA_USE T, SLM_CUST_ALPHA_PHY A, SLM_CUST_ALPHA B
         WHERE T.CHEM_ALPHA_NO = '#CHEM_ALPHA_NO#'
           AND T.VALIDFLAG = '1'
           AND A.CUST_ALPHA_NO = T.CUST_ALPHA_NO
           AND A.VALIDFLAG = '1'
           AND B.CUST_ALPHA_NO = T.CUST_ALPHA_NO
           AND B.CUST_ALPHA_STS <> 'S'
           AND B.VALIDFLAG = '1'
         GROUP BY T.CUST_ALPHA_NO
        UNION ALL
        SELECT T.CUST_ALPHA_NO VALUE, COUNT(1) COUNT
          FROM SLM_CUST_ALPHA_USE T, SLM_CUST_ALPHA_SPEC A, SLM_CUST_ALPHA B
         WHERE T.CHEM_ALPHA_NO = '#CHEM_ALPHA_NO#'
           AND T.VALIDFLAG = '1'
           AND A.CUST_ALPHA_NO = T.CUST_ALPHA_NO
           AND A.VALIDFLAG = '1'
           AND B.CUST_ALPHA_NO = T.CUST_ALPHA_NO
           AND B.CUST_ALPHA_STS <> 'S'
           AND B.VALIDFLAG = '1'
         GROUP BY T.CUST_ALPHA_NO
        UNION ALL
        SELECT T.CUST_ALPHA_NO VALUE, COUNT(1) COUNT
          FROM SLM_CUST_ALPHA_USE T, SLM_CUST_ALPHA_DETECTION A, SLM_CUST_ALPHA B
         WHERE T.CHEM_ALPHA_NO = '#CHEM_ALPHA_NO#'
           AND T.VALIDFLAG = '1'
           AND A.CUST_ALPHA_NO = T.CUST_ALPHA_NO
           AND A.VALIDFLAG = '1'
           AND B.CUST_ALPHA_NO = T.CUST_ALPHA_NO
           AND B.CUST_ALPHA_STS <> 'S'
           AND B.VALIDFLAG = '1'
         GROUP BY T.CUST_ALPHA_NO
        UNION ALL
        SELECT T.CUST_ALPHA_NO VALUE, COUNT(1) COUNT
          FROM SLM_CUST_ALPHA_USE T, SLM_CUST_ALPHA_WATER A, SLM_CUST_ALPHA B
         WHERE T.CHEM_ALPHA_NO = '#CHEM_ALPHA_NO#'
           AND T.VALIDFLAG = '1'
           AND A.CUST_ALPHA_NO = T.CUST_ALPHA_NO
           AND A.VALIDFLAG = '1'
           AND B.CUST_ALPHA_NO = T.CUST_ALPHA_NO
           AND B.CUST_ALPHA_STS <> 'S'
           AND B.VALIDFLAG = '1'
         GROUP BY T.CUST_ALPHA_NO
        UNION ALL
        SELECT T.CUST_ALPHA_NO VALUE, COUNT(1) COUNT
          FROM SLM_CUST_ALPHA_USE T, SLM_CUST_ALPHA_PROCESS A, SLM_CUST_ALPHA B
         WHERE T.CHEM_ALPHA_NO = '#CHEM_ALPHA_NO#'
           AND T.VALIDFLAG = '1'
           AND A.CUST_ALPHA_NO = T.CUST_ALPHA_NO
           AND A.VALIDFLAG = '1'
           AND B.CUST_ALPHA_NO = T.CUST_ALPHA_NO
           AND B.CUST_ALPHA_STS <> 'S'
           AND B.VALIDFLAG = '1'
         GROUP BY T.CUST_ALPHA_NO)
 GROUP BY VALUE
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getChemCustAlphas" desc="通过客户码查询客户alpha编码">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_CHEM T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getPhyCustAlphas" desc="通过客户码查询客户alpha编码">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_PHY T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getDetectionCustAlphas" desc="通过客户码查询客户alpha编码">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_DETECTION T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getSpecCustAlphas" desc="通过客户码查询客户alpha编码">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_SPEC T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getWaterCustAlphas" desc="通过客户码查询客户alpha编码">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_WATER T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getProcessCustAlphas" desc="通过客户码查询客户alpha编码">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_PROCESS T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscByPsc" desc="查询Msc">
		<![CDATA[
SELECT VALUE, SUM(COUNT) COUNT
  FROM (SELECT T.MSC VALUE, COUNT(1) COUNT
          FROM COM_MSC T, COM_PSC_R_MSC B
         WHERE T.MSC = B.MSC
           AND B.PSC = '#PSC#'
           AND T.VALIDFLAG <> 'D'
         GROUP BY T.MSC
        UNION ALL
        SELECT T.MSC VALUE, COUNT(1) COUNT
          FROM COM_MSC T, COM_PSC_R_MSC B
         WHERE T.MSC = B.MSC
           AND B.PSC = '#PSC#'
           AND T.VALIDFLAG <> 'D'
         GROUP BY T.MSC
        UNION ALL
        SELECT T.MSC VALUE, COUNT(1) COUNT
          FROM COM_MSC T, COM_PSC_R_MSC B
         WHERE T.MSC = B.MSC
           AND B.PSC = '#PSC#'
           AND T.VALIDFLAG <> 'D'
         GROUP BY T.MSC
        UNION ALL
        SELECT T.MSC VALUE, COUNT(1) COUNT
          FROM COM_MSC T, COM_PSC_R_MSC B
         WHERE T.MSC = B.MSC
           AND B.PSC = '#PSC#'
           AND T.VALIDFLAG <> 'D'
         GROUP BY T.MSC
        UNION ALL
        SELECT T.MSC VALUE, COUNT(1) COUNT
          FROM COM_MSC T, COM_PSC_R_MSC B
         WHERE T.MSC = B.MSC
           AND B.PSC = '#PSC#'
           AND T.VALIDFLAG <> 'D'
         GROUP BY T.MSC
        UNION ALL
        SELECT T.MSC VALUE, COUNT(1) COUNT
          FROM COM_MSC T, COM_PSC_R_MSC B
         WHERE T.MSC = B.MSC
           AND B.PSC = '#PSC#'
           AND T.VALIDFLAG <> 'D'
         GROUP BY T.MSC)
 GROUP BY VALUE
 ORDER BY VALUE
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscCic" desc="查询Msc">
		<![CDATA[
SELECT CIC VALUE, MODEL_CODE VALUE2, COUNT(1) COUNT
  FROM (SELECT D.CIC, D.CHEM_CODE, C.MODEL_CODE
          FROM COM_MSC B, COM_MSC_STD_CIC C, COM_MSC_STD_CHEM D
         WHERE B.MSC = '#MSC#'
           AND B.VALIDFLAG <> 'D'
           AND C.MSC = B.MSC
           AND C.VALIDFLAG <> '0'
           AND C.CODE_JG IS NULL
           AND C.CIC = D.CIC
           AND D.VALIDFLAG <> '0'
         GROUP BY D.CIC, D.CHEM_CODE, C.MODEL_CODE)
 GROUP BY CIC, MODEL_CODE
 ORDER BY CIC
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscPic" desc="查询MscPic">
		<![CDATA[
SELECT PIC VALUE, MODEL_CODE VALUE2, COUNT(1) COUNT
  FROM (SELECT D.PIC,
               D.PHY_CODE_MAX,
               D.PHY_CODE_MIN,
               D.PHY_CODE,
               D.ITEM_CODE_F,
               D.ITEM_CODE_W,
               D.ITEM_CODE_S,
               C.MODEL_CODE
          FROM COM_MSC B, COM_MSC_STD_PIC C, COM_MSC_STD_PHY D
         WHERE B.MSC = '#MSC#'
           AND B.VALIDFLAG <> 'D'
           AND C.MSC = B.MSC
           AND C.VALIDFLAG <> '0'
           AND C.CODE_JG IS NULL
           AND C.PIC = D.PIC
           AND D.VALIDFLAG <> '0'
         GROUP BY D.PIC,
                  D.PHY_CODE_MAX,
                  D.PHY_CODE_MIN,
                  D.PHY_CODE,
                  D.ITEM_CODE_F,
                  D.ITEM_CODE_W,
                  D.ITEM_CODE_S,
                  C.MODEL_CODE)
 GROUP BY PIC, MODEL_CODE
 ORDER BY PIC
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscSic" desc="查询MscSic">
		<![CDATA[
SELECT SIC VALUE, MODEL_CODE VALUE2, COUNT(1) COUNT
  FROM (SELECT D.SIC, D.BIAS_CODE, C.MODEL_CODE
          FROM COM_MSC B, COM_MSC_STD_SPEC C, COM_MSC_STD_SPEC_C D
         WHERE B.MSC = '#MSC#'
           AND B.VALIDFLAG <> 'D'
           AND C.MSC = B.MSC
           AND C.VALIDFLAG <> '0'
           AND C.CODE_JG IS NULL
           AND C.SIC = D.SIC
           AND D.VALIDFLAG <> '0'
         GROUP BY D.SIC, D.BIAS_CODE, C.MODEL_CODE)
 GROUP BY SIC, MODEL_CODE
 ORDER BY SIC
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscDic" desc="查询MscDic">
		<![CDATA[
SELECT DIC VALUE, MODEL_CODE VALUE2, COUNT(1) COUNT
  FROM (SELECT D.DIC, D.PHY_CODE, C.MODEL_CODE
          FROM COM_MSC B, COM_MSC_STD_DETECTION C, COM_MSC_STD_DETECTION_C D
         WHERE B.MSC = '#MSC#'
           AND B.VALIDFLAG <> 'D'
           AND C.MSC = B.MSC
           AND C.VALIDFLAG <> '0'
           AND C.CODE_JG IS NULL
           AND C.DIC = D.DIC
           AND D.VALIDFLAG <> '0'
         GROUP BY D.DIC, D.PHY_CODE, C.MODEL_CODE)
 GROUP BY DIC, MODEL_CODE
 ORDER BY DIC
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscWic" desc="查询MscWic">
		<![CDATA[
SELECT WIC VALUE, MODEL_CODE VALUE2, COUNT(1) COUNT
  FROM (SELECT D.WIC, D.PRESSURE, D.PRESSURE_Y, D.FORMULA, D.SAVE_TIME, C.MODEL_CODE
          FROM COM_MSC B, COM_MSC_STD_WATER C, COM_MSC_STD_WATER_C D
         WHERE B.MSC = '#MSC#'
           AND B.VALIDFLAG <> 'D'
           AND C.MSC = B.MSC
           AND C.VALIDFLAG <> '0'
           AND C.CODE_JG IS NULL
           AND C.WIC = D.WIC
           AND D.VALIDFLAG <> '0'
         GROUP BY D.WIC, D.PRESSURE, D.PRESSURE_Y, D.FORMULA, D.SAVE_TIME, C.MODEL_CODE)
 GROUP BY WIC, MODEL_CODE
 ORDER BY WIC
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getMscGic" desc="查询MscGic">
		<![CDATA[
SELECT GIC VALUE, MODEL_CODE VALUE2, COUNT(1) COUNT
  FROM (SELECT D.GIC, D.STATION_CODE, C.MODEL_CODE
          FROM COM_MSC B, COM_MSC_STD_PROCESS C, COM_MSC_STD_PROCESS_C D
         WHERE B.MSC = '#MSC#'
           AND B.VALIDFLAG <> 'D'
           AND C.MSC = B.MSC
           AND C.VALIDFLAG <> '0'
           AND C.CODE_JG IS NULL
           AND C.GIC = D.GIC
           AND D.VALIDFLAG <> '0'
         GROUP BY D.GIC, D.STATION_CODE, C.MODEL_CODE)
 GROUP BY GIC, MODEL_CODE
 ORDER BY GIC
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getOrdAddAsksByCustNo" desc="通过客户查询附加要求码">
		<![CDATA[
SELECT A.ADD_ASK_NO VALUE, COUNT(1) COUNT
  FROM SLM_ORDER_ADD_ASK A
 WHERE A.CUSTOMER_NO = '#CUSTOMER_NO#'
 AND A.VALIDFLAG = '1'
 GROUP BY A.ADD_ASK_NO
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getOrdAddAskCnt" desc="通过客户查询附加要求数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_ORDER_ADD_ASK T
 WHERE T.ADD_ASK_NO = '#ADD_ASK_NO#'
   AND T.ASK_ITME_DESC = '#ASK_ITME_DESC#'
   AND T.ASK_SUB_ITME_DESC = '#ASK_SUB_ITME_DESC#'
   AND T.ASK_SUB_ITME_VAL_DESC = '#ASK_SUB_ITME_VAL_DESC#'
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.setPic" desc="保存图片途径">
		<![CDATA[
UPDATE SLM_ORDER_ADD_ASK T
   SET T.PIC = '#PIC#'
 WHERE T.ADD_ASK_NO = '#ADD_ASK_NO#'
   AND T.ASK_SUB_ITME = '#ASK_SUB_ITME#'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getBseAddtionalCnt" desc="获取标准附加要求数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_BASE_ADDITIONAL T
 WHERE T.STD_CODE = '#STD_CODE#'
   AND T.ASK_ITME_DESC = '#ASK_ITME_DESC#'
   AND T.ASK_SUB_ITME_DESC = '#ASK_SUB_ITME_DESC#'
   AND T.ASK_SUB_ITME_VAL_DESC = '#ASK_SUB_ITME_VAL_DESC#'
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getBseAddtionalCnt2" desc="获取标准附加要求数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_BASE_ADDITIONAL T
 WHERE T.STD_CODE = '#STD_CODE#'
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getBseAddtionalCnt3" desc="获取标准附加要求数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM COM_BASE_ADDITIONAL T
 WHERE T.STD_CODE = '#STD_CODE#'
   AND T.ASK_ITME_DESC = '#ASK_ITME_DESC#'
   AND T.ASK_SUB_ITME_DESC = '#ASK_SUB_ITME_DESC#'
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getOrdLnRefAddAskCnt" desc="获取合同行引用的附加要求码的数目">
		<![CDATA[
SELECT COUNT(1)
  FROM SLM_ORDER_LINE T
 WHERE T.ADD_ASK_NO = '#ADD_ASK_NO#'
 AND T.ORD_LN_PK <> '#ORD_LN_PK#'
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getCustAlphaState" desc="获取技术特殊要求状态">
		<![CDATA[
SELECT T.CUST_ALPHA_STS, T.REVIEW_F_RS
  FROM SLM_CUST_ALPHA T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getCustAlphaUseCount" desc="获取技术特殊要求使用数目">
		<![CDATA[
SELECT COUNT(1)
  FROM SLM_ORDER_LINE T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND T.ORD_LN_PK <> '#ORD_LN_PK#'
   AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getBaseAdditional" desc="获取标准附加要求">
		<![CDATA[
 SELECT 
       ASK_ITME,
       ASK_ITME_DESC,
       ASK_SUB_ITME,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       ASK_SUB_ITME_DESC,
       ASK_SUB_ITME_VAL,
       ASK_SUB_ITME_VAL_DESC,
       PIC
 FROM COM_BASE_ADDITIONAL T
 WHERE T.STD_CODE = '#STD_CODE#'
 AND T.VALIDFLAG = '1'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getComMscByPscCstAlpNo" desc="通过产品码和客户要求码获取MSC">
		<![CDATA[
SELECT T.MSC, A.MSC_DESC, A.USE_CODE, A.USE_DESC, A.MSC_STYLE
  FROM COM_PSC_R_MSC T, COM_MSC A
 WHERE T.PSC = '#PSC#'
   AND INSTR(T.CUST_ALPHA_NO, '#CUST_ALPHA_NO#' || ';') > 0
   AND A.MSC = T.MSC
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getComMscByMsc" desc="通过Msc获取MSC表">
		<![CDATA[
SELECT A.MSC, A.MSC_DESC, A.USE_CODE, A.USE_DESC, A.MSC_STYLE
  FROM COM_MSC A
 WHERE A.MSC = '#MSC#'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getStdRCustCnt" desc="查询用途码与客户关系数目">
		<![CDATA[
SELECT COUNT(1)
  FROM COM_BASE_STD_R_CUST T, COM_MSC A
 WHERE A.MSC = '#MSC#'
   AND T.STD_CODE = A.USE_CODE
   AND T.CUST_CODE = '#CUST_CODE#'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.insertStdRCust" desc="新增用途码与客户关系表">
		<![CDATA[
INSERT INTO COM_BASE_STD_R_CUST T
    (T.STD_CODE,
     T.STD_NAME,
     T.CUST_CODE,
     T.CUST_NAME,
     T.CREATE_NAME,
     T.CREATE_TIME)
    (SELECT A.USE_CODE,
            A.USE_DESC,
            '#CUSTOMER_NO#',
            B.CUSTOMER_NM,
            '#CREATE_NAME#',
            SYSDATE
       FROM COM_MSC A
       LEFT JOIN SLM_BASE_CUSTOMER B
         ON B.CUSTOMER_NO = '#CUSTOMER_NO#'
      WHERE A.MSC = '#MSC#')
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.updateComPscRMsc" desc="修改用途码与客户关系表">
		<![CDATA[
UPDATE COM_PSC_R_MSC T
   SET T.CUST_ALPHA_NO = T.CUST_ALPHA_NO || '#CUST_ALPHA_NO#' || ';',
       T.UPDATE_NAME = '#UPDATE_NAME#', T.UPDATE_TIME = SYSDATE
    WHERE T.MSC = '#MSC#'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getBaseStdByPsc" desc="通过产品码查询标准表">
		<![CDATA[
SELECT T.STD_CODE
  FROM COM_BASE_STD T, COM_PSC A
 WHERE A.PSC = '#PSC#'
   AND T.STD_CODE = A.STD_CODE
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getSpecBySpecCode" desc="通过规格代码查询规格表">
		<![CDATA[
SELECT T.SPEC_CODE, T.SPEC_NAME, T.DIMATER, T.HEIGHT, T.MSC_STYLE, T.SPEC_NAME
  FROM COM_BASE_SPEC T
 WHERE T.SPEC_CODE = '#SPEC_CODE#'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.getStdPayItemCnt" desc="获取交付标准项目数">
		<![CDATA[
SELECT 'CIC' ITEM
  FROM COM_MSC_STD_CHEM A
 WHERE A.CIC = (SELECT CIC
                  FROM (SELECT B.CIC
                          FROM COM_MSC_STD_CIC B
                         WHERE B.MSC = '#MSC#'
                           AND B.VALIDFLAG <> '0'
                         ORDER BY B.CIC)
                 WHERE ROWNUM <= 1)
   AND A.VALIDFLAG = '1'
 GROUP BY A.CHEM_CODE
UNION ALL
SELECT 'PIC' ITEM
  FROM COM_MSC_STD_PHY A
 WHERE A.PIC = (SELECT PIC
                  FROM (SELECT B.PIC
                          FROM COM_MSC_STD_PIC B
                         WHERE B.MSC = '#MSC#'
                           AND B.VALIDFLAG <> '0'
                         ORDER BY B.PIC)
                 WHERE ROWNUM <= 1)
   AND A.VALIDFLAG = '1'
 GROUP BY A.PHY_CODE_MAX,
          A.PHY_CODE_MIN,
          A.PHY_CODE,
          A.ITEM_CODE_F,
          A.ITEM_CODE_W,
          A.ITEM_CODE_S
UNION ALL
SELECT 'DIC' ITEM
  FROM COM_MSC_STD_DETECTION_C A
 WHERE A.DIC = (SELECT DIC
                  FROM (SELECT B.DIC
                          FROM COM_MSC_STD_DETECTION B
                         WHERE B.MSC = '#MSC#'
                           AND B.VALIDFLAG <> '0'
                         ORDER BY B.DIC)
                 WHERE ROWNUM <= 1)
   AND A.VALIDFLAG = '1'
 GROUP BY A.PHY_CODE
UNION ALL
SELECT 'SIC' ITEM
  FROM COM_MSC_STD_SPEC_C A
 WHERE A.SIC = (SELECT SIC
                  FROM (SELECT B.SIC
                          FROM COM_MSC_STD_SPEC B
                         WHERE B.MSC = '#MSC#'
                           AND B.VALIDFLAG <> '0'
                         ORDER BY B.SIC)
                 WHERE ROWNUM <= 1)
   AND A.VALIDFLAG = '1'
 GROUP BY A.BIAS_CODE
UNION ALL
SELECT 'WIC' ITEM
  FROM COM_MSC_STD_WATER_C A
 WHERE A.WIC = (SELECT WIC
                  FROM (SELECT B.WIC
                          FROM COM_MSC_STD_WATER B
                         WHERE B.MSC = '#MSC#'
                           AND B.VALIDFLAG <> '0'
                         ORDER BY B.WIC)
                 WHERE ROWNUM <= 1)
   AND A.VALIDFLAG = '1'
 GROUP BY A.PRESSURE_Y, A.PRESSURE, A.SAVE_TIME
UNION ALL
SELECT 'GIC' ITEM
  FROM COM_MSC_STD_PROCESS_C A
 WHERE A.GIC = (SELECT GIC
                  FROM (SELECT B.GIC
                          FROM COM_MSC_STD_PROCESS B
                         WHERE B.MSC = '#MSC#'
                           AND B.VALIDFLAG <> '0'
                         ORDER BY B.GIC)
                 WHERE ROWNUM <= 1)
   AND A.VALIDFLAG = '1'
 GROUP BY A.STATION_CODE,
          A.PROCESS_CDOE,
          A.VALUE_TEXT,
          A.VALUE_NUM,
          A.VALUE_MEMO
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.deleteSlmOrdAddAsk" desc="作废附加要求">
		<![CDATA[
UPDATE SLM_ORDER_ADD_ASK T
   SET T.DELETE_NAME = '#DELETE_NAME#',
       T.DELETE_TIME = SYSDATE,
       T.VALIDFLAG   = '0'
 WHERE T.ADD_ASK_NO = '#ADD_ASK_NO#'
		 ]]>
	</query>
	
	<query id="CoreOrderSpecialInfo.deleteSlmCustAlpha" desc="作废特殊要求">
		<![CDATA[
UPDATE SLM_CUST_ALPHA T
   SET T.DELETE_NAME = '#DELETE_NAME#',
       T.DELETE_TIME = SYSDATE,
       T.VALIDFLAG   = '0'
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
		 ]]>
	</query>
	
    <query id="CoreOrderSpecialInfo.getSlmOrdLineCntByAskNo" desc="查询使用附加要求码的合同数量">
		<![CDATA[
SELECT COUNT(1) CNT, ORDER_NO, ORDER_SEQ
  FROM (SELECT FIRST_VALUE(A.ORDER_NO) OVER(ORDER BY A.ORDER_NO, T.ORDER_SEQ) ORDER_NO,
               FIRST_VALUE(T.ORDER_SEQ) OVER(ORDER BY A.ORDER_NO, T.ORDER_SEQ) ORDER_SEQ
          FROM SLM_ORDER_LINE T, SLM_ORDER_HEAD A
         WHERE T.ORD_PK = A.ORD_PK
           AND T.VALIDFLAG = '1'
           AND A.VALIDFLAG = '1'
           AND T.ADD_ASK_NO = '#ADD_ASK_NO#')
 GROUP BY ORDER_NO, ORDER_SEQ
		 ]]>
	</query>
	
    <query id="CoreOrderSpecialInfo.getSlmOrdLineCntByAlphaNo" desc="查询使用特殊要求码的合同数量">
		<![CDATA[
SELECT COUNT(1) CNT, ORDER_NO, ORDER_SEQ
  FROM (SELECT FIRST_VALUE(A.ORDER_NO) OVER(ORDER BY A.ORDER_NO, T.ORDER_SEQ) ORDER_NO,
               FIRST_VALUE(T.ORDER_SEQ) OVER(ORDER BY A.ORDER_NO, T.ORDER_SEQ) ORDER_SEQ
          FROM SLM_ORDER_LINE T, SLM_ORDER_HEAD A
         WHERE T.ORD_PK = A.ORD_PK
           AND T.VALIDFLAG = '1'
           AND A.VALIDFLAG = '1'
           AND (T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#' OR
               T.CUST_ALPHA_NO2 = '#CUST_ALPHA_NO2#'))
 GROUP BY ORDER_NO, ORDER_SEQ
		 ]]>
	</query>
	
    <query id="CoreOrderSpecialInfo.getComPsc" desc="查询PSC表">
		<![CDATA[
SELECT T.*, A.PRODUC_TYPE
  FROM COM_PSC T, COM_BASE_PRODUCT A
 WHERE T.PRODUCCODE = A.PRODUCCODE
   AND T.PSC = '#PSC#'
		 ]]>
	</query>

	<query id="CoreOrderSpecialInfo.getModelStyleByModelCode" desc="查询扣型描述">
		<![CDATA[
SELECT T.MODEL_STYLE FROM COM_BASE_MODEL T WHERE T.MODEL_CODE = '#MODEL_CODE#'
		 ]]>
	</query>
</queryMap>