<?xml version="1.0" encoding="UTF-8"?>
<queryMap>
    <query id  = "FrmSupervisonInfo.doQueryPline" desc = "查询产线信息">
        SELECT T.PLINE_CODE, T.PLINE_NAME
        FROM COM_BASE_PLINE T
        WHERE T.VALIDFLAG = '1'
        AND T.PROCESS_CODE NOT IN('A','H')
        ORDER BY T.PLINE_CODE ASC
    </query>
    <query id = "FrmSupervisonInfo.doQueryStorageNo" desc = "查询仓库信息">
        SELECT T.STORAGE_NO, T.STORAGE_NAME
        FROM YDM_BS_STORAGE T
        WHERE T.VALIDFLAG = '1'
        ORDER BY T.STORAGE_NO ASC
    </query>
    <query id = "FrmSupervisonInfo.doQuery" desc = "查询">
        SELECT T.SUPERVISOR_CODE,
        T.SUPERVISOR_NAME,
        T.SUPERVISOR_CALL,
        T.PLINE_CODE,
        T.PLINE_NAME,
        T.CREATE_NAME,
        TO_CHAR(T.CREATE_TIME,'YYYY-MM-DD HH:MM:SS')CREATE_TIME,
        T.COL_GROUP,
        DECODE(T.COL_GROUP,'1','甲','2','乙','3','丙','4','丁')COL_GROUP_NAME,
        T.MEMO,
        T.STORAGE_NO,
        T.STORAGE_NAME
        FROM YDM_BC_SUPERVISOR T
        WHERE 1 = 1
    </query>
    <query id = "FrmSupervisonInfo.doAdd" desc = "新增">
        DECLARE
        V_SUPER_CODE YDM_BC_SUPERVISOR.SUPERVISOR_CODE%TYPE := NULL;
        BEGIN
        SELECT '#PLINE_CODE#' ||
        LPAD(NVL(MAX(SUBSTR(T.SUPERVISOR_CODE, 5)), 0) + 1, 3, 0)
        INTO V_SUPER_CODE
        FROM YDM_BC_SUPERVISOR T
        WHERE T.PLINE_CODE = '#PLINE_CODE#';
        INSERT INTO YDM_BC_SUPERVISOR
        (SUPERVISOR_CODE,
        SUPERVISOR_NAME,
        SUPERVISOR_CALL,
        PLINE_CODE,
        PLINE_NAME,
        COL_GROUP,
        CREATE_NAME,
        MEMO,
        CREATE_TIME,
        STORAGE_NO,
        STORAGE_NAME)
        VALUES
        (V_SUPER_CODE,
        '#SUPERVISOR_NAME#',
        '#SUPERVISOR_CALL#',
        '#PLINE_CODE#',
        '#PLINE_NAME#',
        '#COL_GROUP#',
        '#CREATE_NAME#',
        '#MEMO#',
        TO_DATE('#CREATE_TIME#', 'YYYY-MM-DD HH24:MI:SS'),
        '#STORAGE_NO#',
        '#STORAGE_NAME#');
        END;
    </query>
    <query id = "FrmSupervisonInfo.doDelete" desc = "删除">
        DELETE FROM YDM_BC_SUPERVISOR T WHERE T.SUPERVISOR_CODE = '#SUPERVISOR_CODE#'
    </query>
</queryMap>