local m_pGantt = CLuaGantUtil();
m_pGantt:SetGant(ui:getDialogName(), 'id_gantt');

local bOK = false;
--第一步设置 列
bOK = m_pGantt:setDateRange("2016-03-11", "2016-05-24");

--第二步设置 行标题
local help = CSelectHelp();
if db:select('SELECT top(5) eqpt_id,eqpt_name from bs_eqpt','',helpEqpt) < 0 then
    ui:msg(db:error());
    return;
end
bOK = m_pGantt:setListHelp(help, "eqpt_id", "eqpt_name");

local tm = CTNCalcWorkTime();
local str = CTNString();
local err;

bOK = tm:loadShift(str);
bOK = tm:loadWO(str);

--第三步 获取班次help
tm:calcOut("2016-03-11", "2016-05-24", help);
--help为三列 2016-05-02 08:00:00 09:00:00
bOK = m_pGantt:setWorkTime(help);

--增加工单
bOK = m_pGantt:addTask("taskID", "显示名称", 'eqptID', 
    "2016-03-14 10:15:00", "2016-03-15 04:15:00", 34145, 56324);--最后两个参数为背景颜色和字体颜色,颜色可用如ui:rgb(255,0,0)表示红色,这种更习惯些。

--获取工单help  help列信息如下
--"task_id","row", "eqpt_id","start_time"",end_time","back_color","text_color"
bOK = getTask('taskID', help);
local size = getAllTask(help);

--设置工单背景色
bOK = setTaskBackColor('taskID', rgb(100,100,0));

bOK = delTask('taskID');--删除工单
bOK = delAllTask();--删除所有工单

--删除一个设备某一天的班次 日期格式2016-05-02
bOK = delWorkTime('eqptID', '2016-05-02');
bOK = delAllWorkTime();--删除所有班次

--删除所有 行
bOK = delAllEqpt();

bOK = delAll();
Copyright © TouchNet 2015 all right reserved,powered by Gitbook最后修订时间: 2022-06-21 09:21:04

results matching ""

    No results matching ""