1
Jianw
2025-07-09 88e26a2a960dbbc148332772448b79b9877102d8
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
--[[
    编码: 
    名称: WMS-LUA-FUNC-EPI
    作者:HAN
    日期:2025-1-18
 
    级别:BASIS
    
    函数:main
        输入的body体 {func = "函数名称", ...}
    功能:
      
    更改记录:
--]]
 
json = require ("json")
wms  = require("OILua_WMS")
mobox = require("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function main( strLuaDEID )
    local nRet, body, err_code, strValue
 
    err_code = 0
    -- 获取接口传入的数据
    nRet, body = m3.GetSysDataJson(strLuaDEID)  
    if ( nRet ~= 0 ) then
        err_code = 200
        strValue = "WebAPI输入参数的格式有问题!"..body 
        goto api_call_return
    end
    if ( body.func == nil ) then
        err_code = 200
        strValue = "WebAPI输入参数的格式有问题! func 必须有值"
        goto api_call_return        
    end
 
    if ( body.func == "wms_GetConst" ) then
        nRet, strValue = wms.wms_GetConst(  body.strName )
    elseif ( body.func == "wms_GetDevCommExt" ) then
        nRet, strValue = wms.wms_GetDevCommExt(  body.strDevCode, body.strCommCode )        
    elseif ( body.func == "wms_GetDictTypeName" ) then
        nRet, strValue = wms.wms_GetDictTypeName(  body.strDictName, body.nTye )               
    elseif ( body.func == "wms_TaskFinish" ) then
        nRet, strValue = wms.wms_TaskFinish(  body.strLuaDEID, body.strTaskCode )
    elseif ( body.func == "wms_CreateNdcOrder" ) then
        nRet, strValue = wms.wms_TaskFinish(  body.strFactory, body.nScheduleType, body.strOrderXML )  
    elseif ( body.func == "wms_ChangeNdcOrderParameter" ) then
        nRet, strValue = wms.wms_ChangeNdcOrderParameter(  body.strFactory, body.nScheduleType, body.strOrderXML ) 
    elseif ( body.func == "wms_ChangeNdcOrderPriority" ) then
        nRet, strValue = wms.wms_ChangeNdcOrderPriority(  body.strFactory, body.nScheduleType, body.strOrderXML )   
    elseif ( body.func == "wms_GetAreaMostEmptyLoc" ) then
        nRet, strValue = wms.wms_GetAreaMostEmptyLoc(  body.strLuaDEID, body.strAreaType, body.strAreaCode )  
    elseif ( body.func == "wms_GetZoneAvaliableLoc" ) then
        nRet, strValue = wms.wms_GetZoneAvaliableLoc(  body.strLuaDEID, body.strZoneCode, body.strExtParam )  
    elseif ( body.func == "wms_GetAreaCGLoc" ) then
        nRet, strValue = wms.wms_GetAreaCGLoc(  body.strLuaDEID, body.strAreaCode, body.strExtInfo, body.bIsEmptyCntr )  
    elseif ( body.func == "wms_GetZoneCGLoc" ) then
        nRet, strValue = wms.wms_GetZoneCGLoc(  body.strLuaDEID, body.strZoneCode, body.strExtInfo, body.bIsEmptyCntr )  
    elseif ( body.func == "wms_QueryAreaCGLoc" ) then
        nRet, strValue = wms.wms_QueryAreaCGLoc(  body.strLuaDEID, body.strAreaCode, body.strCGDetailWhere. body.strCntrWhere, body.strLocWhere, body.nRetCount )  
    elseif ( body.func == "wms_QueryZoneCGLoc" ) then
        nRet, strValue = wms.wms_QueryZoneCGLoc(  body.strLuaDEID, body.strZoneCode, body.strCGDetailWhere. body.strCntrWhere, body.strLocWhere, body.nRetCount )  
    elseif ( body.func == "wms_QueryAreaECLoc" ) then
        nRet, strValue = wms.wms_QueryAreaECLoc(  body.strLuaDEID, body.strAreaCode, body.strCntrWhere, body.strLocWhere, body.nRetCount )  
    elseif ( body.func == "wms_QueryZoneECLoc" ) then
        nRet, strValue = wms.wms_QueryZoneECLoc(  body.strLuaDEID, body.strZoneCode, body.strCntrWhere, body.strLocWhere, body.nRetCount )  
    elseif ( body.func == "wms_ContainerLocAction" ) then
        nRet, strValue = wms.wms_ContainerLocAction(  body.strLuaDEID, body.strCntrCode, body.strLocCode, body.strAction )  
    elseif ( body.func == "wms_ResetZoneStoreNum" ) then
        nRet, strValue = wms.wms_ResetZoneStoreNum(  body.strLuaDEID, body.strZoneCode, body.bResetLoc  )  
    elseif ( body.func == "wms_GetZoneNumInfo" ) then
        nRet, strValue = wms.wms_GetZoneNumInfo(  body.strZoneCodeList )  
    elseif ( body.func == "wms_IsZoneLoc" ) then
        nRet, strValue = wms.wms_IsZoneLoc(  body.strLocCode, body.strZoneCode )          
    elseif ( body.func == "wms_GetLocActionEQ" ) then
        nRet, strValue = wms.wms_GetLocActionEQ(  body.strLocCode, body.strAction )    
    elseif ( body.func == "wms_GetLocBaseInfo" ) then
        nRet, strValue = wms.wms_GetLocBaseInfo(  body.strLocCode )    
    elseif ( body.func == "wms_GetLocInfo" ) then
        nRet, strValue = wms.wms_GetLocInfo(  body.strLocCode)
    elseif ( body.func == "wms_GetLocZoneList" ) then
        nRet, strValue = wms.wms_GetLocZoneList(  body.strLocCode, body.strZoneGroup  )    
    elseif ( body.func == "wms_GetAreaInfo" ) then
        nRet, strValue = wms.wms_GetAreaInfo(  body.strAreaCode )    
    elseif ( body.func == "wms_GetAreaInfo2" ) then
        nRet, strValue = wms.wms_GetAreaInfo2(  body.strAreaCode )
    elseif ( body.func == "wms_GetAreaZoneList" ) then
        nRet, strValue = wms.wms_GetAreaZoneList(  body.strAreaCode, body.strZoneGroup  )  
    elseif ( body.func == "wms_GetAreaZoneList2" ) then
        nRet, strValue = wms.wms_GetAreaZoneList2(  body.strAreaCode, body.strRuleType  )  
    elseif ( body.func == "wms_GetZoneInfo" ) then
        nRet, strValue = wms.wms_GetZoneInfo(  body.strZoneCode )  
    elseif ( body.func == "wms_GetZoneInfo2" ) then
        nRet, strValue = wms.wms_GetZoneInfo2(  body.strZoneCode )    
    elseif ( body.func == "wms_GetRoadwayInfo" ) then
        nRet, strValue = wms.wms_GetRoadwayInfo(  body.strWHCode, body.strAreaCode, body.nRoadway )  
    elseif ( body.func == "wms_GetAisleInfo" ) then
        nRet, strValue = wms.wms_GetAisleInfo(  body.strWHCode, body.strAreaCode, body.nAisle )  
    elseif ( body.func == "wms_QueryCGDetail" ) then
        nRet, strValue = wms.wms_QueryCGDetail(  body.strLuaDEID, body.strWHCode, body.strAreaCode, body.strCGDetailWhere, body.strCntrWhere )  
    elseif ( body.func == "wms_GetFuncArea" ) then
        nRet, strValue = wms.wms_GetFuncArea(  body.strMasterCls, body.strMasterCode, body.nAreaType )  
    elseif ( body.func == "wms_GetAreaLocInfo" ) then
        nRet, strValue = wms.wms_GetAreaLocInfo(  body.strLuaDEID, body.strAreaCode )  
    elseif ( body.func == "wms_GetZoneLocInfo" ) then
        nRet, strValue = wms.wms_GetZoneLocInfo(  body.strLuaDEID, body.strZoneCode )  
    elseif ( body.func == "wms_LockLocation" ) then
        nRet, strValue = wms.wms_LockLocation(  body.strLuaDEID, body.strLocCode, body.nLockType, body.strTaskCode, body.strOpCode, body.strOpName )  
    elseif ( body.func == "wms_UnlockLocation" ) then
        nRet, strValue = wms.wms_UnlockLocation(  body.strLuaDEID, body.strLocCode, body.strTaskCode )  
    elseif ( body.func == "wms_LockZone" ) then
        nRet, strValue = wms.wms_LockZone(  body.strLuaDEID, body.strZoneCode, body.nLockType, body.strTaskCode, body.strOpCode, body.strOpName  )  
    elseif ( body.func == "wms_UnlockZone" ) then
        nRet, strValue = wms.wms_UnlockZone(  body.strLuaDEID, body.strZoneCode, body.strTaskCode )  
    elseif ( body.func == "wms_LockLinkZone" ) then
        nRet, strValue = wms.wms_LockLinkZone(  body.strLuaDEID, body.strZoneCode, body.nLockType, body.strTaskCode, body.strOpCode, body.strOpName )  
    elseif ( body.func == "wms_UnlockLinkZone" ) then
        nRet, strValue = wms.wms_UnlockLinkZone(  body.strLuaDEID, body.strZoneCode, body.strTaskCode )  
    elseif ( body.func == "wms_UnlockByTask" ) then
        nRet, strValue = wms.wms_UnlockByTask(  body.strLuaDEID, body.strTaskCode )  
    elseif ( body.func == "wms_UnlockByOperation" ) then
        nRet, strValue = wms.wms_UnlockByOperation(  body.strLuaDEID, body.strOpCode  )  
    elseif ( body.func == "wms_CleanInvalidLocLock" ) then
        nRet, strValue = wms.wms_CleanInvalidLocLock( body.strWHCode, body.strAreaCode )  
    elseif ( body.func == "wms_IsLockedCntr" ) then
        nRet, strValue = wms.wms_IsLockedCntr( body.strCntrCode )  
    elseif ( body.func == "wms_LockCntr" ) then
        nRet, strValue = wms.wms_LockCntr( body.strContainerCode, body.nLockType, body.strTransCode, body.nTransTime )  
    elseif ( body.func == "wms_UnlockCntr" ) then
        nRet, strValue = wms.wms_UnlockCntr( body.strLuaDEID, body.strContainerCode )  
    elseif ( body.func == "wms_UnlockCntrByTrans" ) then
        nRet, strValue = wms.wms_UnlockCntrByTrans( body.strLuaDEID, body.strTransCode )
    elseif ( body.func == "wms_CommitCntrLockTrans" ) then
        nRet, strValue = wms.wms_CommitCntrLockTrans( body.strTransCode ) 
    elseif ( body.func == "wms_AbortCntrLockTrans" ) then
        nRet, strValue = wms.wms_AbortCntrLockTrans( body.strTransCode )    
    elseif ( body.func == "wms_GetWHInventory" ) then
        nRet, strValue = wms.wms_GetWHInventory( body.strItemInfo )    
    elseif ( body.func == "wms_GetAreaInventory" ) then
        nRet, strValue = wms.wms_GetAreaInventory( body.strItemInfo )    
    elseif ( body.func == "wms_GetZoneInventory" ) then
        nRet, strValue = wms.wms_GetZoneInventory( body.strItemInfo )    
    elseif ( body.func == "wms_AddWHInventoryChange" ) then
        nRet, strValue = wms.wms_AddWHInventoryChange(  body.strLuaDEID, body.nOpType, body.strItemInfo )  
    elseif ( body.func == "wms_ResetInventory" ) then
        nRet, strValue = wms.wms_ResetInventory(  body.strObjType, body.strObjCode )  
    elseif ( body.func == "wms_StatInventory" ) then
        if ( body.parameter_num == 4 ) then
            nRet, strValue = wms.wms_StatInventory(  body.strLuaDEID, body.strObjType, body.strObjCode, body.nPageSize )
        else
            nRet, strValue = wms.wms_StatInventory(  body.strLuaDEID, body.nPage )  
        end
    elseif ( body.func == "wms_IPA_Start" ) then
        nRet, strValue = wms.wms_IPA_Start(  body.strWHCode, body.strAreaCode, body.strItemInfo, body.strAddKey, body.bForceSorting, body.nTransTime  ) 
    elseif ( body.func == "wms_IPA_Commit" ) then
        nRet, strValue = wms.wms_IPA_Commit(  body.strTransID, body.bIsArray )   
    elseif ( body.func == "wms_IPA_Abort" ) then
        nRet, strValue = wms.wms_IPA_Abort(  body.strTransID, body.bIsArray )  
    elseif ( body.func == "wms_AddAccumQtyChg" ) then
        nRet, strValue = wms.wms_AddAccumQtyChg( body.strLuaDEID, body.strClassID, body.nProcType, body.strNo, body.nRowNo, body.strAddKey )  
    elseif ( body.func == "wms_AddCloseQtyChg" ) then
        nRet, strValue = wms.wms_AddCloseQtyChg( body.strLuaDEID, body.strClassID, body.nProcType, body.strNo, body.nRowNo )
    elseif ( body.func == "wms_GetOrderInfo" ) then
        nRet, strValue = wms.wms_GetOrderInfo(  body.strClassID, body.strNo )  
    elseif ( body.func == "wms_CheckAccumQty" ) then
        nRet, strValue = wms.wms_CheckAccumQty( body.strLuaDEID, body.strClassID, body.nProcType, body.strNo, body.nRowNo )  
    elseif ( body.func == "wms_GetOpDefInfo" ) then
        nRet, strValue = wms.wms_GetOpDefInfo( body.factory, body.op_def_name )    
    elseif ( body.func == "wms_GetStrategyInfo" ) then
        nRet, strValue = wms.wms_GetStrategyInfo( body.strType, body.strStrategyCode )            
    else
        err_code = 200
        strValue = "WebAPI输入参数的格式有问题! 没有定义名为'"..body.func.."'的wms内部函数!" 
        goto api_call_return        
    end
 
    if (nRet ~= 0 ) then err_code = 201 end  
 
    ::api_call_return::
    -- 设置返回结果
    local result = {
        code = err_code,
        value = strValue
    }    
    m3.EPI_Return( strLuaDEID, result )  
end