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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
ÿþ--[[
 x: GT-100-20
  Tðy: ·ƒÖSir™eؚ¦^
 \O€:  ZHR
 eQãSýQpeÿGetMaterialHeight
 “eQpencÿ                                                                                        
{    
    "req_no": "xxx",  /UNx ÿ(uŽN¥cãS!hŒš ÿ؞¤‹ubGUID
    "cntr_code": "xxx",  ¹[hV÷S
    "station_no": "xxx"  å]MO
}
 ŸRý€ô‹f: Ç¹[hV÷SŒTå]MO·ƒÖSir™eù[”^Yb_ÀhKm„vؚ¦^ÿYb_ÀhKm    g3Íyؚ¦^ ÿNO0-N0ؚ    ÿ,‚Yœg/fzzXbRؚ¦^:NNO,Ëz“^@b    g0W¹eýïSåNeQ
 ØSôf†SòS:
    V1.1 LZH 20250325 ‚Yœg¹[hV N:Nzz,å]MO_N«ˆÅˆ±{å]US`S(u,R¥b•Ðc:y
    V1.2 LZH 20250402 ‚YœgMOn/fN|iæ]óS$N§OÞV“^ãSÿ    gxØv:g    ÿRïSåN NÑ~š[ir™eŒTzzXbir™e
 --]]
require("WMS-Equipment")
wms_cntr = require("wms_container")
wms_wh = require("wms_wh")
require("GT-Base")
wms_task = require("wms_task")
function GetMaterialHeight(strLuaDEID)
    local nRet, in_date, strRetInfo, condition
 
    -- 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), 'ýVꁷƒÖSir™eؚ¦^ÂSpe:', in_date)
 
    -- step2 $R­e Å_kXy˜ /f&Tý    g<Pÿ¡l<P¥b•ԏÞV
    local cntr_code = in_date.cntr_code
    if (cntr_code == nil or cntr_code == '') then lua.Error(strLuaDEID, debug.getinfo(1), "RFID Ný€:Nzz!") end
    nRet, strRetInfo = wms_cntr.GetInfo(strLuaDEID, in_date.cntr_code)
    if (nRet ~= 0) then
        return 3, "·ƒÖS0¹[hV0áOo`1Y%! " .. strRetInfo
    end
 
    local station_no = in_date.station_no
    if (station_no == nil or station_no == '') then lua.Error(strLuaDEID, debug.getinfo(1), "å]MO Ný€:Nzz!") end
    -- ·ƒÖSWCSÙz¹pÑ~š[„vå]MO
    station_no = wms_base.Get_sConst(strLuaDEID, station_no)
 
    -- step3 $R­e ¹[hV /f&TX[(W¹[hV'ÁTfÆ~ÿ NX[(WR $R­e/f&TX[(Wň±{å]US,ý NX[(WR¥b•
    local data = {}
    local detail, item_type, material, packing_order
    local strCondition = "S_CNTR_CODE = '" .. cntr_code .. "'"
    nRet, detail = m3.GetDataObjByCondition(strLuaDEID, "CG_Detail", strCondition)
    if (nRet == 1) then
        -- V1.2$R­e/f&T/fæ]óS$N§OÞV“^ãS
        if(station_no == 'ONE-BGHKK-01' or station_no == 'ONE-QGHKK-01')then
            data.height = 1
            mobox.returnValue(strLuaDEID, 1, lua.table2str(data))
            return
        end
        condition = "S_START_LOC = '" .. station_no .. "'"
        nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "GT_PDA_Station", condition)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0å]MO0áOo`1Y%! " .. strRetInfo) end
        station_no = strRetInfo.station
        -- ·ƒÖS,gå]MOg°e„v 0ň±{å]US0
        strCondition = "S_STATION = '" .. station_no .. "' AND S_STATE = '/T(u' "
        nRet, packing_order = m3.GetDataObjByCondition(strLuaDEID, "GT_Packing_Order", strCondition)
        if (nRet ~= 0) then
            lua.Error(strLuaDEID, debug.getinfo(1), "m3.GetDataObjByCondition 1Y%!" .. packing_order)
        end
        --·ƒÖSir™e{|‹W
        nRet, item_type, material = GT_Get_ItemType(strLuaDEID, packing_order.item_code)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "m3.GetDataObjByCondition 1Y%!" .. item_type) end
 
        --9hnc N Tir™e{|‹Weg$R­eir™eؚ¦^
        if item_type == '‰|™e' then
            data.height = 3
        elseif item_type == 'ö€™e' or item_type == 'zzå]ň' or item_type == ')Y6qö€' or item_type == 'ceňö€' then
            data.height = 1
        elseif item_type == '¢”N' then
            data.height = 2
        else
            lua.Error(strLuaDEID, debug.getinfo(1), "*gåwir™e{|‹W: " .. item_type .. " ÿàeÕl·ƒÖSir™eؚ¦^")
        end
        mobox.returnValue(strLuaDEID, 1, lua.table2str(data))
        return
    elseif (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "m3.GetDataObjByCondition 1Y%!" .. detail)
    end
 
    --·ƒÖSir™e{|‹W
    nRet, item_type, material = GT_Get_ItemType(strLuaDEID, detail.item_code)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "m3.GetDataObjByCondition 1Y%!" .. item_type) end
 
    -- V1.1 LZH 20250325
    -- $R­eå]MO/f&TX[(W/T(u„vň±{å]US
    condition = "S_START_LOC = '" .. station_no .. "'"
    nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "GT_PDA_Station", condition)
    if (nRet == 1) then
        --9hnc N Tir™e{|‹Weg$R­eir™eؚ¦^
        if item_type == '‰|™e' then
            data.height = 3
        elseif item_type == 'ö€™e' or item_type == 'zzå]ň' or item_type == ')Y6qö€' or item_type == 'ceňö€' then
            data.height = 1
        elseif item_type == '¢”N' then
            data.height = 2
        else
            lua.Error(strLuaDEID, debug.getinfo(1), "*gåwir™e{|‹W: " .. item_type .. " ÿàeÕl·ƒÖSir™eؚ¦^")
        end
        -- step4  OÂS
        mobox.returnValue(strLuaDEID, 1, lua.table2str(data))
        return
    elseif (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0å]MO0áOo`1Y%! " .. strRetInfo)
    end
 
    lua.Debug(strLuaDEID, debug.getinfo(1), 'station_no', station_no)
    strCondition = "S_STATION = '" .. station_no .. "' AND S_STATE = '/T(u' "
    nRet, packing_order = m3.GetDataObjByCondition(strLuaDEID, "GT_Packing_Order", strCondition)
    if (nRet == 1) then
        --·ƒÖSir™e{|‹W
        nRet, item_type, material = GT_Get_ItemType(strLuaDEID, detail.item_code)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "m3.GetDataObjByCondition 1Y%!" .. item_type) end
 
        --9hnc N Tir™e{|‹Weg$R­eir™eؚ¦^
        if item_type == '‰|™e' then
            data.height = 3
        elseif item_type == 'ö€™e' or item_type == 'zzå]ň' or item_type == ')Y6qö€' or item_type == 'ceňö€' then
            data.height = 1
        elseif item_type == '¢”N' then
            data.height = 2
        else
            lua.Error(strLuaDEID, debug.getinfo(1), "*gåwir™e{|‹W: " .. item_type .. " ÿàeÕl·ƒÖSir™eؚ¦^")
        end
 
        -- step4  OÂS
        mobox.returnValue(strLuaDEID, 1, lua.table2str(data))
    elseif (nRet == 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "å]MOò]«ˆÅˆ±{å]US`S(u!")
    else
        lua.Error(strLuaDEID, debug.getinfo(1), "GetDataObjByCondition1Y%!" .. detail)
    end
end