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
ÿþ--[[
 x:
  Tðy: LocStateFeedBack
 \O€:
 eQãSýQpeÿLocStateFeedBack
 ŸRý€ô‹f:
 ØSôf†SòS:
 --]]
require("WMS-Equipment")
wms_cntr = require("wms_container")
wms_wh = require("wms_wh")
require("GT-Base")
require("GT_InAndOutboundPolicies")
function LocStateFeedBack(strLuaDEID)
    local nRet, in_date, strRetInfo
    -- step1 ·ƒÖS¥cãSpenc
    nRet, in_date = m3.GetSysDataJson(strLuaDEID)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "àeÕl·ƒÖSpencS!" .. in_date) end
    lua.Debug(strLuaDEID, debug.getinfo(1), 'ÂSpe:', in_date)
 
    -- step2 $R­e Å_kXy˜ /f&Tý    g<Pÿ¡l<P¥b•ԏÞV
    local loc_code = in_date.loc_code              -- 'MO
    local type = lua.StrToNumber(in_date.type)     -- 1 AQ¸‹ÖS' 2 AQ¸‹>e' 3 ÖS'Œ[bAQ¸‹»y_ 4 >e'Œ[bAQ¸‹»y_
    local req_no = lua.StrToNumber(in_date.req_no) -- /UNx
    if (loc_code == nil or loc_code == '') then lua.Error(strLuaDEID, debug.getinfo(1), "Ùz¹p Ný€:Nzz!") end
    if (type == nil) then lua.Error(strLuaDEID, debug.getinfo(1), "{|‹W Ný€:Nzz!") end
 
    -- 9hncWCSÙz¹p·ƒÖS'MO
    loc_code = wms_base.Get_sConst(strLuaDEID, loc_code)
 
    -- 9hnc{|‹WŒTÙz¹p ·ƒÖSù[”^„vAGVûN¡R
    local task_no
    if (type == 1 or type == 3) then
        -- Ùz¹p:Nw¹p,ûN¡R¶r`:Nò]¨c
        local condition = "S_START_LOC = '" ..
        loc_code ..
        "' AND N_B_STATE = 1 AND S_CODE IN (SELECT S_TASK_CODE FROM TN_Task_Action WHERE N_ACTION_CODE = " .. type .. ")"
        nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "Task", condition, "T_CREATE")
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0ûN¡R0áOo`1Y%! " .. strRetInfo) end
        task_no = strRetInfo.code
    elseif (type == 2) then
        -- Ùz¹p:NÈ~¹p,ûN¡R¶r`:Nò]¨c
        local condition = "S_END_LOC = '" ..
        loc_code ..
        "' AND N_B_STATE = 1 AND S_CODE IN (SELECT S_TASK_CODE FROM TN_Task_Action WHERE N_ACTION_CODE = " .. type .. ")"
        nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "Task", condition, "T_CREATE")
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0ûN¡R0áOo`1Y%! " .. strRetInfo) end
        task_no = strRetInfo.code
    elseif (type == 4) then
    else
        lua.Error(strLuaDEID, debug.getinfo(1), "*gš[IN„v¶r`ÍSˆ™{|‹W!")
    end
 
    -- Œ(uAGV„v‰[hQ¤N’N¥cãS
    local url = wms_base.Get_sConst(strLuaDEID, "AGV-url")
    local strurl = url .. "/AllowThrough"
    local strHeader = ""
    local data = {
        task_no = task_no,
        type = type, -- 1 AQ¸‹ÖS' 2 AQ¸‹>e' 3 ÖS'Œ[bAQ¸‹»y_ 4 >e'Œ[bAQ¸‹»y_
        loc = loc_code,
        req_no = req_no
    }
    nRet, strRetInfo = CreateInterfaceExc(strLuaDEID, strurl, strHeader, data, "AGV", "'MO¶r`ÍSˆ™")
    if (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "Œ(u¥cãS1Y%!" .. strRetInfo)
    end
end