lzh
2025-06-24 13c4a636539584ab977fddacfae884b3ec250aee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
ÿþlocal function compareTime(a, b)
    -- ÐcÖS\öe0RŸ”ŒTÒy
    local ah, am, as = string.match(a, "(%d+):(%d+):(%d+)")
    local bh, bm, bs = string.match(b, "(%d+):(%d+):(%d+)")
    -- \ÐcÖS„vöeô•èRlbc:NpeW[
    ah, am, as = tonumber(ah), tonumber(am), tonumber(as)
    bh, bm, bs = tonumber(bh), tonumber(bm), tonumber(bs)
    -- Ôkƒ\öe
    if ah > bh then
        return true
    elseif ah < bh then
        return false
    else
        -- \öeøvI{ ÿÔkƒRŸ”
        if am > bm then
            return true
        elseif am < bm then
            return false
        else
            -- RŸ”øvI{ ÿÔkƒÒy
            if as > bs then
                return true
            elseif as < bs then
                return false
            else
                -- öeô•øvI{
                return true
            end
        end
    end
end
 
--[[
   x: GT-27-21
    Tðy: /f&T_ËYgbLˆ,dЏ
   \O€ÿLZH
   åegÿ2025-01-06
 
   ýQpeÿ Start
   ŸRý€:  $R­eS_MRöeô•/f&Tán³ ¶r`:N¡[8hÇ „v_ËY,dЏöeô•„vŒèbUS,án³RRú^ûN¡R_ËY,dЏ
 
   ôf9e°‹U_:
 
--]]
 
json  = require("json")
mobox = require("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
wms_base = require("wms_base")
wms_wh = require("wms_wh")
function Start(strLuaDEID)
    -- ·ƒÖS8^ϑ„vöeô•ŒTS_MRöeô•Ôkù[,$R­e/f&Tán³S_MRŒèbUS„v_ËY,dЏöeô•
    local start_time = wms_base.Get_sConst(strLuaDEID, "sO-‰|™eŒèb_ËYöeô•")
    -- ·ƒÖSS_MRöeô•
    local time = os.date("%H:%M:%S")
    -- \ÐcÖS„vöeô•èRlbc:NpeW[
    local is_true = compareTime(time, start_time)
    -- is_true == true Rán³_ËY,dЏöeô•,Rú^ûN¡R
    if (is_true == true) then
        -- ·ƒÖS@b    g 0¡[8hÇ0„v‰|™eŒèbáOo`
        local strCondition = "S_B_STATE = 1"
        local nRet, allot_order = m3.QueryDataObject(strLuaDEID, "GT_Allot_Order", strCondition)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "QueryDataObject1Y%!" .. allot_order) end
        if (allot_order == '') then goto coroutine end
 
        for i = 1, #allot_order do
            local id = allot_order[i].id -- /UNhƋ
            -- lbc<h_
            -- \ [{"attr":"a1","value":"xxx1"},{"attr":"a2","value":"xxx2"},..] <h_lbcb {"lua_a1":"xxx1","lua_a2":"xxx2"}
            local attr
            nRet, attr = m3.ObjAttrStrToLuaObj("GT_Allot_Order", lua.table2str(allot_order[i].attrs))
            if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "ObjAttrStrToLuaObj1Y%! " .. attr) end
 
            -- Œ(u‹NöN
            local obj_display_name = "0sOûN¡R0"
            local wfp_list_show_name = "'" .. attr.item_code .. "-" .. attr.area_code .. "'0‰|™eŒèb0-ck8^eˆ'"
            local nRet, strRetInfo = mobox.addSysWFP(strLuaDEID, 1, "", "GT_Allot_Order", id, obj_display_name, 0, "", "Rú^ûN¡R",
                wfp_list_show_name, "0‰|™eŒèb0", 0)
            if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "addSysWFP 1Y%!" .. strRetInfo) end
        end
 
        ::coroutine::
    end
end