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
ÿþ--[[
 x: GT-10-12
  Tðy: 'MOÞVŒ
 \O€: LZH
 eQãSýQpeÿCallBackLoc
 ŸRý€ô‹f:
    10Çkbx·ƒÖSAm4l÷S
    20ÇAm4l÷S·ƒÖS¹[hV'ÁTfÆ~°‹U_ ÿ NX[(W¥b•ÿ¹[hV'ÁT*gÑ~š[    ÿ
    30X[(WR¡‹—{N*NïSeQ“^„v ­pўirt'MOv^ÞVŒ
 ØSôf†SòS:
     V1.1 LZH 20240703 $R­eir™e/f&T/fLK ÿ/fR¥b•Ðc:y
     v1.2 LZH 20240704 ŸRý€ØS¨R ÿôv¥c·ƒÖSïSeQ“^'MOv^ÞVŒ
     V1.3 LZH 20240726 Ù~'MO R• ÿv^NOHQågâ‹Am4l÷S/f&TX[(W•
     V1.4 LZH 20240812 penc!j‹WŒte ÿãNx TekŒte
     V1.5 LZH 20241118 d–†N³xў؏    g ^P[^0…PgeQ“^
 --]]
 json  = require("json")
 mobox = require("OILua_JavelinExt")
 m3 = require( "oi_base_mobox" )
 wms_base = require( "wms_base" )
 require("GT-Base")
 function CallBackLoc(strLuaDEID)
     local nRet, strRetInfo, strCondition, attrs
     -- ·ƒÖS‘-N„vagxáOo`
     nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, "S_SERIAL_NO")
     if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSS_MR‘^\'`1Y%! " .. strRetInfo) end
     attrs = json.decode(strRetInfo)
     local serial_no = attrs[1].value
     if(serial_no == nil or serial_no == '') then return end
     -- ·ƒÖSeQ“^USncLˆ
     strCondition = "S_SERIAL_NO = '"..serial_no.."'"
     nRet, strRetInfo = m3.GetDataObjByCondition( strLuaDEID,"GT_Label_Crad", strCondition )
     if ( nRet ~= 0 ) then
         lua.Error( strLuaDEID, debug.getinfo(1), "m3.GetDataObjByCondition 1Y%!"..strRetInfo ) 
     end
     -- ·ƒÖSeQ“^USnc4Y
    nRet, strRetInfo = m3.GetDataObjectByKey(strLuaDEID, "GT_Incoming_Info", "S_ORDER_NO",strRetInfo.order_no)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), strRetInfo) end
    
    local item_code = strRetInfo.item_code -- ir™e{|‹W
    local state = strRetInfo.state  -- ¶r`
    local order_no = strRetInfo.order_no  -- eQ“^US÷S
     if(state ~= '/T(u') then
        -- îO9eeQ“^USnc4Y„v¶r`:NŒ[b
        strCondition = " S_ORDER_NO = '" .. order_no .. "'"
        local strSetSQL_update = " S_STATE = '/T(u' "
        nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, "GT_Incoming_Info", strCondition, strSetSQL_update)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "îO9eeQ“^USnc4Y¶r`1Y%ÿ" .. strRetInfo) end 
     end
 
    --  strCondition = "S_ITEM_CODE = (SELECT S_ITEM_CODE FROM TN_GT_Label_Crad WHERE S_SERIAL_NO = '"..serial_no.."')"
    --  nRet, strRetInfo = m3.GetDataObjByCondition( strLuaDEID,"Material", strCondition )
    --  if ( nRet ~= 0 ) then
    --      lua.Error( strLuaDEID, debug.getinfo(1), "m3.GetDataObjByCondition 1Y%!"..strRetInfo ) 
    --  end
 
    --  local sub_type = strRetInfo.sub_type -- -N{|
    --  local minor_type = strRetInfo.minor_type  -- \{|
    --  -- \{|:NzzŒT N:Nzz„vågâ‹agöN N T
    --  if (minor_type == nil or minor_type == '') then
    --      strCondition = "S_SUB_TYPE = '" .. sub_type .. "' AND S_MINOR_TYPE IS NULL"
    --  else
    --      strCondition = "S_SUB_TYPE = '" .. sub_type .. "' AND S_MINOR_TYPE = '" .. minor_type .. "'"
    --  end
    --  local item_type_info
    --  nRet, item_type_info = m3.GetDataObjByCondition(strLuaDEID, "GT_ITEM_TYPE", strCondition)
    --  if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "·ƒÖS0ir™e^\'`{|‹W0áOo`1Y%! " .. item_type_info) end
    local item_type, material
    nRet, item_type, material = GT_Get_ItemType(strLuaDEID, item_code)
    if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "·ƒÖS0ir™e^\'`{|‹W0áOo`1Y%! " .. item_type) end
 
     if(item_type == '³xў' or item_type == '^P[^' or item_type == '…Pg')then
         local area = ''
         local str = ''
        if(item_type == '³xў') then
             area = 'TH'
             str = '³xў“^`SMO•'
        elseif(item_type == '^P[^')then
             area = 'LZB'
             str = '^P[^`SMO•'
        elseif(item_type == '…Pg')then
             area = 'FC'
             str = '…Pg“^`SMO•'
        end
         -- V1.3OHQågâ‹Am4l÷S/f&TX[(W'MO•
         strCondition = "S_OP_CODE = '" .. serial_no .. "' AND S_OP_NAME IN ('³xў“^`SMO•','^P[^`SMO•','…Pg“^`SMO•')"
         nRet, strRetInfo = m3.QueryDataObject(strLuaDEID, "Lock", strCondition)
         if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0•01Y%ÿ" .. strRetInfo) end
         local loc_code
         if(strRetInfo == '') then
             -- V1.2 ŸRý€ØS¨R
             -- ¡‹—{ïSeQ“^irt'MO
             nRet, strRetInfo = wms_base.GetAreaAvaliableLoc(strLuaDEID, area, "")
             if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "WMS_GetAreaAvaliableLoc1Y%ÿ" .. strRetInfo) end
             loc_code = strRetInfo.loc_code
             -- 'MO R•
             nRet, strRetInfo = wms.wms_LockLocation(strLuaDEID, loc_code, wms_base.Get_nConst(strLuaDEID, "•{|‹W-eQ“^•"),
             loc_code, serial_no, str)
             if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "wms_LockLocation 1Y%!" .. strRetInfo) end
         else
             attrs = strRetInfo[1].attrs
             attrs = m3.KeyValueAttrsToObjAttr(attrs)
             loc_code = attrs.S_TASK_CODE
         end
     
         lua.Debug( strLuaDEID, debug.getinfo(1), 'loc_code', strRetInfo ) 
     
         -- ¾‹n—zãS-N„váOo`
         local setAttr = '[{"attr":"S_LOC_CODE","value":"' .. loc_code .. '"}]'
         local action = {}
         local action1 = {}
         action.action_type = "set_dlg_attr"
         action.value = json.decode(setAttr)
         
         if(item_type ~= '³xў') then
            local setAttr = '[{"attr":"S_CNTR_CODE","show":true}]'
            action1.action_type = "set_dlg_attr_show"
            action1.value = json.decode(setAttr)
            nRet, strRetInfo = mobox.setAction(strLuaDEID, '[' .. lua.table2str(action) ..','..lua.table2str(action1).. ']')
        else
            nRet, strRetInfo = mobox.setAction(strLuaDEID, '[' .. lua.table2str(action) .. ']')   
         end
         
         if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "setAction1Y%! " .. strRetInfo .. ' action = ' .. strAction) end
    else
        lua.Error( strLuaDEID, debug.getinfo(1), "Am4l÷S N^\ŽN³xў0^P[^0…Pg!" )
     end
 end