<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="仓库界面数据显示">

 <query id="YdmStorageDefineSur.storageName" desc="仓库库号信息">
		<![CDATA[
			select STORAGE_NO,
			STORAGE_NAME,
			STORAGE_ATTR,
			STORAGE_ATTR_NAME,
			STORAGE_ADDR_NO,
			STORAGE_ADDR_NAME,
			STORAGE_TYPE_NO,
			STORAGE_TYPE_NAME,
			X_COORDINATE,
			Y_COORDINATE,
			MANAGEMENT_NO,
			MANAGEMENT_NAME,
			HL_MANAGEMENT_NO,
			HL_MANAGEMENT_NAME,
			decode(DUMMY_FLAG,'1','TRUE','FALSE') DUMMY_FLAG,
			decode(VALIDFLAG,'1','有效','无效') VALIDFLAG,
			MEMO,
			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,
			DEPARTMENT_DESC,
            DEPARTMENT_CODE,
            STOCK_GROUP_CODE,
            STOCK_GROUP_NAME,
            IS_CAR_TAKING AS IS_CAR_TAKINGCODE,
            DECODE(IS_CAR_TAKING,'0','否','1','是')IS_CAR_TAKING,
            DECODE(IS_CAR_TAKING_BILL,'0','否','1','是')IS_CAR_TAKING_BILL,
            DECODE(IS_CRANE_LOADING,'0','否','1','是')IS_CRANE_LOADING,
            DECODE(IS_CRANE_UNLOADING,'0','否','1','是')IS_CRANE_UNLOADING,
            DECODE(SEAM_AREA,'0','天管','1','天淮')SEAM_AREA
			from YDM_BS_STORAGE where 1=1 
		]]>
	</query>
	<query id  = "YdmStorageDefineSur.getMaxDepartMent" desc = "根据权限查询科室">
	SELECT T.DEPARTNAME,T.DEPARTID FROM CORE_APP_DEPARTMENT T where t.depttype = '3'#CONDITION# ORDER BY T.DEPARTID asc
	</query>
	<query id="YdmStorageDefineSur.storageRepeatCode" desc="仓库编号是否重复">
		<![CDATA[
			select count(1) from YDM_BS_STORAGE t where t.storage_no = ?
		]]>
	</query>
	 <query id="YdmStorageDefineSur.storageCodeAdd" desc="新增">
		<![CDATA[
			 INSERT INTO YDM_BS_STORAGE
							(STORAGE_NO,
					        STORAGE_NAME,
							STORAGE_ATTR,
							STORAGE_ATTR_NAME,
					        STORAGE_TYPE_NO,
					        STORAGE_TYPE_NAME,
					        STORAGE_ADDR_NO,
					        STORAGE_ADDR_NAME,
					        MANAGEMENT_NO,
					        MANAGEMENT_NAME,
					        HL_MANAGEMENT_NO,
					        HL_MANAGEMENT_NAME,
							X_COORDINATE,
							Y_COORDINATE,
					        MEMO,
					        DUMMY_FLAG,
					       
					        CREATE_TIME,
					        CREATE_NAME,DEPARTMENT_CODE,DEPARTMENT_DESC,STOCK_GROUP_CODE,
					        STOCK_GROUP_NAME,IS_CAR_TAKING,IS_CAR_TAKING_BILL,SEAM_AREA)
							VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,
							?,?,SYSDATE,?,?,?,?,?,?,?,?)
							
			  
		]]>
	</query>
    <query id="YdmStorageDefineSur.storageCodeUpdate" desc="修改">
		<![CDATA[
			 UPDATE YDM_BS_STORAGE
			 SET             STORAGE_NAME = ?,
							STORAGE_ATTR = ?,
							STORAGE_ATTR_NAME=?,
					        STORAGE_TYPE_NO = ?,
					        STORAGE_TYPE_NAME = ?,
					        STORAGE_ADDR_NO = ?,
					        STORAGE_ADDR_NAME = ?,
					        MANAGEMENT_NO = ?,
					        MANAGEMENT_NAME = ?,
					        HL_MANAGEMENT_NO = ?,
					        HL_MANAGEMENT_NAME = ?,
							X_COORDINATE = ?,
							Y_COORDINATE = ?,
					        MEMO = ?,
					        DUMMY_FLAG = ?,
					        UPDATE_TIME = SYSDATE,
					        UPDATE_NAME =?,
					        DEPARTMENT_CODE = ?,
					        DEPARTMENT_DESC = ?,
					         STOCK_GROUP_CODE = ?,
					        STOCK_GROUP_NAME = ?,
					        IS_CAR_TAKING = ?,
					        IS_CAR_TAKING_BILL = ?,
					        IS_CRANE_LOADING = ?,
					        IS_CRANE_UNLOADING = ?,
					        SEAM_AREA = ?
					         where STORAGE_NO = ?
		]]>
	</query>
	<query id="YdmStorageDefineSur.storageCancelUpdate" desc="作废">
		<![CDATA[
			 DELETE from YDM_BS_STORAGE where STORAGE_NO = ?
		]]>
	</query>
	<!-- UPDATE YDM_BS_STORAGE
			 SET             VALIDFLAG = '0',
					        DELETE_TIME = SYSDATE,
					        DELETE_NAME =? where STORAGE_NO = ? -->
	<query id="YdmStorageDefineSur.storageResume" desc="恢复">
		<![CDATA[
			 UPDATE YDM_BS_STORAGE
			 SET             VALIDFLAG = '1',
					        DELETE_TIME = '',
					        DELETE_NAME ='' where STORAGE_NO = ?
		]]>
	</query>
	<query id="YdmStorageDefineSur.departMentKs" desc="重新加载科室">
		<![CDATA[
			 SELECT T.DEPARTID,T.DEPARTNAME
  FROM CORE_APP_DEPARTMENT T
 WHERE  T.DEPTTYPE = '3'
   AND T.PID =?
   ORDER BY T.DEPARTID ASC
		]]>
	</query>
	<query id  = "YdmStorageDefineSur.getGroupStoage" desc = "管理分组">
	SELECT T.BASECODE,T.BASENAME FROM COM_BASE_INFO T WHERE T.SORTCODE=? AND T.VALIDFLAG='1'
	</query>
	<query id  = "YdmStorageDefineSur.getStoreLocation" desc = "查询是否存在有效库位数据">
	SELECT COUNT(1) FROM YDM_BS_LOCATION T WHERE T.STORAGE_NO = ? AND T.VALIDFLAG = '1'
	</query>
	<query id = "YdmStorageDefineSur.getButTressData" desc = "查询仓储表中是否存在有效数据">
	SELECT COUNT(1) FROM YDM_ZC_BUTTRESS T WHERE T.STORAGE_NO = ?
	</query>
	<query id = "YdmStorageDefineSur.storageCodeUpdateLaction" desc = "修改料位表信息">
	UPDATE YDM_BS_LOCATION T
           SET T.MANAGEMENT_NO   = ?,
               T.MANAGEMENT_NAME = ?,
               T.DEPARTMENT_CODE = ?,
               T.DEPARTMENT_DESC = ?,
               T.UPDATE_NAME = ?,
               T.UPDATE_TIME = SYSDATE
         WHERE T.STORAGE_NO = ?
	</query>
</queryMap>
