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
ÿþ--[[
 x: GT-100-08
  Tðy: 006-úQ“^USncÖSˆm
 \O€: LZH
 eQãSýQpeÿDeliveryCancel
 ŸRý€ô‹f:
     “eQpencÿ                                                                                        
    {    
    "task_no": "xxx", úQ“^ûN¡R÷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 ·ƒÖSúQ“^US,9hnc{|‹W$R­e
            ¡[8h¶r` - 0¾‹núQ“^US¶r`:NÖSˆm
            gbLˆ¶r` - 0$R­e\ON„v¶r`/f&T:NI{…_,‚Yœg:NI{…_R Rd–\ON,¾‹núQ“^US¶r`:NÖSˆm,‚Yœg\ON¶r` N:NI{…_R¥b•,àeÕlÖSˆm
 ØSôf†SòS:
 20250221 LZH V1.1 °ežX4*NY(uW[µk
 --]]
require("WMS-Equipment")
wms_cntr = require("wms_container")
wms_wh = require("wms_wh")
require("GT-Base")
function DeliveryCancel(strLuaDEID)
    local strRetInfo
    -- 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), 'úQ“^USncÖSˆmÂSpe:', in_date)
 
    -- step2 $R­e/f&Tý    g<Pÿ¡l<P¥b•ԏÞV
    local task_no = in_date.task_no
    if (task_no == nil or task_no == '') then lua.Error(strLuaDEID, debug.getinfo(1), "úQ“^ûN¡R÷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 ·ƒÖSúQ“^US,9hnc{|‹W$R­e
    local stock_out
    nRet, stock_out = m3.GetDataObjectByKey(strLuaDEID, "GT_Stock_Out", "S_DO_NO", task_no)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0úQ“^USnc0áOo`1Y%! " .. stock_out) end
    lua.Debug(strLuaDEID, debug.getinfo(1), "stock_out:", stock_out)
 
    if (stock_out.state == '¡[8h') then
        local strCondition = "S_DO_NO = '" .. task_no .. "'"
        local strSetSQL_update = " S_STATE = 'ÖSˆm' "
        nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, "GT_Stock_Out", strCondition, strSetSQL_update)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "îO9eúQ“^US¶r`1Y%!" .. strRetInfo) end
    elseif (stock_out.state == '/T(u') then
        lua.Error(strLuaDEID, debug.getinfo(1), "úQ“^USck(WgbLˆ-N,àeÕlÖSˆm!")
    elseif (stock_out.state == 'Œ[b') then
        lua.Error(strLuaDEID, debug.getinfo(1), "úQ“^USò]Œ[b,àeÕlÖSˆm!")
    end
end