--[[
|
编码: JX-01-24
|
名称: 料箱编码输入后
|
作者:KUN
|
日期:2025-03-06
|
|
函数: CntrChange
|
功能:
|
-- 校验料箱信息,并显示在货品明细界面
|
-- 判断是否存在码盘数据
|
|
--]]
|
|
wms_cntr = require( "wms_container" )
|
jx_base = require( "jx_base" )
|
wms_wh = require( "wms_wh" )
|
|
function CntrChange( strLuaDEID )
|
local nRet, strRetInfo
|
local cntr_detail_array
|
|
-- 获取当前编辑的容器编码
|
nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, "S_CODE")
|
if (nRet ~= 0) then
|
mobox.setInfo(strLuaDEID, "获取当前编辑属性失败! " .. strRetInfo)
|
return
|
end
|
|
local obj_attrs = json.decode(strRetInfo)
|
local cntr_code = lua.Get_StrAttrValue(obj_attrs[1].value)
|
|
-- 获取容器信息
|
local cntr_obj
|
nRet, cntr_obj = wms_cntr.GetInfo(strLuaDEID, cntr_code)
|
if (nRet ~= 0 or cntr_obj == '') then
|
mobox.setInfo(strLuaDEID, "编码 = '" .. cntr_code .. "'的拣料箱不存在或获取失败!")
|
return
|
end
|
if (cntr_obj.source ~= '巨沃') then
|
mobox.setInfo(strLuaDEID, "编码 = '" .. cntr_code .. "'的拣料箱不是巨沃的料箱!")
|
return
|
end
|
if (cntr_obj.empty_full ~= 0) then
|
mobox.setInfo(strLuaDEID, "编码 = '" .. cntr_code .. "'的拣料箱是有货的料箱!")
|
return
|
end
|
if (cntr_obj.position ~= '') then
|
mobox.setInfo(strLuaDEID, "编码 = '" .. cntr_code .. "'的拣料箱在库里!")
|
return
|
end
|
|
if (cntr_obj.lock_state ~= 0) then
|
mobox.setInfo(strLuaDEID, "编码 = '" .. cntr_code .. "'的拣料箱有锁!")
|
return
|
end
|
|
local strCondition = "S_CNTR_CODE = '" .. cntr_code .. "' AND ( N_B_STATE = 0 or N_B_STATE = 1 )"
|
nRet, data_objs = mobox.getDataObjCount(strLuaDEID, "JX_Transfer_Order", strCondition)
|
lua.Debug(strLuaDEID, debug.getinfo(1), "data_objs--->", data_objs)
|
|
if (nRet ~= 0) then
|
mobox.setInfo(strLuaDEID, debug.getinfo(1), "查询码盘单失败!" .. data_objs)
|
return
|
end
|
|
nCount = tonumber(data_objs)
|
if (nCount > 0) then
|
mobox.setInfo(strLuaDEID, "容器 '" .. cntr_code .. "' 存在码盘单,无法操作!")
|
return
|
end
|
|
|
|
strCondition = "S_CODE = '" .. cntr_code .. "'"
|
nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "Container", strCondition)
|
if (nRet ~= 0) then
|
mobox.setInfo(strLuaDEID, "查询 Container 表失败: " .. strRetInfo)
|
return
|
end
|
|
local spec = strRetInfo.spec
|
local code = strRetInfo.code
|
local source = strRetInfo.source
|
|
lua.Debug(strLuaDEID, debug.getinfo(1), "strRetInfo--->", strRetInfo)
|
|
local detail_strCondition = "S_CODE = '" .. cntr_code .. "'"
|
local container_detail
|
nRet, container_detail = m3.QueryDataObject(strLuaDEID, "Container", detail_strCondition)
|
if (nRet ~= 0) then
|
mobox.setInfo(strLuaDEID,"查询明细数据失败! " .. container_detail)
|
return
|
end
|
local action_array = {}
|
-- 将所有行数据批量插入到页面
|
action_array[1] = {
|
action_type = "set_subtable_page_content",
|
value = {
|
page_name = "料箱信息",
|
content = container_detail,
|
clear = true,
|
clear_confirm = false,
|
checkbox = false
|
}
|
}
|
-- 提交前端操作
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action_array))
|
if (nRet ~= 0) then
|
lua.Error(strLuaDEID, debug.getinfo(1), "setAction失败! " .. strRetInfo)
|
end
|
|
|
end
|