<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "">
    <query id = "YdmBsSling.doQueryNull" desc = "">
        SELECT
        T.RESULT_NO,
        T.SLING_OLD,
        T.SLING_NEW,
        T.SLING,
        T.STORAGE_NO,
        T.STORAGE_NAME,
        T.LOCATION_NO,
        T.LOCATION_NAME,
        T.CREATE_NAME,
        TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
        T.TAR_STORAGE_NO,
        T.TAR_STORAGE_NAME,
        T.SLING_NO,
        T.FLAG,
        T.TYPE
        FROM YDM_BS_SLING T
        WHERE
         T.TYPE=1
    </query>

    <query id = "YdmBsSling.doQueryOut" desc = "">
        SELECT
        T.RESULT_NO,
        T.SLING_OLD,
        T.SLING_NEW,
        T.SLING,
        T.STORAGE_NO,
        T.STORAGE_NAME,
        T.LOCATION_NO,
        T.LOCATION_NAME,
        T.CREATE_NAME,
        TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
        T.TAR_STORAGE_NO,
        T.TAR_STORAGE_NAME,
        T.SLING_NO,
        T.FLAG,
        T.TYPE
        FROM YDM_BS_SLING T
        WHERE
        T.TYPE=2
    </query>


    <query id = "YdmBsSling.doQueryInsert" desc = "">
        SELECT
        T.RESULT_NO,
        T.SLING_OLD,
        T.SLING_NEW,
        T.SLING,
        T.STORAGE_NO,
        T.STORAGE_NAME,
        T.LOCATION_NO,
        T.LOCATION_NAME,
        T.CREATE_NAME,
        TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
        T.TAR_STORAGE_NO,
        T.TAR_STORAGE_NAME,
        T.SLING_NO,
        T.FLAG,
        T.TYPE
        FROM YDM_BS_SLING T
        WHERE
        1=1
    </query>



    <query id="ydmBsSing.doQuerySling" desc="获取吊带">

        SELECT
        T.LOCATION_NO,
        T.STORAGE_NO,
        T.LOCATION_TYPE,
        T.AREA_NO,
        T.ROW_NO,
        T.COL_NO,
        T.RACK_NO,
        T.LAY_MAX_NUM,
        T.COL_MAX_NUM,
        T.LOCATION_LEN,
        T.LOCATION_WIDTH,
        T.LOCATION_HEIGHT,
        T.X_COORDINATE,
        T.Y_COORDINATE,
        T.LOCATION_STATE,
        T.LOCATION_ATTR_CODE,
        T.LOCATION_ATTR_NAME,
        T.DUMMY_FLAG,
        T.MANAGEMENT_NO,
        T.MANAGEMENT_NAME,
        T.MEMO,
        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.DEPARTMENT_CODE,
        T.DEPARTMENT_DESC,
        T.LOCATION_NAME,
        T.STORAGE_ADDR_NO,
        T.STORAGE_ADDR_NAME,
        T.SLING
        FROM YDM_BS_LOCATION T
        WHERE
        1=1
    </query>


    <query id="YdmBsSling.getYdmBsStorage" desc="获取库号表">
        SELECT
        T.STORAGE_NO,
        T.STORAGE_NAME,
        T.STORAGE_ATTR,
        T.STORAGE_ADDR_NO,
        T.STORAGE_ADDR_NAME,
        T.STORAGE_TYPE_NO,
        T.STORAGE_TYPE_NAME,
        T.X_COORDINATE,
        T.Y_COORDINATE,
        T.MANAGEMENT_NO,
        T.MANAGEMENT_NAME,
        T.HL_MANAGEMENT_NO,
        T.HL_MANAGEMENT_NAME,
        T.DUMMY_FLAG,
        T.MEMO,
        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.STORAGE_ATTR_NAME,
        T.DEPARTMENT_CODE,
        T.DEPARTMENT_DESC,
        T.STOCK_GROUP_CODE,
        T.STOCK_GROUP_NAME,
        T.IS_CAR_TAKING,
        T.IS_CAR_TAKING_BILL,
        T.IS_CRANE_LOADING,
        T.IS_CRANE_UNLOADING,
        T.SEAM_AREA
        FROM YDM_BS_STORAGE T
        WHERE
        1=1

    </query>

    <query id="YdmBsSling.doUpdateSling" desc="">
        UPDATE YDM_BS_LOCATION T
        SET
        T.SLING = '#SLING#'
        WHERE
        1=1

    </query>

    <query id="ydmBsSling.doUpdateFlag" desc="">
        UPDATE YDM_BS_SLING T
        SET
        T.FLAG = '1'
        WHERE
        T.TYPE='2'

    </query>
    <query id="ydmBsSing.DeleteInsert" desc="">
        DELETE YDM_BS_SLING T
        WHERE
        1=1

    </query>



    <query id="YdmBsSling.addSlingNull" desc="">
    INSERT INTO YDM_BS_SLING(
    RESULT_NO,
    TYPE,
    SLING_OLD,
    SLING_NEW,
    SLING,
    STORAGE_NO,
    STORAGE_NAME,
    LOCATION_NO,
    LOCATION_NAME,
    CREATE_NAME,
    CREATE_TIME,
    TAR_STORAGE_NO,
    TAR_STORAGE_NAME,
    SLING_NO,
    FLAG)
    VALUES(
    '#RESULT_NO#',
    '1',
    '#SLING_OLD#',
    '#SLING_NEW#',
    '#SLING#',
    '#STORAGE_NO#',
    '#STORAGE_NAME#',
    '#LOCATION_NO#',
    '#LOCATION_NAME#',
    '#CREATE_NAME#',
    SYSDATE,
    '#TAR_STORAGE_NO#',
    '#TAR_STORAGE_NAME#',
    '#SLING_NO#',
    '')

