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
ÿþ--[[
 x: GT-100-07
  Tðy: 004-eQ“^USncÖSˆm
 \O€: LZH
 eQãSýQpeÿStorageCancel
 ŸRý€ô‹f: Ç6e'US÷S + 6e'USLˆ÷S, Rd–*geQ“^„veQ“^USncLˆ,v^¾‹neQ“^US„v¶r`:NÖSˆm
 
    “eQpencÿ                                                                                        
    {    
    "delivery_no": "xxx",    6e'US÷S
    "delivery_row_no": 1,    6e'USLˆ÷S
    "remark1": "",  -- Yèl ‚f*g/T(u
    "remark2": "",  -- Yèl ‚f*g/T(u
    "remark3": "",  -- Yèl ‚f*g/T(u
    "remark4": ""   -- Yèl ‚f*g/T(u
    }    
 
    Yt;‘
        -- step1 ã‰g¥cãS O„v datajson ÂSpe
        -- step2 !hŒšÅ_ OW[µk/f&T:Nzz ÿ:NzzR¥b•
        -- step3 Ç6e'US÷SŒT6e'USLˆ÷Sågâ‹eQ“^USnc4Y
        -- step4  Rd–eQ“^USnc4Y N„v@b    g*geQ“^„vUSncLˆ
        -- step5 ¾‹neQ“^USnc4Y N„v@b    ggbLˆ-N„vň±{å]US:NsQí•
        -- step6 ¾‹n¶r`:NÖSˆm
    ØSôf†SòS:
    20250221 LZH V1.1 °ežX4*NY(uW[µk
 --]]
m3    = require("oi_base_mobox")
json  = require("json")
mobox = require("OILua_JavelinExt")
function StorageCancel(strLuaDEID)
    -- step1 ·ƒÖS¥cãSpenc
    local 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), 'eQ“^USÖSˆmÂSpe:', in_date)
 
    -- step2 $R­e/f&Tý    g<Pÿ¡l<P¥b•ԏÞV
    local delivery_no = in_date.delivery_no
    if (delivery_no == nil or delivery_no == '') then lua.Error(strLuaDEID, debug.getinfo(1), "6e'US÷S Ný€:Nzz!") end
    local delivery_row_no = tonumber(in_date.delivery_row_no)
    if (delivery_row_no == nil) then lua.Error(strLuaDEID, debug.getinfo(1), "6e'USLˆ÷S Ný€:Nzz!") end
    -- V1.1 °ežXY(uW[µk
    local remark1 = in_date.remark1
    local remark2 = in_date.remark2
    local remark3 = in_date.remark3
    local remark4 = in_date.remark4
 
    -- step3 Ç6e'US÷SŒT6e'USLˆ÷Sågâ‹eQ“^USnc4Y
    local strCondition = "S_DELIVERY_NO = '" .. delivery_no .. "' AND N_DELIVERY_ROW_NO = " .. delivery_row_no
    local incoming_Info
    nRet, incoming_Info = m3.GetDataObjByCondition(strLuaDEID, "GT_Incoming_Info", strCondition)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0eQ“^USnc4Y0áOo`1Y%! " .. incoming_Info) end
    local order_no = incoming_Info.order_no
 
    if (incoming_Info.state == 'Œ[b') then lua.Error(strLuaDEID, debug.getinfo(1), "eQ“^USò]Œ[b,àeÕlÖSˆm!") end
 
    -- step4  Rd–eQ“^USnc4Y N„v@b    g*geQ“^„vUSncLˆ
    strCondition = " S_ORDER_NO  = '" .. order_no .. "' AND S_SERIAL_NO NOT IN (SELECT S_SERIAL_NO FROM TN_CG_Detail)"
    local strRetInfo
    nRet, strRetInfo = mobox.deleteDataObject(strLuaDEID, "GT_Label_Crad", strCondition)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), " Rd–*geQ“^„v0eQ“^USncLˆ01Y%!  " .. strRetInfo) end
 
    -- step5 ¾‹neQ“^USnc4Y N„v@b    ggbLˆ-N„vň±{å]US:NsQí•
    strCondition = " S_ORDER_NO = '" .. order_no .. "' AND S_STATE IN ('/T(u','°eú^')"
    local strSetSQL_update = " S_STATE = 'sQí•' "
    nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, "GT_Packing_Order", strCondition, strSetSQL_update)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "îO9eň±{å]US¶r`1Y%!" .. strRetInfo) end
 
    -- step6 ¾‹n¶r`:NÖSˆm
    strCondition = " S_ORDER_NO = '" .. order_no .. "'"
    strSetSQL_update = " S_STATE = 'ÖSˆm' "
    nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, "GT_Incoming_Info", strCondition, strSetSQL_update)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "îO9eeQ“^US¶r`1Y%!" .. strRetInfo) end
end