lzh
2025-06-19 3a6436e0c88042c6ce8dca2fe8adb0109f0ad9e4
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
--[[
 编码:
 名称: LocState
 作者:
 入口函数:LocState
 功能说明:
 变更历史:
 --]]
function LocState(strLuaDEID)
    local nRet, in_date, strRetInfo
    -- step1 获取接口数据
    nRet, in_date = m3.GetSysDataJson(strLuaDEID)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "无法获取数据包!" .. in_date) end
    lua.Debug(strLuaDEID, debug.getinfo(1), '货位是否可用参数:', in_date)
 
    -- step2 判断 必填项 是否都有值?没值报错返回
    local loc_code = in_date.loc_code              -- 起点位置
    local type = lua.StrToNumber(in_date.type)     -- 1 请求取货 2 请求放货 3 取货完成 4 放货完成
    local req_no = lua.StrToNumber(in_date.req_no) -- 唯一码
    if (loc_code == nil or loc_code == '') then lua.Error(strLuaDEID, debug.getinfo(1), "站点不能为空!") end
    if (type == nil) then lua.Error(strLuaDEID, debug.getinfo(1), "类型不能为空!") end
 
    -- 获取WCS站点
    local condition = "S_VALUE = '" .. loc_code .. "'"
    nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "WMS_Const", condition)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "获取【常量】信息失败! " .. strRetInfo) end
    local loc_code_zd = strRetInfo.name
 
    -- 调用WCS的安全交互接口
    local url = wms_base.Get_sConst(strLuaDEID, "WCS-url")
    local strurl = url .. "/LocState"
    local strHeader = ""
    local data = {
        loc_code = loc_code_zd,
        type = type, -- 1 请求取货 2 请求放货 3 取货完成 4 放货完成
        req_no = req_no
    }
    nRet, strRetInfo = CreateInterfaceExc(strLuaDEID, strurl, strHeader, data, "WCS", "货位是否可用")
    if (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "调用接口失败!" .. strRetInfo)
    end
end