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
ÿþ--[[
 x: GT-100-15
  Tðy: àSØv:gzzå]ňԏÞV
 \O€: LZH
 eQãSýQpeÿEmptyCntrReturn
 ŸRý€ô‹f: ·ƒÖSir™e÷S ÿ‚Yœg:NzzRãNhˆAGV(W÷‹BlzzàSØv:gÞV“^ûN¡R
    “eQpencÿ                                                                                        
    {
    "partNumber": "ir™e÷S",
    "qty": null,
    "locationCode": "w¹pMOnx"
    "CntrCode":"¹[hV÷S"
    }
 
    Yt;‘
    -- step1 ã‰g¥cãS O„v datajson ÂSpe
    -- step2 !hŒšÅ_ OW[µk/f&T:Nzz ÿ:NzzR¥b•
    -- step3 Í‘°e¡‹—{È~¹p'MO
 ØSôf†SòS:
 --]]
-- require("WMS-Equipment")
wms_cntr = require("wms_container")
wms_wh = require("wms_wh")
require("GT-Base")
function EmptyCntrReturn(strLuaDEID)
    local nRet, in_date
    -- step1 ·ƒÖS¥cãSpenc
    nRet, in_date = m3.GetSysDataJson(strLuaDEID)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "WCStoreCallback àeÕl·ƒÖSpencS!" .. in_date) end
    lua.Debug(strLuaDEID, debug.getinfo(1), 'zzå]ňԏÞVÂSpe:', in_date)
 
    -- step2 $R­e Å_kXy˜ /f&Tý    g<Pÿ¡l<P¥b•ԏÞV
    local partNumber = in_date.PartNumber     -- ir™e÷S
    local locationCode = in_date.LocationCode -- w¹pMOn
    local qty = tonumber(in_date.Qty)         -- peϑ
    local CntrCode = in_date.CntrCode         -- ¹[hV÷S Y*N(u,÷S
    if (locationCode == nil or locationCode == '') then lua.Error(strLuaDEID, debug.getinfo(1), "w¹p Ný€:Nzz!") end
 
    -- AGV÷‹BlàSØv:gzzXbÞV“^ûN¡R ÿWMSubûN¡Rv^ NÑS„vgô•O͑ Y÷‹Bl ÿåN,{N!k÷‹Bl:NÆQ ÿ9hncw¹p$R­e/f&Tò]Ï~ubûN¡R
    -- 9hncw¹p·ƒÖSzzXbÞV“^„vûN¡R
    local localtion
    local strCondition = "S_B_STATE IN ('I{…_','gbLˆ') AND S_START_LOC = '" ..
        locationCode .. "' AND S_OP_DEF_NAME = 'AGVzzXbÞV“^'"
    nRet, localtion = m3.GetDataObjByCondition(strLuaDEID, "Operation", strCondition)
    if (nRet == 1) then
        -- ir™e = zz ãNhˆAGV(W÷‹BlbìNàSØv:gzzXbÞV“^ûN¡R
        if (partNumber == nil or partNumber == '') then
            -- Ñ~š[zzXbir™e
            local cg_detail = m3.AllocObject(strLuaDEID, "CG_Detail")
            cg_detail.cntr_code = CntrCode
            cg_detail.item_code = "KGZ"
            cg_detail.item_name = "zzå]ň"
            cg_detail.qty = qty
            cg_detail.uom = '*N'
            nRet, cg_detail = m3.CreateDataObj(strLuaDEID, cg_detail)
            if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), 'Rú^0¹[hV'ÁTfÆ~0ù[aŒ1Y%!' .. cg_detail) end
 
            -- ·ƒÖSw¹páOo`
            local loc_start
            nRet, loc_start = wms_wh.Location_GetInfo(strLuaDEID, locationCode)
            if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "WMS_Location_GetInfo1Y%! " .. loc_start) end
 
            -- Rú^zzXbØvÄ~ÞV“^ûN¡R NµkûN¡Ragv,dЏ ÿŒNµkûN¡RýVê,dЏ
            local operation           = m3.AllocObject(strLuaDEID, "Operation")
            -- w¹páOo`
            operation.start_wh_code   = loc_start.wh_code
            operation.start_area_code = loc_start.area_code
            operation.start_loc_code  = loc_start.code
 
            operation.cntr_code       = CntrCode
 
            operation.op_type         = wms_base.Get_nConst(strLuaDEID, "\ON{|‹W-eQ“^")
            operation.op_def_name     = "AGVzzXbÞV“^"
 
            nRet, operation           = m3.CreateDataObj(strLuaDEID, operation)
            if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), 'Rú^0\ON01Y%!' .. operation) end
        else
            lua.Error(strLuaDEID, debug.getinfo(1), "*gš[IN„vAm z! ")
        end
    elseif (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0\ON0áOo`1Y%! " .. localtion)
    end
end