</query>




    <query id="YdmBsSling.addSlingOut" desc="">
        INSERT INTO YDM_BS_SLING(
        RESULT_NO,
        TYPE,
        SLING_OLD,
        SLING_NEW,
        SLING,
        STORAGE_NO,
        STORAGE_NAME,
        LOCATION_NO,
        LOCATION_NAME,
        CREATE_NAME,
        CREATE_TIME,
        TAR_STORAGE_NO,
        TAR_STORAGE_NAME,
        SLING_NO,
        FLAG)
        VALUES(
        '#RESULT_NO#',
        '2',
        '#SLING_OLD#',
        '#SLING_NEW#',
        '#SLING#',
        '#STORAGE_NO#',
        '#STORAGE_NAME#',
        '#LOCATION_NO#',
        '#LOCATION_NAME#',
        '#CREATE_NAME#',
        SYSDATE,
        '#TAR_STORAGE_NO#',
        '#TAR_STORAGE_NAME#',
        '#SLING_NO#',
        '1')

    </query>


    <query id="YdmBsSling.addSlingInsert" desc="">
        INSERT INTO YDM_BS_SLING(
        RESULT_NO,
        TYPE,
        SLING_OLD,
        SLING_NEW,
        SLING,
        STORAGE_NO,
        STORAGE_NAME,
        LOCATION_NO,
        LOCATION_NAME,
        CREATE_NAME,
        CREATE_TIME,
        TAR_STORAGE_NO,
        TAR_STORAGE_NAME,
        SLING_NO,
        FLAG)
        VALUES(
        '#RESULT_NO#',
        '3',
        '#SLING_OLD#',
        '#SLING_NEW#',
        '#SLING#',
        '#STORAGE_NO#',
        '#STORAGE_NAME#',
        '#LOCATION_NO#',
        '#LOCATION_NAME#',
        '#CREATE_NAME#',
        SYSDATE,
        '',
        '',
        '#SLING_NO#',
        '')

    </query>

    <query id="YdmBsSling.getSlingNo" desc="获取库号表">

        SELECT TO_CHAR((SYSDATE), 'YYMMDD') ||
        LPAD(NVL(MAX(SUBSTR(T.SLING_NO, 9)), 0) + 1, 4, 0) SLING_NO
        FROM YDM_BS_SLING T
        WHERE T.SLING_NO LIKE TO_CHAR((SYSDATE), 'YYMMDD') || '____'
    </query>

    <query id="ydmBsSing.doUpdateOutFlag" desc="出库接收">

        UPDATE YDM_BS_SLING T SET T.FLAG=2 WHERE 1=1
    </query>

    <query id="ydmBsSing.doUpdateInsertFlag" desc="出库待接收">

        UPDATE YDM_BS_SLING T SET T.FLAG=2 WHERE 1=1
    </query>

    <query id="ydmBsSing.doUpdateInsertType" desc="入库接收">

        UPDATE YDM_BS_SLING T SET T.TYPE=3,T.TAR_STORAGE_NO= '#TAR_STORAGE_NO#',
        T.TAR_STORAGE_NAME= '#TAR_STORAGE_NAME#' WHERE 1=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 = "FrmFilpOutStorage.getStoreAll" desc = "查询所有仓库">
        SELECT T.STORAGE_NO,T.STORAGE_NAME FROM YDM_BS_STORAGE T WHERE T.STORAGE_TYPE_NO IN('800202','800205') AND T.VALIDFLAG = '1' and t.seam_area = '1'
    </query>
</queryMap>