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
85
86
87
88
ÿþ--[[
   x: GT-Public-20
    Tðy:  YÀhÞV“^¹pûQnxš[T
   \O€ÿLZH
   åegÿ2025-02-24
 
   ýQpeÿ FjhkClickOk
   ŸRý€:
 
   ôf9e°‹U_:
 
--]]
 
json  = require("json")
mobox = require("OILua_JavelinExt")
require("oi_basestrfunc")
 
function FjhkClickOk(strLuaDEID)
    local nRet, strRetInfo
    -- ·ƒÖSpenc
    nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, "start_loc_code")
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSS_MR‘^\'`1Y%! " .. strRetInfo) end
    lua.Debug(strLuaDEID, debug.getinfo(1), 'strRetInfo', strRetInfo)
    local obj_attrs = json.decode(strRetInfo)
    local start_loc_code = obj_attrs[1].value -- w¹p
    if (start_loc_code == nil or start_loc_code == '') then mobox.setInfo(strLuaDEID, "w¹p Ný€:Nzz!") return end
 
    -- ·ƒÖSw¹páOo`
    local start_loc
    nRet, start_loc = wms_wh.Location_GetInfo(strLuaDEID, start_loc_code)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "WMS_Location_GetInfo1Y%!" .. start_loc) end
 
    -- ·ƒÖSw¹p„v¹[hVáOo`
    local strCondition = "S_LOC_CODE = '" .. start_loc.code .. "'"
    nRet, strRetInfo = m3.QueryDataObject(strLuaDEID, "Lock", strCondition)
    if (nRet == 1)then lua.Error(strLuaDEID, debug.getinfo(1), "å‹'MO¡l    gÑ~š[FRID!")
    elseif (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0'MO¹[hVÑ~š[0áOo`1Y%ÿ" .. strRetInfo) end
    local cntr_code = strRetInfo.cntr_code
 
    -- Rú^AGV¹pù[¹pûN¡R0R    N|iÞV“^ãS
    -- ·ƒÖSù[”^ÞV“^ãS
    -- ·ƒÖSÈ~¹p
    local end_loc
    local str = ''
    if (start_loc.area_code == 'QGFJ') then
        str = "THREE-QGHHK-01"
    elseif (start_loc.area_code == 'BGFJ') then
        str = "THREE-BGHHK-01"
    else
        mobox.setTnfo(strLuaDEID, "w¹p N(Wù[”^„v YÀhs^“^!")
        return
    end
    nRet, end_loc = wms_wh.Location_GetInfo(strLuaDEID, str)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "WMS_Location_GetInfo1Y%!" .. end_loc) end
 
    -- ubûN¡R÷S
    local strCode
    local strHeader = 'TA'..os.date("%y%m%d")..'-'
    nRet,strCode = mobox.getSerialNumber( "ûN¡R", strHeader, 5 )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), '3u÷‹0ûN¡R0x1Y%!'..strCode ) end
 
    -- Rú^AGV,dЏ\ON
    -- Rú^\ON
    --step5  Rú^\ON
    local operation           = m3.AllocObject(strLuaDEID, "Operation")
    operation.start_wh_code   = start_loc.wh_code
    operation.start_area_code = start_loc.area_code
    operation.start_loc_code  = start_loc.code
 
    -- È~¹páOo`
    operation.end_wh_code     = end_loc.wh_code
    operation.end_area_code   = end_loc.area_code
    operation.end_loc_code    = end_loc.code
 
    operation.op_type         = wms_base.Get_nConst(strLuaDEID, "\ON{|‹W-eQ“^")
    local ext_table           = {
        task_no = strCode
    }
    operation.op_def_name     = "AGV“^…Q,dЏ"
    operation.cntr_code       = cntr_code
    operation.ext_data        = lua.table2str(ext_table)
 
    nRet, operation           = m3.CreateDataObj(strLuaDEID, operation)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), 'Rú^0\ON01Y%!' .. operation) end
    lua.Debug(strLuaDEID, debug.getinfo(1), "\ONRú^TáOo`", operation)
    mobox.setInfo(strLuaDEID, "ûN¡R NÑSbŸR!")
end