<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="质量冶金规范处理">
	<query id="QualityMsc.insertUse" desc="添加用途码">
         <![CDATA[
          INSERT INTO COM_BASE_STD_ALPHA(
        ALPHA_CODE,
        ALPHA_NAME,
        STD_CODE,
        STD_NOTE,
        STD_STYLE,
        STD_STYLE_NAME,
        STD_VERSION,
        DEPARTMENT_CODE,
        DEPARTMENT_DESC,
        UNIT_CODE,
        UNIT_DESC,
        CREATE_NAME,
        CREATE_TIME,
        VALIDFLAG,
        MEMO,
        ALPHA_CODE_OLD)
 VALUES( 
        '#ALPHA_CODE#',
        '#ALPHA_NAME#',
        '#STD_CODE#',
        '#STD_NOTE#',
        '#STD_STYLE#',
        '#STD_STYLE_NAME#',
        '#STD_VERSION#',
        '#DEPARTMENT_CODE#',
        '#DEPARTMENT_DESC#',
        '#UNIT_CODE#',
        '#UNIT_DESC#',
        '#CREATE_NAME#',
        SYSDATE,
        '#VALIDFLAG#',
        '#MEMO#',
        '#ALPHA_CODE_OLD#')
         ]]>
	</query>
	
	<query id="QualityMsc.queryStd" desc="查询标准">
         <![CDATA[
		 SELECT 
       PROCESS_CODE,
       PROCESS_DESC,
       STD_CODE_OLD,
       STD_CODE,
       STD_NAME,
       STDSTYLE,
       STD_NOTE,
       STD_STYLE,
       STD_STYLE_NAME,
       STD_VERSION,
       DEPARTMENT_CODE,
       DEPARTMENT_DESC,
       UNIT_CODE,
       UNIT_DESC,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       VALIDFLAG,
       MEMO
 FROM COM_BASE_STD
 WHERE
 STD_CODE = (SELECT STD_CODE FROM COM_PSC A WHERE A.PSC = '#PSC#')
 AND VALIDFLAG = '1'
         ]]>
	</query>
	
	<query id="QualityMsc.queryPsc" desc="查询产品表">
         <![CDATA[
			 SELECT 
       PRODUC_TYPE,
       PRODUC_STYLE,
       PRODUC_DESC,
       PRODUC_HEAD,
       PSC_OLD,
       PSC,
       PSC_DESC,
       PRODUCCODE,
       PRODUCNAME,
       STD_CODE,
       STD_NAME,
       STEELCODE,
       STEELNAME,
       STD_STYLE,
       STD_STYLE_DESC,
       NEW_PROC_CODE,
       NEW_PROC_DESC,
       DEPARTMENT_CODE,
       DEPARTMENT_DESC,
       UNIT_CODE,
       AUTOJUDGE,
       UNIT_DESC,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       VALIDFLAG,
       MEMO
 FROM COM_PSC
 WHERE
 PSC = '#PSC#'
         ]]>
	</query>
	
	<query id="QualityMsc.queryMaxAlphaCode" desc="查询最大的用途码">
         <![CDATA[
		SELECT '#STD_CODE#' ||
       LPAD(TO_NUMBER(SUBSTR(NVL(MAX(T.ALPHA_CODE), 'STD0000001000'), 11, 3)) + 1, 3, '0') MAX_ALPHA_CODE
  FROM COM_BASE_STD_ALPHA T
 WHERE T.STD_CODE = '#STD_CODE#'
         ]]>
	</query>
	
	<query id="QualityMsc.insertStdRCust" desc="新增用户和用途码关系">
         <![CDATA[
		  INSERT INTO COM_BASE_STD_R_CUST(
        VALIDFLAG,
        MEMO,
        STD_CODE_OLD,
        CUST_CODE_OLD,
        STD_CODE,
        STD_NAME,
        CUST_CODE,
        CUST_NAME,
        CREATE_NAME,
        CREATE_TIME)
 VALUES( 
        '#VALIDFLAG#',
        '#MEMO#',
        '#STD_CODE_OLD#',
        '#CUST_CODE_OLD#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#CUST_CODE#',
        '#CUST_NAME#',
        '#CREATE_NAME#',
        SYSDATE)
         ]]>
	</query>
	
	<query id="QualityMsc.queryUserName" desc="查询用户名称">
         <![CDATA[
			SELECT T.CUSTOMER_NM FROM SLM_BASE_CUSTOMER T WHERE T.CUSTOMER_NO = '#CUSTOMER_NO#'
         ]]>
	</query>
	
	<query id="QualityMsc.queryProductType" desc="查询产品类型（规范类型）">
         <![CDATA[
			SELECT T.PRODUC_TYPE, T.PRODUC_HEAD
  FROM COM_BASE_PRODUCT T
 WHERE T.PRODUCCODE =
       (SELECT C.PRODUCCODE FROM COM_PSC C WHERE C.PSC = '#PSC#')
         ]]>
	</query>
	
	<query id="QualityMsc.insertMsc" desc="新增MSC">
         <![CDATA[
			 INSERT INTO COM_MSC(
        FILE_JPEG,
        PRODUC_HEAD,
        UNIT_CODE_PROCESS,
        UNIT_DESC_PROCESS,
        MSC_OLD,
        USE_CODE_OLD,
        REMARK,
        AUDIT_NAME,
        VALIDFLAG_NK,
        AUDIT_NAME_NK,
        REMARK_NK,
        MSC,
        MSC_DESC,
        USE_CODE,
        USE_DESC,
        DEPARTMENT_CODE,
        DEPARTMENT_DESC,
        UNIT_CODE,
        UNIT_DESC,
        MSC_STYLE,
        USER_COUNT,
        PRODUCCODE,
        PRODUCNAME,
        STD_CODE,
        STD_NAME,
        STEELCODE,
        STEELNAME,
        STD_STYLE,
        STD_STYLE_DESC,
        NEW_PROC_CODE,
        NEW_PROC_DESC,
        ALLOW_NK,
        MSC_SEQ,
        MSC_DESC_SEQ,
        CREATE_NAME,
        CREATE_TIME,
        VALIDFLAG,
        MEMO)
 VALUES( 
        '#FILE_JPEG#',
        '#PRODUC_HEAD#',
        '#UNIT_CODE_PROCESS#',
        '#UNIT_DESC_PROCESS#',
        '#MSC_OLD#',
        '#USE_CODE_OLD#',
        '#REMARK#',
        '#AUDIT_NAME#',
        '#VALIDFLAG_NK#',
        '#AUDIT_NAME_NK#',
        '#REMARK_NK#',
        '#MSC#',
        '#MSC_DESC#',
        '#USE_CODE#',
        '#USE_DESC#',
        '#DEPARTMENT_CODE#',
        '#DEPARTMENT_DESC#',
        '#UNIT_CODE#',
        '#UNIT_DESC#',
        '#MSC_STYLE#',
        '#USER_COUNT#',
        '#PRODUCCODE#',
        '#PRODUCNAME#',
        '#STD_CODE#',
        '#STD_NAME#',
        '#STEELCODE#',
        '#STEELNAME#',
        '#STD_STYLE#',
        '#STD_STYLE_DESC#',
        '#NEW_PROC_CODE#',
        '#NEW_PROC_DESC#',
        '#ALLOW_NK#',
        '#MSC_SEQ#',
        '#MSC_DESC_SEQ#',
        '#CREATE_NAME#',
        SYSDATE,
        '#VALIDFLAG#',
        '#MEMO#')
         ]]>
	</query>
	
	<query id="QualityMsc.insertPscRMsc" desc="新增冶金规范码与产品码关系表">
		<![CDATA[
INSERT INTO COM_PSC_R_MSC
  (PSC,
   PSC_DESC,
   USE_CODE,
   USE_DESC,
   MSC,
   MSC_DESC,
   CUST_ALPHA_NO,
   CREATE_NAME,
   CREATE_TIME,
   VALIDFLAG)
VALUES
  ('#PSC#',
   '#PSC_DESC#',
   '#USE_CODE#',
   '#USE_DESC#',
   '#MSC#',
   '#MSC_DESC#',
   '#CUST_ALPHA_NO#',
   '#CREATE_NAME#',
   SYSDATE,
   '#VALIDFLAG#')
		]]>
	</query>
	
	<query id="QualityMsc.queryMaxMscCode" desc="查询最大的冶金规范编码(规则：产品规范码后加3位流水号，并把PSC替换为MSC)">
		<![CDATA[
			 SELECT REPLACE('#PSC#', 'P', 'M') || LPAD(SUBSTR(NVL(MAX(T.MSC), '#PSC#' || '000'), 11, 3) + DECODE(MAX(T.MSC), NULL, 0, 1), 3, '0')
			   MAX_MSC
			   FROM com_psc_r_msc T WHERE T.PSC = '#PSC#'
		]]>
	</query>
	
	<query id="QualityMsc.queryStdMsc" desc="查询标准的冶金规范码">
		<![CDATA[
			 SELECT T.MSC, T.MSC_DESC
  FROM COM_MSC T
 WHERE T.MSC = (SELECT A.MSC
                  FROM COM_PSC_R_MSC A
                 WHERE A.PSC = '#PSC#'
                   AND MSC LIKE '__________000')
		]]>
	</query>
	
	<query id="QualityMsc.insertMscItem" desc="新增冶金规范项目">
		<![CDATA[
			  INSERT INTO COM_MSC_ITEM(
        MSC,
        INDEX_SEQ,
        ITEM,
        ITEM_C,
        CREATE_NAME,
        CREATE_TIME,
        VALIDFLAG,
        MEMO)
 VALUES( 
        '#MSC#',
        '#INDEX_SEQ#',
        '#ITEM#',
        '#ITEM_C#',
        '#CREATE_NAME#',
        SYSDATE,
        '#VALIDFLAG#',
        '#MEMO#')
		]]>
	</query>
	
	<query id="QualityMsc.queryModeDesc" desc="查询扣型描述">
		<![CDATA[
		SELECT T.MODEL_DESC FROM COM_BASE_MODEL T WHERE T.MODEL_CODE = '#MODEL_CODE#'
		]]>
	</query>
	
	<query id="QualityMsc.insertMscStdCic" desc="新增成分主表">
		<![CDATA[
		 INSERT INTO COM_MSC_STD_CIC(
        MODEL_CODE,
        MODEL_DESC,
        PRODUC_HEAD,
        CIC,
        PSC,
        MSC,
        STDSTYLE,
        CREATE_NAME,
        CREATE_TIME,
        VALIDFLAG,
        MEMO)
 VALUES( 
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#PRODUC_HEAD#',
        '#CIC#',
        '#PSC#',
        '#MSC#',
        '#STDSTYLE#',
        '#CREATE_NAME#',
        SYSDATE,
        '#VALIDFLAG#',
        '#MEMO#')
		]]>
	</query>
	
	<query id="QualityMsc.queryMaxCic" desc="查询最大的成分索引号">
		<![CDATA[
		SELECT 'CICG' ||
       LPAD(SUBSTR(NVL(MAX(T.CIC), 'CICG' || '000000'), 5, 6) + 1, 6, '0') MAX_CIC
  FROM COM_MSC_STD_CIC T
 WHERE T.STDSTYLE = 'G'
    OR T.STDSTYLE = 'X'
		]]>
	</query>
	
	<query id="QualityMsc.insertMscStdPic" desc="新增理化主表">
		<![CDATA[
		 INSERT INTO COM_MSC_STD_PIC(
        PIC,
        PSC,
        STDSTYLE,
        CREATE_NAME,
        CREATE_TIME,
        VALIDFLAG,
        MEMO,
        MSC,
        MODEL_CODE,
        MODEL_DESC,
        PRODUC_HEAD)
 VALUES( 
        '#PIC#',
        '#PSC#',
        '#STDSTYLE#',
        '#CREATE_NAME#',
        SYSDATE,
        '#VALIDFLAG#',
        '#MEMO#',
        '#MSC#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#PRODUC_HEAD#')
		]]>
	</query>
	
	<query id="QualityMsc.queryMaxPic" desc="查询最大的理化索引号">
		<![CDATA[
		SELECT 'PICG' ||
       LPAD(SUBSTR(NVL(MAX(T.PIC), 'PICG' || '000000'), 5, 6) + 1, 6, '0') MAX_PIC
  FROM COM_MSC_STD_PIC T
 WHERE T.STDSTYLE = 'G'
    OR T.STDSTYLE = 'X'
		]]>
	</query>
	
	<query id="QualityMsc.insertMscStdDic" desc="新增探伤主表">
		<![CDATA[
		 INSERT INTO COM_MSC_STD_DETECTION(
        PRODUC_HEAD,
        DIC,
        PSC,
        MSC,
        STDSTYLE,
        MODEL_CODE,
        MODEL_DESC,
        CREATE_NAME,
        CREATE_TIME,
        VALIDFLAG,
        MEMO)
 VALUES( 
        '#PRODUC_HEAD#',
        '#DIC#',
        '#PSC#',
        '#MSC#',
        '#STDSTYLE#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#CREATE_NAME#',
        SYSDATE,
        '#VALIDFLAG#',
        '#MEMO#')

		]]>
	</query>
	
	<query id="QualityMsc.queryMaxDic" desc="查询最大的探伤索引号">
		<![CDATA[
		SELECT 'DICG' ||
       LPAD(SUBSTR(NVL(MAX(T.DIC), 'DICG' || '000000'), 5, 6) + 1, 6, '0') MAX_DIC
  FROM COM_MSC_STD_DETECTION T
 WHERE T.STDSTYLE = 'G'
    OR T.STDSTYLE = 'X'
		]]>
	</query>
	
	<query id="QualityMsc.insertMscStdSpec" desc="新增公差主表">
		<![CDATA[
		 INSERT INTO COM_MSC_STD_SPEC(
        PRODUC_HEAD,
        SIC,
        PSC,
        MSC,
        STDSTYLE,
        MODEL_CODE,
        MODEL_DESC,
        STDMEMO,
        CREATE_NAME,
        CREATE_TIME,
        VALIDFLAG)
 VALUES( 
        '#PRODUC_HEAD#',
        '#SIC#',
        '#PSC#',
        '#MSC#',
        '#STDSTYLE#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#STDMEMO#',
        '#CREATE_NAME#',
        SYSDATE,
        '#VALIDFLAG#')
		]]>
	</query>
	
	<query id="QualityMsc.queryMaxSic" desc="查询最大的公差索引号">
		<![CDATA[
		SELECT 'SICG' ||
       LPAD(SUBSTR(NVL(MAX(T.SIC), 'SICG' || '000000'), 5, 6) + 1, 6, '0') MAX_SIC
  FROM COM_MSC_STD_SPEC T
 WHERE T.STDSTYLE = 'G'
    OR T.STDSTYLE = 'X'
		]]>
	</query>
	
	<query id="QualityMsc.insertMscStdWater" desc="新增水压主表">
		<![CDATA[
		  INSERT INTO COM_MSC_STD_WATER(
        PRODUC_HEAD,
        MSC,
        WIC,
        PSC,
        STDSTYLE,
        MODEL_CODE,
        MODEL_DESC,
        CREATE_NAME,
        CREATE_TIME,
        VALIDFLAG,
        MIN_D,
        MAX_D,
        MIN_H,
        MAX_H,
        MEMO,
        SPEC_JG,
        SPEC_JG_DESC)
 VALUES( 
        '#PRODUC_HEAD#',
        '#MSC#',
        '#WIC#',
        '#PSC#',
        '#STDSTYLE#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#CREATE_NAME#',
        SYSDATE,
        '#VALIDFLAG#',
        '#MIN_D#',
        '#MAX_D#',
        '#MIN_H#',
        '#MAX_H#',
        '#MEMO#',
        '#SPEC_JG#',
        '#SPEC_JG_DESC#')
		]]>
	</query>
	
	<query id="QualityMsc.queryMaxWic" desc="查询最大的水压索引号">
		<![CDATA[
		SELECT 'WICG' ||
       LPAD(SUBSTR(NVL(MAX(T.WIC), 'WICG' || '000000'), 5, 6) + 1, 6, '0') MAX_WIC
  FROM COM_MSC_STD_WATER T
 WHERE T.STDSTYLE = 'G'
    OR T.STDSTYLE = 'X'
		]]>
	</query>
	
	<query id="QualityMsc.inserStdProcess" desc="新增加工主表">
		<![CDATA[
		 INSERT INTO COM_MSC_STD_PROCESS(
        GIC,
        PSC,
        MSC,
        STDSTYLE,
        MODEL_CODE,
        MODEL_DESC,
        CREATE_NAME,
        CREATE_TIME,
        VALIDFLAG,
        MEMO,
        PRODUC_HEAD)
 VALUES( 
        '#GIC#',
        '#PSC#',
        '#MSC#',
        '#STDSTYLE#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#CREATE_NAME#',
        SYSDATE,
        '#VALIDFLAG#',
        '#MEMO#',
        '#PRODUC_HEAD#')
		]]>
	</query>
	
	<query id="QualityMsc.queryMaxGic" desc="查询最大的加工索引号">
		<![CDATA[
		 SELECT 'GICG' ||
       LPAD(SUBSTR(NVL(MAX(T.GIC), 'GICG' || '000000'), 5, 6) + 1, 6, '0') MAX_GIC
  FROM COM_MSC_STD_PROCESS T
 WHERE T.STDSTYLE = 'G'
    OR T.STDSTYLE = 'X'
		]]>
	</query>
	
	<query id="QualityMsc.querySaleCustChem" desc="查询最销售客户成分要求">
		<![CDATA[
		 SELECT 
       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,
       VALIDFLAG,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_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
 FROM SLM_CUST_ALPHA_CHEM T
 WHERE
 T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
 AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QualityMsc.insertMscChem" desc="新增成分从表">
		<![CDATA[
		 INSERT INTO COM_MSC_STD_CHEM(
        REP_CODE,
        REP_NAME,
        REP_MIN_SIGN,
        REP_MIN,
        REP_MAX_SIGN,
        REP_MAX,
        REP_VAL,
        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,
        VALIDFLAG,
        CIC,
        INDEX_SEQ,
        CHEM_CODE,
        CHEM_NAME,
        CHEM_TYPE,
        CHEM_FORMULA,
        ISCHECK,
        ISJUDGE,
        ISQUOTE)
 VALUES( 
        '#REP_CODE#',
        '#REP_NAME#',
        '#REP_MIN_SIGN#',
        '#REP_MIN#',
        '#REP_MAX_SIGN#',
        '#REP_MAX#',
        '#REP_VAL#',
        '#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,
        '#VALIDFLAG#',
        '#CIC#',
        (SELECT NVL(MAX(A.INDEX_SEQ), 0) + 1 FROM COM_MSC_STD_CHEM A WHERE A.CIC = '#CIC#'),
        '#CHEM_CODE#',
        '#CHEM_NAME#',
        '#CHEM_TYPE#',
        '#CHEM_FORMULA#',
        '#ISCHECK#',
        '#ISJUDGE#',
        '#ISQUOTE#')
		]]>
	</query>
	
	<query id="QualityMsc.querySaleCustPhy" desc="查询销售理化特殊要求">
		<![CDATA[
		 SELECT 
       SIZE_MAX2,
       SPEC_JG,
       SPEC_JG_DESC,
       VALIDFLAG,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       ADDCONDITION,
       ADDSTDCON_CODE,
       ADDSTD_MIN_SIGN,
       ADDSTD_MIN,
       ADDSTD_MAX_SIGN,
       ADDSTD_MAX,
       ADDPERCENT,
       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,
       ISCHECK,
       ISQUOTE,
       RESULT_COUNT,
       ISJUDGE,
       PHY_TYPE,
       PHY_FORMULA,
       STDMIN_SIGN,
       STDMIN,
       STDMAX_SIGN,
       STDMAX,
       JUDGE_BASIS,
       DELIVERYSTATE,
       MODEL_CODE,
       MODEL_DESC,
       STDMEMO,
       SIZE_CODE,
       SIZE_NAME,
       SIZE_MIN_SIGN,
       SIZE_MIN,
       SIZE_MAX_SIGN,
       SIZE_MAX,
       SIZE_CODE2,
       SIZE_NAME2,
       SIZE_MIN_SIGN2,
       SIZE_MIN2,
       SIZE_MAX_SIGN2,
       STDMIN_SIGN2,
       STDMIN2,
       STDMAX_SIGN2,
       STDMAX2,
       STD_CHOOSE,
       GUID
 FROM SLM_CUST_ALPHA_PHY
 WHERE
CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QualityMsc.insertMscPhy" desc="新增冶金规范理化从表">
		<![CDATA[
		 INSERT INTO COM_MSC_STD_PHY(
        ADDCONDITION,
        ADDSTDCON_CODE,
        ADDSTD_MIN_SIGN,
        ADDSTD_MIN,
        ADDSTD_MAX_SIGN,
        ADDSTD_MAX,
        ADDPERCENT,
        STDMIN_SIGN2,
        STDMIN2,
        STDMAX_SIGN2,
        STDMAX2,
        STD_CHOOSE,
        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,
        ISJUDGE,
        ISQUOTE,
        PHY_TYPE,
        PHY_FORMULA,
        STDMIN_SIGN,
        STDMIN,
        STDMAX_SIGN,
        STDMAX,
        JUDGE_BASIS,
        DELIVERYSTATE,
        MODEL_CODE,
        MODEL_DESC,
        STDMEMO,
        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,
        VALIDFLAG,
        GUID)
 VALUES( 
        '#ADDCONDITION#',
        '#ADDSTDCON_CODE#',
        '#ADDSTD_MIN_SIGN#',
        '#ADDSTD_MIN#',
        '#ADDSTD_MAX_SIGN#',
        '#ADDSTD_MAX#',
        '#ADDPERCENT#',
        '#STDMIN_SIGN2#',
        '#STDMIN2#',
        '#STDMAX_SIGN2#',
        '#STDMAX2#',
        '#STD_CHOOSE#',
        '#PIC#',
        (SELECT NVL(MAX(A.INDEX_SEQ), 0) + 1 FROM COM_MSC_STD_PHY A WHERE A.PIC = '#PIC#'),
        '#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#',
        '#ISJUDGE#',
        '#ISQUOTE#',
        '#PHY_TYPE#',
        '#PHY_FORMULA#',
        '#STDMIN_SIGN#',
        '#STDMIN#',
        '#STDMAX_SIGN#',
        '#STDMAX#',
        '#JUDGE_BASIS#',
        '#DELIVERYSTATE#',
        '#MODEL_CODE#',
        '#MODEL_DESC#',
        '#STDMEMO#',
        '#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,
        '#VALIDFLAG#',
        '#GUID#')
		]]>
	</query>
	
	<query id="QualityMsc.querySaleCustDetection" desc="查询销售探伤特殊要求">
		<![CDATA[
		 SELECT 
       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,
       VALIDFLAG,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME
 FROM SLM_CUST_ALPHA_DETECTION
 WHERE
 CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
 AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QualityMsc.insertMscDetection" desc="新增销售探伤特殊要求">
		<![CDATA[
		  INSERT INTO COM_MSC_STD_DETECTION_C(
        RATE,
        DESC_RATE,
        DESC_VAL,
        GROUP_SEQ,
        DIC,
        XH,
        PHY_CODE,
        PHY_NAME,
        POSITION_CODE,
        POSITION_DESC,
        STD_DESC,
        LV_CODE,
        GROOVE_POS,
        GROOVE_DIR,
        LV_DESC,
        COVERAGE,
        CREATE_NAME,
        CREATE_TIME,
        VALIDFLAG,
        MIN_D,
		MAX_D,
		MIN_H,
		MAX_H,
        MEMO)
 VALUES( 
        '#RATE#',
        '#DESC_RATE#',
        '#DESC_VAL#',
        '#GROUP_SEQ#',
        '#DIC#',
        (SELECT NVL(MAX(A.XH), 0) + 1 FROM COM_MSC_STD_DETECTION_C A WHERE A.DIC = '#DIC#'),
        '#PHY_CODE#',
        '#PHY_NAME#',
        '#POSITION_CODE#',
        '#POSITION_DESC#',
        '#STD_DESC#',
        '#LV_CODE#',
        '#GROOVE_POS#',
        '#GROOVE_DIR#',
        '#LV_DESC#',
        '#COVERAGE#',
        '#CREATE_NAME#',
        SYSDATE,
        '#VALIDFLAG#',
        '#MIN_D#',
        '#MAX_D#',
        '#MIN_H#',
        '#MAX_H#',
        '#MEMO#')
		]]>
	</query>
	
	<query id="QualityMsc.querySaleCustSpec" desc="查询销售公差特殊要求">
		<![CDATA[
SELECT 
       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,
       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,
       VALIDFLAG,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME
 FROM SLM_CUST_ALPHA_SPEC
 WHERE
 CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
 AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QualityMsc.insertMscSpec" desc="新增冶金规范公差从表">
		<![CDATA[
		 INSERT INTO COM_MSC_STD_SPEC_C(
        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,
        VALIDFLAG)
 VALUES( 
        '#SIC#',
        (SELECT NVL(MAX(A.INDEX_SEQ), 0) + 1 FROM COM_MSC_STD_SPEC_C A WHERE A.SIC = '#SIC#'),
        '#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,
        '#VALIDFLAG#')
		]]>
	</query>
	
	<query id="QualityMsc.querySaleCustWater" desc="查询销售水压特殊要求">
		<![CDATA[
		 SELECT 
       CUST_ALPHA_NO,
       WIC,
       INDEX_SEQ,
       PRESSURE_Y,
       PRESSURE,
       FORMULA,
       SAVE_TIME,
       GET_MAXVALUE,
       GET_MINVALUE,
       VALIDFLAG,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME
 FROM SLM_CUST_ALPHA_WATER
 WHERE
 CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
 AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QualityMsc.insertMscWater" desc="新增冶金规范水压从表">
		<![CDATA[
		  INSERT INTO COM_MSC_STD_WATER_C(
        GET_MAXVALUE,
        GET_MINVALUE,
        WIC,
        XH,
        PRESSURE_Y,
        PRESSURE,
        FORMULA,
        SAVE_TIME,
        CREATE_NAME,
        CREATE_TIME,
        VALIDFLAG,
        MEMO)
 VALUES( 
        '#GET_MAXVALUE#',
        '#GET_MINVALUE#',
        '#WIC#',
        (SELECT NVL(MAX(A.XH), 0) + 1 FROM COM_MSC_STD_WATER_C A WHERE A.WIC = '#WIC#'),
        '#PRESSURE_Y#',
        '#PRESSURE#',
        '#FORMULA#',
        '#SAVE_TIME#',
        '#CREATE_NAME#',
        SYSDATE,
        '#VALIDFLAG#',
        '#MEMO#')
		]]>
	</query>
	
	<query id="QualityMsc.querySaleCustProcess" desc="查询销售加工特殊要求">
		<![CDATA[
		 SELECT 
       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,
       VALIDFLAG,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME
 FROM SLM_CUST_ALPHA_PROCESS
 WHERE
 CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
 AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QualityMsc.insertMscProcess" desc="新增冶金规范加工从表">
		<![CDATA[
		 INSERT INTO COM_MSC_STD_PROCESS_C(
        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,
        VALIDFLAG,
        MEMO)
 VALUES( 
        '#GIC#',
        (SELECT NVL(MAX(A.XH), 0) + 1 FROM COM_MSC_STD_PROCESS_C A WHERE A.GIC = '#GIC#'),
        '#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,
        '#VALIDFLAG#',
        '#MEMO#')
		]]>
	</query>
	
	<query id="QualityMsc.getDesignDeptByOrdLnPk" desc="通过合同行查询设计部门表">
		<![CDATA[
SELECT ORD_LN_PK,
       DEPT_CODE,
       DEPT_DESC,
       DELIVY_DEPT_CODE,
       DELIVY_DEPT_DESC,
       TECH_DEPT_CODE,
       TECH_DEPT_DESC
  FROM SLM_ORD_DESIGN_DEPT T
 WHERE T.ORD_LN_PK = '#ORD_LN_PK#'
		]]>
	</query>
	
	<query id="QualityMsc.getCustAlpha" desc="查询客户特殊要求主表">
		<![CDATA[
SELECT MSC,
       CUST_ALPHA_NO,
       CUST_ALPHA_DESC,
       CUST_ALPHA_STS,
       VALIDFLAG,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME
  FROM SLM_CUST_ALPHA T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
		]]>
	</query>
	
	<query id="QualityMsc.getMsc" desc="获取MSC表">
		<![CDATA[
SELECT MSC,
       MSC_DESC,
       USE_CODE,
       USE_DESC,
       DEPARTMENT_CODE,
       DEPARTMENT_DESC,
       UNIT_CODE,
       UNIT_DESC,
       MSC_STYLE,
       USER_COUNT,
       PRODUCCODE,
       PRODUCNAME,
       STD_CODE,
       STD_NAME,
       STEELCODE,
       STEELNAME,
       STD_STYLE,
       STD_STYLE_DESC,
       NEW_PROC_CODE,
       NEW_PROC_DESC,
       ALLOW_NK,
       MSC_SEQ,
       MSC_DESC_SEQ,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       VALIDFLAG,
       MEMO,
       PRODUC_HEAD,
       FILE_JPEG,
       UNIT_CODE_PROCESS,
       UNIT_DESC_PROCESS,
       MSC_OLD,
       USE_CODE_OLD,
       REMARK,
       AUDIT_NAME,
       TO_CHAR(AUDIT_TIME, 'YYYY-MM-DD HH24:MI:SS') AUDIT_TIME,
       VALIDFLAG_NK,
       AUDIT_NAME_NK,
       TO_CHAR(AUDIT_TIME_NK, 'YYYY-MM-DD HH24:MI:SS') AUDIT_TIME_NK,
       REMARK_NK
  FROM COM_MSC T
 WHERE T.MSC = '#MSC#'
		]]>
	</query>
	
	<query id="QualityMsc.getBseStdAlpha" desc="获取用途码">
		<![CDATA[
SELECT T.ALPHA_CODE,
       T.ALPHA_NAME,
       T.STD_CODE,
       T.STD_NOTE,
       T.STD_STYLE,
       T.STD_STYLE_NAME,
       T.STD_VERSION,
       T.DEPARTMENT_CODE,
       T.DEPARTMENT_DESC,
       T.UNIT_CODE,
       T.UNIT_DESC,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       T.VALIDFLAG,
       T.MEMO
  FROM COM_BASE_STD_ALPHA T, COM_MSC B
 WHERE B.MSC = '#MSC#'
   AND T.ALPHA_CODE = B.USE_CODE
		]]>
	</query>
	
	<query id="QualityMsc.getBseStdCust" desc="获取用途码与客户关系">
		<![CDATA[
SELECT STD_CODE,
       STD_NAME,
       CUST_CODE,
       CUST_NAME,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       VALIDFLAG,
       MEMO
  FROM COM_BASE_STD_R_CUST T
 WHERE T.STD_CODE = '#STD_CODE#'
 AND (T.CUST_CODE = '#CUST_CODE#'
 OR T.CUST_CODE = '0000000000')
		]]>
	</query>
	
	<query id="QualityMsc.insertBseStdRCust" 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="QualityMsc.updateCustAlphaState" desc="修改客户要求主表状态">
         <![CDATA[
              UPDATE SLM_CUST_ALPHA
			   SET 
			   	    CUST_ALPHA_STS = '#CUST_ALPHA_STS#',
			        VALIDFLAG = '1',
			        UPDATE_NAME = '#UPDATE_NAME#',
			        UPDATE_TIME = SYSDATE,
			        REVIEW_F_RS = '#REVIEW_F_RS#'
			 WHERE
			 CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
         ]]>
	</query>
	
	<query id="QualityMsc.querySaleCustChemCnt" desc="查询销售客户成分要求数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_CHEM T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QualityMsc.querySaleCustPhyCnt" desc="查询销售客户理化要求数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_PHY T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QualityMsc.querySaleCustSpecCnt" desc="查询销售客户公差要求数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_SPEC T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QualityMsc.querySaleCustDetectionCnt" desc="查询销售客户探伤要求数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_DETECTION T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QualityMsc.querySaleCustWaterCnt" desc="查询销售客户水压要求数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_WATER T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QualityMsc.querySaleCustProcessCnt" desc="查询销售客户加工要求数目">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_CUST_ALPHA_PROCESS T
 WHERE T.CUST_ALPHA_NO = '#CUST_ALPHA_NO#'
   AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="QualityMsc.getBaseStdAlpha" desc="查询用途表">
		<![CDATA[
SELECT ALPHA_NAME FROM COM_BASE_STD_ALPHA T
WHERE T.ALPHA_CODE = '#ALPHA_CODE#'
		]]>
	</query>
	
	<query id="QualityMsc.getBaseNameByBaseCode" desc="通过基础编码查询基础名称">
		<![CDATA[
SELECT T.BASENAME VALUE FROM COM_BASE_INFO T WHERE T.BASECODE = '#BASECODE#'
		]]>
	</query>
	
	<query id="QualityMsc.getMaxCic" desc="查询最大的成分索引号">
		<![CDATA[
SELECT NVL(MAX(T.INDEX_SEQ), 0) + 1 MAX_VALUE FROM COM_MSC_STD_CHEM T WHERE T.CIC = '#CIC#'
		]]>
	</query>
	
	<query id="QualityMsc.getMaxPic" desc="查询最大的理化索引号">
		<![CDATA[
SELECT NVL(MAX(T.INDEX_SEQ), 0) + 1 MAX_VALUE FROM COM_MSC_STD_PHY T WHERE T.PIC = '#PIC#'
		]]>
	</query>
	
	<query id="QualityMsc.getMaxSic" desc="查询最大的公差索引号">
		<![CDATA[
SELECT NVL(MAX(T.INDEX_SEQ), 0) + 1 MAX_VALUE FROM COM_MSC_STD_Spec_C T WHERE T.SIC = '#SIC#'
		]]>
	</query>
	
	<query id="QualityMsc.getMaxDic" desc="查询最大的探伤索引号">
		<![CDATA[
SELECT NVL(MAX(T.XH), 0) + 1 MAX_VALUE FROM COM_MSC_STD_Detection_C T WHERE T.DIC = '#DIC#'
		]]>
	</query>
	
	<query id="QualityMsc.getMaxWic" desc="查询最大的水压索引号">
		<![CDATA[
SELECT NVL(MAX(T.XH), 0) + 1 MAX_VALUE FROM COM_MSC_STD_WATER_C T WHERE T.WIC = '#WIC#'
		]]>
	</query>
	
	<query id="QualityMsc.getMaxGic" desc="查询最大的加工索引号">
		<![CDATA[
SELECT NVL(MAX(T.XH), 0) + 1 MAX_VALUE FROM COM_MSC_STD_PROCESS_C T WHERE T.GIC = '#GIC#'
		]]>
	</query>
	
	<query id="QualityMsc.setModeToChem" desc="修改成分扣型">
		<![CDATA[
UPDATE COM_MSC_STD_CIC T
   SET T.MODEL_CODE  = NVL2(MODEL_CODE, MODEL_CODE || '|', '') ||
                       '#MODEL_CODE#',
       T.MODEL_DESC  = NVL2(MODEL_DESC, MODEL_DESC || '|', '') ||
                       '#MODEL_DESC#',
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
 WHERE T.CIC = '#CIC#'
   AND INSTR(T.MODEL_CODE, '#MODEL_CODE#') = 0
		]]>
	</query>
	
	<query id="QualityMsc.setModeToPhy" desc="修改理化扣型">
		<![CDATA[
UPDATE COM_MSC_STD_PIC T
   SET T.MODEL_CODE = NVL2(MODEL_CODE, MODEL_CODE || '|', '') || '#MODEL_CODE#',
       T.MODEL_DESC = NVL2(MODEL_DESC, MODEL_DESC || '|', '') || '#MODEL_DESC#',
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
 WHERE T.PIC = '#PIC#'
 AND INSTR(T.MODEL_CODE, '#MODEL_CODE#') = 0
		]]>
	</query>
	
	<query id="QualityMsc.setModeToSpec" desc="修改公差扣型">
		<![CDATA[
UPDATE COM_MSC_STD_SPEC T
   SET T.MODEL_CODE = NVL2(MODEL_CODE, MODEL_CODE || '|', '') || '#MODEL_CODE#',
       T.MODEL_DESC = NVL2(MODEL_DESC, MODEL_DESC || '|', '') || '#MODEL_DESC#',
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
 WHERE T.SIC = '#SIC#'
 AND INSTR(T.MODEL_CODE, '#MODEL_CODE#') = 0
		]]>
	</query>
	
	<query id="QualityMsc.setModeToDetection" desc="修改探伤扣型">
		<![CDATA[
UPDATE COM_MSC_STD_DETECTION T
   SET T.MODEL_CODE = NVL2(MODEL_CODE, MODEL_CODE || '|', '') || '#MODEL_CODE#',
       T.MODEL_DESC = NVL2(MODEL_DESC, MODEL_DESC || '|', '') || '#MODEL_DESC#',
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
 WHERE T.DIC = '#DIC#'
 AND INSTR(T.MODEL_CODE, '#MODEL_CODE#') = 0
		]]>
	</query>
	
	<query id="QualityMsc.setModeToWater" desc="修改水压扣型">
		<![CDATA[
UPDATE COM_MSC_STD_WATER T
   SET T.MODEL_CODE = NVL2(MODEL_CODE, MODEL_CODE || '|', '') || '#MODEL_CODE#',
       T.MODEL_DESC = NVL2(MODEL_DESC, MODEL_DESC || '|', '') || '#MODEL_DESC#',
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
 WHERE T.WIC = '#WIC#'
 AND INSTR(T.MODEL_CODE, '#MODEL_CODE#') = 0
		]]>
	</query>
	
	<query id="QualityMsc.setModeToProcess" desc="修改加工扣型">
		<![CDATA[
UPDATE COM_MSC_STD_PROCESS T
   SET T.MODEL_CODE = NVL2(MODEL_CODE, MODEL_CODE || '|', '') || '#MODEL_CODE#',
       T.MODEL_DESC = NVL2(MODEL_DESC, MODEL_DESC || '|', '') || '#MODEL_DESC#',
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
 WHERE T.GIC = '#GIC#'
 AND INSTR(T.MODEL_CODE, '#MODEL_CODE#') = 0
		]]>
	</query>
	
	<query id="QualityMsc.setPscRMscCustAlpaNo" desc="修改PSC和MSC关系表中的客户特殊要求码">
		<![CDATA[
UPDATE COM_PSC_R_MSC T
   SET T.CUST_ALPHA_NO = T.CUST_ALPHA_NO || '#CUST_ALPHA_NO#' || ';'
 WHERE T.MSC = '#MSC#'
   AND (INSTR(T.CUST_ALPHA_NO, '#CUST_ALPHA_NO#') = 0 OR
       INSTR(T.CUST_ALPHA_NO, '#CUST_ALPHA_NO#') IS NULL)
		]]>
	</query>
	<query id="QualityMsc.getMscByCustAlphaNo" desc="获取是否存在CustAlphaNo">
		<![CDATA[
SELECT MSC VALUE
  FROM COM_PSC_R_MSC T
 WHERE INSTR(T.CUST_ALPHA_NO, {0}) > 0
   AND T.PSC = {1}
		]]>
	</query>
</queryMap>