<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="仓库权限">

	<query id="WarehousePermissions.getWarehousePermissions" desc="获取仓库权限">
		<![CDATA[
	      SELECT T.STORAGE_NO, T.STORAGE_NAME
  FROM YDM_BS_STORAGE T
 WHERE 
    T.STORAGE_TYPE_NO || '&' LIKE '%' || ? || '%'
    AND T.STORAGE_ATTR || '&' LIKE '%' || ? || '%'
   AND T.VALIDFLAG='1'	      
		]]>
	</query>
	<query id="WarehousePermissions.getWarehousePermissionsStore"
		desc="获取仓库权限">
		<![CDATA[
	      SELECT T.STORAGE_NO, T.STORAGE_NAME
  FROM YDM_BS_STORAGE T
 WHERE  T.VALIDFLAG='1'	 
		]]>
	</query>

	<query id="WarehousePermissions.getMaterialInfo" desc="物料编码信息">
		<![CDATA[
	      SELECT MATERIAL_NO,
       MATERIAL_DESC,
       PRODUCCODE,
       PRODUCNAME,
       PRODUC_JX,
       PRODUC_ENG,
       STD_STYLE,
       STD_STYLE_DESC,
       STEELCODE,
       STEELNAME,
       GRADECODE,
       GRADENAME,
       DIMATER,
       HEIGHT,
       SPEC_CODE,
       SPEC_NAME,
       MODEL_CODE,
       MODEL_DESC,
       OUTSRC_ALLOW,
       FIRST_PRDC,
       CREATE_NAME,
       CREATE_TIME,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME
  FROM SLM_BASE_MATERIAL T
  ORDER BY T.MATERIAL_NO     
		]]>
	</query>

	<query id="WarehousePermissions.getOrderUnitBySalg" desc="订货单位（销售组织权限）">
		SELECT
		DISTINCT T1.CUSTOMER_NO, T1.CUSTOMER_NM
		FROM SLM_BASE_CUSTOMER T1,
		SLM_BASE_CUSTM_USE T2
		WHERE T1.CUSTOMER_NO = T2.CUSTOMER_NO
		AND
		T1.VALIDFLAG = '1'
		AND T2.VALIDFLAG = '1'
		AND T2.CUSTM_USE='100202'
	</query>

	<query id="WarehousePermissions.getReceivingUnitBySalg" desc="收货单位（销售组织权限）">
		SELECT
		DISTINCT T1.CUSTOMER_NO, T1.CUSTOMER_NM
		FROM SLM_BASE_CUSTOMER
		T1, SLM_BASE_CUSTM_USE T2
		WHERE T1.CUSTOMER_NO = T2.CUSTOMER_NO
		AND
		T1.VALIDFLAG = '1'
		AND T2.VALIDFLAG = '1'
		AND T2.CUSTM_USE='100203'
	</query>


	<query id="WarehousePermissions.getSalgPermissions" desc="获取销售组织权限">
		<![CDATA[
	      SELECT DISTINCT T.SALE_ORG FROM SLM_BASE_SALE_AREA_TYP T WHERE T.VALIDFLAG = '1'      
		]]>
	</query>

	<query id="WarehousePermissions.getSection" desc="获取科室权限">
		SELECT DISTINCT T.SALE_AREA_NO FROM SLM_BASE_SALE_AREA_TYP T WHERE
		T.VALIDFLAG = '1'
</query>
	<query id="WarehousePermissions.getBaseSection" desc="基础信息科室权限">
		select t.departid,t.departname from core_app_department t where t.depttype ='3'
</query>
	<query id="WarehousePermissions.getStoreNo" desc="根据数据权限查询仓库">
		select t.STORAGE_NO,t.STORAGE_NAME from YDM_BS_STORAGE t where 1=1
   #CONDITION#
	</query>
	<query id="WarehousePermissions.getStoreAll" desc="获取所有目标库">
		SELECT T.STORAGE_NO,T.STORAGE_NAME FROM YDM_BS_STORAGE T WHERE
		T.STORAGE_TYPE_NO = ?
	</query>

	<query id="WarehousePermissions.getStoreAll1" desc="获取所有目标库">
		SELECT T.STORAGE_NO,T.STORAGE_NAME FROM YDM_BS_STORAGE T WHERE
		1=1
	</query>
	
		<query id="WarehousePermissions.getStoreAll2" desc="获取所有目标库">
		SELECT T.STORAGE_NO,T.STORAGE_NAME FROM YDM_BS_STORAGE T WHERE 
		T.STORAGE_TYPE_NO = ?  AND T.STORAGE_ATTR = ?
	</query>
	
	<query id="WarehousePermissions.getKepNo" desc="获取所有框号">
	SELECT T.KEP_NO FROM COUPLING_APP_BOX_MAIN T where t.VALIDFLAG='1'
	</query>
	<query id = "WarehousePermissions.getWarehousePermissionsDepart" desc = "根据数据权限获取部门">
		SELECT DISTINCT T.PID FROM CORE_APP_DEPARTMENT T WHERE 1 = 1
	</query>
</queryMap>